Skip to content
  • Ryan Scott's avatar
    Don't reify redundant class method tyvars/contexts · 6e765aeb
    Ryan Scott authored and Krzysztof Gogolewski's avatar Krzysztof Gogolewski committed
    Summary:
    Currently, reifying classes produces class methods with
    redundant tyvars and class contexts in their type signatures, such
    as in the following:
    
    ```lang=haskell
    class C a where
      method :: forall a. C a => a
    ```
    
    Fixing this is very straightforward: just apply `tcSplitMethodTy` to
    the type of each class method to lop off the redundant parts.
    
    It's possible that this could break some TH code in the wild that
    assumes the existence of these tyvars and class contexts, so I'll
    advertise this change in the release notes just to be safe.
    
    Test Plan: make test TEST="TH_reifyDecl1 T9064 T10891 T14888"
    
    Reviewers: goldfire, bgamari, simonpj
    
    Reviewed By: simonpj
    
    Subscribers: simonpj, rwbarton, carter
    
    GHC Trac Issues: #15551
    
    Differential Revision: https://phabricator.haskell.org/D5088
    6e765aeb