control-bool-0.2: Useful combinators for boolean expressions

Portabilitynon-portable
Stabilityexperimental
MaintainerFumiaki Kinoshita <fumiexcel@gmail.com>
Safe HaskellSafe-Inferred

Control.Bool

Contents

Description

Useful combinators for boolean expressions

Synopsis

A pure combinator

bool :: a -> a -> Bool -> aSource

Return its second argument if the boolean value is True, otherwise return first.

Applicative combinators

notF :: Functor f => f Bool -> f BoolSource

A lifted not.

(<||>) :: Applicative f => f Bool -> f Bool -> f BoolSource

A lifted (||).

(<&&>) :: Applicative f => f Bool -> f Bool -> f BoolSource

A lifted (&&).

aguard :: Alternative m => Bool -> m ()Source

An Alternative analogue of guard.

aguard' :: Alternative m => Bool -> a -> m aSource

aguard' b returns the second argument if b is True, otherwise becomes empty.

Monadic combinators

notM :: Monad m => m Bool -> m BoolSource

A lifted not.

(<|=>) :: Monad m => m Bool -> m Bool -> m BoolSource

A lifted (||), but it doesn't run the second argument if the first returns True.

(<&=>) :: Monad m => m Bool -> m Bool -> m BoolSource

A lifted (&&), but it doesn't run the second argument if the first returns False.

guard' :: MonadPlus m => Bool -> a -> m aSource

guard' b returns the second argument if b is True, otherwise becomes mzero.

guardM' :: MonadPlus m => m Bool -> a -> m aSource

guard' b returns the second argument if b is True, otherwise becomes mzero.

whenM :: (Monoid a, Monad m) => m Bool -> m a -> m aSource

Run the action if the given monadic condition becomes True.

unlessM :: (Monoid a, Monad m) => m Bool -> m a -> m aSource

Run the action if the given monadic condition becomes False.

ifThenElseM :: Monad m => m Bool -> m a -> m a -> m aSource