Hello Klaus,

Thursday, August 3, 2006, 2:51:01 PM, you wrote:

> data SimpleExp = Num Int | Add SimpleExp SimpleExp

> data LabelledExp = LNum Int String | LAdd LabelledExp LabelledExp String

> The icing on the cake would be if it would also be possible to have a
> function

> unlabel :: LabeledExp -> Exp

> that does *not* need to know about the full structure of expressions.

> So, what options do I have to address this problem in Haskell?

Template Haskell (compile-time code generator) can be used to
automatically generate unlabel and SimpleExp from the LabelledExp
definition. you can also see to other generic programming solutions
which was overviewed in
http://dfa.imn.htwk-leipzig.de/~waldmann/draft/meta-haskell/second.pdf 



-- 
Best regards,
 Bulat                            mailto:[EMAIL PROTECTED]

_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to