git.iko.soy/typeable/servant
on master help sign in
Fix typos in examples
commit06217ace66974646946bebd551b0cdb9c44ef74c authorCatherine Galkina <catherine@getshoptv.com> dateMon 21 Nov 2016, 15:02 (10 years ago) parent682d7ea
1 file changed+28−30
servant-client/src/Servant/Client/Generic.hs+28−30
servant-client/src/Servant/Client/Generic.hs+28−30
@@ -21,36 +21,34 @@ import Servant.Client (ClientM)
2121--
2222-- Example:
2323--
24−-- @
25−-- type API
26−-- = "foo" :> Capture "x" Int :> Get '[JSON] Int
27−-- :<|> "bar" :> QueryParam "a" Char :> QueryParam "b" String :> Post '[JSON] [Int]
28−-- :<|> Captre "nested" Int :> NestedAPI
29−--
30−-- type NestedAPI
31−-- = Get '[JSON] String
32−-- :<|> "baz" :> QueryParam "c" Char :> Post '[JSON] ()
33−--
34−-- data APIClient = APIClient
35−-- { getFoo :: Int -> ClientM Int
36−-- , postBar :: Maybe Char -> Maybe String -> ClientM [Int]
37−-- , mkNestedClient :: Int -> NestedClient
38−-- } deriving GHC.Generic
39−--
40−-- instance Generic.SOP.Generic APIClient
41−-- instance (Client API ~ client) => ClientLike client APIClient
42−--
43−-- data NestedClient = NestedClient
44−-- { getString :: ClientM String
45−-- , postBaz :: Maybe Char -> ClientM ()
46−-- } deriving GHC.Generic
47−--
48−-- instance Generic.SOP.Generic
49−-- instance (Client NestedAPI ~ client) => ClientLike client NestedAPI
50−--
51−-- mkAPIClient :: APIClient
52−-- mkAPIClient = mkClient (client (Proxy :: Proxy API))
53−-- @
24+-- > type API
25+-- > = "foo" :> Capture "x" Int :> Get '[JSON] Int
26+-- > :<|> "bar" :> QueryParam "a" Char :> QueryParam "b" String :> Post '[JSON] [Int]
27+-- > :<|> Capture "nested" Int :> NestedAPI
28+-- >
29+-- > type NestedAPI
30+-- > = Get '[JSON] String
31+-- > :<|> "baz" :> QueryParam "c" Char :> Post '[JSON] ()
32+-- >
33+-- > data APIClient = APIClient
34+-- > { getFoo :: Int -> ClientM Int
35+-- > , postBar :: Maybe Char -> Maybe String -> ClientM [Int]
36+-- > , mkNestedClient :: Int -> NestedClient
37+-- > } deriving GHC.Generic
38+-- >
39+-- > instance Generic.SOP.Generic APIClient
40+-- > instance (Client API ~ client) => ClientLike client APIClient
41+-- >
42+-- > data NestedClient = NestedClient
43+-- > { getString :: ClientM String
44+-- > , postBaz :: Maybe Char -> ClientM ()
45+-- > } deriving GHC.Generic
46+-- >
47+-- > instance Generic.SOP.Generic
48+-- > instance (Client NestedAPI ~ client) => ClientLike client NestedClient
49+-- >
50+-- > mkAPIClient :: APIClient
51+-- > mkAPIClient = mkClient (client (Proxy :: Proxy API))
5452class ClientLike client custom where
5553 mkClient :: client -> custom
5654 default mkClient :: (Generic custom, GClientLikeP client xs, SOP I '[xs] ~ Rep custom)