packages feed

antelude-0.1.0: src/Antelude/Bool.hs

{- |
Module      : Antelude.Bool
Description : Contains some functions for Bools.
Maintainer  : dneavesdev@pm.me
-}
module Antelude.Bool
    ( Bool (..)
    , all
    , and
    , any
    , not
    , or
    , otherwise
    , xor
    , (&&)
    , (||)
    ) where

import safe           Antelude.Internal.TypesClasses ( Bool (..), List )

import safe           Prelude
    ( not
    , otherwise
    , (&&)
    , (||)
    )
import safe qualified Prelude                        ( and, or )

infixr 3 `and`

-- | Logical `and`, but in word form. Can be used normally or infixed.
and :: Bool -> Bool -> Bool
and a b = a && b

infixr 2 `or`

-- | Logical `or`, but in word form. Can be used normally or infixed.
or :: Bool -> Bool -> Bool
or a b = a || b

infixr 1 `xor`

-- | Logical `xor`, but in word form. Can be used normally or infixed.
xor :: Bool -> Bool -> Bool
xor a b = (a `and` Prelude.not b) `or` (Prelude.not a `and` b)


-- | Return 'True' if 'all' of the contents of the list evaluate to 'True'.
all :: List Bool -> Bool
all = Prelude.and


-- | Return 'True' if 'any' of the contents of the list evaluate to 'True'.
any :: List Bool -> Bool
any = Prelude.or