"Simon Marlow" <[EMAIL PROTECTED]> 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


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

_______________________________________________
Haskell-prime mailing list
Haskell-prime@haskell.org
http://haskell.org/mailman/listinfo/haskell-prime

Reply via email to