[project @ 2005-11-16 12:55:58 by simonpj]
authorsimonpj <unknown>
Wed, 16 Nov 2005 12:55:59 +0000 (12:55 +0000)
committersimonpj <unknown>
Wed, 16 Nov 2005 12:55:59 +0000 (12:55 +0000)
commitcdea99491a8dedfc53fc2e8c4c8fbaf209802b27
tree1b093fe6d1f9b57099a5ed257fea3e2ec2096737
parentb6e680de14e07e1316f3d668b2e46b7a19e7a6b6
[project @ 2005-11-16 12:55:58 by simonpj]
Two significant changes to the representation of types

1. Change the representation of type synonyms

    Up to now, type synonym applications have been held in
    *both* expanded *and* un-expanded form.  Unfortunately, this
    has exponential (!) behaviour when type synonyms are deeply
    nested.  E.g.
    type P a b = (a,b)
    f :: P a (P b (P c (P d e)))

    This showed up in a program of Joel Reymont, now immortalised
    as typecheck/should_compile/syn-perf.hs

    So now synonyms are held as ordinary TyConApps, and expanded
    only on demand.

    SynNote has disappeared altogether, so the only remaining TyNote
    is a FTVNote.  I'm not sure if it's even useful.

2. Eta-reduce newtypes

    See the Note [Newtype eta] in TyCon.lhs

    If we have
    newtype T a b = MkT (S a b)

    then, in Core land, we would like S = T, even though the application
    of T is then not saturated. This commit eta-reduces T's RHS, and
    keeps that inside the TyCon (in nt_etad_rhs).  Result is that
    coreEqType can be simpler, and has less need of expanding newtypes.
18 files changed:
ghc/compiler/codeGen/ClosureInfo.lhs
ghc/compiler/iface/BuildTyCl.lhs
ghc/compiler/iface/IfaceSyn.lhs
ghc/compiler/iface/IfaceType.lhs
ghc/compiler/iface/TcIface.lhs
ghc/compiler/main/Packages.lhs
ghc/compiler/ndpFlatten/Flattening.hs
ghc/compiler/rename/RnTypes.lhs
ghc/compiler/typecheck/TcMType.lhs
ghc/compiler/typecheck/TcSimplify.lhs
ghc/compiler/typecheck/TcTyDecls.lhs
ghc/compiler/typecheck/TcType.lhs
ghc/compiler/typecheck/TcUnify.lhs
ghc/compiler/types/TyCon.lhs
ghc/compiler/types/Type.lhs
ghc/compiler/types/TypeRep.lhs
ghc/compiler/types/Unify.lhs
ghc/compiler/utils/Util.lhs