Fix Trac #2668, and refactor TcDeriv
authorsimonpj@microsoft.com <unknown>
Tue, 21 Oct 2008 14:29:22 +0000 (14:29 +0000)
committersimonpj@microsoft.com <unknown>
Tue, 21 Oct 2008 14:29:22 +0000 (14:29 +0000)
commitda1de991e04dd9a25e9c7253ade7eadf9f399c84
tree098db3c214db8dd9fa7b8bb1151c5a8563d7ba7f
parented8a98a544e23108c09c4b6b5411d30795ce2a5f
Fix Trac #2668, and refactor TcDeriv

TcDeriv deals with both standalone and ordinary 'deriving';
and with both data types and 'newtype deriving'.  The result
is really rather compilcated and ad hoc.  Ryan discovered
#2668; this patch fixes that bug, and makes the internal interfces
#more uniform.  Specifically, the business of knocking off
type arguments from the instance type until it matches the kind of the
class, is now done by derivTyData, not mkNewTypeEqn, because the
latter is shared with standalone derriving, whree the trimmed
type application is what the user wrote.
compiler/typecheck/TcDeriv.lhs