Commit 1036d45f authored by Simon Marlow's avatar Simon Marlow

fix apirecomp001 following GHC API changes

parent c5067299
B.hs:4:1:
Warning: Top-level binding with no type signature:
answer_to_live_the_universe_and_everything :: Int
B.hs:5:12:
Warning: Defaulting the following constraint(s) to type `Integer'
(Enum a) arising from the arithmetic sequence `1 .. 23 * 2'
at B.hs:5:12-20
(Num a) arising from the literal `1' at B.hs:5:13
In the first argument of `length', namely `[1 .. 23 * 2]'
In the first argument of `(-)', namely `length [1 .. 23 * 2]'
In the expression: length [1 .. 23 * 2] - 4
A.hs:7:1:
Warning: Top-level binding with no type signature: main :: IO ()
B.hs:4:1:
Warning: Top-level binding with no type signature:
answer_to_live_the_universe_and_everything :: Int
B.hs:5:12:
Warning: Defaulting the following constraint(s) to type `Integer'
(Enum a) arising from the arithmetic sequence `1 .. 23 * 2'
at B.hs:5:12-20
(Num a) arising from the literal `1' at B.hs:5:13
In the first argument of `length', namely `[1 .. 23 * 2]'
In the first argument of `(-)', namely `length [1 .. 23 * 2]'
In the expression: length [1 .. 23 * 2] - 4
A.hs:7:1:
Warning: Top-level binding with no type signature: main :: IO ()
True
True
target nothing: ok
True
True
target interpreted: ok
42
ok
......@@ -28,13 +28,13 @@ main = do
}
root_mod <- guessTarget "A.hs" Nothing
setTargets [root_mod]
ok <- loadWithLogger myLogger LoadAllTargets
ok <- load LoadAllTargets
when (failed ok) $ error "Couldn't load A.hs in nothing mode"
prn "target nothing: ok"
dflags <- getSessionDynFlags
setSessionDynFlags $ dflags { hscTarget = HscInterpreted }
ok <- loadWithLogger myLogger LoadAllTargets
ok <- load LoadAllTargets
when (failed ok) $ error "Couldn't load A.hs in interpreted mode"
prn "target interpreted: ok"
......@@ -44,8 +44,6 @@ main = do
setContext [mod] []
liftIO $ hFlush stdout -- make sure things above are printed before
-- interactive output
dflags <- getSessionDynFlags
setSessionDynFlags $ flattenExtensionFlags dflags
r <- runStmt "main" RunToCompletion
case r of
RunOk _ -> prn "ok"
......@@ -55,13 +53,5 @@ main = do
liftIO $ hFlush stdout
return ()
-- prints number of warnings; this is our indicator for recompilation. We ignore
-- the number of warnings since this might change, however, there should always
-- be at least one.
myLogger _ = do
ws <- getWarnings
clearWarnings
liftIO $ print (length (bagToList ws) > 0)
prn :: MonadIO m => String -> m ()
prn = liftIO . putStrLn
\ No newline at end of file
prn = liftIO . putStrLn
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment