Phoenix and Elm, a real use case (pt. 4) Provide up-to-date information in an email sent hours ago with Elixir/Phoenix

Focus - lightweight, pure Elixir lenses

Focus is a lens library that helps you get, set, and apply functions to values at any level of a data structure.

https://travispoulsen.com/blog/posts/2017-02-19-Focus-and-Functional-Lenses.html

person = %{name: "Homer"}
nameLens = Lens.make_lens(:name)

# Extract a value from a map
Focus.view(nameLens, person) 
# "Homer"

# Replace a value in a map
Focus.set(nameLens, person, "Bart")
# %{name: "Bart"}

# Apply a function to a value in a map
Focus.over(nameLens, person, &String.upcase/1)
# %{name: "HOMER"}