class HasBaseStruct rec base | rec->base where base :: base -> rec hsId n = base $ HsId n hsLit lit = base $ HsLit lit hsApp e1 e2 = base $ HsApp e1 e2 hsLambda pats e = base $ HsLambda pats e ...
This makes the constructor functions reusable in extensions to the base language. Code duplication is reduced, but there is a risk of introducing ambiguity...