id,summary,reporter,owner,description,type,status,priority,milestone,component,version,resolution,keywords,cc,os,architecture,failure,difficulty,testcase,blockedby,blocking,related
3440,Improve error message for GADT failures,simonpj,,"If you write
{{{
 type family Fam a :: *

 data GADT :: * -> * where
   GADT :: a -> Fam a -> GADT (Fam a)

 unwrap :: GADT (Fam a) -> (a, Fam a)
 unwrap (GADT x y) = (x, y)
}}}
then typechecking `unwrap` should certainly fail. And it does, but with a horrible message:
{{{
 Main.hs:9:21:
   Couldn't match expected type `a' against inferred type `a1'
     `a' is a rigid type variable bound by
         the type signature for `unwrap' at Main.hs:8:20
     `a1' is a rigid type variable bound by
          the constructor `GADT' at Main.hs:9:8
   In the expression: x
   In the expression: (x, y)
   In the definition of `unwrap': unwrap (GADT x y) = (x, y)
}}}
It would be better to say something more like:
{{{
	Cannot deduce (a ~ a1) from (Fam a ~ Fam a1)
}}}
See the thread at [http://thread.gmane.org/gmane.comp.lang.haskell.cafe/62322]",bug,closed,low,7.0.1,Compiler (Type checker),6.10.4,fixed,,michal.terepeta@…,Unknown/Multiple,Unknown/Multiple,None/Unknown,Unknown,indexed-types/should_fail/T3440,,,
