Liking cljdoc? Tell your friends :D

active.clojure.freer-monad

Freer monads.

This is a variant of active.clojure.monad with a more efficient representation for bind.

See http://okmij.org/ftp/Haskell/extensible/index.html for details.

Freer monads.

This is a variant of `active.clojure.monad` with a more efficient
representation for bind.

See http://okmij.org/ftp/Haskell/extensible/index.html for details.
raw docstring

and-finallyclj/s

(and-finally m final-m)

Execute m, and always final-m, no matter if an exception occurs or not.

Execute m, and always final-m, no matter if an exception occurs or not.
sourceraw docstring

apply-continuationsclj/s

(apply-continuations continuations first-result)
(apply-continuations continuations first-result decomposed-queue)

Apply continuations to the result of the first action.

Apply continuations to the result of the first action.
sourceraw docstring

bindclj/s

(bind first-action continuation)

Bind/flatMap for the free monad.

Bind/flatMap for the free monad.
sourceraw docstring

Bindclj/s

source

bind-continuationsclj/s≠

clj
(bind-continuations rec__2619__auto__)
(bind-continuations data__2620__auto__ v__2621__auto__)
cljs
(bind-continuations rec__2304__auto__)
(bind-continuations data__2305__auto__ v__2306__auto__)

Lens for the continuations field from a Bind record. See active.clojure.freer-monad/make-bind.

Lens for the `continuations` field from a [[Bind]] record. See [[active.clojure.freer-monad/make-bind]].
sourceraw docstring

bind-exceptclj/s

(bind-except m handler f)

Evaluate m, and if an exception occurs continue with (handler exception), otherwise with (f value-of-m). Note that neither the handler result is to f, nor exceptions are caught in f.

Evaluate m, and if an exception occurs continue with (handler exception), otherwise with (f value-of-m).
Note that neither the handler result is to f, nor exceptions are caught in f.
sourceraw docstring

bind-first-actionclj/s≠

clj
(bind-first-action rec__2619__auto__)
(bind-first-action data__2620__auto__ v__2621__auto__)
cljs
(bind-first-action rec__2304__auto__)
(bind-first-action data__2305__auto__ v__2306__auto__)

Lens for the first-action field from a Bind record. See active.clojure.freer-monad/make-bind.

Lens for the `first-action` field from a [[Bind]] record. See [[active.clojure.freer-monad/make-bind]].
sourceraw docstring

bind?clj/s

(bind? thing)

Is object a Bind record? See active.clojure.freer-monad/make-bind.

Is object a `Bind` record? See [[active.clojure.freer-monad/make-bind]].
sourceraw docstring

call-ccclj/s

(call-cc f)

Construct a CallCC (Accepts a function f with one argument that returns a monadic value. call-cc packages the current continuation as a function and passes it as an argument to f. If the function is called later, the continuation of that call will be discarded and instead reinstate the continuation that was in effect when the function was created.) record.

f: access via active.clojure.freer-monad/call-cc-f

Construct a `CallCC` (Accepts a function `f` with one argument that
  returns a monadic value.  `call-cc` packages the current continuation as a
  function and passes it as an argument to `f`.  If the function is called
  later, the continuation of that call will be discarded and instead reinstate
  the continuation that was in effect when the function was created.) record.

`f`: access via [[active.clojure.freer-monad/call-cc-f]]
sourceraw docstring

call-cc-fclj/s≠

clj
(call-cc-f rec__2619__auto__)
(call-cc-f data__2620__auto__ v__2621__auto__)
cljs
(call-cc-f rec__2304__auto__)
(call-cc-f data__2305__auto__ v__2306__auto__)

Lens for the f field from a CallCC record. See active.clojure.freer-monad/call-cc.

Lens for the `f` field from a [[CallCC]] record. See [[active.clojure.freer-monad/call-cc]].
sourceraw docstring

call-cc?clj/s

(call-cc? thing)

Is object a CallCC record? See active.clojure.freer-monad/call-cc.

Is object a `CallCC` record? See [[active.clojure.freer-monad/call-cc]].
sourceraw docstring

CallCCclj/s≠

cljs

