Module: eq

Methods

(static) Eq() → {boolean}

The Eq type class defines equality and inequality. Instances of Eq must define an isEq method.

Parameters:
Type Description
*

Any object

Source:
Returns:

true if an object is an instance of Eq and false otherwise

Type
boolean

(static) isEq(a, b) → {boolean}

Compare two objects for equality. Both objects must be instances of the Eq type class (i.e. they both define an isEq method) and must also be the same data type (or primitive type).
Haskell> (==) :: a -> a -> Bool

Parameters:
Name Type Description
a *

Any object

b *

Any object

Source:
Returns:

a === b

Type
boolean
Example
const lst1 = list(1,2,3);
const lst2 = list(4,5,6);
isEq(lst1, lst2);         // => false
isEq(lst1, list(1,2,3));  // => true
isEq(0, 1);               // => false
isEq(0, 0);               // => true

(static) isNotEq(a, b) → {boolean}

Compare two objects for inequality. Both objects must be instances of the Eq type class (i.e. they both define an isEq method) and must be also be the same data type (or primitive type).
Haskell> (/=) :: a -> a -> Bool

Parameters:
Name Type Description
a *

Any object

b *

Any object

Source:
Returns:

a !== b

Type
boolean
Example
const lst1 = list(1,2,3);
const lst2 = list(4,5,6);
isNotEq(lst1, lst2);        // => true
isNotEq(lst1, list(1,2,3)); // => false
isNotEq(0, 1);              // => true
isNotEq(0, 0);              // => false