The dreaded M-R

Malcolm Wallace Malcolm.Wallace at cs.york.ac.uk
Tue Jan 31 06:19:59 EST 2006


"Simon Marlow" <simonmar at microsoft.com> writes:

> Given the new evidence that it's actually rather hard to demonstrate any
> performance loss in the absence of the M-R with GHC, I'm attracted to
> the option of removing it in favour of a warning.

As another data point, today for the first time I received an error
(not a warning) from ghc about the M-R:

    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 (bound at Pretty.hs:28:0)
    Probable fix: give these definition(s) an explicit type signature
                  or use -fno-monomorphism-restriction

So, without the M-R or a type signature, my code is OK.  The proposal
to accept this code but produce an optional warning is (I think)
better than the current error.

Regards,
    Malcolm


More information about the Haskell-prime mailing list