[Haskell-cafe] GHC 6.10 and scoped variables

Hugo Pacheco hpacheco at gmail.com
Sat Nov 15 05:07:28 EST 2008


Hi,

When migrating some code with type families to GHC 6.10, I frequently get
the same error.

The deal is. If I define some type family and instance:

*type family Rep (f :: * -> *) x :: *

data (g :+: h) x    = Inl (g x) | Inr (h x)
type instance Rep (g :+: h) x = Rep g x `Either` Rep h x*

and then define a function that has a scoped argument:

*test :: Rep (g :+: h) x -> y
test (Left x :: Rep (g :+: h) x) = undefined*

I get the error:

* Pattern signature must exactly match: Rep (g :+: h) x
    In the pattern: Left x :: Rep (g :+: h) x
    In the definition of `test':
        test (Left x :: Rep (g :+: h) x) = undefined*

Is this error expected? At least the error message is not clear...

Interestingly, when experimenting with a different functor, I get the
impossible:
*
newtype Const t x   = Const {unConst :: t}
type instance Rep (Const t) x = t**

**test2 :: Rep (Const t) x -> y
test2 x = undefined*

*ghc: panic! (the 'impossible' happened)
  (GHC version 6.10.1 for i386-unknown-linux):
    readFilledBox x{tv aoB} [box]
Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug
> *

Sorry for the extensiveness. Thanks,
hugo

-- 
www.di.uminho.pt/~hpacheco
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20081115/0ebaaa60/attachment.htm


More information about the Haskell-Cafe mailing list