Proposal: Add Chris Done's "om" combinator to Control.Monad

John Wiegley johnw at fpcomplete.com
Fri Jul 26 06:37:24 CEST 2013


>>>>> Stephen Tetley <stephen.tetley at gmail.com> writes:

> This just looks like a synthetic combinator to me (cue the arbitrary name).
> Naturally it can make some code shorter (that's the point of combinators) but I
> have reservations that the code is significantly clearer, more appealing.

It's just that I tend to write the following a LOT:

    x <- someMonadicFunction
    when x $ do
        ...

I generally avoid using whenM because it seems silly to bring in a package
dependency for something so trivial.  With "om", it's the same thing:

    om when someMonadicFunction $ do
        ...

I really didn't think it was that confusing or hard to read, but if people
dislike it on principle, I have no other arguments besides utility.  I find
myself reaching for it a lot, so thought others might too.

-- 
John Wiegley
FP Complete                         Haskell tools, training and consulting
http://fpcomplete.com               johnw on #haskell/irc.freenode.net




More information about the Libraries mailing list