Re: [Haskell-cafe] Wouter-style expressions

2008-06-04 Thread Wouter Swierstra
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 -> Doc you can't make recursive calls to sub-expressions. There is, after all, no reason to believe that "t"

[Haskell-cafe] Wouter-style expressions

2008-06-03 Thread Ron Alford
Here's something that should be an easy extension of Wouter's approach to extensible datatypes, but I'm failing (possibly since it's 2:20am). I several classes of expressions I'm trying to represent (thus, Wouter's approach), and my first operation to implement over them is printing. Attached is