Accepts a function f with one argument that returns a monadic value. call-cc packages the current continuation as a function and passes it as an argument to f. If the function is called later, the continuation of that call will be discarded and instead reinstate the continuation that was in effect when the function was created.

Accepts a function `f` with one argument that
returns a monadic value.  `call-cc` packages the current continuation as a
function and passes it as an argument to `f`.  If the function is called
later, the continuation of that call will be discarded and instead reinstate
the continuation that was in effect when the function was created.
source (clj)source (cljs)raw docstring

combine-monad-command-configsclj/s

(combine-monad-command-configs & mccs)

Combine a sequence of monad-command configs into one. The earlier entries have precedence.

Combine a sequence of monad-command configs into one.
The earlier entries have precedence.
sourceraw docstring

DecomposedQueuecljs

source

execute-freer-reader-state-exceptionclj/s

(execute-freer-reader-state-exception command-config m & [state])

Run monadic computation in a reader-state-exception monad, turning exceptions into Clojure exceptions.

  • command-config is the configuration object for running commands
  • m is the computation to run
  • state is an optional initial state (from a previous run)

Returns [result state].

Run monadic computation in a reader-state-exception monad, turning exceptions
into Clojure exceptions.

- `command-config` is the configuration object for running commands
- `m` is the computation to run
- `state` is an optional initial state (from a previous run)

Returns [result state].
sourceraw docstring

execute-monadic-swiss-armyclj/s

(execute-monadic-swiss-army command-config m & [state])

Run monadic computation in an almighty monad, turning exceptions into Clojure exceptions. See [[`run-monadic-swiss-army]].

  • command-config is the configuration object for running commands
  • m is the computation to run
  • state is an optional initial state (from a previous run)

Returns [result state].

Run monadic computation in an almighty monad, turning exceptions
into Clojure exceptions.  See [[`run-monadic-swiss-army]].

- `command-config` is the configuration object for running commands
- `m` is the computation to run
- `state` is an optional initial state (from a previous run)

Returns [result state].
sourceraw docstring

get-env-componentclj/s

(get-env-component name)

Retrieve a named component of a map-valued environment.

Retrieve a named component of a map-valued environment.
sourceraw docstring

get-state-componentclj/s

(get-state-component name)

Retrieve a named component of a map-valued state.

Retrieve a named component of a map-valued state.
sourceraw docstring

IDecomposedQueueclj/sprotocol

get-first-continuationclj/s

(get-first-continuation this)

get-rest-continuationsclj/s

(get-rest-continuations this)

set-decomposedclj/s

(set-decomposed this first rest)
source

make-bindclj/s

(make-bind first-action continuations)

Construct a Bind record.

first-action: access via active.clojure.freer-monad/bind-first-action continuations: access via active.clojure.freer-monad/bind-continuations

Construct a `Bind` record.

`first-action`: access via [[active.clojure.freer-monad/bind-first-action]]
`continuations`: access via [[active.clojure.freer-monad/bind-continuations]]
sourceraw docstring

make-monad-command-configclj/s

(make-monad-command-config run-command env state)

Construct a MonadCommandConfig (Configuration for supporting a set of monad commands.) record.

run-command: access via active.clojure.freer-monad/monad-command-config-run-command env: access via active.clojure.freer-monad/monad-command-config-env state: access via active.clojure.freer-monad/monad-command-config-state

Construct a `MonadCommandConfig` (Configuration for supporting a set of monad commands.) record.

`run-command`: access via [[active.clojure.freer-monad/monad-command-config-run-command]]
`env`: access via [[active.clojure.freer-monad/monad-command-config-env]]
`state`: access via [[active.clojure.freer-monad/monad-command-config-state]]
sourceraw docstring

make-queue-nodeclj/s

(make-queue-node left right)

Construct a QueueNode record.

left: access via active.clojure.freer-monad/queue-node-left right: access via active.clojure.freer-monad/queue-node-right

Construct a `QueueNode` record.

`left`: access via [[active.clojure.freer-monad/queue-node-left]]
`right`: access via [[active.clojure.freer-monad/queue-node-right]]
sourceraw docstring

monad-command-config-envclj/s≠

