[Haskell-cafe] Explaining monads

Sebastian Sylvan sebastian.sylvan at gmail.com
Tue Aug 14 15:50:47 EDT 2007


On 14/08/07, Seth Gordon <sethg at ropine.com> wrote:
> Sebastian Sylvan wrote:
> > On 14/08/07, Dan Piponi <dpiponi at gmail.com> wrote:
> >> If I was one of your students and you said that monads are recipes I
> >> would immediately ask you where the monads are in my factorial program
> >> regardless of whether you had introduced one or two different
> >> analogies for recipes.
> >
> > Why would you? I really don't see where you would get that idea? If I
> > tell you that a function returns "a fruit", would you ask where the
> > fruit in your factorial program is? Probably not. Why would you go off
> > and take an analogy for monads and apply it to something completely
> > different and still think the analogy holds?
> > A function is *not* a recipe in this analogy, it's just a function
> > (which you hopefully should've covered by the time you get to monads.
> > Monadic values, and *only* monadic values (not functions!) are to be
> > viewed as analogous to real world cooking recipes in this analogy.
> > Functions shouldn't. If you start mixing things together it will get
> > confused, so just don't!
>
> As a mostly-newbie who is working on his own monad tutorial
> (bwah-hah-hah), I share Dan's confusion about your analogy.
>
> Teacher: "Monads are like recipes."
>
> Student: "Aren't functions like recipes, too?"
>
> Teacher: "Well, yes, but we're talking about monads now, not functions."
>

Teacher: No, functions are like chefs. They do things to their input.
Monads are like recipes, they don't *do* anything at all, they just
represent an action, they need chefs to interpret them.

-- 
Sebastian Sylvan
+44(0)7857-300802
UIN: 44640862


More information about the Haskell-Cafe mailing list