
4 Aug
2006
4 Aug
'06
9:29 a.m.
Klaus Ostermann schrieb:
data SimpleExp = Num Int | Add SimpleExp SimpleExp
data LabelledExp = LNum Int String | LAdd LabelledExp LabelledExp String
I wonder what would be the best way to model this situation without repeating the structure of the AST.
How about the following simple parameterization? data Exp label = LNum Int label | LAdd (Exp label) (Exp label) label type SimpleExp = Exp () mkNum i = LNum i () type LabelledExp = Exp String Cheers Christian