On these pages we look at specific examples of monads, some from the world of programming:
Monads in Haskell
Haskell is a programming language that does not directly support the concept of a sequence of computations in strict order, Haskell tends to combine its computations only by function composition, in that sense there is a link between Haskell and category theory in that they both rely on function composition.
Haskell also does not directly support other computations that would require 'non-pure' functions such as state, input and output. However all computer languages need these things, a simple computer program might compute a sequence of statements like:
Read some input
do some computation on it
Output the result
Not being able to do these things, or not guaranteeing to do them in that order, would make the language useless for practical work.
There is a way we can guarantee order in a functional language, if we have a set of composed functions:
then f1 must have computed its result before f2 and so on.
So haskell must take function composition and make it look like a sequence of statements, to do this it uses monads (in a slightly modified form).
Monads in Haskell are described more fully here.