servant/servant-client
Oleg Grenrus cfaa7a06be Merge pull request #665 from phadej/client-monad-control
Add MonadBaseControl IO ClientM instance
2017-01-16 10:25:35 +02:00
..
include
src/Servant Merge pull request #665 from phadej/client-monad-control 2017-01-16 10:25:35 +02:00
test
CHANGELOG.md Add more changelog entries 2017-01-16 10:11:38 +02:00
docs.sh
LICENSE
README.md
servant-client.cabal Merge pull request #665 from phadej/client-monad-control 2017-01-16 10:25:35 +02:00
Setup.hs
tinc.yaml

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 :: Manager -> BaseUrl -> ExceptT String IO [Book]
postNewBook :: Book -> Manager -> BaseUrl -> ExceptT String IO Book
-- 'client' allows you to produce operations to query an API from a client.
(getAllBooks :<|> postNewBook) = client myApi