Haskell:IO
lastmod 2026-11-10created 2020-09-272 edits
Input and output in Haskell are expressed with the IO monad type, which keeps side effects separate from pure functions. An IO a value is a description of an action that produces effects when executed and returns an a; actions are chained in order with do notation and the bind operator, and the program starts at main :: IO (). putStrLn, getLine, file reading and writing, random numbers, and so on are provided through IO.