aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--haddock-api/haddock-api.cabal1
-rw-r--r--haddock-api/src/Haddock/Backends/Hyperlinker/Utils.hs18
2 files changed, 19 insertions, 0 deletions
diff --git a/haddock-api/haddock-api.cabal b/haddock-api/haddock-api.cabal
index 216627cc..7670f888 100644
--- a/haddock-api/haddock-api.cabal
+++ b/haddock-api/haddock-api.cabal
@@ -85,6 +85,7 @@ library
Haddock.Backends.HaddockDB
Haddock.Backends.Hoogle
Haddock.Backends.Hyperlinker
+ Haddock.Backends.Hyperlinker.Utils
Haddock.ModuleTree
Haddock.Types
Haddock.Doc
diff --git a/haddock-api/src/Haddock/Backends/Hyperlinker/Utils.hs b/haddock-api/src/Haddock/Backends/Hyperlinker/Utils.hs
new file mode 100644
index 00000000..25ed942b
--- /dev/null
+++ b/haddock-api/src/Haddock/Backends/Hyperlinker/Utils.hs
@@ -0,0 +1,18 @@
+module Haddock.Backends.Hyperlinker.Utils
+ ( srcModUrl
+ , srcNameUrlMap
+ ) where
+
+import Haddock.Utils
+import Haddock.Backends.Xhtml.Types
+
+import GHC
+
+import Data.Maybe
+import Data.Map (Map)
+
+srcModUrl :: SourceURLs -> String
+srcModUrl (_, mModUrl, _, _) = fromMaybe defaultModuleSourceUrl mModUrl
+
+srcNameUrlMap :: SourceURLs -> Map PackageKey FilePath
+srcNameUrlMap (_, _, nameUrlMap, _) = nameUrlMap