If you are using Haskell on back end with an Elm front end, then tools that can generate Elm data types along with JSON encoders/decoders from Haskell data types, are probably an important part of your infra. There are a bunch of Haskell packages that address this issue. But from my own experience, if you try to use one of these, you very quickly run into some limitation regarding the type of Haskell data definitions they can handle, or the number of encoding options they support. This often causes you to limit yourself while defining data types on the Haskell side or use awkward workarounds so that they can be shared with Elm. This package is something I wrote as an attempt to solve these issues.
Some of the distinguishing features are
- Supports generation of polymorphic types (as well as concrete ones) in Elm from possibly polymorphic Haskell types, including types with phantom type variables.
- Supports generation of recursively defined types.
- Generates code that does not depend on external Elm libraries.
- Does not have limits on the number of fields that the constructors of your type can have.
- Supports JSON encoding options exported by the Aeson library comprehensively (The tests exhaustively check the Elm/Haskell round tripping of values for all possible configurations of Aeson.options)
- Supports generation of code that can depend on pre defined types and encoders/decoders in Elm.
Feedback and suggestion are welcome!