Skip to content
  • Ben Gamari's avatar
    Optimise nullary type constructor usage · dad87210
    Ben Gamari authored
    During the compilation of programs GHC very frequently deals with
    the `Type` type, which is a synonym of `TYPE 'LiftedRep`. This patch
    teaches GHC to avoid expanding the `Type` synonym (and other nullary
    type synonyms) during type comparisons, saving a good amount of work.
    This optimisation is described in `Note [Comparing nullary type
    synonyms]`.
    
    To maximize the impact of this optimisation, we introduce a few
    special-cases to reduce `TYPE 'LiftedRep` to `Type`. See
    `Note [Prefer Type over TYPE 'LiftedPtrRep]`.
    
    Closes #17958.
    
    Metric Decrease:
       T18698b
       T1969
       T12227
       T12545
       T12707
       T14683
       T3064
       T5631
       T5642
       T9020
       T9630
       T9872a
       T13035
       haddock.Cabal
       haddock.base
    dad87210