Created
July 28, 2010 07:23
-
-
Save m2ym/493681 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Control.Monad | |
import System.IO | |
import System.IO.Unsafe | |
ifte :: Monad m => m Bool -> m a -> m a -> m a | |
ifte c t e = c >>= \b -> if b then t else e | |
getLinesI :: IO [String] | |
getLinesI = unsafeInterleaveIO $ ifte isEOF (return []) (liftM2 (:) getLine getLinesI) | |
main = getLinesI >>= mapM_ putStrLn |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment