[Haskell-cafe] Data-Type Serialization

Lyndon Maydwell maydwell at gmail.com
Mon Apr 23 04:24:59 CEST 2012


Hi Café.

I'm pondering over an old chestnut that I'd forgotten about until recently.

I'd like to be able to express schemas for general recursive datatypes
(excluding functions and possibly encoding bounds) and have an
interactive constructor for that datatype generated automatically.
Originally this idea came about as an XML/JS framework for creating
advanced form inputs on the client-side, however, I'm interested in
how this could be implemented idiomatically in Haskell.

I'm guessing that the best way to go about this would be to capture
the declaration in template Haskell, having a passthrough for the
declaration itself, and also generating a representation that can be
used for introspection and the creation of the interactive component.
Ideally I'd like to integrate this concept into one of the
web-frameworks such as Yesod so that complicated data-types can be
constructed interactively on the client-side using (generated)
javascript in order to get instantaneous feedback about validity of
fields, etc, and avoid page reloads and even ajax communication. The
details of the web-side of things would probably be quite messy, but
if the Haskell side can be made general enough then this can be
considered a separate problem :-)

Has anyone had experience with trying to solve this, or a similar
issue? What approach did you take? Did you use Template-Haskell, or
something else?

Thanks!



More information about the Haskell-Cafe mailing list