Module monadic.option
Basic Option monad, also known as Maybe monad
See Option Type on Wikipedia
Functions
Name | Description |
---|---|
isNone(option)
|
Checks if object is None. |
isSome(option)
|
Checks if object is Some. |
map(option)
|
Calls fun on value of Some or returns self if called on None. This is used to create chains of transformations, which might be stopped at any point when None is returned. |
unwrap(option)
|
Takes a value out of Some and casts it into a T type. Raises CannotUnwrapNone exception if called on None. |
unwrapOr(option, defaultValue)
|
Same as unwrap, but returns defaultValue if unwrap is not possible (called on None or type mismatch). |
Classes
Name | Description |
---|---|
CannotUnwrapNone
|
Exception thrown when unwrap is called on None
|