Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- getInt function
- -- Reads a line from standard in and transforms it to integer.
- getInt :: IO Int
- getInt = do
- line <- getLine
- return (read line :: Int)
- -- sI function
- -- Takes an integer as parameter, reads another integer, and sums the two.
- -- Continues until 0 is input.
- sI:: Int -> IO Int
- sI s = do
- n<-getInt
- if n==0
- then return s
- else sI (s+n)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement