utility-ht-0.0.8: Various small helper functions for Lists, Maybes, Tuples, Functions

Safe HaskellSafe-Infered

Data.Bool.HT

Synopsis

Documentation

if' :: Bool -> a -> a -> aSource

if-then-else as function.

Example:

 if' (even n) "even" $
 if' (isPrime n) "prime" $
 "boring"

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

The same as if', but the name is chosen such that it can be used for GHC-7.0's rebindable if-then-else syntax.

select :: a -> [(Bool, a)] -> aSource

From a list of expressions choose the one, whose condition is true.

Example:

 select "boring" $
   (even n, "even") :
   (isPrime n, "prime") :
   []

(?:) :: Bool -> (a, a) -> aSource

Like the ? operator of the C progamming language. Example: bool ?: (yes, no).

implies :: Bool -> Bool -> BoolSource

Logical operator for implication.

Funnily because of the ordering of Bool it holds implies == (<=).