commonMain.extensions.EitherFold.kt Maven / Gradle / Ivy
package com.javiersc.either.extensions
import com.javiersc.either.Either
/** Fold an Either with left and right callbacks */
public fun Either.fold(left: (L) -> Unit, right: (R) -> Unit): Unit =
when (this) {
is Either.Left -> left(this.left)
is Either.Right -> right(this.right)
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy