Fix typos in examples

This commit is contained in:
Catherine Galkina 2016-11-21 15:02:19 +03:00
parent 682d7ead5c
commit 06217ace66

View File

@ -21,36 +21,34 @@ import Servant.Client (ClientM)
-- --
-- Example: -- Example:
-- --
-- @ -- > type API
-- type API -- > = "foo" :> Capture "x" Int :> Get '[JSON] Int
-- = "foo" :> Capture "x" Int :> Get '[JSON] Int -- > :<|> "bar" :> QueryParam "a" Char :> QueryParam "b" String :> Post '[JSON] [Int]
-- :<|> "bar" :> QueryParam "a" Char :> QueryParam "b" String :> Post '[JSON] [Int] -- > :<|> Capture "nested" Int :> NestedAPI
-- :<|> Captre "nested" Int :> NestedAPI -- >
-- -- > type NestedAPI
-- type NestedAPI -- > = Get '[JSON] String
-- = Get '[JSON] String -- > :<|> "baz" :> QueryParam "c" Char :> Post '[JSON] ()
-- :<|> "baz" :> QueryParam "c" Char :> Post '[JSON] () -- >
-- -- > data APIClient = APIClient
-- data APIClient = APIClient -- > { getFoo :: Int -> ClientM Int
-- { getFoo :: Int -> ClientM Int -- > , postBar :: Maybe Char -> Maybe String -> ClientM [Int]
-- , postBar :: Maybe Char -> Maybe String -> ClientM [Int] -- > , mkNestedClient :: Int -> NestedClient
-- , mkNestedClient :: Int -> NestedClient -- > } deriving GHC.Generic
-- } deriving GHC.Generic -- >
-- -- > instance Generic.SOP.Generic APIClient
-- instance Generic.SOP.Generic APIClient -- > instance (Client API ~ client) => ClientLike client APIClient
-- instance (Client API ~ client) => ClientLike client APIClient -- >
-- -- > data NestedClient = NestedClient
-- data NestedClient = NestedClient -- > { getString :: ClientM String
-- { getString :: ClientM String -- > , postBaz :: Maybe Char -> ClientM ()
-- , postBaz :: Maybe Char -> ClientM () -- > } deriving GHC.Generic
-- } deriving GHC.Generic -- >
-- -- > instance Generic.SOP.Generic
-- instance Generic.SOP.Generic -- > instance (Client NestedAPI ~ client) => ClientLike client NestedClient
-- instance (Client NestedAPI ~ client) => ClientLike client NestedAPI -- >
-- -- > mkAPIClient :: APIClient
-- mkAPIClient :: APIClient -- > mkAPIClient = mkClient (client (Proxy :: Proxy API))
-- mkAPIClient = mkClient (client (Proxy :: Proxy API))
-- @
class ClientLike client custom where class ClientLike client custom where
mkClient :: client -> custom mkClient :: client -> custom
default mkClient :: (Generic custom, GClientLikeP client xs, SOP I '[xs] ~ Rep custom) default mkClient :: (Generic custom, GClientLikeP client xs, SOP I '[xs] ~ Rep custom)