The monomorphism restriction and monomorphic pattern bindings

Simon Marlow marlowsd at gmail.com
Wed Apr 23 13:32:24 EDT 2008


Folks,

The current proposal on the table for what to do about the monomorphism 
restriction (henceforth MR) is

   * remove the MR entirely
   * adopt Monomorphic Pattern Bindings (MPB)

Right now, the committee is almost uniformly in favour of dropping the 
MR, and most of us are coming round to the idea of MPB.  Since this area 
has historically been difficult to achieve a concensus on, I'm excited 
that we appear to be close to making a decision, and a good one at that!

The arguments for removing the MR are pretty well summarised on the wiki:

http://hackage.haskell.org/trac/haskell-prime/wiki/MonomorphismRestriction

You can read about MPB here:

http://hackage.haskell.org/trac/haskell-prime/wiki/MonomorphicPatternBindings

GHC has implemented MPB by default (i.e. we deviate slightly from 
Haskell 98) since 6.8.1.

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

or if you don't mind a strict binding: !x = e.  The wiki points out that

  (x) = e

would also be monomorphic, but arguably this is in poor taste since we 
expect (x) to mean the same as x everywhere.

Cheers,
	Simon


More information about the Haskell-prime mailing list