Liking cljdoc? Tell your friends :D

monads.cont


callccclj

(callcc f)
source

cont-mclj

source

cont-tclj

(cont-t inner)
source

mclj

source

reorg-bindsclj

(reorg-binds m)
source

reorg-plusclj

(reorg-plus m)
source

reorganizeclj

(reorganize m)

Reorganize the monadic computation m so that binds nested on the left are moved to the right, i.e. transform expressions like

(>>= (>>= (>>= m f) g) h)

into expressions like

(>>= m (fn [x] (>>= (f x) (fn [y] (>>= (g y) h))))).

A monad implementation for which these two expressions give different results is broken.

Similarly reorganizes mplus operations nested on the left:

(mplus (mplus (mplus a b) c) d)

Becomes

(mplus a (mplus b (mplus c d))).

And, similarly, an mplus operation which is not associative is considered to be in error.

Both transformations are interleaved:

(mplus (mplus (>>= (>>= (mplus (mplus a b) c) f) g) d) e)

becomes

(mplus (>>= (mplus a (mplus b c)) (fn [x] (>>= (f x) g))) (mplus d e)).

Note that only mplus and bind operations are investigated: the reorganization does not recurse into the monadic-computation arguments of e.g. listen, local, or pass.

Reorganize the monadic computation m so that binds nested on the
left are moved to the right, i.e. transform expressions like

(>>= (>>= (>>= m f) g) h)

into expressions like

(>>= m (fn [x] (>>= (f x) (fn [y] (>>= (g y) h))))).

A monad implementation for which these two expressions give
different results is broken.

Similarly reorganizes mplus operations nested on the left:

(mplus (mplus (mplus a b) c) d)

Becomes

(mplus a (mplus b (mplus c d))).

And, similarly, an mplus operation which is not associative is
considered to be in error.

Both transformations are interleaved:

(mplus (mplus (>>= (>>= (mplus (mplus a b) c) f) g) d) e)

becomes

(mplus (>>= (mplus a (mplus b c)) (fn [x] (>>= (f x) g))) (mplus d e)).

Note that *only* mplus and bind operations are investigated: the
reorganization does not recurse into the monadic-computation
arguments of e.g. listen, local, or pass.
sourceraw docstring

resetclj

(reset computation)
source

run-contclj

(run-cont m)
source

run-cont-tclj

(run-cont-t m computation)
source

shiftclj

(shift f)
source

tclj

source

trampclj

(tramp cur)
source

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

× close