aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Waern <david.waern@gmail.com>2008-08-10 22:42:05 +0000
committerDavid Waern <david.waern@gmail.com>2008-08-10 22:42:05 +0000
commit6a8d312cdba65a07b923a30cec0de2cc6a3d2da8 (patch)
tree1e46ecadca219b05c8b5aa56da0bcad6d8c74dcd
parentaa3e4fda3d50d16ff1c16ce819d2f264db6211e3 (diff)
Make H.GHC.Utils build with GHC HEAD
-rw-r--r--haddock.cabal4
-rw-r--r--src/Haddock/GHC/Utils.hs11
2 files changed, 14 insertions, 1 deletions
diff --git a/haddock.cabal b/haddock.cabal
index e25bc178..ea63079e 100644
--- a/haddock.cabal
+++ b/haddock.cabal
@@ -70,6 +70,10 @@ executable haddock
pretty,
containers,
array
+
+ if impl(ghc >= 6.9)
+ build-depends: Cabal >= 1.5
+
main-is: Main.hs
hs-source-dirs: src
extensions: CPP, PatternGuards, DeriveDataTypeable,
diff --git a/src/Haddock/GHC/Utils.hs b/src/Haddock/GHC/Utils.hs
index 6de56f88..f0423303 100644
--- a/src/Haddock/GHC/Utils.hs
+++ b/src/Haddock/GHC/Utils.hs
@@ -12,6 +12,10 @@
module Haddock.GHC.Utils where
+#if __GLASGOW_HASKELL__ >= 609
+import Distribution.Text
+#endif
+
import Data.Char
import Data.Version
import qualified Data.Map as Map
@@ -22,6 +26,7 @@ import SrcLoc
import Outputable
import Name
import Packages
+import Module
unL :: Located a -> a
@@ -43,8 +48,12 @@ modulePackageString = packageIdString . modulePackageId
-- return the (name,version) of the package
modulePackageInfo mod = case unpackPackageId pkg of
Nothing -> (packageIdString pkg, "")
+#if __GLASGOW_HASKELL__ >= 609
+ Just x -> (display $ pkgName x, showVersion (pkgVersion x))
+#else
Just x -> (pkgName x, showVersion (pkgVersion x))
- where pkg = modulePackageId mod
+#endif
+ where pkg = modulePackageId mod
mkModuleNoPackage :: String -> Module