onNone

inline fun onNone(action: () -> Unit): Option<A>(source)

The given function is applied as a fire and forget effect if this is a None. When applied the result is ignored and the original None value is returned

Example:

import arrow.core.Some
import arrow.core.none

fun main() {
Some(12).onNone { println("flower") } // Result: Some(12)
none<Int>().onNone { println("flower") } // Result: prints "flower" and returns: None
}