Monads in Haskell

Nathanael Schilling · 2014

In Haskell, monads provide a mechanism for mapping functions of the type a -> m b to those of the type m a -> m b. This mapping is dependent on m, hence the behaviour of the resulting function can be made specic to m, allowing for a wide range of notions ranging from non-determenism to failure-handling to be modelled. Additionally, the way monads behave make it possible to use both functions with eects and those without eects in the same program whilst keeping them separated, letting Haskell preserve its functional aspect without losing the ability to run programs that have eects. Due to the utility of monadic programming (i.e. programming with monads), Haskell has a specic syntax (called ‘do notation’) specically for programming with monads. This article describes what monads are in Haskell, and how to program with them. Examples of monads are given including the List, Maybe and IO monad.

Read the paper · More papers on PaperTik