[Haskell-cafe] A question about data declaration

Evan Laforge qdunkan at gmail.com
Sat Mar 23 20:34:00 CET 2013


> Brent, my use case is not particularly complicated. I am trying to model the
> pdf spec - which says that pdf contains Objects that could of of types
> Number, String, Name, Array and Dictionary - while array is list of objects,
> the Disctionary is a list of tuples (Name, Object) not (Object, Object) -
> hence my situation.

The WASH web framework used a trick to type HTML.  If I recall
correctly, they had a couple of phantom type parameters and then wrote
MPTC instances for only the allowed combinations.  So you'd have "HTML
InXContext OrderedList" and "HTML InXContext UnorderedList", etc.
Then the constructor for an X would have a type signature that
required 'HTML InXContext a' of its argument.

Or something like that.  See if you can dig up any old WASH docs for
more details.



More information about the Haskell-Cafe mailing list