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]>
(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.
(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.
(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.
(either-transformer inner-monad)
The Either transformer constructor.
The Either transformer constructor.
(either? v)
Return true in case of v
is instance
of Either monad.
Return true in case of `v` is instance of Either monad.
Given a collection of either, return the first value that is left
Given a collection of either, return the first value that is left
Given a collection of either, return the first value that is right
Given a collection of either, return the first value that is right
(from-either mv)
Return inner value of either monad.
This is a specialized version of cats.core/extract
for Either monad.
The use of this function is DEPRECATED and
cats.core/extract
should be used.
Return inner value of either monad. This is a specialized version of `cats.core/extract` for Either monad. The use of this function is DEPRECATED and `cats.core/extract` should be used.
(invert e)
Convert a left to a right or viceversa, preserving content.
Convert a left to a right or viceversa, preserving content.
(left? v)
Return true if v
is an instance
of Left type.
Return true if `v` is an instance of Left type.
Given a collection of eithers, return only the values that are left.
Given a collection of eithers, return only the values that are left.
(right? v)
Return true if v
is an instance
of Right type.
Return true if `v` is an instance of Right type.
Given a collection of eithers, return only the values that are left.
Given a collection of eithers, return only the values that are left.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close