Safe HaskellSafe

Eta.Types.IO

Description

A value of type IO a is a computation which, when performed, does some I/O before returning a value of type a.

There is really only one way to "perform" an IO action: bind it to Main.main in your program. When your program is run, the IO will be performed. It isn't possible to perform I/O from an arbitrary function, unless that function is itself in the IO monad and called at some point, directly or indirectly, from Main.main.

IO implements Monad, so IO actions can be combined using either the do-notation or |>> operation from the Monad class.

Synopsis

Documentation

data IO a :: * -> * #

Instances

Monad IO 

Methods

(>>=) :: IO a -> (a -> IO b) -> IO b #

(>>) :: IO a -> IO b -> IO b

return :: a -> IO a

fail :: String -> IO a

Functor IO 

Methods

fmap :: (a -> b) -> IO a -> IO b #

(<$) :: a -> IO b -> IO a

Applicative IO 

Methods

pure :: a -> IO a #

(<*>) :: IO (a -> b) -> IO a -> IO b #

(*>) :: IO a -> IO b -> IO b

(<*) :: IO a -> IO b -> IO a

MonadPlus IO 

Methods

mzero :: IO a

mplus :: IO a -> IO a -> IO a

Alternative IO 

Methods

empty :: IO a #

(<|>) :: IO a -> IO a -> IO a #

some :: IO a -> IO [a] #

many :: IO a -> IO [a] #

Monoid a => Monoid (IO a) 

Methods

mempty :: IO a #

mappend :: IO a -> IO a -> IO a #

mconcat :: [IO a] -> IO a #

print :: String -> IO () #

Print a String on screen

printLine :: String -> IO () #

Print a String on screen, followed by a newline.

printShow :: Show a => a -> IO () #

Converts the value to a String using show and then printLines it.

getArgs :: IO [String] #

Returns the arguments of the program