[erlang-questions] Understanding Erlang types with type variables
Athanasios Valsamakis
athanasios.valsamakis@REDACTED
Wed Feb 21 11:39:17 CET 2018
In Erlang, you can have a (generic) type declaration parameterized with
type variables e.g.
-type dict(K, V) :: [{K,V}].
K, V are type variables i.e. they can be replaced in subsequent type
declarations or function specifications with concrete types. E.g.
-type catalog() :: dict(string(), integer()).
Here K is replaced with type string(), and V with type integer(). Or, it
can be used in function specifications e.g.
-spec find(string(), dict(string(), any())) -> any().
Is it correct?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20180221/1ff05dc2/attachment.htm>
More information about the erlang-questions
mailing list