Proposal: add ifM and whenM to Control.Monad

Herbert Valerio Riedel hvr at gnu.org
Mon Apr 21 07:49:40 UTC 2014


On 2014-04-21 at 00:35:03 +0200, Edward Kmett wrote:
> mif appears to pass the naming convention rules. It looks strange, but we
> can chalk that up to lack of exposure.

I'm +1 on using `mif`/`mwhen`/`munless` (assuming all those pass the
current naming convention), because otherwise adding an exception to the
naming convention for Control.Monad entities would also require
rewording the existing naming convention in the Haskell Report.

Moreover, since 'Control.Monad' is often imported unqualified, we'd
probably cause clashes in existing packages (and together with non-PVP
upper-bounds on base that'd mean build failures)

A quick heuristic grep over all Hackage packages results in quite a bit
of packages containing the ifM/whenM/unlessM:

,----
| $ zgrep -l  '^\(when\|if\|unless\)M ' -- *.tar.gz
| Adaptive-0.23.tar.gz
| Adaptive-Blaisorblade-0.23.tar.gz
| Agda-2.3.2.2.tar.gz
| alms-0.6.5.tar.gz
| alpha-1.0.15.tar.gz
| apelsin-1.2.3.tar.gz
| aws-sdk-0.12.4.tar.gz
| bamboo-2010.2.25.tar.gz
| bff-mono-0.2.1.tar.gz
| bool-extras-0.4.0.tar.gz
| btree-concurrent-0.1.5.tar.gz
| buildbox-2.1.4.1.tar.gz
| caldims-0.1.0.tar.gz
| cao-0.1.1.tar.gz
| clafer-0.3.5.1.tar.gz
| Coadjute-0.1.1.tar.gz
| Commando-1.0.0.4.tar.gz
| concurrent-extra-0.7.0.6.tar.gz
| cond-0.4.0.2.tar.gz
| control-bool-0.2.1.tar.gz
| control-monad-loop-0.1.tar.gz
| ctrie-0.1.0.1.tar.gz
| custom-prelude-0.2.2.0.tar.gz
| darcs-benchmark-0.1.9.tar.gz
| data-spacepart-20090215.0.tar.gz
| DPM-0.3.0.0.tar.gz
| feldspar-language-0.6.0.3.tar.gz
| fix-imports-1.0.3.tar.gz
| fquery-0.2.1.5.tar.gz
| git-annex-5.20140412.tar.gz
| github-backup-1.20131203.tar.gz
| git-repair-1.20140227.tar.gz
| hjs-0.2.1.tar.gz
| hsc3-graphs-0.14.1.tar.gz
| hsConfigure-0.1.tar.gz
| hxt-filter-8.4.2.tar.gz
| IfElse-0.85.tar.gz
| infinity-0.3.tar.gz
| JYU-Utils-0.1.1.2.tar.gz
| kure-2.14.6.tar.gz
| language-sh-0.0.3.1.tar.gz
| lhae-0.0.3.tar.gz
| libcspm-1.0.0.tar.gz
| liquid-fixpoint-0.1.0.0.tar.gz
| LslPlus-0.4.3.tar.gz
| manatee-core-0.1.1.tar.gz
| MiniAgda-0.2014.1.9.tar.gz
| omega-1.5.2.tar.gz
| orchid-0.0.8.tar.gz
| panda-2009.4.1.tar.gz
| processing-1.2.0.1.tar.gz
| propellor-0.5.0.tar.gz
| regexpr-0.5.4.tar.gz
| rosso-1.0.tar.gz
| runghc-0.1.0.2.tar.gz
| scion-0.1.0.2.tar.gz
| scyther-proof-0.8.0.0.tar.gz
| shellish-0.1.4.tar.gz
| shelly-1.5.2.tar.gz
| sindre-0.4.tar.gz
| spacepart-0.1.0.0.tar.gz
| Strafunski-StrategyLib-5.0.0.3.tar.gz
| StrategyLib-4.0.0.0.tar.gz
| tamarin-prover-utils-0.8.5.1.tar.gz
| test-sandbox-0.0.1.7.tar.gz
| usb-1.2.tar.gz
| vhd-0.2.2.tar.gz
| watcher-0.0.3.0.tar.gz
| wxc-0.90.1.1.tar.gz
| YampaSynth-0.1.2.tar.gz
| yesod-bin-1.2.8.1.tar.gz
| yi-0.8.1.tar.gz
| yjtools-0.9.18.tar.gz
| zip-conduit-0.2.2.1.tar.gz
| zoom-0.1.0.1.tar.gz
`----

...whereas a grep on the `m`-prefixed versions turns up much less hits:

,----
| $ zgrep -l  '^m\(when\|if\|unless\) ' -- *.tar.gz
| bool-extras-0.4.0.tar.gz
| ideas-1.1.tar.gz
`----


Cheers,
  hvr


More information about the Libraries mailing list