Suave and Giraffe are functional web frameworks that work based on composition of handlers. A handler is a function that accepts an HttpContext
and returns an Async<HttpContext option>
, fitting nicely into an HTTP server's protocol of accepting HTTP messages with a request and some metadata, then returning a message with that metadata and a response. This makes the WebPart
in Suave, for example.
While the frameworks themselves only allow you to put a WebPart
into the processing pipeline, it is entirely up to you how you compose functions together to get that WebPart
. When you compose WebPart A and WebPart B (or HttpHandler A and HttpHandler B), you are using the a compose
operator - >=>
. Take a look at the function:
let compose (first : 'a -> Async<'b option>) (second : 'b -> Async