The dreaded M-R

Malcolm Wallace Malcolm.Wallace at
Tue Jan 31 11:14:20 EST 2006

John Hughes <rjmh at> writes:

>     Ambiguous type variable `a' in the constraint:
>       `Ord a' arising from use of `Data.Set.insert' at Pretty.hs:28:11-20
>     Possible cause: the monomorphism restriction applied to the following:
>       addToSet :: a -> Data.Set.Set a -> Data.Set.Set a
>     Probable fix: give these definition(s) an explicit type signature
>                   or use -fno-monomorphism-restriction
> Well, is it OK? From the type-checker's point of view, yes, But have you
> lost sharing?

Yes, I have lost sharing, but then again, sharing is impossible here
anyway.  In fact, the monomorphism restriction wanted to force sharing,
but the types indicated it was not possible, hence the error.  :-)

What the M-R was complaining about, is my having eta-reduced a
definition into completely point-free style.


More information about the Haskell-prime mailing list