Liking cljdoc? Tell your friends :D

monnit.core

A library of Functors, Monads and other category theory abstractions.

A library of Functors, Monads and other category theory abstractions.

Alternativeprotocol

A generalization of or.

A generalization of `or`.
alt
(alt self other)

Return self unless it is considered a failure; otherwise return other.

Return `self` unless it is considered a failure; otherwise return `other`.

sourceraw docstring

flat-map

(flat-map f mv)

For a Monad mv (of type T<a>), call the function f (of type a -> T<b>) on the contained values and combine the results back into on result (of type T<b>).

For a [[Monad]] `mv` (of type T<a>), call the function `f` (of type `a -> T<b>`)
on the contained values and combine the results back into on result (of type `T<b>`).
sourceraw docstring

fmap

(fmap f a)
(fmap f a b)
(fmap f a b c)
(fmap f a b c d)
(fmap f a b c d & args)

Map the function f over the Functor-implementing arguments, producing a new value of the same Functor type.

Map the function `f` over the [[Functor]]-implementing arguments, producing
a new value of the same [[Functor]] type.
sourceraw docstring

Functorprotocol

A type whose 'contents' can be mapped with a function, producing a new value of the same type.

A type whose 'contents' can be mapped with a function, producing a new value
of the same type.
-fmap
(-fmap a f)
(-fmap a f b)
(-fmap a f b c)
(-fmap a f b c d)
(-fmap a f b c d args)

fmap with the first Functor value first. An implementation detail, call fmap instead.

[[fmap]] with the first [[Functor]] value first. An implementation
detail, call [[fmap]] instead.

sourceraw docstring

mletmacro

(mlet bindings & body)

A convenience macro similar to let, for and Haskell do-notation:

(mlet [a (foo 0)
        b (bar a)
        :let [c (+ a b)]]
   (monnit.state/pure c))
=>
(bind (foo 0)
       (fn [a] (bind (bar a)
                     (fn [b] (let [c (+ a b)]
                               (monnit.state/pure c))))))
A convenience macro similar to `let`, `for` and Haskell `do`-notation:

```
(mlet [a (foo 0)
        b (bar a)
        :let [c (+ a b)]]
   (monnit.state/pure c))
=>
(bind (foo 0)
       (fn [a] (bind (bar a)
                     (fn [b] (let [c (+ a b)]
                               (monnit.state/pure c))))))
```
sourceraw docstring

Monadprotocol

A type whose 'contents' can be mapped with a function to other values of the containing type and then combined. When implementing this on a type, you should also implement pure for that type.

A type whose 'contents' can be mapped with a function to other values of the containing
type and then combined. When implementing this on a type, you should also implement
[[pure]] for that type.
bind
(bind self f)

flat-map, but with the Monad value first.

[[flat-map]], but with the [[Monad]] value first.

sourceraw docstring

puremultimethod

(pure type v)

Wrap v into the Monad type. If you know type statically as is usually the case, prefer calling its pure (e.g. monnit.state/pure) directly.

Wrap `v` into the [[Monad]] `type`. If you know `type` statically as is usually the case,
prefer calling its `pure` (e.g. [[monnit.state/pure]]) directly.
sourceraw docstring

sconcat

(sconcat a)
(sconcat a b)
(sconcat a b c)
(sconcat a b c d)
(sconcat a b c d & args)

Combine the arguments with their Semigroup combination operation.

Combine the arguments with their [[Semigroup]] combination operation.
sourceraw docstring

Semigroupprotocol

A type whose values can be combined with an associative binary operation.

A type whose values can be combined with an associative binary operation.
-sconcat
(-sconcat self b)
(-sconcat self b c)
(-sconcat self b c d)
(-sconcat self b c d args)

Combine self with the other arguments, left to right. An implementation detail, call sconcat instead.

Combine `self` with the other arguments, left to right. An implementation
detail, call [[sconcat]] instead.

sourceraw docstring

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

× close