[Solved] Integer addition program with haskell [closed]


import Control.Monad (replicateM)

main :: IO ()
main = mapM_ print . map (uncurry (+)) =<< flip replicateM readIntPair =<< readLn

readIntPair :: IO (Integer, Integer)
readIntPair = do
    x <- readLn
    y <- readLn
    return (x, y)

replicateM is from Control.Monad, the other functions are imported automatically from the Prelude.

You will also want to read part of a tutorial that explains do notation: it looks the same as, but is subtly different from, a list of instructions in an imperative language.

3

solved Integer addition program with haskell [closed]