Liking cljdoc? Tell your friends :D

cats.monad.maybe

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]>
raw docstring

cat-maybesclj/s

(cat-maybes coll)

Given a collection of maybes, return a sequence of the values that the just's contain.

Given a collection of maybes, return a sequence of the values
that the just's contain.
raw docstring

from-maybeclj/s

(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
raw docstring

Justcljs


justclj/s

(just v)

A Just type constructor.

A Just type constructor.
raw docstring

just?clj/s

(just? v)

Returns true if v is an instance of Just type.

Returns true if `v` is an instance
of `Just` type.
raw docstring

map-maybeclj/s

(map-maybe mf coll)

Given a maybe-returning function and a collection, map the function over the collection returning the values contained in the just values of the resulting collection.

Given a maybe-returning function and a collection, map the function over
the collection returning the values contained in the just values of the
resulting collection.
raw docstring

maybeclj/smacro

(maybe default m f)

Given a default value, a maybe and a function, return the default if the maybe is a nothing; if its a just, apply the function to the value it contains and return the result.

Given a default value, a maybe and a function, return the default if the
maybe is a nothing; if its a just, apply the function to the value it
contains and return the result.
raw docstring

maybe->seqclj/s

(maybe->seq m)

Given a maybe, return an empty seq if its nothing or a one-element seq with its value if its not.

Given a maybe, return an empty seq if its nothing or a one-element seq
with its value if its not.
raw docstring

maybe?clj/s

(maybe? v)

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

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

Nothingcljs


nothingclj/s

(nothing)

A Nothing type constructor.

A Nothing type constructor.
raw docstring

nothing?clj/s

(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.
raw docstring

seq->maybeclj/s

(seq->maybe coll)

Given a collection, return a nothing if its empty or a just with its first element if its not.

Given a collection, return a nothing if its empty or a just with its
first element if its not.
raw docstring

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

× close