[commit: haddock] master: Add support for hyperlinking field names in record patterns. (a1d3cb1)
git at git.haskell.org
git at git.haskell.org
Wed Jul 8 08:41:17 UTC 2015
Repository : ssh://git@git.haskell.org/haddock
On branch : master
Link : http://git.haskell.org/haddock.git/commitdiff/a1d3cb1d86340cd670e50f88e1cb8bf4a4e64f7b
>---------------------------------------------------------------
commit a1d3cb1d86340cd670e50f88e1cb8bf4a4e64f7b
Author: Łukasz Hanuszczak <lukasz.hanuszczak at gmail.com>
Date: Mon Jun 29 23:15:26 2015 +0200
Add support for hyperlinking field names in record patterns.
>---------------------------------------------------------------
a1d3cb1d86340cd670e50f88e1cb8bf4a4e64f7b
haddock-api/src/Haddock/Backends/Hyperlinker/Ast.hs | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/haddock-api/src/Haddock/Backends/Hyperlinker/Ast.hs b/haddock-api/src/Haddock/Backends/Hyperlinker/Ast.hs
index fd3f2f1..3b0e0f4 100644
--- a/haddock-api/src/Haddock/Backends/Hyperlinker/Ast.hs
+++ b/haddock-api/src/Haddock/Backends/Hyperlinker/Ast.hs
@@ -102,7 +102,11 @@ binds =
pat term = case cast term of
(Just (GHC.L sspan (GHC.VarPat name))) ->
pure (sspan, RtkBind name)
- (Just (GHC.L _ (GHC.ConPatIn (GHC.L sspan name) _))) ->
+ (Just (GHC.L _ (GHC.ConPatIn (GHC.L sspan name) recs))) ->
+ [(sspan, RtkVar name)] ++ everything (<|>) rec recs
+ _ -> empty
+ rec term = case cast term of
+ (Just (GHC.HsRecField (GHC.L sspan name) (_ :: GHC.LPat GHC.Name) _)) ->
pure (sspan, RtkVar name)
_ -> empty
More information about the ghc-commits
mailing list