You have to write it as a transformation. If you use only a filter, it will of course doesn’t change the value if it’s a map.
def removeEmpty(%{} = map) do
for {k,v} <- map, !is_nil(v), into: %{}, do: {k, removeEmpty(v)}
end
def removeEmpty(v), do: v






















