base class Option<+T>
Represents an optional value, ie one that may or may not be present. Some(T) represents a value that is present and None() represents a missing value.
Option fulfills a similar role to nullable types in other languages, but in a type-safe way: the programmer must explicitly handle the case of a missing value.
Example:
maybeValue = map.maybeGet(key);
maybeValue match {
| Some(value) -> /* use value */
| None() -> /* key not found, fallback...*/
};
NOTE: As a NBE optimization this implementation is customized in native/FastOption.sk, and the APIs must be kept in sync.
Methods
For Some() values, returns a new Option with the result of applying the mapping function to the contained value. Returns None() when this is None().
For Some() values, returns the results of applying the mapping function to the contained value. Returns None() when this is None().
Returns the result of calling the lambda for a Some() value or nothing
for None() values. Equivalent to option.map(mjust).default(nothing)
Returns the contained value for Some(), otherwise returns the default value.
For Some() values, returns the result of calling the predicate on the contained value. Returns false for None() values.
For Some() values, calls the lambda with the contained value. Does nothing for None() values.