October 2014
Intermediate to advanced
280 pages
7h 20m
English
The attribute @type can be used to define new types.
| | @type type_name :: type_specification |
Elixir uses this to predefine some built-in types and aliases.
| | @type term :: any |
| | @type binary :: <<_::_*8>> |
| | @type bitstring :: <<_::_*1>> |
| | @type boolean :: false | true |
| | @type byte :: 0..255 |
| | @type char :: 0..0x10ffff |
| | @type list :: [ any ] |
| | @type list(t) :: [ t ] |
| | @type number :: integer | float |
| | @type module :: atom |
| | @type mfa :: {module, atom, byte} |
| | @type node :: atom |
| | @type timeout :: :infinity | non_neg_integer |
| | @type no_return :: none |
As the list entries show, you can parameterize the types in a new definition. Simply use one or more identifiers as parameters on the left side, and use these ...
Read now
Unlock full access