From 6a8d312cdba65a07b923a30cec0de2cc6a3d2da8 Mon Sep 17 00:00:00 2001 From: David Waern Date: Sun, 10 Aug 2008 22:42:05 +0000 Subject: Make H.GHC.Utils build with GHC HEAD --- haddock.cabal | 4 ++++ src/Haddock/GHC/Utils.hs | 11 ++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) 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 -- cgit v1.2.3