The code below shows an example of what I'm asking about: why Map, Enum, etc... can't be used within guard clauses or inside my own macros.
defmodule GuardMod do
defmacro has_any_key(arg, keys) do
quote do
Map.keys(unquote(arg), unquote(keys)) |> Enum.any?
end
end
end
defmodule OtherMod do
import GuardMod
@doc """
has_any_key/2 is allowed, but Map.keys or Map.any not
"""
def fn1(list) when has_any_key(list, [:key1, :key2]), do: :nothing
end