Skip to content

Instantly share code, notes, and snippets.

@mwotton
Created November 19, 2014 07:19
Show Gist options
  • Save mwotton/988b83339a3f2c4ab481 to your computer and use it in GitHub Desktop.
Save mwotton/988b83339a3f2c4ab481 to your computer and use it in GitHub Desktop.
import Control.Monad
import System.IO
main :: IO ()
main = do
hSetBuffering stdout LineBuffering
forever $ do
getLine >> emptyStdin
putStrLn "x"
emptyStdin :: IO ()
emptyStdin = do
res <- hReady stdin
when res $ getLine >> void emptyStdin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment