Desugaring instances
Simon Peyton-Jones
simonpj at microsoft.com
Thu Mar 5 06:27:58 EST 2009
Guys
I've been struggling with how to desugar instance declarations for some time. It's been going round and round in my head, but without reaching a fixed point. Ganesh's message (below) made me realise an additional problem with the current "solution".
So I thought I'd take an hour to articulate the issues and invite you all to help me.
Here's my writeup:
http://hackage.haskell.org/trac/ghc/wiki/Commentary/Compiler/DesugaringInstances
Can you look, and see if you can think of a good way to go?
It's a wiki, of course, so feel free to edit to add clarity, or add clarifying questions that I can answer. You can also add new sections for ideas you have. Or just use email.
(I've used cvs-ghc for now because you guys are closest to this stuff, not because it's a secret of any kind.)
thanks
Simon
| -----Original Message-----
| From: glasgow-haskell-users-bounces at haskell.org [mailto:glasgow-haskell-users-
| bounces at haskell.org] On Behalf Of Ganesh Sittampalam
| Sent: 19 February 2009 22:30
| To: glasgow-haskell-users at haskell.org
| Subject: GHC 6.10 changes for recursive calls to class instances
|
| 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
More information about the Cvs-ghc
mailing list