I have an implementation of a Balanced Search Tree in elixir which serves as a key value store.
I have a method from_list
which takes a list of key value tuples and returns a tree with them. Is there a way to use generics to typespec this the way I would do in a strongly typed language?
@spec from_list([{key_type, value_type}]) :: tree(key_type, value_type)
def from_list(list), do:
When I try this I get an error. Are there generics in Elixir? Or do I have to just make it a list of type {any, any}?