patch applied (ghc): Improve error messages for type functions
Simon Peyton Jones
simonpj at microsoft.com
Tue May 12 13:17:20 EDT 2009
Tue May 12 10:12:29 PDT 2009 simonpj at microsoft.com
* Improve error messages for type functions
Following a suggestion of Claus Reinke, this patch improves the error
messages involving type functions. Here's the relevant note from TcTyFuns.
Note [Non-injective type functions]
It's very confusing to get a message like
Couldn't match expected type `Depend s'
against inferred type `Depend s1'
so pp_open_tc adds:
NB: `Depend' is a (non-injective) type function
Currently we add this independently for each argument, so we also get
Couldn't match expected type `a'
against inferred type `Dual (Dual a)'
NB: `Dual' is a (non-injective) type function
which is arguably redundant. But on the other hand, it's probably
a good idea for the programmer to know the error involves type functions
so I've left it in for now. The obvious alternative is to only add
this NB in the case of matching (T ...) ~ (T ...).
M ./compiler/typecheck/TcTyFuns.lhs -2 +30
M ./compiler/types/TyCon.lhs +12
View patch online:
More information about the Cvs-ghc