servant/servant-client
2015-10-11 21:12:05 +02:00
..
src/Servant More generous acceptable status codes for servant-client 2015-10-11 21:12:05 +02:00
test More generous acceptable status codes for servant-client 2015-10-11 21:12:05 +02:00
CHANGELOG.md Update changelog 2015-10-11 21:12:05 +02:00
docs.sh prepare merge 2015-04-20 11:15:58 +02:00
LICENSE prepare merge 2015-04-20 11:15:58 +02:00
README.md Drop EitherT in favor of ExceptT 2015-09-12 15:11:24 +03:00
servant-client.cabal Add version bounds for http-api-data 2015-10-08 16:21:02 +03:00
Setup.hs stylish haskell changes 2015-08-18 00:07:12 +02:00

servant-client

servant

This library lets you automatically derive Haskell functions that let you query each endpoint of a servant webservice.

Example

type MyApi = "books" :> Get '[JSON] [Book] -- GET /books
        :<|> "books" :> ReqBody Book :> Post '[JSON] Book -- POST /books

myApi :: Proxy MyApi
myApi = Proxy

getAllBooks :: ExceptT String IO [Book]
postNewBook :: Book -> ExceptT String IO Book
-- 'client' allows you to produce operations to query an API from a client.
(getAllBooks :<|> postNewBook) = client myApi host
  where host = BaseUrl Http "localhost" 8080