OptionSyntax

implicit
class OptionSyntax[V](option: Option[V])

Syntax for treating Options as indicators of success or failure in a computation.

The simplest usage is something like: myOption ~>? "Do I have Some?". The 'value' and log tree of the returned treelog.LogTreeSyntax.DescribedComputation will indicate success or failure depending on the value of myOption.

class Object
trait Matchable
class Any

Value members

Concrete methods

def log(description: String): DescribedComputation[V]

Use the same description whether the Option is Some or None. Equivalent to log(description, description)

Use the same description whether the Option is Some or None. Equivalent to log(description, description)

def log(noneDescription: => String, someDescription: => String): DescribedComputation[V]

Use different descriptions for the Some and None cases.

Use different descriptions for the Some and None cases.

If the option is Some(x) the 'value' of the returned DescribedComputation will be \/-(x), otherwise, the 'value' will be -\/(noneDescription).

def log(noneDescription: => String, someDescription: V => String): DescribedComputation[V]

Use different descriptions for the Some and None cases, providing the boxed Some value to the function used to produce the description for the Some case, so that it can be included in the description if you wish.

Use different descriptions for the Some and None cases, providing the boxed Some value to the function used to produce the description for the Some case, so that it can be included in the description if you wish.

If the option is Some(x) the 'value' of the returned DescribedComputation will be \/-(x), otherwise, the 'value' will be -\/(noneDescription).

def ~>?(description: String): DescribedComputation[V]

Sugar for log(String)

Sugar for log(String)

def ~>?(noneDescription: => String, someDescription: => String): DescribedComputation[V]
def ~>?(noneDescription: => String, someDescription: V => String): DescribedComputation[V]
def ~>|[B](f: V => DescribedComputation[B], dflt: => DescribedComputation[Option[B]]): DescribedComputation[Option[B]]

Return a default treelog.LogTreeSyntax.DescribedComputation if option is a None.

Return a default treelog.LogTreeSyntax.DescribedComputation if option is a None.

If the option is Some(x) the 'value' of the returned DescribedComputation will be \/-(Some(x)), otherwise, the returned treelog.LogTreeSyntax.DescribedComputation will be dflt.