The dreaded M-R

Cale Gibbard cgibbard at gmail.com
Sat Jan 28 16:06:12 EST 2006


On 26/01/06, John Hughes <rjmh at cs.chalmers.se> wrote:
> I had promised myself not to propose anything that was not already
> implemented,
> tried, and tested, but I just can't resist bringing up a proposal I've
> made in the
> past to fix the monomorphism restriction. Maybe now is the time to do so.
>
> I know many will proclaim "just get rid of it", but consider this:
> without the
> M-R, some programs can run exponentially slower than you expect. This
> actually happened to me, which is how we discovered something of the sort
> was needed in the first place. But the current design is surely a wart.

Do you have an example of such a program handy? Perhaps I'm just doing
something stupid, but I can't seem to replicate the lack of sharing
that's supposed to happen with the MR turned off in GHCi, so it's hard
to play around with doing various translations by hand and seeing the
results. Perhaps the optimiser is getting to the code and commoning
things up? If this is the case, can't we just show that it always does
so, or write that commoning into the translation, as suggested by
Philippa, and forget about it?

 - Cale


More information about the Haskell-prime mailing list