[Haskell-cafe] Explaining monads

Lennart Augustsson lennart at augustsson.net
Tue Aug 14 13:37:23 EDT 2007

You don't normally call x::Int a computation of an Int because there's
nothing that distinguishes the value of the x from what it was before you
computed it.  So I prefer to regard x as a value (in a domain, of course).
But for x :: (Monad m) => m Int there is something else happening, so the
word computation makes sense.
This is just the terminology people use, not an absolute truth, so you're
free to think it's wrong. :)
BTW, if you regard non-termination as an effect then even x :: Int is a

  -- Lennart

On 8/14/07, Dan Piponi <dpiponi at gmail.com> wrote:
> 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"?
> --
> Dan
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20070814/7fd50f28/attachment.htm

More information about the Haskell-Cafe mailing list