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]>
branch
(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.
branch-left
(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.
branch-right
(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.
map->Left
(map->Left m__7585__auto__)
Factory function for class cats.monad.either.Left, taking a map of keywords to field values.
map->Right
(map->Right m__7585__auto__)
Factory function for class cats.monad.either.Right, taking a map of keywords to field values.
try-either
macro
(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.