-
Notifications
You must be signed in to change notification settings - Fork 0
maybe
Ivan Pidhurskyi edited this page Nov 26, 2025
·
1 revision
type maybe(T) = Some(T) | Nothing()
Represents an optional value that may or may not be present.
Constructors:
-
Some(value)- Wraps a value -
Nothing()- Represents absence of value
Operations:
-
unpack(maybe)- Extract value or raise error if Nothing -
expect(maybe, message)- Extract value or raise error with custom message -
unpack_or(maybe, default)- Extract value or return default if Nothing -
bool(maybe)- Convert to boolean (truefor Some,falsefor Nothing)