ensureNotNull

suspend fun <R, B : Any> ContEffect<R>.ensureNotNull(value: B?, shift: () -> R): B

Ensure that value is not null. if it's non-null it will be smart-casted and returned if it's false it will shift with the provided value R. Monadic version of kotlin.requireNotNull.

suspend fun test() = checkAll(Arb.string(), Arb.int().orNull()) { failure, int: Int? ->
cont<String, Int> {
ensureNotNull(int) { failure }
}.toEither() shouldBe (int?.right() ?: failure.left())
}

suspend fun <B : Any> ContEffect<None>.ensureNotNull(value: B?): B