Package arrow. core
Types
NonEmptyList
is a data type used in Λrrow to model ordered lists that guarantee to have at least one value.
If you have worked with Java at all in the past, it is very likely that you have come across a NullPointerException
at some time (other languages will throw similarly named errors in such a case). Usually this happens because some method returns null
when you weren't expecting it and, thus, isn't dealing with that possibility in your client code. A value of null
is often abused to represent an absent optional value. Kotlin tries to solve the problem by getting rid of null
values altogether, and providing its own special syntax Null-safety machinery based on ?
.
Functions
Combines two structures by taking the union of their shapes and using Ior to hold the elements.
Combines two structures by taking the union of their shapes and combining the elements with the given function.
Catch allows for transforming Throwable in the Either.Left side. This API is the same as recover, but offers the same APIs for working over Throwable as Effect&EagerEffect.
Returns an Option containing all elements that are instances of specified type parameter B.
Returns a Map containing all elements that are instances of specified type parameter R.
If this
is valid return this
, otherwise if that
is valid return that
, otherwise combine the failures. This is similar to orElse except that here failures are accumulated.
Returns the first element as Some(element), or None if the iterable is empty.
Returns the first element as Some(element) matching the given predicate, or None if element was not found.
Map, or transform, the right value B of this Either into a new Either with a right value of type C. Returns a new Either with either the original left value of type A or the newly transformed right value of type C.
Binds the given function across Ior.Right.
Returns the option's value if the option is nonempty, otherwise return the result of evaluating default
.
Return the Valid value, or the default if Invalid
Applies the given function f
if this is a Left, otherwise returns this if this is a Right. This is like flatMap
for the exception.
Logical conditional. The equivalent of Prolog's soft-cut. If its first argument succeeds at all, then the results will be fed into the success branch. Otherwise, the failure branch is taken.
Returns the last element as Some(element), or None if the iterable is empty.
Returns the last element as Some(element) matching the given predicate, or None if no such element was found.
Returns a List> containing the zipped values of the two lists with null for padding on the left.
Returns a Sequence> containing the zipped values of the two sequences with null for padding on the left.
Returns a List containing the result of applying some transformation (A?, B) -> C
on a zip, excluding all cases where the right value is null.
Returns a Sequence containing the result of applying some transformation (A?, B) -> C
on a zip, excluding all cases where the right value is null.
Extractor of non-fatal Throwable. Will not match fatal errors like VirtualMachineError
(for example, OutOfMemoryError
and StackOverflowError
, subclasses of VirtualMachineError
), ThreadDeath
, LinkageError
, InterruptedException
. This will also not match CancellationException since that's a fatal exception in Kotlin for cancellation purposes.
Returns the Throwable if NonFatal and throws it otherwise.
Returns this option's if the option is nonempty, otherwise returns another option provided lazily by default
.
Return this if it is Valid, or else fall back to the given default. The functionality is similar to that of findValid except for failure accumulation, where here only the error on the right is preserved and the error on the left is ignored.
Returns a List> containing the zipped values of the two lists with null for padding.
Align two structures as in zip, but filling in blanks with null.
Returns a Sequence> containing the zipped values of the two sequences with null for padding.
Returns a List containing the result of applying some transformation (A?, B?) -> C
on a zip.
Returns a Sequence containing the result of applying some transformation (A?, B?) -> C
on a zip.
Compose both:
Returns a List> containing the zipped values of the two lists with null for padding on the right.
Returns a Sequence> containing the zipped values of the two sequences with null for padding on the right.
Returns a List containing the result of applying some transformation (A, B?) -> C
on a zip, excluding all cases where the left value is null.
Returns a Sequence containing the result of applying some transformation (A, B?) -> C
on a zip, excluding all cases where the left value is null.
aligns two structures and combine them with the given Semigroup.combine
aligns two structures and combine them with the given Semigroups '+'
Separate the inner Either value into the Either.Left and Either.Right.
Separate the inner Either values into the Either.Left and Either.Right.
Separate the inner Validated value into the Validated.Invalid and Validated.Valid.
Separate the inner Validated values into the Validated.Invalid and Validated.Valid.
Returns single element as Some(element), or None if the iterable is empty or has more than one element.
Returns the single element as Some(element) matching the given predicate, or None if element was not found or more than one element was found.
splits a union into its component parts.
Splits a union into its component parts.
splits an union into its component parts.
after applying the given function, splits the resulting union shaped structure into its components parts
unzips the structure holding the resulting elements in an Pair
Unzips the structure holding the resulting elements in an Pair
after applying the given function unzip the resulting structure into its elements.
After applying the given function unzip the resulting structure into its elements.
Given A is a sub type of B, re-type this value from Iterable to Iterable
Given A is a sub type of B, re-type this value from Sequence to Sequence
Combines to structures by taking the intersection of their shapes and using Pair
to hold the elements.
Combines to structures by taking the intersection of their shapes and combining the elements with the given function.