View Source WriterMonad (Chorex v0.4.3)

Makes it easy to do operations on code and track gathered data.

Summary

Types

t()

{expression, [callback_spec], [fresh_functions]}

Types

@type t() :: {any(), [any()], [any()]}

{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
@spec fmap({a, [b], [c]}, (a -> d)) :: {d, [b], [c]}
when a: var, b: var, c: var, d: var
@spec mapM(vs :: [a], f :: (a -> t())) :: t()

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]}

@spec return(v :: any()) :: t()
@spec return(v :: any(), xs :: [any()]) :: t()
@spec return(v :: any(), xs :: [any()], ys :: [any()]) :: t()