[Haskell-cafe] Monad pronounced like gonad?
Derek Elkins
derek.a.elkins at gmail.com
Thu May 10 18:46:58 EDT 2007
Andrew Coppin wrote:
>
>>> ->
>>
>> "to"
>>
>>> <-
>>
>> "from", or "drawn from" for list comprehensions.
>>
>>> []
>>
>> "nil"
>
> More curiosely, that (>>=) function. Why is the Haskell name for it
> (>>=), and why is it pronounced "bind"? Neither of these choices make a
> lot of sense to me...
(>>=) is chosen as it seems fairly nice when you use a sugar free monadic style,
foo x >>= \y ->
bar y >>= \z ->
return (y+z)
To understand why it's called "bind" look at common sugar for it, e.g. the above
using do-notation and a "let" notation (e.g. monadic- or ]administrative-
(A-)normal form):
do
y <- foo x
z <- bar y
return (y+z)
letM y = foo x in
letM z = bar y in
y + z
So the effect of (>>=) is to bind the value produced by a monadic computation to
some variable. If we view impure languages as implicitly using a monad, their
"let" statements (which bind variables to values) translate to exactly the above.
More information about the Haskell-Cafe
mailing list