monomorphism restriction confusions

Isaac Dupree isaacdupree at charter.net
Mon Jul 9 16:28:05 EDT 2007


Haskell98's monomorphism restriction is too confusing!  See my mistaken 
GHC bug report <http://hackage.haskell.org/trac/ghc/ticket/1503>. 
Whether a binding is monomorphic depends not just on syntax, but on the 
amount of type constraints on the right-hand side of a binding - and I 
didn't realize, because this issue usually doesn't come up (usually 
types are already monomorphic or are at least typeclass qualified, or at 
least don't have to be monomorphic to prevent a type error).  Although 
this finally convinces me that we should dump H98 m-r in favor of the 
very straightforward "monomorphic pattern bindings", if we don't, at 
least I believe that Report Section 4.5.5, Rule 1 needs a reword.  It 
uses "(un) restricted" to mean "restricted (to be monomorphic) IN SOME 
CASES".  Maybe a word like "suspicious" would be less misleading than 
"restricted" there?

Isaac


More information about the Haskell-prime mailing list