[commit: haddock] master: Add support for anchoring data family constructor declarations. (5c01af0)
git at git.haskell.org
git at git.haskell.org
Wed Jul 8 08:42:29 UTC 2015
Repository : ssh://git@git.haskell.org/haddock
On branch : master
Link : http://git.haskell.org/haddock.git/commitdiff/5c01af0e605c2bd16382cbd0de7102f1fbc2f361
>---------------------------------------------------------------
commit 5c01af0e605c2bd16382cbd0de7102f1fbc2f361
Author: Łukasz Hanuszczak <lukasz.hanuszczak at gmail.com>
Date: Thu Jul 2 12:47:03 2015 +0200
Add support for anchoring data family constructor declarations.
>---------------------------------------------------------------
5c01af0e605c2bd16382cbd0de7102f1fbc2f361
haddock-api/src/Haddock/Backends/Hyperlinker/Ast.hs | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/haddock-api/src/Haddock/Backends/Hyperlinker/Ast.hs b/haddock-api/src/Haddock/Backends/Hyperlinker/Ast.hs
index c12ac35..b592326 100644
--- a/haddock-api/src/Haddock/Backends/Hyperlinker/Ast.hs
+++ b/haddock-api/src/Haddock/Backends/Hyperlinker/Ast.hs
@@ -129,20 +129,21 @@ binds =
decls :: GHC.RenamedSource -> DetailsMap
decls (group, _, _, _) = concatMap ($ group)
[ concat . map typ . concat . map GHC.group_tyclds . GHC.hs_tyclds
- , everything (<|>) fun
+ , everything (<|>) (fun `combine` con)
]
where
typ (GHC.L _ t) = case t of
- GHC.DataDecl name _ defn _ ->
- [decl name] ++ concatMap con (GHC.dd_cons defn)
+ GHC.DataDecl name _ _ _ -> pure . decl $ name
GHC.FamDecl fam -> pure . decl $ GHC.fdLName fam
_ -> pure . decl $ GHC.tcdLName t
fun term = case cast term of
(Just (GHC.FunBind (GHC.L sspan name) _ _ _ _ _ :: GHC.HsBind GHC.Name))
| GHC.isExternalName name -> pure (sspan, RtkDecl name)
_ -> empty
- con (GHC.L _ t) =
- map decl (GHC.con_names t) ++ everything (<|>) fld t
+ con term = case cast term of
+ (Just cdcl) ->
+ map decl (GHC.con_names cdcl) ++ everything (<|>) fld cdcl
+ Nothing -> empty
fld term = case cast term of
Just field -> map decl $ GHC.cd_fld_names field
Nothing -> empty
More information about the ghc-commits
mailing list