Hi Ron, I've attached a revised file that solves your problem.
The solution is actually quite subtle. If you define the class as: class Functor f => Printable f where exprDoc :: f t -> Docyou can't make recursive calls to sub-expressions. There is, after all, no reason to believe that "t" is Printable. The following choice of class is better:
class Functor f => Printable f where exprDoc :: Printable g => f (Expr g) -> DocNow when you define the instance for And, you can safely make recursive calls to the list of subchildren.
To define the function you want, just add a wrapper to exprDoc: ppExpr : Printable f => Expr f -> Doc ppExpr (In t) = exprDoc t All the best, Wouter PS - You may want to add: infixr 6 :+: to you code. It'll save you a lot of parentheses! This message has been checked for viruses but the contents of an attachment may still contain software viruses, which could damage your computer system: you are advised to perform your own checks. Email communications with the University of Nottingham may be monitored as permitted by UK legislation.
WouterTest.hs
Description: Binary data
_______________________________________________ Haskell-Cafe mailing list [email protected] http://www.haskell.org/mailman/listinfo/haskell-cafe
