[Template-haskell] Problem with Labelled Fields

Ian Lynagh igloo@earth.li
Thu, 26 Jun 2003 14:03:30 +0100


On Thu, Jun 26, 2003 at 01:15:28PM +0200, Eric Offermann wrote:
> 
> instance Lift (C a) where
>   lift c =
>     recCon "C"
>       [fieldExp "c_succ" [| c_succ c |]
>       ,fieldExp "c_pred" [| c_pred c |]
>       ]

I think [| c_succ c |] doesn't do what you think it does - are you
hoping for it to be the code for "\n -> n + 1"? What you will actually
get is the code for applying "c_succ" to lift c (it is lifted as it is
an argument to the function). However, lifting c needs to use this
instance again so loops.


Ian