fold

suspend fun <R, A, B> Effect<R, A>.fold(error: suspend (error: Throwable) -> B, recover: suspend (raised: R) -> B, transform: suspend (value: A) -> B): B

invoke the Effect and fold the result:

This method should never be wrapped in try/catch as it will not throw any unexpected errors, it will only result in CancellationException, or fatal exceptions such as OutOfMemoryError.


suspend fun <R, A, B> Effect<R, A>.fold(recover: suspend (raised: R) -> B, transform: suspend (value: A) -> B): B
inline fun <R, A, B> EagerEffect<R, A>.fold(error: (error: Throwable) -> B, recover: (raised: R) -> B, transform: (value: A) -> B): B
inline fun <R, A, B> EagerEffect<R, A>.fold(recover: (R) -> B, transform: (A) -> B): B
@JvmName(name = "_foldOrThrow")
inline fun <R, A, B> fold(program: Raise<R>.() -> A, recover: (raised: R) -> B, transform: (value: A) -> B): B
@JvmName(name = "_fold")
inline fun <R, A, B> fold(program: Raise<R>.() -> A, error: (error: Throwable) -> B, recover: (raised: R) -> B, transform: (value: A) -> B): B