arrow-core-data / arrow.core / kotlin.collections.Iterable / unalign
fun <A, B>
Iterable
<
Ior
<A, B>>.unalign():
Pair
<
List
<A>,
List
<B>>
splits a union into its component parts.
import arrow.core.*
fun main(args: Array<String>) {
//sampleStart
val result =
listOf(("A" to 1).bothIor(), ("B" to 2).bothIor(), "C".leftIor())
.unalign()
//sampleEnd
println(result)
}
inline fun <A, B, C>
Iterable
<C>.unalign(fa: (C) ->
Ior
<A, B>):
Pair
<
List
<A>,
List
<B>>
after applying the given function, splits the resulting union shaped structure into its components parts
import arrow.core.*
fun main(args: Array<String>) {
//sampleStart
val result =
listOf(1, 2, 3).unalign {
it.leftIor()
}
//sampleEnd
println(result)
}
Do you like Arrow?
✖