ensure

inline fun <A> Option<A>.ensure(error: () -> Unit, predicate: (A) -> Boolean): Option<A>


inline fun <A, B> Either<A, B>.ensure(error: () -> A, predicate: (B) -> Boolean): Either<A, B>

Deprecated

This API is considered redundant. If this method is crucial for you, please let us know on the Arrow Github. Thanks! https://github.com/arrow-kt/arrow/issues Prefer if-else statement inside either DSL, or replace with explicit flatMap

Replace with

flatMap { b -> b.takeIf(predicate)?.right() ?: default().left() }