[Haskell-cafe] [ANN] mig-0.2 library to build servers and clients

Anton Kholomiov anton.kholomiov at gmail.com
Thu Nov 9 17:26:31 UTC 2023

I’m happy to announce the latest release of mig-0.2
<https://github.com/anton-k/mig> library. It is a library to write
composable servers for simple / boring haskell. The main focus of this
release is the ability to serve Swagger UI from the server with ease and
ability to create clients from the same code as servers. I’m happy to
confirm that both goals are reached with this release.

The tutorial for the library <https://anton-k.github.io/mig/> was created.

Also there are many other improvements:

   - OpenApi schema for servers
   - swagger servers support (we can add swagger to server with one line of
   code: withSwagger def server )
   - clients from the same code as servers
   - redesign of internal types
   - redesign of DSL for routes
   - many ergonomic improvements
   - packages for extra utils
   - split of mig package to several packages:
      - mig <https://hackage.haskell.org/package/mig> - core
      - mig-wai <https://hackage.haskell.org/package/mig-wai> - rendering
      servers to wai apps
      - mig-client <https://hackage.haskell.org/package/mig-client> -
      - mig-extra <https://hackage.haskell.org/package/mig-extra> - extra
      - mig-server <https://hackage.haskell.org/package/mig-server> - mig
      servers with batteries
      - mig-swagger-ui <https://hackage.haskell.org/package/mig-swagger-ui> -
      swagger ui server
   - tutorial and quickstart guide <https://anton-k.github.io/mig/> on
   github pages
   - CI for repo with formatter, build and tests and update of docs on
   github pages

The internal type for Servers was redesigned so that we assemble the
handler function with API description at the same time. In the first
release it was just a handler function under the hood.

As a refresher mig <https://github.com/anton-k/mig> is a family of
libraries to write lightweight, simple, type-safe and composable servers.
It strives to be in the middle ground between scotty and servant. To be
composable, flexible and type-safe as servant and simple and lightweight in
concepts as scotty.

One thing that interesting to think about as Server is a first-class value
and all servers have the same type and we have just a small number of
functions to compose them (they are link server to path and make
alternative routes with Monoid) it’s interesting to explore the possibility
of creation small grain-like servers for typical tasks. For example, a
server can be a function from interfaces (logging, DB or something else) to
server value and we can join them together on various paths. This idea is
interesting to consider.

Thanks to Ambros for contribution. Also I’d like to thank the authors of
packages servant, servant-swagger-ui and servant-openapi3 packages for
inspiration for my work in this release. Many lines of code are influenced
by those packages.


   - github <https://github.com/anton-k/mig>
   - tutorial <https://anton-k.github.io/mig/>
   - mig on hackage <https://hackage.haskell.org/package/mig> also see
   packages mig-server <https://hackage.haskell.org/package/mig-server> and
   mig-client <https://hackage.haskell.org/package/mig-client>.
   - examples

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

More information about the Haskell-Cafe mailing list