//arrow-core/arrow.core.continuations/EagerEffect
common interface EagerEffect<R, A>
RestrictsSuspension version of Effect. This version runs eagerly, and can be used in non-suspending code. An effect computation interoperates with an EagerEffect via bind
.
common
arrow.core.continuations.Effect |
Name | Summary |
---|---|
attempt | common open fun attempt(): EagerEffect<R, Result<A» |
flatMap | common open fun <B> flatMap(f: (A) -> EagerEffect<R, B>): EagerEffect<R, B> |
fold | common abstract fun <B> fold(recover: (R) -> B, transform: (A) -> B): B Runs the non-suspending computation by creating a Continuation with an EmptyCoroutineContext, and running the fold function over the computation.common open fun <B> fold(error: (error: Throwable) -> B, recover: (R) -> B, transform: (A) -> B): B Like fold but also allows folding over any unexpected Throwable that might have occurred. |
handleError | common open fun handleError(f: (R) -> A): EagerEffect<Nothing, A> |
handleErrorWith | common open fun <R2> handleErrorWith(f: (R) -> EagerEffect<R2, A>): EagerEffect<R2, A> |
map | common open fun <B> map(f: (A) -> B): EagerEffect<R, B> |
orNull | common open fun orNull(): A? fold the EagerEffect into an A?. Where the shifted value R is mapped to null, and result value A. |
redeem | common open fun <B> redeem(f: (R) -> B, g: (A) -> B): EagerEffect<Nothing, B> |
redeemWith | common open fun <R2, B> redeemWith(f: (R) -> EagerEffect<R2, B>, g: (A) -> EagerEffect<R2, B>): EagerEffect<R2, B> |
toEither | common open fun toEither(): Either<R, A> fold the EagerEffect into an Either. Where the shifted value R is mapped to Either.Left, and result value A is mapped to Either.Right. |
toIor | common open fun toIor(): Ior<R, A> fold the EagerEffect into an Ior. Where the shifted value R is mapped to Ior.Left, and result value A is mapped to Ior.Right. |
toOption | common open fun toOption(orElse: (R) -> Option<A>): Option<A> fold the EagerEffect into an Option. Where the shifted value R is mapped to Option by the provided function orElse, and result value A is mapped to Some. |
toValidated | common open fun toValidated(): Validated<R, A> fold the EagerEffect into an Validated. Where the shifted value R is mapped to Validated.Invalid, and result value A is mapped to Validated.Valid. |
Name | Summary |
---|---|
toOption | common fun <A> EagerEffect<None, A>.toOption(): Option<A> |
toResult | common fun <A> EagerEffect<Throwable, A>.toResult(): Result<A> |
Do you like Arrow?
✖