Proposal: add ifM and whenM to Control.Monad

Greg Weber greg at gregweber.info
Mon Apr 21 21:55:05 UTC 2014


On Mon, Apr 21, 2014 at 1:38 PM, Oliver Charles <ollie at ocharles.org.uk>wrote:

> I'm +/-0 on ifM, but that doesn't seem to be in the original proposal
> anyway. I can see the value in it, but I've never really needed it. I would
> probably use f >>= bool x y in practice.
>
>
agreed. additionally, while when/unless/whenM/unlessM gets rid of a `return
()` branch, ifM does not.
In situations where I have branching code containing more than just
properly curried functions I will prefer an intermediate variable if I get
to use the language built-in if/then/else that gets syntax highlighted and
avoids parentheses. `$ do` avoids parentheses with
when/unless/whenM/unlessM, but with a second branch the parentheses return
for both.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/libraries/attachments/20140421/94e25637/attachment-0001.html>


More information about the Libraries mailing list