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

eitherclj/s

source

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

Leftclj/s

source

leftclj/s

(left)
(left v)

A Left type constructor.

A Left type constructor.
sourceraw 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.
sourceraw 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.
sourceraw docstring

(right)
(right v)

A Right type constructor.

A Right type constructor.
sourceraw docstring

source

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

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

× close