[Haskell-cafe] type checking failure curiosity

Julian Bradfield jcb+hc at julianbradfield.org
Tue Nov 16 12:44:47 UTC 2021

>My guess is that you've disabled the monomorphism restriction somehow... but you need the MR to type-check this code. Without the MR, `new` gets a type `forall a. a`, which gets specialized differently in `new`'s two occurrences, meaning that the type information from the second occurrence doesn't affect the first one... which you need it to in order to type-check the `null new` call.

Hm. I see the MR is off at the command prompt by default, but on in
compiled modules. The offending code was in a module starting:

module CLTutorial9 where
import Prelude hiding (lookup)
import Data.Set(Set, insert, empty, member, fromList, toList,
                 union,intersection, size, singleton, (\\))
import qualified Data.Set as S
import Test.QuickCheck
import Data.Char

I haven't knowingly done any thing to turn off the MR.

More information about the Haskell-Cafe mailing list