wiki:MonomorphismRestriction/MonomorphicBindingSyntax

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

text moved from MonmorphismRestriction?

A monomorphic binding syntax

behave just like the monomorhpic binding operator, but instead of having a new operator, use parens as in:

(shared) = 3 + 4    -- monomorphic binding

see http://www.haskell.org//pipermail/haskell-prime/2006-January/000117.html

For:

  • Simpler and more consistent than the M-R
  • doesn't eat up a new operator
  • can be seen as a degenerate case of the standard 'pattern matching is monomorphic' rule
  • syntax makes it clear this is something that can happen to values and not functions
  • we are already used to (=) being overloaded in this way

Against:

  • would make parentheses matter in a certain situation (n+k patterns and negative literals already do this)