either
Either.bind
Section titled “Either.bind”def bind {E : Type} {A : Type} {B : Type} (e : Either E A) (f : A -> Either E B) : Either E BThe result of f on a right value; a left value stays (the chaining of the Monad (Either E) instance).
Either.join
Section titled “Either.join”def join {E : Type} {A : Type} (e : Either E (Either E A)) : Either E AA nested right flattened.
Either.apply
Section titled “Either.apply”def apply {E : Type} {A : Type} {B : Type} (ef : Either E (A -> B)) (ea : Either E A) : Either E BA function in a right applied to a value in a right; the first left otherwise.
Either.orElse
Section titled “Either.orElse”def orElse {E : Type} {A : Type} (e : Either E A) (recover : E -> Either E A) : Either E AA left value handed to recover; a right value stays.
Either.traverse
Section titled “Either.traverse”def traverse {E : Type} {A : Type} {B : Type} (f : A -> Either E B) (xs : List A) : Either E (List B)f on every element, the results in a right; the first left otherwise.
Either.sequence
Section titled “Either.sequence”def sequence {E : Type} {A : Type} (xs : List (Either E A)) : Either E (List A)The values of a list of rights; the first left otherwise.
Either.partition
Section titled “Either.partition”def partition {A : Type} {B : Type} (xs : List (Either A B)) : List A * List BThe left values and the right values of a list, each in order.
Either.lefts
Section titled “Either.lefts”def lefts {A : Type} {B : Type} (xs : List (Either A B)) : List AThe left values of a list, in order.
Either.rights
Section titled “Either.rights”def rights {A : Type} {B : Type} (xs : List (Either A B)) : List BThe right values of a list, in order.
Either.toOption
Section titled “Either.toOption”def toOption {A : Type} {B : Type} (e : Either A B) : Option BThe right value, if there is one.
Either.ofOption
Section titled “Either.ofOption”def ofOption {A : Type} {B : Type} (missing : A) (o : Option B) : Either A BA present value as a right, an absent one as left missing.
Either.merge
Section titled “Either.merge”def merge {A : Type} (e : Either A A) : AThe value, whichever side it is on.
Either.bimapIdentity
Section titled “Either.bimapIdentity”def bimapIdentity {A : Type} {B : Type} (e : Either A B) : bimap (fun (a : A) => a) (fun (b : B) => b) e = eMapping both sides with identities changes nothing.
Either.bimapCompose
Section titled “Either.bimapCompose”def bimapCompose {A : Type} {B : Type} {C : Type} {D : Type} {E : Type} {F : Type} (f : A -> C) (f2 : C -> E) (g : B -> D) (g2 : D -> F) (e : Either A B) : bimap f2 g2 (bimap f g e) = bimap (fun (a : A) => f2 (f a)) (fun (b : B) => g2 (g b)) eMapping both sides twice is mapping with the compositions.
Either.bimapSplits
Section titled “Either.bimapSplits”def bimapSplits {A : Type} {B : Type} {C : Type} {D : Type} (f : A -> C) (g : B -> D) (e : Either A B) : bimap f g e = mapRight g (mapLeft f e)Mapping both sides is mapping the left, then the right.
Either.swapSidesTwice
Section titled “Either.swapSidesTwice”def swapSidesTwice {A : Type} {B : Type} (e : Either A B) : swapSides (swapSides e) = eSwapping twice gives the value back.
Either.foldBimap
Section titled “Either.foldBimap”def foldBimap {A : Type} {B : Type} {C : Type} {D : Type} {E : Type} (f : A -> C) (g : B -> D) (h : C -> E) (k : D -> E) (e : Either A B) : fold h k (bimap f g e) = fold (fun (a : A) => h (f a)) (fun (b : B) => k (g b)) eFolding after mapping is folding with the compositions.
Either.bindRight
Section titled “Either.bindRight”def bindRight {E : Type} {A : Type} {B : Type} (a : A) (f : A -> Either E B) : bind (right a) f = f aChaining a right into f is f of its value.
Either.bindIntoRight
Section titled “Either.bindIntoRight”def bindIntoRight {E : Type} {A : Type} (e : Either E A) : bind e (fun (a : A) => right a) = eChaining into right changes nothing.
Either.bindAssociative
Section titled “Either.bindAssociative”def bindAssociative {E : Type} {A : Type} {B : Type} {C : Type} (e : Either E A) (f : A -> Either E B) (g : B -> Either E C) : bind (bind e f) g = bind e (fun (a : A) => bind (f a) g)Chaining is associative.