control-bool-0.2.1: Useful combinators for boolean expressions

Portabilityportable
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

bool a b is a function that returns a if the argument is True, otherwise returns b.

ifThenElse :: Bool -> a -> a -> aSource

An argument-permuted equivalent of bool.

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 short-circuited.

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

A lifted (&&), but short-circuited.

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

guard' b a returns a 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