DynHacks (dyn_hacks v0.1.0)
Collection of hacks that utilise dynamic typing and syergise with standard Elixir protocols to improve UX.
Use map
from Witchcraft.Functor when possible, instead of fmap. In general, try to never use functions from this module unless you're working with raw data coming from dynamic elixir.
Link to this section Summary
Functions
Constant function
Forgetful continuation over {:error, reason}, {:ok, _value}
Apply a function deeply traversing f_a for which an Enumerable implementation exists. 2-tuples are traversed on the right.
Exploding version of fmap.
Take a nillable value and if it's not nil, shove it into an addressed structure under given address.
See DynHacks.fwrap/1
.
Wraps a value into a nullary function.
Run a side-effect (second argument) on the value (first argument), returning the value (first argument).
Left sparrow operator.
Take a nillable value and if it's not nil, put_new it into the map under key.
Take a nillable value and if it's not nil, put_new it into the map under key.
Right sparrow operator.
Link to this section Functions
const(x)
Specs
Constant function
cont(e, f)
Specs
Forgetful continuation over {:error, reason}, {:ok, _value}
fmap(f_a, a___b)
Specs
Apply a function deeply traversing f_a for which an Enumerable implementation exists. 2-tuples are traversed on the right.
fmap!(f_a, a___b)
Specs
Exploding version of fmap.
fval(f_a_b, a, b, f_a_b___a___b___f_a_b)
Specs
Take a nillable value and if it's not nil, shove it into an addressed structure under given address.
fw(x)
Specs
See DynHacks.fwrap/1
.
fwrap(x)
Specs
Wraps a value into a nullary function.
imp(x, f)
Specs
See DynHacks.impure/2
.
impure(x, f)
Specs
Run a side-effect (second argument) on the value (first argument), returning the value (first argument).
left_sparrow(f, g)
Specs
Left sparrow operator.
lsp(f, g)
Specs
put_new_value(map, key, value)
Specs
Take a nillable value and if it's not nil, put_new it into the map under key.
put_value(map, key, value)
Specs
Take a nillable value and if it's not nil, put_new it into the map under key.
r_m(x, f)
Specs
See DynHacks.impure/2
.
right_sparrow(f, g)
Specs
Right sparrow operator.