• Simon Peyton Jones's avatar
    A nice tidy-up for CvSubst and liftCoSubst · 525aca2c
    Simon Peyton Jones authored
    A "lifting substitition" takes a *type* to a *coercion*, using a
    substitution that takes a *type variable* to a *coercion*.  We were
    using a CvSubst for this purpose, which was an awkward exception: in
    every other use of CvSubst, type variables map only to types.
    
    Turned out that Coercion.liftCoSubst is quite a small function, so I
    rewrote it with a special substitution type Coercion.LiftCoSubst, just
    for that purpose.  In doing so I found that the function itself was
    bizarrely over-complicated ... a direct result of mis-using CvSubst.
    
    So this patch makes it all simpler, faster, and easier to understand.
    No bugs fixed though!
    525aca2c
Coercion.lhs 38.9 KB