I was trying to use ghc-7.10 (RC 2) and got this message in a number of cases, e.g.,
src/Text/Regex/XMLSchema/Generic/RegexParser.hs:439:5:
Non type-variable argument
in the constraint: Text.Parsec.Prim.Stream s m Char
(Use FlexibleContexts to permit this)
When checking that ‘prop’ has the inferred type
prop :: forall s u (m :: * -> *) (t :: * -> *).
(Foldable t, Text.Parsec.Prim.Stream s m Char) =>
Char -> t Char -> Text.Parsec.Prim.ParsecT s u m [Char]
In an equation for ‘isCategory'’:
isCategory'
= (foldr1 (<|>) . map (uncurry prop)
$ [('L', "ultmo"), ('M', "nce"), ('N', "dlo"), ....])
<?> "illegal Unicode character property"
where
prop c1 cs2
= do { _ <- char c1;
.... }
Failed to install hxt-regex-xmlschema-9.2.0
This must be something that is introduced by the new ghc, or the new base that comes with it, or the new parsec (3.1.8), since it worked before.
source code snippet:
isCategory' :: Parser String
isCategory'
= ( foldr1 (<|>) . map (uncurry prop) $
[ ('L', "ultmo")
, ('M', "nce")
, ('N', "dlo")
, ('P', "cdseifo")
, ('Z', "slp")
, ('S', "mcko")
, ('C', "cfon")
]
) <?> "illegal Unicode character property"
where
prop c1 cs2
= do
_ <- char c1
s2 <- option ""
( do
c2 <- satisfy (`elem` cs2)
return [c2] )
return $ c1:s2
Note: I am not asking about this specific libray (hxt-*) since I observed this in other places also.
This was a change introduced in GHC 7.10.1-rc1:
GHC now checks that all the language extensions required for the inferred type signatures are explicitly enabled. This means that if any of the type signatures inferred in your program requires some language extension you will need to enable it. The motivation is that adding a missing type signature inferred by GHC should yield a program that typechecks. Previously this was not the case.
This is a breaking change. Code that used to compile in the past might fail with an error message requiring some particular language extension (most likely
-XTypeFamilies
,-XGADTs
or-XFlexibleContexts
).