Lens2 is a library for working with values deep within a nested data structure.
For reasons why you might prefer it to Elixir's built-in
Kernel.update_in
and friends, see
"Are lenses worth it to you?".
This library is descended from
Lens
. To see why it's a
different project, see the
rationale. The short version is:
- Lots of beginner and intermediate documentation.
- An alternate API for operating on data with lenses (but the same API for creating lenses).
- Operations that encourage (but do not require) information hiding.
- Extra lenses and utility functions.
The package can be installed by adding it to your list of dependencies in mix.exs:
def deps do
[
{:lens2, "~> 0.2"},
]
end
- Consider separating
:get
and:get_and_update
cases.- some performance advantage for lists
- Lens.at would work with Enumerables for getting.
- Makes writing
def_raw_maker
style lenses more complicated.
- Make Deeply.pop?
- Fix the bug where
Deeply.update(["0", "1"], Lens.at(2), &Integer.parse/1)
calls the update function with a nil. - Figure out if it's possible to make TypedStructLens work with this, or include a Lens2.TypedStructLens.
- add defmakerp