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

Carter Schonwald carter.schonwald at gmail.com
Wed Aug 9 17:16:50 UTC 2023


as i said on reddit, this is super cool and hits a design combination
i've long wanted to see (and never had the time myself to explore
doing)

On Sun, Aug 6, 2023 at 11:28 AM Anton Kholomiov
<anton.kholomiov at gmail.com> wrote:
>
> 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
> _______________________________________________
> Haskell-Cafe mailing list
> To (un)subscribe, modify options or view archives go to:
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
> Only members subscribed via the mailman list are allowed to post.


More information about the Haskell-Cafe mailing list