Data.Bool

v11.3.15 • Boolean Logic

Boolean operations and Church-encoded logic.

Types

Bool :: *

Boolean type representing truth values (True and False).

Implementation
data Bool = False | True

Foreigns

No foreign functions defined in this module.

Functions

not :: Bool -> Bool

Standard boolean negation.

Implementation
not b = case b of
    True  -> False
    False -> True

and :: Bool -> Bool -> Bool

Boolean conjunction.

Implementation
and a b = case a of
    True  -> b
    False -> False

or :: Bool -> Bool -> Bool

Boolean disjunction.

Implementation
or a b = case a of
    True  -> True
    False -> b

bool_if :: Bool -> A -> A -> A

Functional version of if-then-else.

Implementation
bool_if b t f = case b of
    True  -> t
    False -> f