//arrow-core/arrow.core/Some

Some

common data class Some<out T>(val value: T) : Option<T>

Constructors

   
Some common fun <out T> Some(value: T)

Types

Name Summary
Companion common object Companion

Functions

Name Summary
align common infix fun <B> align(b: Option<B>): Option<Ior<T, B»
Align two options (this on the left and b on the right) as one Option of Ior.
common inline fun <B, C> align(b: Option<B>, f: (Ior<T, B>) -> C): Option<C>
Align two options (this on the left and b on the right) as one Option of Ior, and then, if it’s not None, map it using f.
all common inline fun all(predicate: (T) -> Boolean): Boolean
Returns true if this option is empty ‘'’or’’’ the predicate $predicate returns true when applied to this $option’s value.
and common infix fun <X> and(value: Option<X>): Option<X>
crosswalk common inline fun <B> crosswalk(f: (T) -> Option<B>): Option<Option<B»
crosswalkMap common inline fun <K, V> crosswalkMap(f: (T) -> Map<K, V>): Map<K, Option<V»
crosswalkNull common inline fun <B> crosswalkNull(f: (T) -> B?): Option<B>?
exists common inline fun exists(predicate: (T) -> Boolean): Boolean
Returns true if this option is nonempty ‘'’and’’’ the predicate $p returns true when applied to this $option’s value. Otherwise, returns false.
filter common inline fun filter(predicate: (T) -> Boolean): Option<T>
Returns this $option if it is nonempty ‘'’and’’’ applying the predicate $p to this $option’s value returns true. Otherwise, return $none.
filterNot common inline fun filterNot(predicate: (T) -> Boolean): Option<T>
Returns this $option if it is nonempty ‘'’and’’’ applying the predicate $p to this $option’s value returns false. Otherwise, return $none.
findOrNull common inline fun findOrNull(predicate: (T) -> Boolean): T?
Returns the $option’s value if this option is nonempty ‘'’and’’’ the predicate $p returns true when applied to this $option’s value. Otherwise, returns null.
flatMap common inline fun <B> flatMap(f: (T) -> Option<B>): Option<B>
Returns the result of applying $f to this $option’s value if this $option is nonempty. Returns $none if this $option is empty. Slightly different from map in that $f is expected to return an $option (which could be $none).
fold common inline fun <R> fold(ifEmpty: () -> R, ifSome: (T) -> R): R
foldLeft common inline fun <B> foldLeft(initial: B, operation: (B, T) -> B): B
foldMap common inline fun <B> foldMap(MB: Monoid<B>, f: (T) -> B): B
isDefined common fun isDefined(): Boolean
Returns true if the option is an instance of Some, false otherwise.
isEmpty common open override fun isEmpty(): Boolean
Returns true if the option is None, false otherwise.
isNotEmpty common fun isNotEmpty(): Boolean
map common inline fun <B> map(f: (T) -> B): Option<B>
Returns a Some<$B> containing the result of applying $f to this $option’s value if this $option is nonempty. Otherwise return $none.
mapNotNull common inline fun <B> mapNotNull(f: (T) -> B?): Option<B>
Returns $none if the result of applying $f to this $option’s value is null. Otherwise returns the result.
nonEmpty common fun nonEmpty(): Boolean
alias for isDefined
orNull common fun orNull(): T?
padZip common fun <B> padZip(other: Option<B>): Option<Pair<T?, B
inline fun <B, C> padZip(other: Option<B>, f: (T?, B?) -> C): Option<C>
pairLeft common fun <L> pairLeft(left: L): Option<Pair<L, T»
pairRight common fun <R> pairRight(right: R): Option<Pair<T, R»
reduceOrNull common inline fun <B> reduceOrNull(initial: (T) -> B, operation: (B, T) -> B): B?
reduceRightEvalOrNull common inline fun <B> reduceRightEvalOrNull(initial: (T) -> B, operation: (T, acc: Eval<B>) -> Eval<B>): Eval<B?>
replicate common fun replicate(n: Int): Option<List<T»
tap common inline fun tap(f: (T) -> Unit): Option<T>
The given function is applied as a fire and forget effect if this is a some. When applied the result is ignored and the original Some value is returned
tapNone common inline fun tapNone(f: () -> Unit): Option<T>
The given function is applied as a fire and forget effect if this is a None. When applied the result is ignored and the original None value is returned
toEither common inline fun <L> toEither(ifEmpty: () -> L): Either<L, T>
toList common fun toList(): List<T>
toString common open override fun toString(): String
traverse common inline fun <B> traverse(fa: (T) -> Iterable<B>): List<Option<B»
traverseEither common inline fun <AA, B> traverseEither(fa: (T) -> Either<AA, B>): Either<AA, Option<B»
traverseValidated common inline fun <AA, B> traverseValidated(fa: (T) -> Validated<AA, B>): Validated<AA, Option<B»
void common fun void(): Option<Unit>
zip common fun <B> zip(other: Option<B>): Option<Pair<T, B»
inline fun <B, C> zip(b: Option<B>, map: (T, B) -> C): Option<C>
inline fun <B, C, D> zip(b: Option<B>, c: Option<C>, map: (T, B, C) -> D): Option<D>
inline fun <B, C, D, E> zip(b: Option<B>, c: Option<C>, d: Option<D>, map: (T, B, C, D) -> E): Option<E>
inline fun <B, C, D, E, F> zip(b: Option<B>, c: Option<C>, d: Option<D>, e: Option<E>, map: (T, B, C, D, E) -> F): Option<F>
inline fun <B, C, D, E, F, G> zip(b: Option<B>, c: Option<C>, d: Option<D>, e: Option<E>, f: Option<F>, map: (T, B, C, D, E, F) -> G): Option<G>
inline fun <B, C, D, E, F, G, H> zip(b: Option<B>, c: Option<C>, d: Option<D>, e: Option<E>, f: Option<F>, g: Option<G>, map: (T, B, C, D, E, F, G) -> H): Option<H>
inline fun <B, C, D, E, F, G, H, I> zip(b: Option<B>, c: Option<C>, d: Option<D>, e: Option<E>, f: Option<F>, g: Option<G>, h: Option<H>, map: (T, B, C, D, E, F, G, H) -> I): Option<I>
inline fun <B, C, D, E, F, G, H, I, J> zip(b: Option<B>, c: Option<C>, d: Option<D>, e: Option<E>, f: Option<F>, g: Option<G>, h: Option<H>, i: Option<I>, map: (T, B, C, D, E, F, G, H, I) -> J): Option<J>
inline fun <B, C, D, E, F, G, H, I, J, K> zip(b: Option<B>, c: Option<C>, d: Option<D>, e: Option<E>, f: Option<F>, g: Option<G>, h: Option<H>, i: Option<I>, j: Option<J>, map: (T, B, C, D, E, F, G, H, I, J) -> K): Option<K>

Properties

Name Summary
value common val value: T

Do you like Arrow?

Arrow Org
<