summaryrefslogtreecommitdiff
path: root/ghc
diff options
context:
space:
mode:
authorRyan Scott <ryan.gl.scott@gmail.com>2017-06-02 11:49:47 -0400
committerBen Gamari <ben@smart-cactus.org>2017-06-02 12:27:45 -0400
commit2abe54e16cbd14cab27abdc7967e907753354d54 (patch)
treefec7e858402af6cd681cfb787182fbd65ca301f1 /ghc
parentbf775e9d6895c07f629409ee18503f40730cb5a0 (diff)
downloadhaskell-2abe54e16cbd14cab27abdc7967e907753354d54.tar.gz
Make GHCi work when RebindableSyntax is enabled
Previously, we were running some blocks of code at the start of every GHCi sessions which use do-notation, something which doesn't work well if you start GHCi with the `-XRebindableSyntax` flag on. This tweaks the code to avoid the use of do-notation so that `-XRebindableSyntax` won't reject it. Test Plan: make test TEST=T13385 Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: rwbarton, thomie GHC Trac Issues: #13385 Differential Revision: https://phabricator.haskell.org/D3621
Diffstat (limited to 'ghc')
-rw-r--r--ghc/GHCi/UI/Monad.hs12
1 files changed, 7 insertions, 5 deletions
diff --git a/ghc/GHCi/UI/Monad.hs b/ghc/GHCi/UI/Monad.hs
index 244595b8b0..b57a5a0a64 100644
--- a/ghc/GHCi/UI/Monad.hs
+++ b/ghc/GHCi/UI/Monad.hs
@@ -420,13 +420,15 @@ foreign import ccall "revertCAFs" rts_revertCAFs :: IO ()
-- | Compile "hFlush stdout; hFlush stderr" once, so we can use it repeatedly
initInterpBuffering :: Ghc (ForeignHValue, ForeignHValue)
initInterpBuffering = do
+ -- We take great care not to use do-notation in the expressions below, as
+ -- they are fragile in the presence of RebindableSyntax (Trac #13385).
nobuf <- GHC.compileExprRemote $
- "do { System.IO.hSetBuffering System.IO.stdin System.IO.NoBuffering; " ++
- " System.IO.hSetBuffering System.IO.stdout System.IO.NoBuffering; " ++
- " System.IO.hSetBuffering System.IO.stderr System.IO.NoBuffering }"
+ " System.IO.hSetBuffering System.IO.stdin System.IO.NoBuffering" ++
+ "`GHC.Base.thenIO` System.IO.hSetBuffering System.IO.stdout System.IO.NoBuffering" ++
+ "`GHC.Base.thenIO` System.IO.hSetBuffering System.IO.stderr System.IO.NoBuffering"
flush <- GHC.compileExprRemote $
- "do { System.IO.hFlush System.IO.stdout; " ++
- " System.IO.hFlush System.IO.stderr }"
+ " System.IO.hFlush System.IO.stdout" ++
+ "`GHC.Base.thenIO` System.IO.hFlush System.IO.stderr"
return (nobuf, flush)
-- | Invoke "hFlush stdout; hFlush stderr" in the interpreter