The monomorphism restriction and monomorphic pattern bindings

Neil Mitchell ndmitchell at
Wed Apr 23 17:16:52 EDT 2008


>   * remove the MR entirely


>   * adopt Monomorphic Pattern Bindings (MPB)

There are 6 reasons on that page why we shouldn't adopt MPB - of those
number 5 I think is particularly compelling. There seems to be 1 main
reason to remove it, which is that it has a complex translation to
System F. That doesn't seem to be a particularly good reason at all!
I'm guessing someone has written the translation so now applying
consistently isn't that hard? Having x /= (x) is rather disturbing.

Haskell has always had the attitude of doing what suits users, and
making implementations work hard to handle the language features. In
addition, this is a breaking change.

>  The nice thing about the combination of removing MR and adopting MPB is
> that we retain a way to explicitly declare monomorphic bindings.  These are
> monomorphic bindings:
>   ~x = e
>   x at _ = e

If you really care, add a type signature. Given the tendancy for
Hackage packages to have -Wall turned on and all warnings removed in
patches (I'm sure half the people on Hackage have had a patch doing
that from Gwern) I don't see a top-level type signature as being
particularly problematic. In addition, both of those forms are
non-obvious ways to declaring something monomorphic, and could easily
be "cleaned up" by someone not appreciating the subtleties of sharing.



More information about the Haskell-prime mailing list