Monads in Haskell are structures used to supplement pure computations with features like state, common environment or I/O. Even though Haskell is a purely-functional language, side effects can be conveniently simulated using monads.

Because they are very useful in practice but rather mind-twisting for the beginners, numerous tutorials that deal exclusively with monads were created (see monad tutorials).

-notation is transformed by the compiler to ordinary expressions that use

Monad

class functions.
When using the

do

-notation and a monad like

State

or

IO

programs look very much like programs written in an imperative language as each line contains a statement that can change the simulated global state of the program and optionally binds a (local) variable that can be used by the statements later in the code block.
It is possible to intermix the

4 Commutative monads

Commutative monads are monads for which the order of actions makes no difference (they commute), that is when following code:

do
a <- f x
b <- g y
m a b

is the same as:

do
b <- g y
a <- f x
m a b

Examples of commutative include:

Reader

monad

Maybe

monad

5 Monad tutorials

Monads are known for being deeply confusing to lots of people, so there are plenty of tutorials specifically related to monads. Each takes a different approach to Monads, and hopefully everyone will find something useful.