Liking cljdoc? Tell your friends :D

monnit.result

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).

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).
raw docstring

Errclj/s≠

cljs

An error Result

An error [[Result]]
sourceraw docstring

errclj/s

(err error)

Make a Result that failed with error.

Make a [[Result]] that failed with `error`.
sourceraw docstring

okclj/s

(ok value)

Make a Result that succeeded with value.

Make a [[Result]] that succeeded with `value`.
sourceraw docstring

Okclj/s≠

cljs

A successful Result

A successful [[Result]]
sourceraw docstring

pureclj/s

(pure value)

Make a Result that succeeded with value.

Make a [[Result]] that succeeded with `value`.
sourceraw docstring

Resultclj/sprotocol

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).

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).

-run-resultclj/s

(-run-result self on-error on-success)

run with the Result first. An implementation detail; call run instead.

[[run]] with the [[Result]] first. An implementation detail; call [[run]]
instead.

err?clj/s

(err? self)

Is self an Err?

Is `self` an [[Err]]?

ok?clj/s

(ok? self)

Is self an Ok?

Is `self` an [[Ok]]?

result?clj/s

(result? self)

Is self a Result?

Is `self` a [[Result]]?
sourceraw docstring

runclj/s

(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.
sourceraw docstring

try->resultclj/s

(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.
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close