• simonpj's avatar
    [project @ 2005-11-16 12:55:58 by simonpj] · cdea9949
    simonpj authored
    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.
    cdea9949