Fix Trac #3012: allow more free-wheeling in standalone deriving
authorsimonpj@microsoft.com <unknown>
Thu, 23 Jul 2009 13:01:45 +0000 (13:01 +0000)
committersimonpj@microsoft.com <unknown>
Thu, 23 Jul 2009 13:01:45 +0000 (13:01 +0000)
commitaa0c0de94e25aa64139688f8e4c4ba51ddca6f54
treebe374cbb776da2d28d599e7ba6c031c758775245
parentb752fe11fcff303a5ced0bbf67066941597b28af
Fix Trac #3012: allow more free-wheeling in standalone deriving

In standalone deriving, we now do *not* check side conditions.
We simply generate the code and typecheck it.  If there's a type
error, it's the programmer's problem.

This means that you can do 'deriving instance Show (T a)', where
T is a GADT, for example, provided of course that the boilerplate
code does in fact typecheck.

I put some work into getting a decent error message.  In particular
if there's a type error in a method, GHC will show the entire code
for that method (since, after all, the user did not write it).
Most of the changes are to achieve that goal.

Still to come: changes in the documentation.
compiler/typecheck/TcClassDcl.lhs
compiler/typecheck/TcDeriv.lhs
compiler/typecheck/TcEnv.lhs
compiler/typecheck/TcInstDcls.lhs
compiler/typecheck/TcMatches.lhs
compiler/typecheck/TcRnMonad.lhs
compiler/typecheck/TcRnTypes.lhs
compiler/utils/Outputable.lhs