Bool
Eq implements
is_eq : a, a -> Bool
where a implements Eq
Defines a type that can be compared for total equality.
Total equality means that all values of the type can be compared to each
other, and two values a
, b
are identical if and only if isEq(a, b)
is
Bool.true
.
Not all types support total equality. For example, F32
and F64
can
be a NaN
(Not a Number), and the
IEEE-754 floating point standard
specifies that two NaN
s are not equal.
Bool
Represents the boolean true and false using an opaque type.
Bool
implements the Eq
ability.
true : Bool
The boolean true value.
false : Bool
The boolean false value.
not : Bool -> Bool
Returns Bool.false
when given Bool.true
, and vice versa. This is
equivalent to the logic NOT
gate. The operator !
can also be used as shorthand for Bool.not
.
expect Bool.not(Bool.false) == Bool.true expect !Bool.false == Bool.true
is_not_eq : a, a -> Bool
where a implements Eq
This will call the function Bool.is_eq
on the inputs, and then Bool.not
on the result. The is equivalent to the logic
XOR gate. The infix operator
!=
can also be used as shorthand for Bool.is_not_eq
.
Note that is_not_eq
does not accept arguments whose types contain
functions.
expect Bool.is_not_eq(Bool.false, Bool.true) == Bool.true expect (Bool.false != Bool.false) == Bool.false expect "Apples" != "Oranges"