• Simon Peyton Jones's avatar
    Implement 'left' and 'right' coercions · af7cc995
    Simon Peyton Jones authored
    This patch finally adds 'left' and 'right' coercions back into
    GHC.  Trac #7205 gives the details.
    
    The main change is to add a new constructor to Coercion:
    
      data Coercion
        = ...
        | NthCo  Int         Coercion     -- OLD, still there
        | LRCo   LeftOrRight Coercion     -- NEW
    
      data LeftOrRight = CLeft | CRight
    
    Plus:
      * Similar change to TcCoercion
      * Use LRCo when decomposing AppTys
      * Coercion optimisation needs to handle left/right
    
    The rest is just knock-on effects.
    af7cc995
Coercion.lhs 42.7 KB