Hi everyone,

in Elixir we work a lot with maps (or at least I do :D). And we know and
love Map.merge. However given a map like %{a: %{b: 1}} and we want to
merge it with a map like %{a: %{c: 2}} then the :a key will be totally
overridden with whatever is supplied in the other map.

However, for instance for configuration, what we might want is the
result to be %{a: %{b: 1, c: 2}} - e.g. if the value is a map on both
sides recursively merge that as well.

It is rather simple to implement in elixir with Map.merge/3 [1] but I
think it'd still be helpful to have it in elixir core (otherwise I'll
make a mini hex package :D). E.g. it is useful and it'll keep people
from wondering about it or writing their own a little flawed
implementations.

So, what do you think - Map.deep_merge in elixir-core - yay/nay? I'm
happy to draft a PR if it gets the sign of approval.

Tobi


[1] http://stackoverflow.com/a/38865647/1810896
-- 
http://www.pragtob.info/

-- 
You received this message because you are subscribed to the Google Groups 
"elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elixir-lang-core+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elixir-lang-core/5eb1a5d2-01b3-9a27-6ff9-36836959cf36%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to