aboutsummaryrefslogtreecommitdiff
path: root/haddock-api/src
diff options
context:
space:
mode:
authorŁukasz Hanuszczak <lukasz.hanuszczak@gmail.com>2015-07-02 18:53:28 +0200
committerŁukasz Hanuszczak <lukasz.hanuszczak@gmail.com>2015-07-02 18:53:28 +0200
commitd761512f239b17f8e9824629595d75aa46e55554 (patch)
tree1acbd8cc3dc678e90f22386b2abffec8abed68b3 /haddock-api/src
parent257e0456854a0835bb9901b6d73c17f6f8d0d841 (diff)
Add support for anchoring signatures in type class declarations.
Diffstat (limited to 'haddock-api/src')
-rw-r--r--haddock-api/src/Haddock/Backends/Hyperlinker/Ast.hs5
1 files changed, 5 insertions, 0 deletions
diff --git a/haddock-api/src/Haddock/Backends/Hyperlinker/Ast.hs b/haddock-api/src/Haddock/Backends/Hyperlinker/Ast.hs
index 4b60ca37..98c9770f 100644
--- a/haddock-api/src/Haddock/Backends/Hyperlinker/Ast.hs
+++ b/haddock-api/src/Haddock/Backends/Hyperlinker/Ast.hs
@@ -1,5 +1,7 @@
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ScopedTypeVariables #-}
+{-# LANGUAGE RecordWildCards #-}
+
module Haddock.Backends.Hyperlinker.Ast
( enrich
@@ -135,6 +137,7 @@ decls (group, _, _, _) = concatMap ($ group)
typ (GHC.L _ t) = case t of
GHC.DataDecl name _ _ _ -> pure . decl $ name
GHC.FamDecl fam -> pure . decl $ GHC.fdLName fam
+ GHC.ClassDecl{..} -> [decl tcdLName] ++ concatMap sig tcdSigs
_ -> pure . decl $ GHC.tcdLName t
fun term = case cast term of
(Just (GHC.FunBind (GHC.L sspan name) _ _ _ _ _ :: GHC.HsBind GHC.Name))
@@ -152,6 +155,8 @@ decls (group, _, _, _) = concatMap ($ group)
fld term = case cast term of
Just field -> map decl $ GHC.cd_fld_names field
Nothing -> empty
+ sig (GHC.L _ (GHC.TypeSig names _ _)) = map decl names
+ sig _ = []
decl (GHC.L sspan name) = (sspan, RtkDecl name)
tyref (GHC.L sspan name) = (sspan, RtkType name)