From a4636014ab24c810e491a5267042fd70e067c2c3 Mon Sep 17 00:00:00 2001 From: Tom Smeding Date: Fri, 14 Oct 2022 09:52:06 +0200 Subject: Flush stdout --- src/IRC.hs | 6 ++++-- src/Main.hs | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/IRC.hs b/src/IRC.hs index 7e78c50..5a24909 100644 --- a/src/IRC.hs +++ b/src/IRC.hs @@ -4,11 +4,12 @@ import Control.Monad (forM_) import Control.Monad.IO.Class (liftIO) import qualified Data.ByteString.Char8 as Char8 import Data.Char +import Data.Text (Text) +import qualified Data.Text as T import Network.IRC.Client -- import Network.IRC.Client.Events import Lens.Micro -import Data.Text (Text) -import qualified Data.Text as T +import System.IO (hFlush, stdout) connectIRC :: (Text -> Bool) -> (Text -> IO [Text]) -> IO () @@ -49,6 +50,7 @@ noticeHandler = EventHandler _ -> Nothing) (\_ () -> do liftIO $ putStrLn "Identification confirmation received, joining channel" + liftIO $ hFlush stdout send $ Join (T.pack "#haskell")) privmsgHandler :: (Text -> Bool) -> (Text -> IO [Text]) -> EventHandler s diff --git a/src/Main.hs b/src/Main.hs index 88a7259..9987b29 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -6,6 +6,7 @@ import Data.Text (Text) import qualified Data.Text as T import System.Environment (getArgs) import System.Exit (die) +import System.IO (hFlush, stdout) import Ghci import IRC @@ -29,6 +30,7 @@ mainIRC = do (\t -> T.take 2 t == T.pack "% ") (\recvmsg -> do putStrLn $ "Responding to " ++ T.unpack recvmsg + hFlush stdout ghci <- takeMVar ghcivar (ghci', msgs) <- runInGhci ghci (T.drop 2 recvmsg) putMVar ghcivar ghci' -- cgit v1.2.3-70-g09d2