@@ -53,10 +53,9 @@ import Servant.Common.Req
5353-- > myApi :: Proxy MyApi
5454-- > myApi = Proxy
5555-- >
56−-- > getAllBooks :: ExceptT String IO [Book]
57−-- > postNewBook :: Book -> ExceptT String IO Book
58−-- > (getAllBooks :<|> postNewBook) = client myApi host manager
59−-- > where host = BaseUrl Http "localhost" 8080
56+-- > getAllBooks :: ClientM [Book]
57+-- > postNewBook :: Book -> ClientM Book
58+-- > (getAllBooks :<|> postNewBook) = client myApi
6059client :: HasClient layout => Proxy layout -> Client layout
6160client p = clientWithRoute p defReq
6261
@@ -78,10 +77,9 @@ class HasClient layout where
7877-- > myApi :: Proxy MyApi
7978-- > myApi = Proxy
8079-- >
81−-- > getAllBooks :: ExceptT String IO [Book]
82−-- > postNewBook :: Book -> ExceptT String IO Book
83−-- > (getAllBooks :<|> postNewBook) = client myApi host manager
84−-- > where host = BaseUrl Http "localhost" 8080
80+-- > getAllBooks :: ClientM [Book]
81+-- > postNewBook :: Book -> ClientM Book
82+-- > (getAllBooks :<|> postNewBook) = client myApi
8583instance (HasClient a, HasClient b) => HasClient (a :<|> b) where
8684 type Client (a :<|> b) = Client a :<|> Client b
8785 clientWithRoute Proxy req =
@@ -104,9 +102,8 @@ instance (HasClient a, HasClient b) => HasClient (a :<|> b) where
104102-- > myApi :: Proxy MyApi
105103-- > myApi = Proxy
106104-- >
107−-- > getBook :: Text -> ExceptT String IO Book
108−-- > getBook = client myApi host manager
109−-- > where host = BaseUrl Http "localhost" 8080
105+-- > getBook :: Text -> ClientM Book
106+-- > getBook = client myApi
110107-- > -- then you can just use "getBook" to query that endpoint
111108instance (KnownSymbol capture, ToHttpApiData a, HasClient sublayout)
112109 => HasClient (Capture capture a :> sublayout) where
@@ -182,9 +179,8 @@ instance OVERLAPPING_
182179-- > myApi :: Proxy MyApi
183180-- > myApi = Proxy
184181-- >
185−-- > viewReferer :: Maybe Referer -> ExceptT String IO Book
186−-- > viewReferer = client myApi host
187−-- > where host = BaseUrl Http "localhost" 8080
182+-- > viewReferer :: Maybe Referer -> ClientM Book
183+-- > viewReferer = client myApi
188184-- > -- then you can just use "viewRefer" to query that endpoint
189185-- > -- specifying Nothing or e.g Just "http://haskell.org/" as arguments
190186instance (KnownSymbol sym, ToHttpApiData a, HasClient sublayout)
@@ -233,9 +229,8 @@ instance HasClient sublayout
233229-- > myApi :: Proxy MyApi
234230-- > myApi = Proxy
235231-- >
236−-- > getBooksBy :: Maybe Text -> ExceptT String IO [Book]
237−-- > getBooksBy = client myApi host
238−-- > where host = BaseUrl Http "localhost" 8080
232+-- > getBooksBy :: Maybe Text -> ClientM [Book]
233+-- > getBooksBy = client myApi
239234-- > -- then you can just use "getBooksBy" to query that endpoint.
240235-- > -- 'getBooksBy Nothing' for all books
241236-- > -- 'getBooksBy (Just "Isaac Asimov")' to get all books by Isaac Asimov
@@ -278,9 +273,8 @@ instance (KnownSymbol sym, ToHttpApiData a, HasClient sublayout)
278273-- > myApi :: Proxy MyApi
279274-- > myApi = Proxy
280275-- >
281−-- > getBooksBy :: [Text] -> ExceptT String IO [Book]
282−-- > getBooksBy = client myApi host
283−-- > where host = BaseUrl Http "localhost" 8080
276+-- > getBooksBy :: [Text] -> ClientM [Book]
277+-- > getBooksBy = client myApi
284278-- > -- then you can just use "getBooksBy" to query that endpoint.
285279-- > -- 'getBooksBy []' for all books
286280-- > -- 'getBooksBy ["Isaac Asimov", "Robert A. Heinlein"]'
@@ -318,9 +312,8 @@ instance (KnownSymbol sym, ToHttpApiData a, HasClient sublayout)
318312-- > myApi :: Proxy MyApi
319313-- > myApi = Proxy
320314-- >
321−-- > getBooks :: Bool -> ExceptT String IO [Book]
322−-- > getBooks = client myApi host
323−-- > where host = BaseUrl Http "localhost" 8080
315+-- > getBooks :: Bool -> ClientM [Book]
316+-- > getBooks = client myApi
324317-- > -- then you can just use "getBooks" to query that endpoint.
325318-- > -- 'getBooksBy False' for all books
326319-- > -- 'getBooksBy True' to only get _already published_ books
@@ -365,9 +358,8 @@ instance HasClient Raw where
365358-- > myApi :: Proxy MyApi
366359-- > myApi = Proxy
367360-- >
368−-- > addBook :: Book -> ExceptT String IO Book
369−-- > addBook = client myApi host manager
370−-- > where host = BaseUrl Http "localhost" 8080
361+-- > addBook :: Book -> ClientM Book
362+-- > addBook = client myApi
371363-- > -- then you can just use "addBook" to query that endpoint
372364instance (MimeRender ct a, HasClient sublayout)
373365 => HasClient (ReqBody (ct ': cts) a :> sublayout) where