[Haskell-cafe] Simulating open datatypes with type families?

Stephen Tetley stephen.tetley at gmail.com
Sat Feb 26 18:33:58 CET 2011


I don't think typeclasses or a type family will solve the problem directly.

Both the statement parsers are producing concrete types - type class
polymorphism won't be able to create a union of the two concrete types
- a concrete sum type (i.e. Either) will be able to make the union,
but it would make the grammar messy.

Making an extensible parser for a language as big as C will be tricky.
Tim Sheard and Emir Pasalic have done it for a small language in this
paper - they use a technique that doubles the number of constructors.

http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.19.8983

Best wishes

Stephen



More information about the Haskell-Cafe mailing list