Skip to content
  • Ryan Scott's avatar
    Fix #14060 by more conservatively annotating TH-reified types · ad7b9452
    Ryan Scott authored
    Before, TH was quite generous in applying kind annotations to reified
    type constructors whose result kind happened to mention type variables.
    This could result in agonizingly large reified types, so this patch aims
    to quell this a bit by adopting a more nuanced algorithm for determining
    when a tycon application deserves a kind annotation.
    
    This implements the algorithm laid out in
    https://ghc.haskell.org/trac/ghc/ticket/14060#comment:1. I've updated
    `Note [Kind annotations on TyConApps]` to reflect the new wisdom.
    Essentially, instead of only checking if the result kind contains free
    variables, we also check if any of those variables do not appear free in
    injective positions in the argument kinds—only then do we put on a kind
    annotation.
    
    Bumps `haddock` submodule.
    
    Test Plan: make test TEST=T14060
    
    Reviewers: goldfire, austin, bgamari
    
    Reviewed By: goldfire
    
    Subscribers: rwbarton, thomie
    
    GHC Trac Issues: #14060
    
    Differential Revision: https://phabricator.haskell.org/D3807
    ad7b9452