sequence

fun <A, B, C> Either<A, Validated<B, C>>.sequence(): Validated<B, Either<A, C>>
fun <A, B> Ior<A, Iterable<B>>.sequence(): List<Ior<A, B>>
fun <A, B, C> Ior<A, Either<B, C>>.sequence(): Either<B, Ior<A, C>>
fun <A, B> Ior<A, Option<B>>.sequence(): Option<Ior<A, B>>
fun <A, B> Ior<A, B?>.sequence(): Ior<A, B>?
fun <A, B, C> Ior<A, Validated<B, C>>.sequence(): Validated<B, Ior<A, C>>
fun <E, A> Iterable<Either<E, A>>.sequence(): Either<E, List<A>>
fun <E, A> Iterable<Validated<E, A>>.sequence(semigroup: Semigroup<E>): Validated<E, List<A>>
fun <A> Iterable<A?>.sequence(): List<A>?
fun <E, A> Sequence<Either<E, A>>.sequence(): Either<E, List<A>>
fun <E, A> Sequence<Validated<E, A>>.sequence(semigroup: Semigroup<E>): Validated<E, List<A>>
fun <E, A, B> Validated<A, Either<E, B>>.sequence(): Either<E, Validated<A, B>>
fun <A, B> Validated<A, B?>.sequence(): Validated<A, B>?
fun <K, E, A> Map<K, Either<E, A>>.sequence(): Either<E, Map<K, A>>
fun <K, E, A> Map<K, Validated<E, A>>.sequence(semigroup: Semigroup<E>): Validated<E, Map<K, A>>
fun <K, V> Map<K, Option<V>>.sequence(): Option<Map<K, V>>


fun <A, B> Either<A, Iterable<B>>.sequence(): List<Either<A, B>>

Deprecated

Prefer Kotlin nullable syntax inside either DSL, or replace with explicit fold

Replace with

import arrow.core.right
fold({ emptyList() }, { iterable -> iterable.map { it.right() } })

fun <A, B> Either<A, Option<B>>.sequence(): Option<Either<A, B>>

Deprecated

Prefer Kotlin nullable syntax inside either DSL, or replace with explicit fold

Replace with

import arrow.core.toOption
import arrow.core.right
import arrow.core.left
orNull()?.orNull()?.right().toOption()

fun <A, B> Either<A, B?>.sequence(): Either<A, B>?

Deprecated

Prefer Kotlin nullable syntax

Replace with

import arrow.core.right
orNull()?.right()

Deprecated

Prefer using the Option DSL, or explicit fold or when

Replace with

import arrow.core.Some
fold({ emptyList() }) { a -> fa(a).map(::Some) }

fun <A, B> Option<Either<A, B>>.sequence(): Either<A, Option<B>>

Deprecated

This API is niche and will be removed in the future. If this method is crucial for you, please let us know on the Arrow Github. Thanks! https://github.com/arrow-kt/arrow/issues Prefer using the Option DSL, or explicit fold or when

Replace with

import arrow.core.Either.Right
import arrow.core.None
import arrow.core.Some
fold({ Right(None) }) { a -> fa(a).map(::Some) }

Deprecated

This API is niche and will be removed in the future. If this method is crucial for you, please let us know on the Arrow Github. Thanks! https://github.com/arrow-kt/arrow/issues Prefer using the Option DSL, or explicit fold or when

Replace with

import arrow.core.Valid
import arrow.core.None
import arrow.core.Some
fold({ Valid(None) }) { a -> fa(a).map(::Some) }