A computation that can fail with an error value; for when there is nothing
exceptional about getting an error and the error should be handled sooner
rather than later (or never). Implements monnit.core/Functor
, monnit.core/Monad
and monnit.core/Alternative
.
A computation that can fail with an error value; for when there is nothing exceptional about getting an error and the error should be handled sooner rather than later (or never). Implements [[monnit.core/Functor]], [[monnit.core/Monad]] and [[monnit.core/Alternative]].
(err error)
Make a Result
that failed with error
.
Make a [[Result]] that failed with `error`.
(ok value)
Make a Result
that succeeded with value
.
Make a [[Result]] that succeeded with `value`.
(pure value)
Make a Result
that succeeded with value
.
Make a [[Result]] that succeeded with `value`.
A computation that can fail with an error value; for when there is nothing
exceptional about getting an error and the error should be handled sooner
rather than later (or never). Implements monnit.core/Functor
, monnit.core/Monad
and monnit.core/Alternative
.
A computation that can fail with an error value; for when there is nothing exceptional about getting an error and the error should be handled sooner rather than later (or never). Implements [[monnit.core/Functor]], [[monnit.core/Monad]] and [[monnit.core/Alternative]].
(err? self)
Is self
an Err
?
Is `self` an [[Err]]?
(ok? self)
Is self
an Ok
?
Is `self` an [[Ok]]?
(result? self)
Is self
a Result
?
Is `self` a [[Result]]?
(run on-error on-success res)
If res
contains an error, call on-error
with the error. If res
is successful,
call on-success
with the contained value.
If `res` contains an error, call `on-error` with the error. If `res` is successful, call `on-success` with the contained value.
(try->result thunk)
Call thunk
with no arguments. If it throws an Exception (clj) or Error (cljs),
catch that and wrap it with err
. Otherwise wrap the result with ok
.
Calls thunk
immediately instead of waiting for run
.
Does not catch non-Exception/Error throwables.
Call `thunk` with no arguments. If it throws an Exception (clj) or Error (cljs), catch that and wrap it with [[err]]. Otherwise wrap the result with [[ok]]. Calls `thunk` immediately instead of waiting for [[run]]. Does not catch non-Exception/Error throwables.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close