From 257c3d4081ccafab3dea551acc2871899a383be2 Mon Sep 17 00:00:00 2001 From: "Julian K. Arni" Date: Wed, 13 Sep 2017 12:50:37 -0400 Subject: [PATCH] Readme for servant-client-core --- servant-client-core/README.md | 25 +++++++++++++++++++ servant-client-core/servant-client-core.cabal | 3 ++- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/servant-client-core/README.md b/servant-client-core/README.md index 601a1d55..180063a9 100644 --- a/servant-client-core/README.md +++ b/servant-client-core/README.md @@ -3,3 +3,28 @@ ![servant](https://raw.githubusercontent.com/haskell-servant/servant/master/servant.png) 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: + + 1) Define a `RunClient` instance for your datatype (call it 'MyMonad') + 2) Define a `ClientLike` instance. This will look like: + +``` haskell +instance ClientLike (MyMonad a) (MyMonad a) where + mkClient = id +``` + + 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. + +## For combinator-writers + +You'l need to define a new `HasClient` instance for your combinator. There are +plenty of examples to guide you in the +[HasClient](src/Servant/Client/Core/Internal/HasClient.hs) module. diff --git a/servant-client-core/servant-client-core.cabal b/servant-client-core/servant-client-core.cabal index 8f16b11e..59d02870 100644 --- a/servant-client-core/servant-client-core.cabal +++ b/servant-client-core/servant-client-core.cabal @@ -2,7 +2,8 @@ name: servant-client-core version: 0.11 synopsis: Core functionality and class for client function generation for servant APIs description: - This library provides a class + This library provides backend-agnostic generation of client functions. For + more information, see the README. license: BSD3 license-file: LICENSE author: Servant Contributors