Proposal: add ifM and whenM to Control.Monad

Casey McCann cam at uptoisomorphism.net
Mon Apr 21 13:57:00 UTC 2014


On Sun, Apr 20, 2014 at 6:35 PM, Edward Kmett <ekmett at gmail.com> wrote:
> mif appears to pass the naming convention rules. It looks strange, but we
> can chalk that up to lack of exposure.
>
> The principal use of ' in base is for adding strictness, and when' and
> unless' don't fit that pattern. Looking at
> it in code doesn't send a signal that most users would pick up that an extra
> monadic effect is going on.

Roughly half the uses of ' in base don't involve adding strictness, by
the way, and of the half that does several were added relatively
recently.

More accurate would probably be to say that the principal use of ' in
base is for naming foldl', which I suspect originally followed the
naming convention of "foo' is like foo, except different", and that
the current interpretation of ' arose due to how frequently newcomers
needed to be warned away from regular foldl.

Using ' in this case would be historically justified but I think
common consensus these days is in favor of the unwritten "foo' is like
foo, except stricter" convention.

- C


More information about the Libraries mailing list