bimap
Apply fa
if this is a Left or Both to A
and apply fb
if this is Right or Both to B
Example:
import arrow.core.Ior
fun main() {
Ior.Right(12).bimap ({ "flower" }, { 12 }) // Result: Right(12)
Ior.Left(12).bimap({ "flower" }, { 12 }) // Result: Left("flower")
Ior.Both(12, "power").bimap ({ it * 2 }, { b -> "flower $b" }) // Result: Both("flower power", 24)
}
Content copied to clipboard