Liking cljdoc? Tell your friends :D

cats.monad.either

The Either monad implementation and helper functions for working with either related types.

Also commonly known as Error monad.

(require '[cats.monad.either :as either])

(either/right 1)
;; => #<Right [1]>

(either/left 1)
;; => #<Left [1]>
The Either monad implementation and helper functions
for working with either related types.

Also commonly known as Error monad.

    (require '[cats.monad.either :as either])

    (either/right 1)
    ;; => #<Right [1]>

    (either/left 1)
    ;; => #<Left [1]>
raw docstring

branchclj/s

(branch e lf rf)

Given an either value and two functions, if the either is a left apply the first function to the value it contains; if the either is a right apply the second function to its value.

Given an either value and two functions, if the either is a
left apply the first function to the value it contains; if the
either is a right apply the second function to its value.
raw docstring

branch-leftclj/s

(branch-left e lf)

Given an either value and a function, if the either is a left, apply the function to the value it contains; if the either is a right, return it.

Given an either value and a function, if the either is a
left, apply the function to the value it contains; if the
either is a right, return it.
raw docstring

branch-rightclj/s

(branch-right e rf)

Either-specific synonym for #'cats.core/bind

Given an either value and a function, if the either is a right, apply the function to the value it contains; if the either is a left, return it.

Either-specific synonym for #'cats.core/bind

Given an either value and a function, if the either is a
right, apply the function to the value it contains; if the
either is a left, return it.
raw docstring

eitherclj/s


either?clj/s

(either? v)

Return true in case of v is instance of Either monad.

Return true in case of `v` is instance
of Either monad.
raw docstring

first-leftclj/s

Given a collection of either, return the first value that is left

Given a collection of either, return the first value that is left
raw docstring

first-rightclj/s

Given a collection of either, return the first value that is right

Given a collection of either, return the first value that is right
raw docstring

invertclj/s

(invert e)

Convert a left to a right or viceversa, preserving content.

Convert a left to a right or viceversa, preserving content.
raw docstring

Leftcljs


leftclj/s

(left)
(left v)

A Left type constructor.

A Left type constructor.
raw docstring

left?clj/s

(left? v)

Return true if v is an instance of Left type.

Return true if `v` is an instance
of Left type.
raw docstring

leftsclj/s

Given a collection of eithers, return only the values that are left.

Given a collection of eithers, return only the values that are left.
raw docstring

(right)
(right v)

A Right type constructor.

A Right type constructor.
raw docstring


right?clj/s

(right? v)

Return true if v is an instance of Right type.

Return true if `v` is an instance
of Right type.
raw docstring

rightsclj/s

Given a collection of eithers, return only the values that are right.

Given a collection of eithers, return only the values that are right.
raw docstring

try-eithercljmacro

(try-either & body)

Try to evalute the body and return the result as an either. If an exception is thrown return the exception as a left, otherwise return the result as a right.

Try to evalute the body and return the result as an either.
If an exception is thrown return the exception as a left,
otherwise return the result as a right.
raw docstring

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

× close