
"Simon Marlow"
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 Well, is it OK? From the type-checker's point of view, yes, But have you lost sharing? Have you introduced a space leak, because a seq on one of the occurrences of your variable only forces one instance? Those are the dangers of following the advice to put a type signature in. John

John Hughes
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. Regards, Malcolm
participants (2)
-
John Hughes
-
Malcolm Wallace