Ternary operator.
Ternary operator. Note that the arguments s and n are call-by-name.
Example
option ? "defined" | "undefined"
Catamorphism over the option.
Catamorphism over the option. Returns the provided function some
applied to item contained in the Option
if it is defined, otherwise, the provided value none
.
Returns the item contained in the Option if it is defined, otherwise, raises an error with the provided message.
Alias for cata
Returns the given value if None, otherwise lifts the Some value and passes it to the given function.
Returns the given value if None, otherwise lifts the Some value to Option and passes it to the given function.
Executes the provided side effect if the Option if it is undefined.
Returns a Done iteratee with the given value if the Option is not defined, otherwise runs the given function.
Returns the item contained in the Option wrapped in type M if the Option is defined, otherwise, the empty value for type M.
Returns the provided function s
applied to item contained in the Option if it is defined,
otherwise, the provided value n
.
Returns the provided function s
applied to item contained in the Option if it is defined,
otherwise, the provided value n
.
This is a syntactic alternative to { @link scalaz.OptionW # cata }
Example:
option.some(_ * 2).none(0)
Returns the item contained in the Option if it is defined, otherwise, the zero element for the type A
Returns the item contained in the Option if it is defined, otherwise, the zero element for the type A
For example:
val o: Option = None val a: List[String] = ~o
Returns the item contained in the Option if it is defined, otherwise, the provided argument.