[Haskell-cafe] Re: process

Albert Y. C. Lai trebla at vex.net
Fri Feb 23 13:07:23 EST 2007


h. wrote:
> module Main where
> main :: IO ()
> main = f
>   where
>   f = do
>     a <- getLine
>     if a == "quit" then return () else putStrLn a >> f

This one also needs to switch to line buffering. Add/Change:

import System.IO(stdout, hSetBuffering, BufferMode(LineBuffering))
main = hSetBuffering stdout LineBuffering >> f




More information about the Haskell-Cafe mailing list