diff options
-rw-r--r-- | haddock.cabal | 4 | ||||
-rw-r--r-- | src/Haddock/GHC/Utils.hs | 11 |
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 |