Liking cljdoc? Tell your friends :D

active.clojure.monad

Monad related functionality, particularly free monads.

Monad related functionality, particularly free monads.
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

Bindcljs

source

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

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

exception-value-exceptionclj/s

(exception-value-exception ExceptionValue)

Access exception field from a [[ExceptionValue]] record. See active.clojure.monad/make-exception-value.

Access `exception` field from a [[ExceptionValue]] record. See [[active.clojure.monad/make-exception-value]].
sourceraw docstring

exception-value?clj/s

(exception-value? thing)

Is object a ExceptionValue record? See active.clojure.monad/make-exception-value.

Is object a `ExceptionValue` record? See [[active.clojure.monad/make-exception-value]].
sourceraw docstring

execute-free-reader-state-exceptionclj/s

(execute-free-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

free-bindclj/s

(free-bind mv f)

Bind/flatMap for the free monad.

Bind/flatMap for the free monad.
sourceraw docstring

free-bind-contclj/s

(free-bind-cont Bind)

Access cont field from a Bind record. See active.clojure.monad/make-free-bind.

Access `cont` field from a [[Bind]] record. See [[active.clojure.monad/make-free-bind]].
sourceraw docstring

free-bind-monadclj/s

(free-bind-monad Bind)

Access monad field from a Bind record. See active.clojure.monad/make-free-bind.

Access `monad` field from a [[Bind]] record. See [[active.clojure.monad/make-free-bind]].
sourceraw docstring

free-bind?clj/s

(free-bind? thing)

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

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

free-returnclj/s

(free-return val)

Construct a Return record.

val: access via active.clojure.monad/free-return-val

Construct a `Return` record.

`val`: access via [[active.clojure.monad/free-return-val]]
sourceraw docstring

free-return-valclj/s

(free-return-val Return)

Access val field from a [[Return]] record. See active.clojure.monad/free-return.

Access `val` field from a [[Return]] record. See [[active.clojure.monad/free-return]].
sourceraw docstring

free-return?clj/s

(free-return? thing)

Is object a Return record? See active.clojure.monad/free-return.

Is object a `Return` record? See [[active.clojure.monad/free-return]].
sourceraw docstring

free-throwclj/s

(free-throw exception)

Construct a Throw record.

exception: access via active.clojure.monad/free-throw-exception

Construct a `Throw` record.

`exception`: access via [[active.clojure.monad/free-throw-exception]]
sourceraw docstring

free-throw-exceptionclj/s

(free-throw-exception Throw)

Access exception field from a [[Throw]] record. See active.clojure.monad/free-throw.

Access `exception` field from a [[Throw]] record. See [[active.clojure.monad/free-throw]].
sourceraw docstring

free-throw?clj/s

(free-throw? thing)

Is object a Throw record? See active.clojure.monad/free-throw.

Is object a `Throw` record? See [[active.clojure.monad/free-throw]].
sourceraw docstring

get-envclj/s

(get-env)

Construct a GetEnv record.

Construct a `GetEnv` record.
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-env?clj/s

(get-env? thing)

Is object a GetEnv record? See active.clojure.monad/get-env.

Is object a `GetEnv` record? See [[active.clojure.monad/get-env]].
sourceraw docstring

get-stateclj/s

(get-state)

Construct a GetState record.

Construct a `GetState` record.
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

get-state?clj/s

(get-state? thing)

Is object a GetState record? See active.clojure.monad/get-state.

Is object a `GetState` record? See [[active.clojure.monad/get-state]].
sourceraw docstring

make-exception-valueclj/s

(make-exception-value exception)

Construct a ExceptionValue record.

exception: access via active.clojure.monad/exception-value-exception

Construct a `ExceptionValue` record.

`exception`: access via [[active.clojure.monad/exception-value-exception]]
sourceraw docstring

make-free-bindclj/s

(make-free-bind monad cont)

Construct a Bind record.

monad: access via active.clojure.monad/free-bind-monad cont: access via active.clojure.monad/free-bind-cont

Construct a `Bind` record.

`monad`: access via [[active.clojure.monad/free-bind-monad]]
`cont`: access via [[active.clojure.monad/free-bind-cont]]
sourceraw docstring

make-monad-command-configclj/s

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

Construct a MonadCommandConfig record.

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

Construct a `MonadCommandConfig` record.

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

make-unknown-commandclj/s

(make-unknown-command)

Construct a UnknownCommand record.

Construct a `UnknownCommand` record.
sourceraw docstring

monad-command-config-envclj/s

(monad-command-config-env MonadCommandConfig)

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

(monad-command-config-run-command MonadCommandConfig)

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

(monad-command-config-state MonadCommandConfig)

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.monad/make-monad-command-config.

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

MonadCommandConfigcljs

source

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

monadic-1clj/smacro

(monadic-1 ?meta & ?stmts)
source

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!clj/s

(put-state! state)

Construct a PutState record.

state: access via active.clojure.monad/put-state-state

Construct a `PutState` record.

`state`: access via [[active.clojure.monad/put-state-state]]
sourceraw docstring

put-state!?clj/s

(put-state!? thing)

Is object a PutState record? See active.clojure.monad/put-state!.

Is object a `PutState` record? See [[active.clojure.monad/put-state!]].
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

put-state-stateclj/s

(put-state-state PutState)

Access state field from a [[PutState]] record. See active.clojure.monad/put-state!.

Access `state` field from a [[PutState]] record. See [[active.clojure.monad/put-state!]].
sourceraw docstring

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

returnclj/s

source

run-free-reader-state-exceptionclj/s

(run-free-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-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

unknown-command?clj/s

(unknown-command? thing)

Is object a UnknownCommand record? See active.clojure.monad/make-unknown-command.

Is object a `UnknownCommand` record? See [[active.clojure.monad/make-unknown-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-envclj/s

(with-env trans body)

Construct a WithEnv record.

trans: access via active.clojure.monad/with-env-trans body: access via active.clojure.monad/with-env-body

Construct a `WithEnv` record.

`trans`: access via [[active.clojure.monad/with-env-trans]]
`body`: access via [[active.clojure.monad/with-env-body]]
sourceraw docstring

with-env-bodyclj/s

(with-env-body WithEnv)

Access body field from a [[WithEnv]] record. See active.clojure.monad/with-env.

Access `body` field from a [[WithEnv]] record. See [[active.clojure.monad/with-env]].
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

with-env-transclj/s

(with-env-trans WithEnv)

Access trans field from a [[WithEnv]] record. See active.clojure.monad/with-env.

Access `trans` field from a [[WithEnv]] record. See [[active.clojure.monad/with-env]].
sourceraw docstring

with-env?clj/s

(with-env? thing)

Is object a WithEnv record? See active.clojure.monad/with-env.

Is object a `WithEnv` record? See [[active.clojure.monad/with-env]].
sourceraw docstring

with-handlerclj/s

(with-handler handler body)

Construct a WithHandler record.

handler: access via active.clojure.monad/with-handler-handler body: access via active.clojure.monad/with-handler-body

Construct a `WithHandler` record.

`handler`: access via [[active.clojure.monad/with-handler-handler]]
`body`: access via [[active.clojure.monad/with-handler-body]]
sourceraw docstring

with-handler-bodyclj/s

(with-handler-body WithHandler)

Access body field from a [[WithHandler]] record. See active.clojure.monad/with-handler.

Access `body` field from a [[WithHandler]] record. See [[active.clojure.monad/with-handler]].
sourceraw docstring

with-handler-handlerclj/s

(with-handler-handler WithHandler)

Access handler field from a [[WithHandler]] record. See active.clojure.monad/with-handler.

Access `handler` field from a [[WithHandler]] record. See [[active.clojure.monad/with-handler]].
sourceraw docstring

with-handler?clj/s

(with-handler? thing)

Is object a WithHandler record? See active.clojure.monad/with-handler.

Is object a `WithHandler` record? See [[active.clojure.monad/with-handler]].
sourceraw docstring

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

× close