diff options
author | Gintautas Miliauskas <gintautas.miliauskas@gmail.com> | 2014-06-08 11:49:29 +0000 |
---|---|---|
committer | Joachim Breitner <mail@joachim-breitner.de> | 2014-07-07 09:21:13 +0200 |
commit | 55e7ab1210975e6276f3cab3ac0e1f35bcd772f0 (patch) | |
tree | e5cf32b00fbb442d711e999359bfa6fda671ec6e /ghc/InteractiveUI.hs | |
parent | fa8553de237a2f91f8551d69ef604c1d8a007b5f (diff) | |
download | haskell-55e7ab1210975e6276f3cab3ac0e1f35bcd772f0.tar.gz |
Do not print the result of 'main' after invoking ':main' (fixes #9086).
Diffstat (limited to 'ghc/InteractiveUI.hs')
-rw-r--r-- | ghc/InteractiveUI.hs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/ghc/InteractiveUI.hs b/ghc/InteractiveUI.hs index 0a56799679..c3d9f25754 100644 --- a/ghc/InteractiveUI.hs +++ b/ghc/InteractiveUI.hs @@ -1141,9 +1141,10 @@ runMain s = case toArgs s of Left err -> liftIO (hPutStrLn stderr err) Right args -> do dflags <- getDynFlags - case mainFunIs dflags of - Nothing -> doWithArgs args "main" - Just f -> doWithArgs args f + let main = fromMaybe "main" (mainFunIs dflags) + -- Wrap the main function in 'void' to discard its value instead + -- of printing it (#9086). See Haskell 2010 report Chapter 5. + doWithArgs args $ "Control.Monad.void (" ++ main ++ ")" ----------------------------------------------------------------------------- -- :run |