From b6e9968643bc0ab6c61289ecee7205e4d7bc421a Mon Sep 17 00:00:00 2001 From: Ɓukasz Hanuszczak Date: Mon, 6 Jul 2015 17:26:49 +0200 Subject: Add short documentation for hyperlinker source map type. --- haddock-api/src/Haddock/Backends/Hyperlinker/Types.hs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/haddock-api/src/Haddock/Backends/Hyperlinker/Types.hs b/haddock-api/src/Haddock/Backends/Hyperlinker/Types.hs index c3954dc9..5f4dbc8c 100644 --- a/haddock-api/src/Haddock/Backends/Hyperlinker/Types.hs +++ b/haddock-api/src/Haddock/Backends/Hyperlinker/Types.hs @@ -70,6 +70,15 @@ data SrcPath = SrcExternal FilePath | SrcLocal +-- | Mapping from modules to cross-package source paths. +-- +-- This mapping is actually a pair of maps instead of just one map. The reason +-- for this is because when hyperlinking modules in import lists we have no +-- 'GHC.Module' available. On the other hand, we can't just use map with +-- 'GHC.ModuleName' as indices because certain modules may have common name +-- but originate in different packages. Hence, we use both /rich/ and /poor/ +-- versions, where the /poor/ is just projection of /rich/ one cached in pair +-- for better performance. type SrcMap = (Map GHC.Module SrcPath, Map GHC.ModuleName SrcPath) mkSrcMap :: Map GHC.Module SrcPath -> SrcMap -- cgit v1.2.3