• Ryan Scott's avatar
    Fix #14167 by using isGadtSyntaxTyCon in more places · 8e4229ab
    Ryan Scott authored
    Summary:
    Two places in GHC effectively attempt to //guess// whether a data type
    was declared using GADT syntax:
    
    1. When reifying a data type in Template Haskell
    2. When pretty-printing a data type (e.g., via `:info` in GHCi)
    
    But there's no need for heuristics here, since we have a 100% accurate way to
    determine whether a data type was declared using GADT syntax: the
    `isGadtSyntaxTyCon` function! By simply using that as the metric, we obtain
    far more accurate TH reification and pretty-printing results.
    
    This is technically a breaking change, since Template Haskell reification will
    now reify some data type constructors as `(Rec)GadtC` that it didn't before,
    and some data type constructors that were previously reified as `(Rec)GadtC`
    will no longer be reified as such. But it's a very understandable breaking
    change, since the previous behavior was simply incorrect.
    
    Test Plan: ./validate
    
    Reviewers: simonpj, goldfire, austin, bgamari
    
    Reviewed By: simonpj
    
    Subscribers: rwbarton, thomie
    
    GHC Trac Issues: #14167
    
    Differential Revision: https://phabricator.haskell.org/D3901
    8e4229ab
IfaceType.hs 52.1 KB