servant/servant-client-core/README.md

31 lines
993 B
Markdown
Raw Permalink Normal View History

2017-09-12 18:38:52 +02:00
# servant-client-core
![servant](https://raw.githubusercontent.com/haskell-servant/servant/master/servant.png)
HTTP-client-agnostic client functions for servant APIs.
2017-09-13 18:50:37 +02:00
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:
2017-09-13 22:01:31 +02:00
1. Define a `RunClient` instance for your datatype (call it `MyMonad`)
2017-09-13 18:57:18 +02:00
2. Define a `ClientLike` instance. This will look like:
2017-09-13 18:50:37 +02:00
``` haskell
instance ClientLike (MyMonad a) (MyMonad a) where
mkClient = id
```
2017-09-13 18:57:18 +02:00
3. 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.
2017-09-13 18:50:37 +02:00
## For combinator-writers
2017-09-15 15:02:50 +02:00
You'll need to define a new `HasClient` instance for your combinator. There are
2017-09-13 18:50:37 +02:00
plenty of examples to guide you in the
[HasClient](src/Servant/Client/Core/Internal/HasClient.hs) module.