Bunch v0.1.2 Bunch.Access View Source

A bunch of functions for easier manipulation on terms of types implementing Access behaviour.

Link to this section Summary

Functions

Implements Access behaviour by delegating callbacks to Map module

Works like pop_in/2, but discards returned value

Works like Kernel.get_in/2 with small differences

Works like Kernel.pop_in/2 with small differences

Works like Kernel.put_in/3 with small differences

Works like Kernel.update_in/3 with small differences

Link to this section Functions

Link to this macro __using__(args) View Source (macro)

Implements Access behaviour by delegating callbacks to Map module.

All the callbacks are overridable.

Link to this function delete_in(container, keys) View Source
delete_in(Access.t(), Access.key() | [Access.key()]) :: Access.t()

Works like pop_in/2, but discards returned value.

Link to this function get_and_update_in(container, keys, f) View Source
get_and_update_in(Access.t(), Access.key() | [Access.key()], (a -> {b, a})) ::
  {b, Access.t()}
when a: Access.value(), b: any()

Works like Kernel.get_and_update_in/3 with small differences.

Behaviour differs in the following aspects:

  • empty lists of keys are allowed
  • single key does not have to be wrapped in a list
Link to this function get_in(container, keys) View Source
get_in(Access.t(), Access.key() | [Access.key()]) :: Access.value()

Works like Kernel.get_in/2 with small differences.

Behaviour differs in the following aspects:

  • empty lists of keys are allowed
  • single key does not have to be wrapped in a list
Link to this function pop_in(container, keys) View Source
pop_in(Access.t(), Access.key() | [Access.key()]) ::
  {Access.value(), Access.t()}

Works like Kernel.pop_in/2 with small differences.

Behaviour differs in the following aspects:

  • empty lists of keys are allowed
  • single key does not have to be wrapped in a list

Works like Kernel.put_in/3 with small differences.

Behaviour differs in the following aspects:

  • empty lists of keys are allowed
  • single key does not have to be wrapped in a list
Link to this function update_in(container, keys, f) View Source
update_in(
  Access.t(),
  Access.key() | [Access.key()],
  (Access.value() -> Access.value())
) :: Access.t()

Works like Kernel.update_in/3 with small differences.

Behaviour differs in the following aspects:

  • empty lists of keys are allowed
  • single key does not have to be wrapped in a list