Is there anything unique about TypeCheck that might stop me from writing a macro that generates a function with a @spec!
?
I’m experimenting with a few macros for functions I write all over the place and was hoping to include specs. This example (which I import) works fine except when I add the @spec!
. Is it because it is a macro in a macro?
defmacro crud_list(resource) do
quote bind_quoted: [resource: resource] do
@spec! unquote(:"list_#{resource.plural_name}")(query_pipe()) ::
list(unquote(resource.schema).t())
def unquote(:"list_#{resource.plural_name}")(queries \\ & &1) do
unquote(resource.schema)
|> queries.()
|> unquote(resource.repo).all()
end
end
end