• Ryan Scott's avatar
    Fix #15012 with a well-placed use of Any · b08a6d75
    Ryan Scott authored
    Previously, derived `Generic1` instances could have associated `Rep1`
    type family instances with unbound variables, such as in the following
    example:
    
    ```lang=haskell
    data T a = MkT (FakeOut a) deriving Generic1
    type FakeOut a = Int
    
    ==>
    
    instance Generic1 T where
      type Rep1 T = ... (Rec0 (FakeOut a))
    ```
    
    Yikes! To avoid this, we simply map the last type variable in a
    derived `Generic1` instance to `Any`.
    
    Test Plan: make test TEST=T15012
    
    Reviewers: bgamari
    
    Reviewed By: bgamari
    
    Subscribers: simonpj, thomie, carter
    
    GHC Trac Issues: #15012
    
    Differential Revision: https://phabricator.haskell.org/D4602
    b08a6d75
T15012a.hs 227 Bytes