Skip to content

Instantly share code, notes, and snippets.

@mwotton
Created April 27, 2014 03:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mwotton/11336830 to your computer and use it in GitHub Desktop.
Save mwotton/11336830 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