[Haskell-cafe] Monads

Kristopher Micinski krismicinski at gmail.com
Sun Sep 30 04:11:26 CEST 2012

You have fallen into the misconception that monads are impure, they are not.

Many monad tutorials begin (erroneously) with the lines "monads allow
you to do impure programming in Haskell."

This is false, monads are pure, it's IO that's impure, not the monadic
programming style.  Monads let you *emulate* an impure style in pure
code, but it's nothing more than this: an emulation.

So in summary you can take any monad you want, and it will be pure,
however it's underlying implementation may not be (such is the case
with IO, for example).  Consider any of:
  -- State,
  -- List,
  -- Cont,
  -- ... literally any monad, some may be more "obviously pure" than
others, but hey, people say that about me all the time.


On Sat, Sep 29, 2012 at 9:57 PM, Vasili I. Galchin <vigalchin at gmail.com> wrote:
> Hello,
>         I would an examples of monads that are pure, i.e. no side-effects.
> Thank you,
> Vasili
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe

More information about the Haskell-Cafe mailing list