bind :: Monad m => (a -> m b) -> m a -> m b

David Feuer david.feuer at gmail.com
Wed Dec 10 03:44:54 UTC 2014


I should mention that LYAH, in
http://learnyouahaskell.com/a-fistful-of-monads , says

    The >>= function is pronounced as bind.

RWH, in, http://book.realworldhaskell.org/read/monads.html , indicates

    Here, (>>=) is our chaining function. [...] It's often referred to
as “bind”, as it binds the result of the computation on the left to
the parameter of the one on the right.

A Gentle Introduction to Haskell, at
https://www.haskell.org/tutorial/monads.html , says

    The Monad class defines two basic operators: >>= (bind) and return.

http://en.wikibooks.org/wiki/Haskell/Understanding_monads#Definition says

    an operator (>>=) which is pronounced "bind".

In case it's not clear yet, I am firmly against using the name "bind"
to mean (=<<).


On Tue, Dec 9, 2014 at 10:24 PM, Felipe Lessa <felipe.lessa at gmail.com> wrote:
> I'm not sure what Abel's vote is, but I'm -1 on this proposal precisely
> because of the issues he explained below.
>
> Cheers,
>
> On 09-12-2014 23:44, Andreas Abel wrote:
>> If there is a bindIO as specialization of (>>=), having a bind as alias
>> for (=<<) is a bad idea.
>>
>> In category theory (Kleisli triple), (=<<) is called the extension
>> operator.
>>
>> Most of my uses of (=<<) are infix, as a monadic application operator,
>> so I never felt the need to have a non-operator version of it.
>>
>> Haskell is all about saving parentheses and being not Scheme, so
>>
>>   f a =<< g b
>>
>> is definitely preferable over
>>
>>   bind (f a) (g b)
>>
>> ;-)
>>
>> Cheers,
>> Andreas
>>
>> On 10.12.2014 00:35, David Feuer wrote:
>>> It's possible I got confused by GHC.Base, which defines
>>>
>>> bindIO :: IO a -> (a -> IO b) -> IO b
>>>
>>> If that's backwards, then go right ahead and use bind to mean (=<<).
>>>
>>> On Tue, Dec 9, 2014 at 6:17 PM, Gabriel Gonzalez <gabriel439 at gmail.com
>>> <mailto:gabriel439 at gmail.com>> wrote:
>>>
>>>     My understanding was that bind historically referred to `(=<<)`, not
>>>     `(>>=)`
>>>
>>>     Either way I am (+1) on this, even if my previous sentence is false.
>>>
>>>
>>>     On 12/9/14, 1:55 PM, David Feuer wrote:
>>>>
>>>>     On Dec 9, 2014 4:44 PM, "Christopher Done" <chrisdone at gmail.com
>>>>     <mailto:chrisdone at gmail.com>> wrote:
>>>>     > The name for this function is a no-brainer:
>>>>     >
>>>>     > bind :: Monad m => (a -> m b) -> m a -> m b
>>>>     > bind = (=<<)
>>>>
>>>>     Since most people use the term "bind" to refer to the >>=
>>>>     operator, this would be very confusing.
>>>>
>>>>     > For comparison, the not-very-pleasant <$> and <*> each have word
>>>>     > alternatives, fmap and ap. Even <> has mappend.
>>>>
>>>>     fmap predates <$>, and <$> tends to be used only in certain
>>>>     contexts. "ap" has a narrower type than <*>.
>>>>
>>>>     > I don’t hold much hope for this, Haskellers love operators as
>>>>     much as
>>>>     > Perl programmers so few on this list will see the value in
>>>> plain old
>>>>     > words, but at least I can link to this email in the archives for
>>>>     > future reference.
>>>>
>>>>     I have nothing against the idea in principle, but that name won't
>>>> fly.
>>>>
>>>>
>>>>
>>>>     _______________________________________________
>>>>     Libraries mailing list
>>>>     Libraries at haskell.org  <mailto:Libraries at haskell.org>
>>>>     http://www.haskell.org/mailman/listinfo/libraries
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> Libraries mailing list
>>> Libraries at haskell.org
>>> http://www.haskell.org/mailman/listinfo/libraries
>>>
>>
>>
>
> --
> Felipe.
>
>
> _______________________________________________
> Libraries mailing list
> Libraries at haskell.org
> http://www.haskell.org/mailman/listinfo/libraries
>


More information about the Libraries mailing list