From 682d7ead5c2fc9d7dcb1ad97616e61bf5c2ee40d Mon Sep 17 00:00:00 2001 From: Catherine Galkina Date: Mon, 21 Nov 2016 14:28:01 +0300 Subject: [PATCH] Update example in Servant.Client.Generic --- servant-client/src/Servant/Client/Generic.hs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/servant-client/src/Servant/Client/Generic.hs b/servant-client/src/Servant/Client/Generic.hs index 138e769d..ade748ce 100644 --- a/servant-client/src/Servant/Client/Generic.hs +++ b/servant-client/src/Servant/Client/Generic.hs @@ -21,6 +21,7 @@ import Servant.Client (ClientM) -- -- Example: -- +-- @ -- type API -- = "foo" :> Capture "x" Int :> Get '[JSON] Int -- :<|> "bar" :> QueryParam "a" Char :> QueryParam "b" String :> Post '[JSON] [Int] @@ -31,8 +32,8 @@ import Servant.Client (ClientM) -- :<|> "baz" :> QueryParam "c" Char :> Post '[JSON] () -- -- data APIClient = APIClient --- { getFoo :: Int -> Manager -> BaseUrl -> ClientM Int --- , postBar :: Maybe Char -> Maybe String -> Manager -> BaseUrl -> ClientM [Int] +-- { getFoo :: Int -> ClientM Int +-- , postBar :: Maybe Char -> Maybe String -> ClientM [Int] -- , mkNestedClient :: Int -> NestedClient -- } deriving GHC.Generic -- @@ -40,8 +41,8 @@ import Servant.Client (ClientM) -- instance (Client API ~ client) => ClientLike client APIClient -- -- data NestedClient = NestedClient --- { getString :: Manager -> BaseUrl -> ClientM String --- , postBaz :: Maybe Char -> Manager -> BaseUrl -> ClientM () +-- { getString :: ClientM String +-- , postBaz :: Maybe Char -> ClientM () -- } deriving GHC.Generic -- -- instance Generic.SOP.Generic @@ -49,6 +50,7 @@ import Servant.Client (ClientM) -- -- mkAPIClient :: APIClient -- mkAPIClient = mkClient (client (Proxy :: Proxy API)) +-- @ class ClientLike client custom where mkClient :: client -> custom default mkClient :: (Generic custom, GClientLikeP client xs, SOP I '[xs] ~ Rep custom)