servant-0.1: A library to generate REST-style webservices on top of scotty, handling all the boilerplate for you

MaintainerAlp Mestanogullari <>
Safe HaskellSafe-Inferred



A Context type for holding a function that will use some context to execute something analoguous to a database operation.

This is equivalent to holding something like:

 withConnection someConnection

where you have previously set up someConnection by specifying a connection string or something like that. This lets us support any kind of backend (even an in-memory Map in an IORef), and most interestingly, we can use just raw connections or a connection pool, this approach really covers a lot of situations while keeping everything quite simple.



data Context c Source

A Context is just a wrapper around a function that can execute IO operations given this context.

mkContext :: (forall r. (c -> IO r) -> IO r) -> Context cSource

Create a Context from a suitable function

withContext :: Context c -> (c -> IO r) -> IO rSource

Use the Context to actually perform an IO operation requiring it.