summaryrefslogtreecommitdiff
path: root/compiler/ghci
diff options
context:
space:
mode:
authorIan Lynagh <ian@well-typed.com>2013-06-23 12:49:42 +0100
committerIan Lynagh <ian@well-typed.com>2013-06-23 12:49:42 +0100
commitf81e14bb14e459cdd59ea232f7c711827be85dd6 (patch)
tree8d6f780898d16ebecf8703d4a87ec0faa7e59cf2 /compiler/ghci
parent03fbf8ac9e76ac6d7bff20f56e4ba4bee786c96c (diff)
downloadhaskell-f81e14bb14e459cdd59ea232f7c711827be85dd6.tar.gz
Allow the GHCi messages to be overridden via the GHC API; fixes #7456
They now go through log_action. The existing severities all used printDoc, which always adds a trailing newline, which we don't want for the GHCi messages. I therefore added a new severity SevInteractive, which doesn't add a newline.
Diffstat (limited to 'compiler/ghci')
-rw-r--r--compiler/ghci/Linker.lhs9
1 files changed, 5 insertions, 4 deletions
diff --git a/compiler/ghci/Linker.lhs b/compiler/ghci/Linker.lhs
index df82510b62..a409e7f628 100644
--- a/compiler/ghci/Linker.lhs
+++ b/compiler/ghci/Linker.lhs
@@ -1271,12 +1271,13 @@ findFile mk_file_path (dir : dirs)
\begin{code}
maybePutStr :: DynFlags -> String -> IO ()
-maybePutStr dflags s | verbosity dflags > 0 = putStr s
- | otherwise = return ()
+maybePutStr dflags s
+ = when (verbosity dflags > 0) $
+ do let act = log_action dflags
+ act dflags SevInteractive noSrcSpan defaultUserStyle (text s)
maybePutStrLn :: DynFlags -> String -> IO ()
-maybePutStrLn dflags s | verbosity dflags > 0 = putStrLn s
- | otherwise = return ()
+maybePutStrLn dflags s = maybePutStr dflags (s ++ "\n")
\end{code}
%************************************************************************