get package:polysemy
Get the stateful environment of the world at the moment the effect
e is to be run. Prefer
pureT,
runT or
bindT instead of using this function directly.
Get a natural transformation capable of potentially inspecting values
inside of
f. Binding the result of
getInspectorT
produces a function that can sometimes peek inside values returned by
bindT.
This is often useful for running callback functions that are not
managed by polysemy code.
Example
We can use the result of
getInspectorT to "undo"
pureT
(or any of the other
Tactical functions):
ins <- getInspectorT
fa <- pureT "hello"
fb <- pureT True
let a = inspect ins fa -- Just "hello"
b = inspect ins fb -- Just True
Get the stateful environment of the world at the moment the
Strategy is to be run.
Prefer
pureS,
liftS,
runS, or
bindS
instead of using this function directly.
Get a natural transformation capable of potentially inspecting values
inside of
f. Binding the result of
getInspectorS
produces a function that can sometimes peek inside values returned by
bindS.
This is often useful for running callback functions that are not
managed by polysemy code.
See also
getInspectorT
Given an name of datatype or some of it's constructors/fields, return
datatype's name together with info about it's constructors.
Apply a function to the state and return the result.