-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | Useful combinators for boolean expressions
--   
--   Useful combinators for boolean expressions
@package control-bool
@version 0.2.1


-- | Useful combinators for boolean expressions
module Control.Bool

-- | <tt>bool a b</tt> is a function that returns a if the argument is
--   True, otherwise returns <tt>b</tt>.
bool :: a -> a -> Bool -> a

-- | An argument-permuted equivalent of <a>bool</a>.
ifThenElse :: Bool -> a -> a -> a

-- | A lifted <a>not</a>.
notF :: Functor f => f Bool -> f Bool

-- | A lifted (<a>||</a>).
(<||>) :: Applicative f => f Bool -> f Bool -> f Bool
infixr 2 <||>

-- | A lifted (<a>&amp;&amp;</a>).
(<&&>) :: Applicative f => f Bool -> f Bool -> f Bool
infixr 3 <&&>

-- | An <a>Alternative</a> analogue of <a>guard</a>.
aguard :: Alternative m => Bool -> m ()

-- | <a>aguard'</a> b returns the second argument if b is True, otherwise
--   becomes <a>empty</a>.
aguard' :: Alternative m => Bool -> a -> m a

-- | A lifted <a>not</a>.
notM :: Monad m => m Bool -> m Bool

-- | A lifted (<a>||</a>), but short-circuited.
(<|=>) :: Monad m => m Bool -> m Bool -> m Bool
infixr 2 <|=>

-- | A lifted (<a>&amp;&amp;</a>), but short-circuited.
(<&=>) :: Monad m => m Bool -> m Bool -> m Bool
infixr 3 <&=>

-- | <a>guard'</a> b a returns a if b is True, otherwise becomes
--   <a>mzero</a>.
guard' :: MonadPlus m => Bool -> a -> m a

-- | <a>guard'</a> b returns the second argument if b is True, otherwise
--   becomes mzero.
guardM' :: MonadPlus m => m Bool -> a -> m a

-- | Run the action if the given monadic condition becomes <a>True</a>.
whenM :: (Monoid a, Monad m) => m Bool -> m a -> m a

-- | Run the action if the given monadic condition becomes <a>False</a>.
unlessM :: (Monoid a, Monad m) => m Bool -> m a -> m a
ifThenElseM :: Monad m => m Bool -> m a -> m a -> m a
