module containing GADTs no longer compiles in ghc 6.8.0

Simon Peyton-Jones simonpj at microsoft.com
Wed Sep 26 12:55:10 EDT 2007


| PS: On a side note, I found this error message to be kind of funny. It seems
| to indicate no real error but some sort of error-message-driven poll!

That's exactly what it is, and you are the pollee.

Nevertheless it's probably needlessly obscure.  The point is this: you are doing
        case x of { ... }
where the "..." has GADT patterns.  But GHC doesn't know what type 'x' is.  Usually type inference will suffice, but not for GADTs.

Solution: use a type signature to tell GHC just what type x has.  Example:

f x = case x of ...

give f a type signature

f :: forall a. T a -> Int

There ought to be a "contributed documentation" wiki page about GADTs here
        http://haskell.org/haskellwiki/GHC
but there isn't yet. Would someone like to start one?

sorry brevity, rushing to get to icfp

Simon


| -----Original Message-----
| From: glasgow-haskell-users-bounces at haskell.org [mailto:glasgow-haskell-users-bounces at haskell.org] On
| Behalf Of Daniel Gorín
| Sent: 26 September 2007 17:34
| To: glasgow-haskell-users at haskell.org
| Subject: module containing GADTs no longer compiles in ghc 6.8.0
|
| Hi
|
| I just tried to compile a project of mine that builds fine using ghc 6.6.1 and
| got many errors like this:
|
| src/HyLo/Formula/NNF.hs:247:48:
|     GADT pattern match in non-rigid context for `Opaque'
|       Tell GHC HQ if you'd like this to unify the context
|     In the pattern: Opaque f'
|     In the expression: \ (Opaque f') -> Opaque (Box r f')
|     In the definition of `box':
|         box = \ (Opaque f') -> Opaque (Box r f')
|
| I don't know what a "non-rigid context" is, nor if "I like this to unify the
| context" or not, but I would certainly be happy if I could get this module to
| compile again! :)
|
| For the record, I was using ghc-6.8.0.20070917. Please let me know if you need
| further information....
|
| Thanks
| Daniel
|
| _______________________________________________
| Glasgow-haskell-users mailing list
| Glasgow-haskell-users at haskell.org
| http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


More information about the Glasgow-haskell-users mailing list