HTTP-client-agnostic client functions for servant APIs.
This library should mainly be of interest to backend- and combinator-writers.
For backend-writers
If you are creating a new backend, you’ll need to:
Define a RunClient instance for your datatype (call it MyMonad)
Define a ClientLike instance. This will look like:
instance ClientLike (MyMonad a) (MyMonad a) where
mkClient = id
Re-export the module Servant.Client.Core.Reexport so that your end-users
can be blissfully unaware of ‘servant-client-core’, and so each
backend-package comes closer to the warm hearth of the drop-in-replacement
equivalence class.
For combinator-writers
You’ll need to define a new HasClient instance for your combinator. There are
plenty of examples to guide you in the
HasClient module.
Merge in servant-generic (by Patrick Chilton)
into servant (Servant.API.Generic),
servant-client-code (Servant.Client.Generic)
and servant-server (Servant.Server.Generic).
0.14
Stream takes a status code argument
-Stream method framing ctype a
+Stream method status framing ctype a
ToStreamGenerator definition changed, so it’s possible to write an instance
for conduits.
-class ToStreamGenerator f a where
- toStreamGenerator :: f a -> StreamGenerator a
+class ToStreamGenerator a b | a -> b where
+ toStreamGenerator :: a -> StreamGenerator b
servant-client-core Free Client implementation.
Useful for testing HasClient instances.
(#920)
servant-client-core Add hoistClient to HasClient.
Just like hoistServer allows us to change the monad in which request handlers
of a web application live in, we also have hoistClient for changing the monad
in which client functions live.
Read tutorial section for more information.
(#936)
iF you have own combinators, you’ll need to define a new method of
HasClient class, for example:
type Client m (MyCombinator :> api) = MyValue :> Client m api
hoistClientMonad pm _ nt cl = hoistClientMonad pm (Proxy :: Proxy api) nt . cl