liveBook · Manning

Servant

Servant is a Haskell library for defining type-safe web APIs and deriving corresponding server and client implementations.

How 2 Manning books explain it

Learn Haskell by Example

Servant is a Haskell library ecosystem for defining type-safe web APIs and generating server and client implementations from API descriptions.

How it is used
Defines a todo-list HTTP/JSON API, implements its server, and derives a CLI-facing client from one API description.
How deep it goes
Works through API operators, concrete handlers, HTTP errors, middleware, and generated clients, while deferring the internals of DataKinds and TypeOperators.
Examples
Builds a todo API with entries, add, and toggle endpoints, database-backed handlers, a root HTML route, and derived client actions.
What you can do after
Apply it via Servant to specify a typed HTTP API, assemble matching handlers, add middleware, and derive client functions.

Read how Learn Haskell by Example explains Servant →

Functional Design and Architecture: Examples in Haskell

servant-client is a Haskell library that derives client functions for making HTTP requests from Servant API specifications.

How it is used
Deploys typed HTTP clients and RESTful servers while keeping business logic independent of the communication channel.
How deep it goes
Explains type-level API schemas, generated client actions, and framework integration, but leaves uncommon requirements such as streaming difficult.
Examples
Uses meteor and asteroid POST endpoints, JSON payload types, generated ClientM functions, and reporting-error conversion.
What you can do after
Build it from scratch: define a shared API type and derive client operations for framework-managed HTTP requests.

Read how Functional Design and Architecture: Examples in Haskell explains Servant →

Related concepts

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.