[commit: haddock] master: Add support for hyperlinking field names in record expressions. (7d26944)

git at git.haskell.org git at git.haskell.org
Wed Jul 8 08:41:25 UTC 2015


Repository : ssh://git@git.haskell.org/haddock

On branch  : master
Link       : http://git.haskell.org/haddock.git/commitdiff/7d269444ea9c55a2b364ead45fe06d435fa078b2

>---------------------------------------------------------------

commit 7d269444ea9c55a2b364ead45fe06d435fa078b2
Author: Łukasz Hanuszczak <lukasz.hanuszczak at gmail.com>
Date:   Mon Jun 29 23:41:10 2015 +0200

    Add support for hyperlinking field names in record expressions.


>---------------------------------------------------------------

7d269444ea9c55a2b364ead45fe06d435fa078b2
 haddock-api/src/Haddock/Backends/Hyperlinker/Ast.hs | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/haddock-api/src/Haddock/Backends/Hyperlinker/Ast.hs b/haddock-api/src/Haddock/Backends/Hyperlinker/Ast.hs
index 3b0e0f4..c41b5e5 100644
--- a/haddock-api/src/Haddock/Backends/Hyperlinker/Ast.hs
+++ b/haddock-api/src/Haddock/Backends/Hyperlinker/Ast.hs
@@ -69,11 +69,17 @@ enrichToken _ _ = Nothing
 -- | Obtain details map for variables ("normally" used identifiers).
 variables :: GHC.RenamedSource -> DetailsMap
 variables =
-    everything (<|>) var
+    everything (<|>) (var `combine` rec)
   where
     var term = case cast term of
         (Just (GHC.L sspan (GHC.HsVar name))) ->
             pure (sspan, RtkVar name)
+        (Just (GHC.L _ (GHC.RecordCon (GHC.L sspan name) _ _))) ->
+            pure (sspan, RtkVar name)
+        _ -> empty
+    rec term = case cast term of
+        Just (GHC.HsRecField (GHC.L sspan name) (_ :: GHC.LHsExpr GHC.Name) _) ->
+            pure (sspan, RtkVar name)
         _ -> empty
 
 -- | Obtain details map for types.



More information about the ghc-commits mailing list