I’d like to understand the inner workings of the Yesod.Form.MassInput module. It is so old that not even Michael Snoyman feels able to advise on it. It is sparsely documented. Is there anyone here who could share insights on how it works? Are there comparable modules in other Haskell web frameworks?
I plan to generalize this module to arbitrary Generic
types and asked on haskell-cafe and perfomed some experiments. As I understand it, frameworks such as Yesod’s MForm
monad, while in principle can contain optional brances via monadic bind, in practice generate all fields and only process the posted content based on the monadic logic. That does not fly with potentially infinite data structures and algebraic sums.
If not with Yesod, I believe it would be beneficial for the Haskell webdev community as a whole if we had a way to generate HTML forms from the representation of a Generic
type much in the spirit of Aeson’s Generic classes generating parsers and serializers, together with code to marshal the form’s contents back to a Haskell value.
Already suggested as relevant were: Grace and Tangible Values, both of which do not provide the full generality that GHC.Generics
offers. In particular, branching and recursion are the problematic features.