An "invertible syntax description" is something that can be used to both parse and generate a syntax.
For example, instead of defining separate toJson
and fromJson
functions for a given data type, an invertible syntax description could be used to provide both.
There are many Haskell libraries that provide this functionality or something close to it.
As far as I can tell most of them are at least inspired by Invertible syntax descriptions by Tillmann Rendel and Klaus Ostermann.
Personally I am interested in using these for HTTP routing.
I frequently want to be able to define a route such as /episodes/:id.json
, dispatch based on that route, and generate links to that route.
Doing so manually is tedious and error prone.