aboutsummaryrefslogtreecommitdiff
path: root/haddock-api/src/Haddock/Backends/Hyperlinker/Ast.hs
diff options
context:
space:
mode:
authorŁukasz Hanuszczak <lukasz.hanuszczak@gmail.com>2015-07-02 13:31:05 +0200
committerŁukasz Hanuszczak <lukasz.hanuszczak@gmail.com>2015-07-02 13:31:05 +0200
commit28e93ceec440d0d1ed053bbf3c20e4bdcd6d5f4e (patch)
tree2490debca28600f3eb51f14b7ecead0862fcdd87 /haddock-api/src/Haddock/Backends/Hyperlinker/Ast.hs
parent5c01af0e605c2bd16382cbd0de7102f1fbc2f361 (diff)
Improve support for hyperlinking type families.
Diffstat (limited to 'haddock-api/src/Haddock/Backends/Hyperlinker/Ast.hs')
-rw-r--r--haddock-api/src/Haddock/Backends/Hyperlinker/Ast.hs8
1 files changed, 7 insertions, 1 deletions
diff --git a/haddock-api/src/Haddock/Backends/Hyperlinker/Ast.hs b/haddock-api/src/Haddock/Backends/Hyperlinker/Ast.hs
index b592326d..4b60ca37 100644
--- a/haddock-api/src/Haddock/Backends/Hyperlinker/Ast.hs
+++ b/haddock-api/src/Haddock/Backends/Hyperlinker/Ast.hs
@@ -129,7 +129,7 @@ binds =
decls :: GHC.RenamedSource -> DetailsMap
decls (group, _, _, _) = concatMap ($ group)
[ concat . map typ . concat . map GHC.group_tyclds . GHC.hs_tyclds
- , everything (<|>) (fun `combine` con)
+ , everything (<|>) (fun `combine` con `combine` ins)
]
where
typ (GHC.L _ t) = case t of
@@ -144,10 +144,16 @@ decls (group, _, _, _) = concatMap ($ group)
(Just cdcl) ->
map decl (GHC.con_names cdcl) ++ everything (<|>) fld cdcl
Nothing -> empty
+ ins term = case cast term of
+ (Just (GHC.DataFamInstD inst)) -> pure . tyref $ GHC.dfid_tycon inst
+ (Just (GHC.TyFamInstD (GHC.TyFamInstDecl (GHC.L _ eqn) _))) ->
+ pure . tyref $ GHC.tfe_tycon eqn
+ _ -> empty
fld term = case cast term of
Just field -> map decl $ GHC.cd_fld_names field
Nothing -> empty
decl (GHC.L sspan name) = (sspan, RtkDecl name)
+ tyref (GHC.L sspan name) = (sspan, RtkType name)
-- | Obtain details map for import declarations.
--