diff options
author | Joey Hess <joey@kitenet.net> | 2011-05-17 11:44:13 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2011-05-17 11:45:24 -0400 |
commit | 21d9c84e7292a8984ea5d46c0134ddc6ff19babc (patch) | |
tree | 4ad29fe99c515c5d8fd27233c88611a8f792ec2d /Utility.hs | |
parent | c91929f6934fc4e94603d0fa004e824d5e2cfb65 (diff) |
more standard names for whenM and unlessM operators
These are defined in ifelse, but it's not currently available and I don't
want to pull in a library for 6 lines of code anyhow.
Also, ifelse sets the fixity to 1, which does not allow >>? error $ ...
Diffstat (limited to 'Utility.hs')
-rw-r--r-- | Utility.hs | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/Utility.hs b/Utility.hs index 5aa0afea7..816464373 100644 --- a/Utility.hs +++ b/Utility.hs @@ -27,9 +27,9 @@ module Utility ( myHomeDir, catchBool, whenM, - (<&>), + (>>?), unlessM, - (<|>), + (>>!), prop_idempotent_shellEscape, prop_idempotent_shellEscape_multiword, @@ -271,12 +271,12 @@ whenM c a = c >>= flip when a unlessM :: Monad m => m Bool -> m () -> m () unlessM c a = c >>= flip unless a -(<&>) :: Monad m => m Bool -> m () -> m () -(<&>) = whenM +(>>?) :: Monad m => m Bool -> m () -> m () +(>>?) = whenM -(<|>) :: Monad m => m Bool -> m () -> m () -(<|>) = unlessM +(>>!) :: Monad m => m Bool -> m () -> m () +(>>!) = unlessM -- low fixity allows eg, foo bar <|> error $ "failed " ++ meep -infixr 0 <&> -infixr 0 <|> +infixr 0 >>? +infixr 0 >>! |