Improve error reporting for non-rigid GADT matches
authorsimonpj@microsoft.com <unknown>
Thu, 30 Oct 2008 14:39:47 +0000 (14:39 +0000)
committersimonpj@microsoft.com <unknown>
Thu, 30 Oct 2008 14:39:47 +0000 (14:39 +0000)
commit259d5ea8479dbbf0220335c740efebec1bc19a7f
tree4197e9c5f30277d3f90f90a49b9a6abfdbbf1744
parent9bcd95bad83ee937c178970e8b729732e680fe1e
Improve error reporting for non-rigid GADT matches

Following suggestions from users, this patch improves the error message
when a GADT match needs a rigid type:

 tcfail172.hs:19:10:
     GADT pattern match in non-rigid context for `Nil'
-      Solution: add a type signature
+      Probable solution: add a type signature for `is_normal'
     In the pattern: Nil
     In the definition of `is_normal': is_normal Nil = True

Now GHC tries to tell you what to give a type signature *for*.
Thanks to Daniel Gorin and others for the suggestions.
compiler/hsSyn/HsExpr.lhs
compiler/typecheck/TcArrows.lhs
compiler/typecheck/TcMatches.lhs
compiler/typecheck/TcPat.lhs