[Haskell-cafe] Re: Explaining monads

Aaron Denney wnoise at ofb.net
Tue Aug 14 14:52:41 EDT 2007


On 2007-08-14, Dan Piponi <dpiponi at gmail.com> wrote:
> On 8/14/07, Sebastian Sylvan <sebastian.sylvan at gmail.com> wrote:
>> I like the very light weight analogy (which works for most practical
>> uses of monads) that a monadic action is a "recipe"
>
> Many introductory programming books present the idea of a program as a
> recipe. Here's a recipe for computing factorials:
>
> fact 0 = 1
> fact n = n*fact (n-1)
>
> Where do monads come in?

Playing the devil's advocate here:

Recipe is a reasonable description for imperative code ... because it's
all in the IO monad.

Not such a good mapping for functional code.

(I don't think recipe is a good analogy for, say, the List monad, reader
monads, etc.)

-- 
Aaron Denney
-><-



More information about the Haskell-Cafe mailing list