[prev in list] [next in list] [prev in thread] [next in thread]
List: haskell-cafe
Subject: [Haskell-cafe] Re: what is inverse of mzero and return?
From: Daniel Fischer <daniel.is.fischer () web ! de>
Date: 2005-01-25 9:30:04
Message-ID: 200501251030.04846.daniel.is.fischer () web ! de
[Download RAW message or body]
Am Dienstag, 25. Januar 2005 03:25 schrieb Jan-Willem Maessen:
> I feel obliged to point out (because the repeated references to the
> question are driving me up the wall) that this simple equality holds in
> every monad:
>
> return 4 >> return 5
>
> === (definition of >>)
>
> return 4 >>= \_ -> return 5
>
> === (monad laws)
>
> (\_ -> return 5) 4
>
> === (beta reduction)
>
> return 5
>
> We don't need to know anything about the semantics, etc. of any other
> actions the monad might happen to define.
>
> -Jan-Willem Maessen
>
Thanks, nice to be taken back down to earth.
So we have
putStrLn "hello" >> mzero
===
putStrLn "hello" >>= (\_ -> mzero)
===
(\_ -> mzero) ()
===
mzero
indeed.
Daniel
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic