[erlang-questions] -spec tuple variable size

Dmitry Kolesnikov dmkolesnikov@REDACTED
Wed Nov 28 22:10:40 CET 2012


Hello,

I am trying to make a -spec for tuple of variable size but same time I'd like to restrict the type of its elements.

Looking into http://www.erlang.org/doc/reference_manual/typespec.html, there is a construction

Tuple :: tuple()                       
       | {}
       | {TList}

TList :: Type
       | Type, TList

but compiler fails syntax error before: ','

-- CLIP --
-type value()     :: string() | binary() | number() | boolean() | undefined.
-type entity()    :: [{atom(), value()}] | {field()}.
-type field()      :: value() | value(), field().
-- CLIP --

Do you have any advices on the issue?

Thanks in advanced!

- Dmitry


More information about the erlang-questions mailing list