"do" notation and ">>"

Simon Marlow simonmar@microsoft.com
Wed, 24 Apr 2002 15:14:01 +0100

> I was not suggesting that the Haskell'98 report should
> change or even give a warning -- I was giving a warning to
> compiler implementors, that this simple change might have
> disastrous effects.
> BTW, I remember a similar discussion along these lines on
> the Haskell mailing list that happened in 1997 I think, but
> I cannot find the archives.
> Another comment one can make here is the following: if
> Haskell does not care about sharing, why is the monomorphism
> restriction there?

One difference is that when the compiler gives you *less* sharing than
you were expecting, then it is in some sense worse than getting more
sharing.  More sharing might result in space leaks, but in practice (in
my experience anyway) this isn't as noticeable as the time leaks you get
when sharing is lost.

GHC has implemented almost-full-laziness for a long time, and I don't
recall anyone ever complaining about space leaks introduced as a result.
The monomorphism restriction, on the other hand, is concerned with the
user getting no less than the amount of sharing he/she was expecting
(personally I think this should be a compiler warning rather than a
language restriction, but I'm aware there are other reasons for wanting
the MR too).