Proposal: add ifM and whenM to Control.Monad

Herbert Valerio Riedel hvr at gnu.org
Mon Apr 21 09:01:57 UTC 2014


On 2014-04-20 at 23:48:06 +0200, Edward Kmett wrote:
> if' is a commonly used name in user code for what is now called bool, but
> it also gets used all over the place for 'if' inside of EDSLs.

Just a minor nit-pick, I had always assumed if' and bool had different
argument ordering:

  bool :: a -> a -> Bool -> a
  bool f _ False = f
  bool _ t True  = t

(following the style of 'either'/'maybe')

vs.

  if' :: Bool -> a -> a -> a
  if' True  x _ = x
  if' False _ y = y

(see http://www.haskell.org/haskellwiki/If-then-else)



More information about the Libraries mailing list