[Haskell-cafe] Explaining monads

Dan Piponi dpiponi at gmail.com
Tue Aug 14 12:56:51 EDT 2007

On 8/14/07, Jeff Polakow <jeff.polakow at db.com> wrote:
> One general intuition about monads is that they represent computations
> rather than simple (already computed) values:

>     x :: Int               -- x is an Int
>     x :: Monad m => m Int  -- x is a computation of an Int

What's a "computation"? It seems to me that in a lazy language, x::Int
represents a computation of an int, not an "already computed" value.
x::[Int] is a computation that returns multiple values. x::(Int,Int)
is a computation that returns a pair of values. x::() is a computation
that returns nothing. x::Map a b is a computation that gives a way to
associate values of type a with values of type b. Some of these are
monads, some are not. What's the difference between them? Why are you
calling certain values "computations"?

More information about the Haskell-Cafe mailing list