I\'m fairly new to Haskell, and I\'d like to keep reading lines from the console until the end of the stream, and outputting everything I get in upper case. So far, I\'ve got
Another option is to use when
whose documentation can be found here:
import System.IO (isEOF)
import Data.Char (toUpper)
import Control.Monad (forever, when)
import System.Exit (exitSuccess)
main = myLoop
myLoop = forever $ do
done <- isEOF
when done $ putStrLn "Bye!" >> exitSuccess
inp <- getLine
putStrLn (map toUpper inp)
myLoop
Otherwise, the answer is identical to the one by @dave4420.