From 90b15b0ecc6fc153120e0d01288697dfe10e28f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20Smr=C5=BE?= Date: Mon, 26 Sep 2022 22:17:52 +0200 Subject: Process lifetime determined by scope --- src/Output.hs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'src/Output.hs') diff --git a/src/Output.hs b/src/Output.hs index 0bf757a..ca7f862 100644 --- a/src/Output.hs +++ b/src/Output.hs @@ -18,8 +18,6 @@ import Data.Text.Lazy.IO qualified as TL import System.IO -import Test - data Output = Output { outState :: MVar OutputState , outConfig :: OutputConfig @@ -91,14 +89,14 @@ showPrompt _ = return () ioWithOutput :: MonadOutput m => (Output -> IO a) -> m a ioWithOutput act = liftIO . act =<< getOutput -outLine :: MonadOutput m => OutputType -> Maybe ProcName -> Text -> m () -outLine otype mbproc line = ioWithOutput $ \out -> +outLine :: MonadOutput m => OutputType -> Text -> Text -> m () +outLine otype prompt line = ioWithOutput $ \out -> when (outVerbose (outConfig out) || printWhenQuiet otype) $ do withMVar (outState out) $ \st -> do clearPrompt st TL.putStrLn $ TL.fromChunks [ T.pack "\ESC[", outColor otype, T.pack "m" - , maybe T.empty textProcName mbproc + , prompt , outSign otype , T.pack "> " , line -- cgit v1.2.3