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.

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

Specs

const(any()) :: (any() -> any())

Constant function

Specs

cont({:ok | :error, any()}, (() -> {:ok | :error, any()})) ::
  {:ok | :error, any()}

Forgetful continuation over {:error, reason}, {:ok, _value}

Link to this function

fmap(f_a, a___b)

Specs

fmap(any(), any()) :: {:ok, list() | map()} | {:error, any()}

Apply a function deeply traversing f_a for which an Enumerable implementation exists. 2-tuples are traversed on the right.

Link to this function

fmap!(f_a, a___b)

Specs

fmap!(any(), any()) :: list() | map()

Exploding version of fmap.

Link to this function

fval(f_a_b, a, b, f_a_b___a___b___f_a_b)

Specs

fval(any(), any(), any(), any()) :: any()

Take a nillable value and if it's not nil, shove it into an addressed structure under given address.

Specs

fw(any()) :: (() -> any())

See DynHacks.fwrap/1.

Specs

fwrap(any()) :: (() -> any())

Wraps a value into a nullary function.

Specs

imp(any(), (any() -> any())) :: any()

See DynHacks.impure/2.

Specs

impure(any(), (any() -> any())) :: any()

Run a side-effect (second argument) on the value (first argument), returning the value (first argument).

Link to this function

left_sparrow(f, g)

Specs

left_sparrow((() -> any()), (() -> any())) :: any()

Left sparrow operator.

Specs

lsp((() -> any()), (() -> any())) :: any()

See DynHacks.left_sparrow/2.

Link to this function

put_new_value(map, key, value)

Specs

put_new_value(map(), any(), any()) :: map()

Take a nillable value and if it's not nil, put_new it into the map under key.

Link to this function

put_value(map, key, value)

Specs

put_value(map(), any(), any()) :: map()

Take a nillable value and if it's not nil, put_new it into the map under key.

Specs

r_m(any(), (any() -> any())) :: any()

See DynHacks.impure/2.

Link to this function

right_sparrow(f, g)

Specs

right_sparrow((() -> any()), (() -> any())) :: any()

Right sparrow operator.

Specs

rsp((() -> any()), (() -> any())) :: any()

See DynHacks.right_sparrow/2.