blob: f5ca66682800852ce83c042bd59a285db4273a89 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
import System.IO
main = do
hSetBuffering stdout NoBuffering
putStr "Enter an integer: "
x1 <- readLine
putStr "Enter another integer: "
x2 <- readLine
putStr ("Their sum is " ++ show (read x1 + read x2 :: Int) ++ "\n")
where readLine = do
eof <- isEOF
if eof then return [] else do
c <- getChar
if c `elem` ['\n','\r']
then return []
else do cs <- readLine
return (c:cs)
|