[Haskell-beginners] applicativeParsec.hs in Real World Haskell not compiling any more

Kees Bleijenberg k.bleijenberg at inter.nl.net
Thu Oct 25 10:46:39 CEST 2012


--original message
....
Hum, the current version is 7.6.1, you should consider installing that,
7.0.4 is already rather oldish.

I don't know what the latest version is for Windows. I'll give it a try.

> unchanged version doesn't compile any more. I get warning:
> ApplicativeParsec.hs:17:10:
>     Illegal instance declaration for `Applicative (GenParser s a)'
>       (All instance types must be of the form (T t1 ... tn)
>        where T is not a synonym.
>        Use -XTypeSynonymInstances if you want to disable this.)
>     In the instance declaration for `Applicative (GenParser s a)'
> 
> ApplicativeParsec.hs:22:10:
>     Illegal instance declaration for `Alternative ....(same advice as 
> above)

That's unfortunate, it should better have reported the below immediately.
But it's hard to make the compiler always give the best error message, so
sometimes it gives a not-best.

..... 
> Then I added the OverlappingInstances directive. Same error and no 
> compilation.
> 
> I wonder, is this the new GHC version? And what can I do about it?

It's a new parsec version, that now provides Applicative and Alternative
instances out-of-the-box.

Just remove (delete or comment out) the instance declarations from your
code.

--- end original message

Removing ApplicationParsec.hs from the project and adding a few new
references (Control.Applicative....) did the trick. 

Thanks,
Kees





More information about the Beginners mailing list