patch applied (ghc): Big tidy-up of deriving code
Simon Peyton Jones
simonpj at microsoft.com
Tue Jan 2 11:22:52 EST 2007
Tue Jan 2 07:46:10 PST 2007 simonpj at microsoft.com
* Big tidy-up of deriving code
This tidy-up, triggered by Trac #1068, re-factors the way that 'deriving'
happens. It took me way longer than I had intended. The main changes,
by far are to TcDeriv; everyting else is a minor consequence.
While I was at it, I changed the syntax for standalone deriving, so that
it goes
derive instance Show (T a)
(instead of "derive Show for T"). However, there's still an implicit
context, generated by the deriving code, and I wonder if it shouldn't really
be
derive instance (..) => Show (T a)
but I have left it simple for now.
I also added a function Type.substTyVars, and used it here and there, which
led to some one-line changes otherwise unrelated (sorry).
Loose ends:
* 'deriving Typeable' for indexed data types is still not right
* standalone deriving should be documented
M ./compiler/basicTypes/DataCon.lhs -1 +1
M ./compiler/basicTypes/MkId.lhs -1 +1
M ./compiler/hsSyn/HsDecls.lhs -10 +21
M ./compiler/hsSyn/HsTypes.lhs -2 +1
M ./compiler/hsSyn/HsUtils.lhs +2
M ./compiler/parser/Lexer.x -3 +3
M ./compiler/parser/Parser.y.pp -6 +3
M ./compiler/rename/RnSource.lhs -4 +3
M ./compiler/typecheck/Inst.lhs -1 +1
M ./compiler/typecheck/TcDeriv.lhs -335 +342
M ./compiler/typecheck/TcEnv.lhs -8 +17
M ./compiler/typecheck/TcExpr.lhs -1 +1
M ./compiler/typecheck/TcGenDeriv.lhs -2 +1
M ./compiler/typecheck/TcHsType.lhs -10 +23
M ./compiler/typecheck/TcInstDcls.lhs -5 +1
M ./compiler/typecheck/TcMType.lhs -1 +1
M ./compiler/typecheck/TcSimplify.lhs -46 +15
M ./compiler/typecheck/TcType.lhs -1 +1
M ./compiler/types/FamInstEnv.lhs -3 +7
M ./compiler/types/TyCon.lhs -3 +3
M ./compiler/types/Type.lhs -2 +4
M ./compiler/utils/Util.lhs -1 +8
More information about the Cvs-ghc
mailing list