Desugaring instances
Max Bolingbroke
omega.theta at gmail.com
Thu Mar 5 09:13:40 EST 2009
2009/3/5 Simon Peyton-Jones <simonpj at microsoft.com>:
I think that suffers from the same lack-of-memoisation as (A).
>
> After all, each recursive call is to (opF_aux d_a), and each such call builds a new d_as.
Thats why I mentioned CSE at the end of my email:
"""
To prevent reconstruction of the dictionary in general, I think that
CSE needs to be able to do:
f x = ... f x ...
=>
f x = letrec n = ... n ...
in n
"""
This corresponds to having CSE rewrite (opF_aux d_a) into a local
recursive loop. It's interesting that this corresponds exactly to the
arity-improving transformation for dictionaries we have discussed
before.
Cheers,
Max
More information about the Cvs-ghc
mailing list