All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.extensions.EitherFold.kt Maven / Gradle / Ivy

There is a newer version: 0.1.0-alpha.3
Show newest version
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