defimpl String.Chars, for: Map do
import Kernel, except: [to_string: 1]
def to_string(m) when is_map(m) do
#for i <- Map.to_list(m), do: "#{to_string(elem(i,0))} -> #{to_string(elem(i,1))}"
"#{inspect(m)}"
end
#def to_string(a) when is_atom(a) do
# :erlang.atom_to_binary(a,:latin1)
#end
#def to_string(x) do
# "#{inspect(x)}"
#end
end
Last active
April 18, 2017 15:16
-
-
Save binarytemple-external/845aeba6fe26502c62e733bc1cd8e3f5 to your computer and use it in GitHub Desktop.
elixir map protocol
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment