A library of Functors, Monads and other category theory abstractions.
A library of Functors, Monads and other category theory abstractions.
A generalization of or
.
A generalization of `or`.
(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`.
(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>`).
(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)
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.
(mlet bindings & body)
A convenience macro similar to let
, for
and Haskell do
-notation:
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))))))```
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.
(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.
(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.
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 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.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close