Re: [Haskell] Ambiguous type variable when using Data.Generic

2006-05-20 Thread Neil Mitchell
Hi Bas, I had a requirement to do something similar as part of one of my projects, essentially reduce full Haskell to a small and manageable subset. Unfortunately I think you'll find that this task is a lot bigger than you first realise, and in particular that case-of is probably the expression

Re: [Haskell] Ambiguous type variable when using Data.Generic

2006-05-20 Thread Taral
On 5/20/06, Bas van Dijk [EMAIL PROTECTED] wrote: How can I make this work? As far as I know, you can't. To see the problem, rewrite it using dictionaries: data Simplify a = Simplify { simplify :: a - a } simplify_HsExp (HsInfixApp e1 op e2) = HsApp (HsApp (opToExp op) e1) e2 simplify_HsExp

Re: [Haskell] Ambiguous type variable when using Data.Generic

2006-05-20 Thread Taral
On 5/20/06, Bas van Dijk [EMAIL PROTECTED] wrote: simplifyExp (HsLeftSection e op)= HsApp (opToExp op) e simplifyExp (HsRightSection op e) = HsApp (opToExp op) e By the way, I think this looks wrong. One of these needs to create a lambda expression. -- Taral [EMAIL PROTECTED]

RE: [Haskell] Ambiguous type variable when using Data.Generic

2006-05-20 Thread Ralf Lammel
Bas, There is a really easy (and intended) way to make this work. See Sec. 6.4 SYB1 paper (TLDI 2003). - You compose things as follows: simplify = id `extT` simplifyRhs `extT` simplifyExp `extT` ... - You apply everything right away to simplify. There is no need to use a class in your case.