I’m happy to announce the release of a new library for web-servers.
It offers simple and concise functions to build servers from small parts.
Servers are monoids, and we can aggregate them with functions like mconcat
.
Main features:
- lightweight library
- expressive DSL to compose servers
- type-safe handlers
- handlers are encoded with generic haskell functions
- built on top of WAI and warp server libraries.
For DSL design I wanted to touch the middle ground between scotty (being small and simple, but imperative) and servant (being composable, but somewhat advanced on type-level features)
I like scotty for being very simple and servant for being composable, type-safe and how functions are used as handlers which provides decoupling of Web-handlers from application logic. But sometimes scotty feels too imperative and lacks servant’s composability. And servant with type-level magic and huge errors can feel to complicated. So I wanted to create something in the middle. Something composable and simple at the same time. And be able to use arbitrary haskell functions as handlers.
There are only two functions to combine servers. And types of inputs and outputs are encoded with newtype-wrpappers with phantom types which provide type-safety.
It’s very first release. So feedback is welcome and I’m sure there are places to improve.
I hope that you will enjoy the lib.
links: