tur/option
some
(some [x])
wrap a value in a some option.
| x | the value to wrap |
Since: Phase B1
none
(none)
return the none option (NULL).
Since: Phase B1
some?
(some? [o] :bool)
check whether an option contains a value.
| o | the option to test |
Since: Phase B1
option-unwrap
(option-unwrap [o] :int)
extract the value from a some option, panicking if none.
| o | the option to unwrap |
Since: Phase B1
option-free
(option-free [o])
free the heap memory for an option value.
| o | the option to free (may be none / NULL) |
Since: Phase B1
option-must
(option-must [o :ptr<void>] :int)
unwrap a some option or panic with a default message.
| o | the option to unwrap (:ptr<void>) |
Since: Phase R4
option-expect
(option-expect [o :ptr<void> msg :cstr] :int)
unwrap a some option or panic with a caller-supplied message.
| o | the option to unwrap (:ptr<void>) | |
| msg | the panic message (:cstr) |
Since: Phase R4
Foldable[option]
(definstance Foldable [option])
Foldable: foldl and foldr over the contained value.
Functor[option]
(definstance Functor [option])
Functor: fmap over the contained value.
Applicative[option]
(definstance Applicative [option])
Applicative: pure and ap.
Monad[option]
(definstance Monad [option])
Monad: bind (flat-map over the contained value).
Foldable[option]
(definstance Foldable [option])
Traversable[option]
(definstance Traversable [option])
Traversable: traverse with an Applicative.
Alternative[option]
(definstance Alternative [option])
Alternative: empty and alt-or.
option-eq?
(option-eq? [o1 o2 cmp-fn] :bool)
compare two options using a caller-supplied comparator.
| o1 | first option | |
| o2 | second option | |
| cmp-fn | comparator of type fn [a :int b :int] :bool |
Since: Phase E1
Eq[option]
(definstance Eq [option])
Eq: structural equality via option-eq?.
Clone[option]
(definstance Clone [option])
Clone: deep copy of the option struct.
Internal definitions
__foldable_option_foldl-- SINCE: Phase HKT ยง6__foldable_option_foldr-- foldr implementation for the option Foldable instance.__functor_option_fmap-- SINCE: Phase HKT H3__applicative_option_pure-- pure implementation for the option Applicative instance.__applicative_option_ap-- ap implementation for the option Applicative instance.__monad_option_bind-- bind implementation for the option Monad instance.__foldable_option_foldl__foldable_option_foldr__traversable_option_traverse-- traverse implementation for the option Traversable instance.__alternative_option_empty-- empty implementation for the option Alternative instance.__alternative_option_alt_or-- alt-or implementation for the option Alternative instance.__clone_option_clone-- clone implementation for the option Clone instance.