Re: Qualified variable in pattern: T.mkRoot

Olaf Chitil <[email protected]> Mon, 04 Jul 2005 14:50:18 +0100
Newsgroups gmane.comp.lang.haskell.hat
Message-ID <[email protected]>
>hat-trans is generating bad code for this, because the pattern binding
>is at the toplevel.  If the pattern binding were in a let or where
>clause, the generated code is different.  When not at the toplevel,
>the parent, p, of the binding is always a variable passed in.
>But at the toplevel, there is no static parent, so hat-trans has
>wrongly substituted T.mkRoot (which explicitly represents no parent),
>in both the generated pattern and the generated expression:
>
>    gx px T.mkRoot = T.constUse px T.mkRoot sx	-- incorrect
>vs.
>    gx px p = T.constUse px p sx		-- correct
>
>I think the attached patch for hat-trans should fix the problem (but
>would like someone to confirm this is not going to break anything else,
>before I will commit it to CVS).
>  
>
You are absolutely right. I just committed it to CVS.

Ciao,
Olaf