Proposal: add ifM and whenM to Control.Monad

Mario Pastorelli pastorelli.mario at gmail.com
Mon Apr 21 09:35:49 UTC 2014


On 04/21/2014 10:41 AM, Simon Hengel wrote:
>> A quick heuristic grep over all Hackage packages results in quite a bit
>> of packages containing the ifM/whenM/unlessM:
> But that kind of shows that the "expected" names for those functions are
> ifM/whenM/unlessM.  I would ask the question:
>
>      Are there any other useful combinators that would be named
>      ifM/whenM/unlessM under the current naming convention?
>
> If no, then I'm not entirely convinced that we should decide against
> what seems to be common intuition here.

Breaking API consistency because a lot of people are already doing it 
doesn't feel right. If they are like me, they probably were ignoring the 
naming convention and used the most intuitive name. Once you know forM 
then it's obvious that you append 'M' to functions that "are more 
monadic". Probably mif, mwhen and munless are more compatible with the 
API rules.

>
> In general, I'm not sure about ifM (as it does not line up with `bool`).
>

This is the second time that I read about `bool` but I can't find it. 
Can somebody provide a link to it? mbool can be a solution, but not as 
intuitive as mif.

Mario


More information about the Libraries mailing list