GHC 6.10 changes for recursive calls to class instances

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


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, but I'm a little unclear
on whether it's the same problem or not.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: RecDict.hs
Type: text/x-haskell
Size: 675 bytes
Url :

More information about the Glasgow-haskell-users mailing list