[Haskell-beginners] Re: WWAAA... I hate monads
Daniel Carrera
daniel.carrera at theingots.org
Fri Apr 24 12:09:40 EDT 2009
Federico Brubacher wrote:
> While i agree to some extent that analogies are bad in some sense , i
> found this one really insightful when i was trying to put my head around
> monads :
>
> http://www.haroldtherebel.com/2007/12/02/monads-and-schroedingers-cat/
>
> what do u guys think ?
Personally, I don't find this analogy useful. Because monads are
obviously not Schrödinger's cat, the analogy makes me feel like I don't
actually have any idea of what monads are.
There are other things that I thought were more confusing than useful:
If you have a monad (m a) you do not "put a function (a -> b) into the
box". First of all, the second parameter of the bind operator does not
have the signature (a -> b). It has the signature (a -> m b).
Another problem with saying box or wrapper, which Ertugrul pointed out
when I said "wrapper" is that the monad may not always return the same
result. To quote Ertugrul: "An IO computation can give different results
in each run".
Finally, the analogy with Schrödinger doesn't seem apt. The point of
Schrödinger's cat is that he is simultaneously dead and alive until you
open the box to make a measurement. This is not how monads behave. It is
*not* a property of Schrödinger's cat that you can't interact with the
cat. Sure you can, just make a measurement.
Finally, this page doesn't have all the detailed explanation that is
necessary to make an analogy really work.
Daniel.
More information about the Beginners
mailing list