Dynamically generate typespecs from module attribute list

As said it’s not possible …

@spec and @type accepts any valid expression and stores it’s AST representation. No matter what you call they would store an AST of call.

iex> quote do
iex>   my_func()
iex> end
{:my_func, [], []}
# this is just tuple (AST of call)
# since it's not call there is nothing called

Since we are working on quoted expressions to add something inside quoted expression you need to use unquote(expr) call.