[Haskell-cafe] [ANNOUNCE] mig - new library to write composable web-servers

Anton Kholomiov anton.kholomiov at gmail.com
Sun Aug 6 15:28:22 UTC 2023


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 a servant's composability. And servant with type-level
magic and huge errors can feel too 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:
* [github](https://github.com/anton-k/mig)
* [hackage](https://hackage.haskell.org/package/mig-0.1.0.1)
* [examples](
https://github.com/anton-k/mig/tree/main/examples/mig-example-apps)
* [example of a handle pattern app](
https://github.com/anton-k/handle-pattern-mig-app)
* [example of a reader pattern app](
https://github.com/anton-k/reader-pattern-mig-app)

Cheers,
Anton
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20230806/7a310fad/attachment.html>


More information about the Haskell-Cafe mailing list