Arraybe
This is an implementation of the Maybe monad using array
API
nothing :: Maybe
It is a nothing value
Definition:
const nothing = Object;
empty :: () => Maybe
It is a function that returns nothing
Definition:
const empty =
just :: T => Maybe T
It takes a value and wrap it with Maybe monad
Definition:
const just = x;
of :: T => Maybe T
It's an equivalent of just
isJust :: Maybe T => boolean
It takes a Maybe monad and returns true
if it contains a value.
Definition:
const isJust = maybeValuelength > 0;
isNothing :: Maybe T => boolean
It takes a Maybe monad and returns true
if it doesn't contain a value.
Definition:
const isNothing = maybeValuelength === 0;
equals :: Maybe T => Maybe T => boolean
It takes two maybe monads and returns true if they are equal.
Simple definition:
const equals = { return && || && && a0 === b0 // both contains same value ;};
This is a curried function:
=== b;
lte :: Maybe T => Maybe T => boolean
It takes two maybe values and returns true
if first is less or equal then second
; // true; // true; // true; // false // false
lteWith :: ((a,b) => boolean) => Maybe T => Maybe T
It takes function that desides if inner value of first maybe less or equal then innerValue of second maybe value.
const arrayLengthLte = arr1length <= arr2length const maybeArrayLte = // true // true // false // true // true // true
lte
can be rewritten as:
const lte =