ensure

open suspend fun ensure(value: Boolean)

Ensure check if the value is true, and if it is it allows the nullable { } binding to continue. In case it is false, then it short-circuits the binding and returns null.

import arrow.core.computations.nullable

//sampleStart
suspend fun main() {
nullable<Int> {
ensure(true)
println("ensure(true) passes")
ensure(false)
1
}
//sampleEnd
.let(::println)
}
// println: "ensure(true) passes"
// res: null