[Haskell-beginners] Re: WWAAA... I hate monads
Ertugrul Soeylemez
es at ertes.de
Fri Apr 24 13:19:41 EDT 2009
Daniel Carrera <daniel.carrera at theingots.org> 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).
I think, this is rather an allusion to functors.
> 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".
Monadic values (computations, containers, whatever you call them) are
expressed intrinsically without a notion of running them. Running is
something separate and specific to particular monads. There may be
monads, which are not supposed to be "run", or for which "running"
doesn't make any sense at all.
> 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.
Actually Schrödinger's cat is neither dead nor alive. Its state S is a
unit vector living in a Hilbert space. The two possible measurement
outcomes are also unit vectors in that vector space. They form an
orthonormal basis, but S isn't equal to either of them. Measuring S
means turning it into one of them, thereby destroying the original
state.
Greets,
Ertugrul.
--
nightmare = unsafePerformIO (getWrongWife >>= sex)
http://blog.ertes.de/
More information about the Beginners
mailing list