aboutsummaryrefslogtreecommitdiff
path: root/src/Main.hs
diff options
context:
space:
mode:
authorDavid Waern <david.waern@gmail.com>2008-10-10 20:33:38 +0000
committerDavid Waern <david.waern@gmail.com>2008-10-10 20:33:38 +0000
commitff03f4f8b4ac1b9ccd9ef93c294ac835871c349f (patch)
tree3cee68382d8029088b54154188c7396cf563731d /src/Main.hs
parent8a57f3d9eb971ab4957f2780ed7a0b5be0b3b6e3 (diff)
Make Haddock build with GHC 6.8.2
Diffstat (limited to 'src/Main.hs')
-rw-r--r--src/Main.hs19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/Main.hs b/src/Main.hs
index dce204d1..d2b99f11 100644
--- a/src/Main.hs
+++ b/src/Main.hs
@@ -161,6 +161,7 @@ main = handleTopExceptions $ do
return libdir -- from GHC.Paths
#endif
+#if __GLASGOW_HASKELL__ >= 609
-- initialize GHC
startGhc libDir (ghcFlags flags) $ \dynflags -> do
@@ -179,7 +180,25 @@ main = handleTopExceptions $ do
-- last but not least, dump the interface file
dumpInterfaceFile (map toInstalledIface interfaces) homeLinks flags
+#else
+ -- initialize GHC
+ (session, dynflags) <- startGhc libDir (ghcFlags flags)
+
+ -- get packages supplied with --read-interface
+ packages <- readInterfaceFiles (nameCacheFromGhc session) (ifacePairs flags)
+ -- combine the link envs of the external packages into one
+ let extLinks = Map.unions (map (ifLinkEnv . fst) packages)
+
+ -- create the interfaces -- this is the core part of Haddock
+ (interfaces, homeLinks) <- createInterfaces session fileArgs extLinks flags
+
+ -- render the interfaces
+ renderStep packages interfaces
+
+ -- last but not least, dump the interface file
+ dumpInterfaceFile (map toInstalledIface interfaces) homeLinks flags
+#endif
else do
-- get packages supplied with --read-interface
packages <- readInterfaceFiles freshNameCache (ifacePairs flags)