aboutsummaryrefslogtreecommitdiff
path: root/src/Haddock/Interface.hs
diff options
context:
space:
mode:
authorDavid Waern <david.waern@gmail.com>2010-11-16 00:17:21 +0000
committerDavid Waern <david.waern@gmail.com>2010-11-16 00:17:21 +0000
commite3fc750872a65ba6cc7c859172f433cc31a89dd7 (patch)
tree23bb456384fb8514793c0d324473603c27924b03 /src/Haddock/Interface.hs
parentcaaf70f74df9bfa1b18cc8b5f14f9b2f1fd9e357 (diff)
Make a little more use of DoAndIfThenElse
Diffstat (limited to 'src/Haddock/Interface.hs')
-rw-r--r--src/Haddock/Interface.hs42
1 files changed, 20 insertions, 22 deletions
diff --git a/src/Haddock/Interface.hs b/src/Haddock/Interface.hs
index 865183cd..276621d2 100644
--- a/src/Haddock/Interface.hs
+++ b/src/Haddock/Interface.hs
@@ -102,12 +102,11 @@ createIfaces0 verbosity modules flags instIfaceMap =
-- resulting ModSummaries.
(if useTempDir then withTempOutputDir else id) $ do
modGraph <- depAnalysis
- if needsTemplateHaskell modGraph
- then do
- modGraph' <- enableCompilation modGraph
- createIfaces verbosity flags instIfaceMap modGraph'
- else
- createIfaces verbosity flags instIfaceMap modGraph
+ if needsTemplateHaskell modGraph then do
+ modGraph' <- enableCompilation modGraph
+ createIfaces verbosity flags instIfaceMap modGraph'
+ else
+ createIfaces verbosity flags instIfaceMap modGraph
where
useTempDir :: Bool
@@ -157,22 +156,21 @@ processModule :: Verbosity -> ModSummary -> [Flag] -> IfaceMap -> InstIfaceMap -
processModule verbosity modsum flags modMap instIfaceMap = do
out verbosity verbose $ "Checking module " ++ moduleString (ms_mod modsum) ++ "..."
tm <- loadModule =<< typecheckModule =<< parseModule modsum
- if not $ isBootSummary modsum
- then do
- out verbosity verbose "Creating interface..."
- (interface, msg) <- runWriterGhc $ createInterface tm flags modMap instIfaceMap
- liftIO $ mapM_ putStrLn msg
- let (haddockable, haddocked) = ifaceHaddockCoverage interface
- percentage = round (fromIntegral haddocked * 100 / fromIntegral haddockable :: Double) :: Int
- coveragemsg = printf "haddock coverage for %s: %7s %3d%%"
- (ifaceOrigFilename interface)
- (printf "%d/%d" haddocked haddockable :: String)
- percentage
- out verbosity normal coveragemsg
- interface' <- liftIO $ evaluate interface
- return (Just interface')
- else
- return Nothing
+ if not $ isBootSummary modsum then do
+ out verbosity verbose "Creating interface..."
+ (interface, msg) <- runWriterGhc $ createInterface tm flags modMap instIfaceMap
+ liftIO $ mapM_ putStrLn msg
+ let (haddockable, haddocked) = ifaceHaddockCoverage interface
+ percentage = round (fromIntegral haddocked * 100 / fromIntegral haddockable :: Double) :: Int
+ coveragemsg = printf "haddock coverage for %s: %7s %3d%%"
+ (ifaceOrigFilename interface)
+ (printf "%d/%d" haddocked haddockable :: String)
+ percentage
+ out verbosity normal coveragemsg
+ interface' <- liftIO $ evaluate interface
+ return (Just interface')
+ else
+ return Nothing
--------------------------------------------------------------------------------