The module has Dictbeen softly deprecated since Elixir v1.2. We are now in 1.4, and this raises warnings:
Dict.merge / 2 is deprecated, use the Map module for working with maps or the Keyword module for working with keyword lists
Dict.merge worked as follows:
iex(1)> animals_keyword_list = [cats: 2, dogs: 1]
[cats: 2, dogs: 1]
iex(2)> animals_map = %{cats: 3, rabbits: 1}
%{cats: 3, rabbits: 1}
iex(3)> Dict.merge(animals_map, animals_keyword_list)
%{cats: 2, dogs: 1, rabbits: 1}
What is the best way to handle a simple keyword list → merging maps in the future?
source
share