OptionOps2

final
class OptionOps2[A](self: Option[A])
class Object
trait Matchable
class Any

Type members

Classlikes

final
class Conditional[X]
final
class Fold[X]

Value members

Concrete methods

final
def ?[X](s: => X): Conditional[X]

Ternary operator. Note that the arguments s and n are call-by-name.

Ternary operator. Note that the arguments s and n are call-by-name.

Example

option ? "defined" | "undefined"
final
def some[X](s: A => X): Fold[X]

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 scalaz.syntax.std.OptionOps#cata

Example:

o.some(_ * 2).none(0)