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 y
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_HsEx
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]>
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.
Ho