In type specs for the Erlang standard library, there are almost never any types in the spec until the when
clause. For example, the spec for lists:member/2
is like this:
-spec member(Elem, List) -> boolean() when
Elem :: T,
List :: [T],
T :: term().
instead of:
-spec member(Elem :: T, List :: [T]) -> boolean() when
T :: term().
Is there a reason for this? Are these two styles equivalent from the dialyzer's point of view?
It is done that way because the documentation that is generated from the specs looks better if done like that.