Appearance
aivi.bool
Boolean utilities for AIVI. These functions complement the built-in and, or, and bool branching operators with named combinators for common logical patterns.
aivi
use aivi.bool (
not
xor
implies
both
either
neither
fromInt
)not
Negates a boolean value.
aivi
not : Bool -> Boolaivi
use aivi.bool (not)
type Bool -> Bool
func isInactive = active =>
not activexor
Returns True if exactly one of the two arguments is True (exclusive or).
aivi
xor : Bool -> Bool -> Boolaivi
use aivi.bool (xor)
type Bool -> Bool -> Bool
func toggleChanged = previous current =>
xor previous currentimplies
Logical implication: implies a b is False only when a is True and b is False.
aivi
implies : Bool -> Bool -> Boolaivi
use aivi.bool (implies)
type Bool -> Bool -> Bool
func checkRule = hasPermission canAccess =>
implies hasPermission canAccessboth
Returns True if both arguments are True. Equivalent to a and b.
aivi
both : Bool -> Bool -> Boolaivi
use aivi.bool (both)
type Bool -> Bool -> Bool
func isAdminAndActive = isAdmin isActive =>
both isAdmin isActiveeither
Returns True if at least one argument is True. Equivalent to a or b.
aivi
either : Bool -> Bool -> Boolaivi
use aivi.bool (either)
type Bool -> Bool -> Bool
func canProceed = hasTokenA hasTokenB =>
either hasTokenA hasTokenBneither
Returns True only if both arguments are False.
aivi
neither : Bool -> Bool -> Boolaivi
use aivi.bool (neither)
type Bool -> Bool -> Bool
func isSilent = isPlaying isPaused =>
neither isPlaying isPausedfromInt
Converts an integer to a boolean: 0 becomes False, any other value becomes True.
aivi
fromInt : Int -> Boolaivi
use aivi.bool (fromInt)
type Int -> Bool
func hasFlags = flagBits =>
fromInt flagBits