3.11 option
Usage:
include option
import option as ...
3.11.1 The Option Datatype
3.11.2 Option Methods
For none, returns none. For some, applies f to the value field and returns a new some with the updated value.
Examples:
check: add1 = lam(n): n + 1 end n = none n.and-then(add1) is none s = some(5) s.and-then(add1) is some(6) end
For none, returns v. For some, returns the value field. Useful for providing default values.
Examples:
check: n = none n.or-else(42) is 42 s = some(5) s.or-else(10) is 5 end