clj
(monad-command-config-env rec__2619__auto__)
(monad-command-config-env data__2620__auto__ v__2621__auto__)
cljs
(monad-command-config-env rec__2304__auto__)
(monad-command-config-env data__2305__auto__ v__2306__auto__)

reader-monad initial environment represented as a mergable map

reader-monad initial environment represented as a mergable map
sourceraw docstring

monad-command-config-run-commandclj/s≠

clj
(monad-command-config-run-command rec__2619__auto__)
(monad-command-config-run-command data__2620__auto__ v__2621__auto__)
cljs
(monad-command-config-run-command rec__2304__auto__)
(monad-command-config-run-command data__2305__auto__ v__2306__auto__)

run-command :: run-any env state comp -> (| [(| exception-value? val) state] unknown-command) Where run-any is a function for running any monad command of the signature `env state comp -> (| [(| exception-value? val) state] unknown-command)

`run-command` :: run-any env state comp -> (| [(| exception-value? val) state] unknown-command)
Where `run-any` is a function for running any monad command of the signature
`env state comp -> (| [(| exception-value? val) state] unknown-command)
sourceraw docstring

monad-command-config-stateclj/s≠

clj
(monad-command-config-state rec__2619__auto__)
(monad-command-config-state data__2620__auto__ v__2621__auto__)
cljs
(monad-command-config-state rec__2304__auto__)
(monad-command-config-state data__2305__auto__ v__2306__auto__)

state-monad initial state represented as a mergable map

state-monad initial state represented as a mergable map
sourceraw docstring

monad-command-config?clj/s

(monad-command-config? thing)

Is object a MonadCommandConfig record? See active.clojure.freer-monad/make-monad-command-config.

Is object a `MonadCommandConfig` record? See [[active.clojure.freer-monad/make-monad-command-config]].
sourceraw docstring

MonadCommandConfigclj/s≠

cljs

Configuration for supporting a set of monad commands.

Configuration for supporting a set of monad commands.
source (clj)source (cljs)raw docstring

monadicclj/smacro

(monadic & ?stmts)

Construct a monadic computation.

The syntax is (monadic <stmt> ...) where <stmt> is one of the following:

  • [<pat> <exp> ...] which creates monadic bindings
  • (let <bindings>) which creates regular bindings
  • anything else is just a regular expression, expected to yield a monadic value.

Example:

(monadic [first (ask "what's your first name?")
          last (ask "what's your last name?")]
         (let [s (str "Hello, " first " " last)])
         (tell s))
Construct a monadic computation.

The syntax is `(monadic <stmt> ...)` where `<stmt>` is one of the following:

- `[<pat> <exp> ...]` which creates monadic bindings
- `(let <bindings>)` which creates regular bindings
- anything else is just a regular expression, expected to yield a monadic value.

Example:

    (monadic [first (ask "what's your first name?")
              last (ask "what's your last name?")]
             (let [s (str "Hello, " first " " last)])
             (tell s))
sourceraw docstring

null-monad-command-configclj/s

(null-monad-command-config env state)

Monad command-configuration with no commands except for reader/state/exception.

Monad command-configuration with no commands except for reader/state/exception.
sourceraw docstring

put-state-component!clj/s

(put-state-component! name value)

Set a named component of a map-valued state.

Set a named component of a map-valued state.
sourceraw docstring

queue-decomposeclj/s

(queue-decompose queue decomposed-queue)
source

queue-decompose-mclj/smacro

(queue-decompose-m queue
                   singleton-name
                   singleton-code
                   first-name
                   rest-name
                   queue-code)
source

queue-node-leftclj/s≠

clj
(queue-node-left rec__2619__auto__)
(queue-node-left data__2620__auto__ v__2621__auto__)
cljs
(queue-node-left rec__2304__auto__)
(queue-node-left data__2305__auto__ v__2306__auto__)

Lens for the left field from a QueueNode record. See active.clojure.freer-monad/make-queue-node.

Lens for the `left` field from a [[QueueNode]] record. See [[active.clojure.freer-monad/make-queue-node]].
sourceraw docstring

queue-node-rightclj/s≠

