Vivian McPhail <vivian.mcphail@paradise.net.nz> wrote in article <001301c54d6c$ba44b980$0301a8c0@intranet> in gmane.comp.lang.haskell.general:
It seems that I must be missing something? Is there a more elegant way of doing this?
Check out the "generalized algebraic data types" feature (GADT, one of its many names), now available in GHC. One classical example of its use is to write type-safe interpreters similar to your NL parser. -- Edit this signature at http://www.digitas.harvard.edu/cgi-bin/ken/sig Science operates according to a law of conservation of difficulty. The simplest questions have the hardest answers; to get an easier answer, you need to ask a more complicated question. -- George Musser. Color Madness. Oddball maps can require more than four colors. Sci. Am., January 2003.