The Maybe monad implementation and helpers functions for working with maybe related types.
(require '[cats.monad.maybe :as maybe])
(maybe/just 1)
;; => #<Just [1]>
The Maybe monad implementation and helpers functions for working with maybe related types. (require '[cats.monad.maybe :as maybe]) (maybe/just 1) ;; => #<Just [1]>
(from-maybe mv)
(from-maybe mv default)
Return inner value from maybe monad.
This is a specialized version of cats.core/extract
for Maybe monad types that allows set up
the default value.
Let see some examples:
(from-maybe (just 1))
;=> 1
(from-maybe (nothing))
;=> nil
(from-maybe (nothing) 42)
;=> 42
Return inner value from maybe monad. This is a specialized version of `cats.core/extract` for Maybe monad types that allows set up the default value. Let see some examples: (from-maybe (just 1)) ;=> 1 (from-maybe (nothing)) ;=> nil (from-maybe (nothing) 42) ;=> 42
(just)
(just v)
A Just type constructor.
Without arguments it returns a Just instance with nil as wrapped value.
A Just type constructor. Without arguments it returns a Just instance with nil as wrapped value.
(just? v)
Returns true if v
is an instance
of Just
type.
Returns true if `v` is an instance of `Just` type.
(maybe-transformer inner-monad)
The maybe transformer constructor.
The maybe transformer constructor.
(maybe? v)
Return true in case of v
is instance
of Maybe monad.
Return true in case of `v` is instance of Maybe monad.
(nothing? v)
Returns true if v
is an instance
of Nothing
type or is nil.
Returns true if `v` is an instance of `Nothing` type or is nil.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close