clj
(queue-node-right rec__2619__auto__)
(queue-node-right data__2620__auto__ v__2621__auto__)
cljs
(queue-node-right rec__2304__auto__)
(queue-node-right data__2305__auto__ v__2306__auto__)

Lens for the right field from a QueueNode record. See active.clojure.freer-monad/make-queue-node.

Lens for the `right` field from a [[QueueNode]] record. See [[active.clojure.freer-monad/make-queue-node]].
sourceraw docstring

queue-node?clj/s

(queue-node? thing)

Is object a QueueNode record? See active.clojure.freer-monad/make-queue-node.

Is object a `QueueNode` record? See [[active.clojure.freer-monad/make-queue-node]].
sourceraw docstring

QueueNodeclj/s

source

reified?clj/s

(reified? m)

Checks whether a monadic command is reified.

Checks whether a monadic command is reified.
sourceraw docstring

reify-asclj/s

(reify-as m reification)

Adds reification meta data to m that helps utilities (like the mock runner for tests), to reify a composed command as something comparable (and printable), for cases where the command itself is not; e.g. it includes a bind inside. See [[reify-command]] to extract the meta data again.

Adds `reification` meta data to `m` that helps utilities (like the
mock runner for tests), to reify a composed command as something
comparable (and printable), for cases where the command itself is
not; e.g. it includes a `bind` inside. See [[`reify-command`]] to
extract the meta data again.
sourceraw docstring

reify-commandclj/s

(reify-command m)

Return the reification object of m, if one was added with [[reify-as]], or m itself otherwise.

Return the reification object of `m`, if one was added
with [[`reify-as`]], or m itself otherwise.
sourceraw docstring

run-freer-reader-state-exceptionclj/s

(run-freer-reader-state-exception command-config m & [state])

Run monadic computation in a reader-state-exception monad.

  • command-config is the configuration object for running commands
  • m is the computation to run
  • state an optional initial state (from a previous run) that is merged into the one from command-config

Returns [result state]

Run monadic computation in a reader-state-exception monad.

- `command-config` is the configuration object for running commands
- `m` is the computation to run
- `state` an optional initial state (from a previous run) that is merged
  into the one from `command-config`

Returns [result state]
sourceraw docstring

run-monadic-swiss-armyclj/s

(run-monadic-swiss-army command-config m & [state])

Run a monadic computation in an almighty monad. Same as [[run-freer-reader-state-exception]] with the addition of call-cc.

  • command-config is the configuration object for running commands
  • m is the computation to run
  • state an optional initial state (from a previous run) that is merged into the one from command-config

Returns [result state]

Run a monadic computation in an almighty monad.  Same as
[[`run-freer-reader-state-exception`]] with the addition of `call-cc`.

- `command-config` is the configuration object for running commands
- `m` is the computation to run
- `state` an optional initial state (from a previous run) that is merged
  into the one from `command-config`

Returns [result state]
sourceraw docstring

run-no-commandsclj/s

(run-no-commands run-any env state m)

For use in make-monad-command-config when there are no commands.

For use in [[make-monad-command-config]] when there are no commands.
sourceraw docstring

sequclj/s

(sequ ms)

Evaluate each action in the sequence from left to right, and collect the results.

Evaluate each action in the sequence from left to right, and collect the results.
sourceraw docstring

sequ_clj/s

(sequ_ ms)

Evaluate each action in the sequence from left to right, and ignore the results.

Evaluate each action in the sequence from left to right, and ignore the results.
sourceraw docstring

throw-illegal-argument-exceptionclj/s

(throw-illegal-argument-exception msg)
source

unknown-commandclj/s

Marker that command functions can return to signal they don't recognize a command.

Marker that command functions can return to signal they don't recognize a command.
sourceraw docstring

update-state-component!clj/s

(update-state-component! name f & args)

Calls f with the current value of the component and puts back return value as the new component.

Calls f with the current value of the component and puts back return value as the new component.
sourceraw docstring

with-env-componentclj/s

(with-env-component key f m)

Transform a keyed component of a map-valued environment.

Transform a keyed component of a map-valued environment.
sourceraw docstring

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

× close