GHC 6.10 changes for recursive calls to class instances

Ganesh Sittampalam ganesh at earth.li
Thu Feb 19 17:29:37 EST 2009


Hi,

I have a problem in GHC 6.10 with functions in a class instance calling 
other functions in the same class instance. It seems that the dictionary 
is freshly constructed for this call, despite being already available.

The reason I care is that I want to memoise some expensive computations 
inside the dictionary for each instance. [Obviously I also have to make 
sure that the dictionary isn't constructed multiple times by external 
callers, but I can make other arrangements to ensure that.]

To see the problem in action, run main from the attached code. In GHC 6.8 
and before, this only executes the trace statement once. In GHC 6.10, the 
trace statement executes twice, at all optimisation levels.

This seems related to
http://hackage.haskell.org/trac/ghc/ticket/2902, but I'm a little unclear
on whether it's the same problem or not.

Cheers,

Ganesh
-------------- next part --------------
A non-text attachment was scrubbed...
Name: RecDict.hs
Type: text/x-haskell
Size: 675 bytes
Desc: 
Url : http://www.haskell.org/pipermail/glasgow-haskell-users/attachments/20090219/f2258537/RecDict.bin


More information about the Glasgow-haskell-users mailing list