aboutsummaryrefslogtreecommitdiff
path: root/haddock-api/src
diff options
context:
space:
mode:
authorŁukasz Hanuszczak <lukasz.hanuszczak@gmail.com>2015-07-06 17:26:49 +0200
committerŁukasz Hanuszczak <lukasz.hanuszczak@gmail.com>2015-07-06 17:26:49 +0200
commitb6e9968643bc0ab6c61289ecee7205e4d7bc421a (patch)
tree34b3843a745846f4c159d38bcce3cdbedd8af040 /haddock-api/src
parentbbd036ad309c95ce70affa5aa0a77a61aa5569c8 (diff)
Add short documentation for hyperlinker source map type.
Diffstat (limited to 'haddock-api/src')
-rw-r--r--haddock-api/src/Haddock/Backends/Hyperlinker/Types.hs9
1 files changed, 9 insertions, 0 deletions
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