To match against empty map you could use either map_size/1 function or compare with %{} explicitly in guard as:
def f(map) do
case map do
# any map that has key :a
%{a: i} -> i
# empty map
map when map == %{} -> :empty
# map with exactly 1 key but not :a
map when map_size(map) == 1 -> :one_key_not_a
# any other map
%{} -> :other
# not a map
_ -> :not_a_map
end
end