GADT pattern match in non-rigid context

Wolfgang Jeltsch g9ks157k at
Tue Sep 2 07:20:01 EDT 2008


I have some code giving me the error message: “GADT pattern match in non-rigid 
context for … Tell GHC HQ if you'd like this to unify the context”.  I 
reduced my code to the following example which still gives this error 

> data T a b where
>     C :: T a [b]
> f :: (forall a'. T a' b) -> T a b
> f t = case t of C -> C

How do I work around this error?  Some former e-mail discussion gave the hint 
of adding a type signature but this probably doesn’t work in my case.  Note 
also that specializing the type of the argument t to T a b inside the 
definition of f is not an option since in the real code I need the first 
argument of T to be universally quantified for calling another function which 
needs this quantification.

I use GHC 6.8.2.  Don’t know whether this problem still shows up with GHC HEAD 
but am interested in hearing whether this is the case.

I’m thankful for any help.

Best wishes,

More information about the Glasgow-haskell-users mailing list