Skip to content
This repository was archived by the owner on Aug 3, 2024. It is now read-only.

Commit 8f29edb

Browse files
committed
Add debug code to inspect bug on Windows
1 parent 9e4edc8 commit 8f29edb

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

haddock-api/src/Haddock/Interface.hs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ import qualified Data.Set as Set
4848
import Distribution.Verbosity
4949
import System.Directory
5050
import System.FilePath
51+
import System.IO
5152
import Text.Printf
5253

5354
import Digraph
@@ -57,6 +58,8 @@ import GHC hiding (verbosity)
5758
import HscTypes
5859
import FastString (unpackFS)
5960

61+
import MonadUtils (liftIO)
62+
6063
-- | Create 'Interface's and a link environment by typechecking the list of
6164
-- modules using the GHC API and processing the resulting syntax trees.
6265
processModules
@@ -162,10 +165,19 @@ createIfaces verbosity flags instIfaceMap mods = do
162165
Nothing -> (ifaces, ifaceMap) -- Boot modules don't generate ifaces.
163166

164167

168+
inspect s a = do
169+
r <- a
170+
liftIO $ putStrLn s
171+
return r
172+
173+
165174
processModule :: Verbosity -> ModSummary -> [Flag] -> IfaceMap -> InstIfaceMap -> Ghc (Maybe Interface)
166175
processModule verbosity modsum flags modMap instIfaceMap = do
167176
out verbosity verbose $ "Checking module " ++ moduleString (ms_mod modsum) ++ "..."
168-
tm <- loadModule =<< typecheckModule =<< parseModule modsum
177+
liftIO $ putStrLn "Before parseModule"
178+
liftIO $ print =<< hGetEncoding stderr
179+
tm <- inspect "loadModule" $ loadModule =<< (inspect "typecheckModule" $ typecheckModule =<< inspect "parseModule" (parseModule modsum))
180+
liftIO $ putStrLn "After loadModule"
169181
if not $ isBootSummary modsum then do
170182
out verbosity verbose "Creating interface..."
171183
(interface, msg) <- runWriterGhc $ createInterface tm flags modMap instIfaceMap

0 commit comments

Comments
 (0)