Skip to content
  • Ömer Sinan Ağacan's avatar
    reify associated types when reifying typeclasses · 5c115236
    Ömer Sinan Ağacan authored
    As reported in Trac #10891, Template Haskell's `reify` was not generating Decls
    for associated types. This patch fixes that.
    
    Note that even though `reifyTyCon` function used in this patch returns some
    type instances, I'm ignoring that.
    
    Here's an example of how associated types are encoded with this patch:
    
    (Simplified representation)
    
        class C a where
          type F a :: *
    
        -->
    
        OpenTypeFamilyD "F" ["a"]
    
    With default type instances:
    
        class C a where
          type F a :: *
          type F a = a
    
        -->
    
        OpenTypeFamilyD "F" ["a"]
        TySynInstD "F" (TySynEqn [VarT "a"] "a")
    
    Reviewed By: goldfire
    
    Differential Revision: https://phabricator.haskell.org/D1254
    
    GHC Trac Issues: #10891
    5c115236