I currently understand how to define custom types and export them, as described here. For example:
-module(common_types).
-export([my_type/0]).
-type my_type() :: string().
When using my_type
in a spec in another module, I can use it like:
-spec some_function(common_types:my_type()) -> any()
I would like to import the type such that I can just do:
-spec some_function(my_type()) -> any().
This would allow me to name my modules containing types in a non-abbreviated way and then import them to clarify where the custom types are coming from. If I have to do common_types:my_type
every time, my worry is that this is going to get verbose. So, then I’ll have to do something like ctypes:my_type
, which I would prefer not to do.
I have tried using:
-import(common_types, [my_type/0]).
but this doesn’t seem to work.
Apologies if I have missed anything in the documentation! I have looked!