isSome

Returns true if the option is Some, false otherwise.


inline fun isSome(predicate: (A) -> Boolean): Boolean(source)

Returns true if this option is nonempty '''and''' the predicate $p returns true when applied to this $option's value. Otherwise, returns false.

Example:

import arrow.core.Some
import arrow.core.None
import arrow.core.Option

fun main() {
Some(12).isSome { it 10 } // Result: true
Some(7).isSome { it 10 } // Result: false

val none: Option<Int> = None
none.isSome { it 10 } // Result: false
}

Parameters

predicate

the predicate to test