wiki:MonomorphismRestriction/MonomorphicVariableAndPatternBindings

Version 1 (modified by simonmar@…, 6 years ago) (diff)

text moved from MonmorphismRestriction?

All variable/pattern bindings are monomorphic unless a signature is given

(one of the proposals for reforming the MonomorphismRestriction)

For:

  • Simpler than the M-R
  • Polymorphism in local variable bindings is rare (but less rare at the top-level), and can always be recovered with a type signature

Against:

  • Against the spirit of Haskell - shouldn't compromise expressiveness for performance by default
  • Already huge potential for ruining your performance without the M-R, why introduce such draconian measures just for this?
  • Monomorphic bindings lead to hard to understand errors when polymorphism was expected
  • Haskell doesn't define an operational semantics so introducing a concept of sharing into the report would be odd.