This approach differs from
- Yesod
- Servant
Instead, the following approach is used:
-
A request can be modelled as an Applicative (a la
optparse-applicative
): it can generate a parser, and also documentation, and clients, etc. a la servant. That's because Applicative lets you create a tree that produces arguments while being inspectable without providing those arguments. -
A response can be modelled as a HoleyMonoid (a la
formatting
): it can generate a printer (writing body, headers), and also documentation, client, etc. a la servant. That's because HoleyMonoid lets you create a tree that consumes arguments while being inspectable without providing those arguments.
In that sense HoleyMonoid is the corresponding opposite concept of Applicative. For a web server to be self-documenting and to generate JS/Haskell clients, you need a way to inspect both sides without providing real arguments.
Hence the two modules:
Request
- modules a parser that is self-describingResponse
- modules a printer that is self-describing
Below is a rough sketch.