Either
LEFT
Constructs a Left value in an Either type.
LEFT 1 == [0 1]
LEFT b#hello == [0 b#hello]
LEFT NIL == [0 0]RIGHT
Constructs a Right value in an Either type.
RIGHT 1 == [1 1]
RIGHT b#hello == [1 b#hello]
RIGHT NIL == [1 0]fromLeft
Extracts the value from a Left, or returns a default value for a Right.
fromLeft 0 [0 2] == 2
fromLeft 0 ~[0 2] == [2 0]
fromLeft 1 (LEFT b#b) == b#b
fromLeft 1 (RIGHT b#b) == (1 b#b)unpackLeft
Extracts the value from a Left, or crashes for a Right.
fromRight
Extracts the value from a Right, or returns a default value for a Left.
unpackRight
Extracts the value from a Right, or crashes for a Left.
eitherCase
Pattern matches on an Either value, applying the appropriate function.
eitherOpen
Pattern matches on an Either value, returning the value for a Right, or applying a function for a Left.
eitherOpenLeft
Pattern matches on an Either value, returning the value for a Left, or applying a function for a Right.
eitherCaseLeft
Pattern matches on an Either value, applying the appropriate function (opposite order of eitherCase).
eitherGetRight
Extracts the value from a Right, or applies a function to the Left value.
eitherGetLeft
Extracts the value from a Left, or applies a function to the Right value.
eitherMap
Applies a function to the value in a Right, leaving a Left unchanged.
eitherBind
Applies a function that returns an Either to the value in a Right, leaving a Left unchanged.
partition
Separates a row of Either values into two rows: one for Left values and one for Right values.
Last updated