On Saturday, September 15, 2012 at 10:24 AM, Kristopher Micinski wrote:
On Fri, Sep 14, 2012 at 10:08 PM, Joel Burget <joelburget@gmail.com> wrote:[snip]Also, Maybe and Either are not "implemented as monads". They are definedusing `data` like you suggest:data Maybe a = Nothing | Just adata Either a b = Left a | Right bThat's not my point, or my objection. My objection is to people whopresent monads showing examples that begin with Maybe or Either, orthese 'trivial monads,' types onto which you can strip monadicbehavior fairly simply. I'm not saying they're bad as monads, oruseless, but I think the step from Maybe as a datatype to using it asa monad is great enough that explaining monads by way of introducingthem with Maybe as an example is sort of confusing because ittrivializes what's actually going on.I'm honestly not sure what you mean by Maybe or Either being"implemented as monads," versus others. Monad is just a type class,there's always an underlying type. Perhaps you mean that peopleactually *care* about things in Maybe outside of it being used as amonad, versus other things where you don't touch the underlying type.This isn't intended to start an argument, however, and I'd prefer notto argue over methodology, I just wanted to throw out there that ifyou say "monads, think about maybe, and add some stuff, then that's itis, what's all the fuss about!?" I think the hard part for peopleunderstanding monads isn't the definition of monads, but rather thatyou are forced to really tackle higher order behavior in a very directway. (For example, say you're new to Haskell, you probably don't knowabout CPS, and you read about Cont in a monad tutorial. Is it themonad that makes it hard? No, it's probably the concept of CPS.)kris