View Source WriterMonad (Chorex v0.8.5)
Makes it easy to do operations on code and track gathered data.
Summary
Functions
Flatten nested block expressions as much as possible.
Haskell-like do
notation for monads.
Types
{expression, [callback_spec], [fresh_functions]}
Functions
@spec bind({a, [b], [d]}, (a -> {c, [b], [d]})) :: {c, [b], [d]}
when a: var, b: var, d: var, c: var
Flatten nested block expressions as much as possible.
Turn something like
do
do
…
end
end
into simply
do
…
end
This is important for the merge/2
function to be able to tell when
two expressions are equivalent.
@spec fmap({a, [b], [c]}, (a -> d)) :: {d, [b], [c]}
when a: var, b: var, c: var, d: var
Haskell-like do
notation for monads.
iex> import WriterMonad iex> monadic do ...> thing1 <- return(5) ...> thing2 <- {thing1 + 2, ["foo"], [:zoop]} ...> thing3 <- {thing1 + thing2, ["bar"], [:quux]} ...> return thing3 ...> end {12, ["bar", "foo"], [:zoop, :quux]}