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

Joachim Breitner mail at joachim-breitner.de
Wed Dec 10 21:48:45 UTC 2014


Hi,


Am Dienstag, den 09.12.2014, 22:44 +0100 schrieb Christopher Done:
> The name for this function is a no-brainer:
> 
> bind :: Monad m => (a -> m b) -> m a -> m b
> bind = (=<<)

Such a function already exists, unfortunately with a slightly too
specialized type. So in the spirit of recent changes to Data.List, let’s
just generalize

        concatMap :: (a -> [b]) -> [a] -> [b]

to 

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

and use that existing name.


/me ducks and runs.

Greetings,
Joachim

PS, jokes aside: I’m not convinced that the need for this is
sufficiently strong, so this proposal, although nice and sensible,
currently does not pass my rather vague threshold for change. Especially
as (=<<) is (syntactically, grammatically) equivalent to a named
function. So count me as -1 for now, unless better arguments arise.


-- 
Joachim “nomeata” Breitner
  mail at joachim-breitner.dehttp://www.joachim-breitner.de/
  Jabber: nomeata at joachim-breitner.de  • GPG-Key: 0xF0FBF51F
  Debian Developer: nomeata at debian.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part
URL: <http://www.haskell.org/pipermail/libraries/attachments/20141210/1cfc62b4/attachment.sig>


More information about the Libraries mailing list