aboutsummaryrefslogtreecommitdiffstats
path: root/system/doc
diff options
context:
space:
mode:
authorHans Bolinder <[email protected]>2013-09-04 16:29:16 +0200
committerHans Bolinder <[email protected]>2013-09-06 09:37:15 +0200
commitec72f8938ed5217d85c3b4cbb5080ae209bd8ae3 (patch)
tree1642459dc6a5643ea23e058fc42c86723610cda6 /system/doc
parent11c31f5ba8489b0e179caea46e514b990fbadb95 (diff)
downloadotp-ec72f8938ed5217d85c3b4cbb5080ae209bd8ae3.tar.gz
otp-ec72f8938ed5217d85c3b4cbb5080ae209bd8ae3.tar.bz2
otp-ec72f8938ed5217d85c3b4cbb5080ae209bd8ae3.zip
Correct documentation of predefined and built-in types
iodata/0, arity/0, and nonempty_list/0,1 have been added; nonempty_maybe_improper_list/1 and maybe_improper_list/1 removed.
Diffstat (limited to 'system/doc')
-rw-r--r--system/doc/reference_manual/typespec.xml28
1 files changed, 16 insertions, 12 deletions
diff --git a/system/doc/reference_manual/typespec.xml b/system/doc/reference_manual/typespec.xml
index 1279493ba8..97ab344f7d 100644
--- a/system/doc/reference_manual/typespec.xml
+++ b/system/doc/reference_manual/typespec.xml
@@ -124,6 +124,7 @@
List :: list(Type) %% Proper list ([]-terminated)
| improper_list(Type1, Type2) %% Type1=contents, Type2=termination
| maybe_improper_list(Type1, Type2) %% Type1 and Type2 as above
+ | nonempty_list(Type) %% Proper non-empty list
Tuple :: tuple() %% stands for a tuple of any size
| {}
@@ -146,9 +147,8 @@
</p>
<p>
Because lists are commonly used, they have shorthand type notations.
- The type <c>list(T)</c> has the shorthand <c>[T]</c>.
- The shorthand <c>[T,...]</c> stands for
- the set of non-empty proper lists whose elements are of type <c>T</c>.
+ The types <c>list(T)</c> and <c>nonempty_list(T)</c> have the shorthands
+ <c>[T]</c> and <c>[T,...]</c>, respectively.
The only difference between the two shorthands is that <c>[T]</c> may be an
empty list but <c>[T,...]</c> may not.
</p>
@@ -194,7 +194,7 @@
<cell><c>maybe_improper_list()</c></cell><cell><c>maybe_improper_list(any(), any())</c></cell>
</row>
<row>
- <cell><c>maybe_improper_list(T)</c></cell><cell><c>maybe_improper_list(T, any())</c></cell>
+ <cell><c>nonempty_list()</c></cell><cell><c>nonempty_list(any())</c></cell>
</row>
<row>
<cell><c>string()</c></cell><cell><c>[char()]</c></cell>
@@ -203,13 +203,19 @@
<cell><c>nonempty_string()</c></cell><cell><c>[char(),...]</c></cell>
</row>
<row>
+ <cell><c>iodata()</c></cell><cell><c>iolist() | binary()</c></cell>
+ </row>
+ <row>
<cell><c>iolist()</c></cell><cell><c>maybe_improper_list(byte() | binary() | iolist(), binary() | [])</c></cell>
</row>
<row>
<cell><c>module()</c></cell><cell><c>atom()</c></cell>
</row>
<row>
- <cell><c>mfa()</c></cell><cell><c>{atom(),atom(),byte()}</c></cell>
+ <cell><c>mfa()</c></cell><cell><c>{atom(),atom(),arity()}</c></cell>
+ </row>
+ <row>
+ <cell><c>arity()</c></cell><cell><c>0..255</c></cell>
</row>
<row>
<cell><c>node()</c></cell><cell><c>atom()</c></cell>
@@ -253,16 +259,14 @@
but they are expected to be rarely used. Hence, they have long names:
</note>
<pre>
- nonempty_maybe_improper_list(Type) :: nonempty_maybe_improper_list(Type, any())
- nonempty_maybe_improper_list() :: nonempty_maybe_improper_list(any())</pre>
- <p>
- where the following two types
- define the set of Erlang terms one would expect:
- </p>
- <pre>
+ nonempty_maybe_improper_list() :: nonempty_maybe_improper_list(any(), any())
nonempty_improper_list(Type1, Type2)
nonempty_maybe_improper_list(Type1, Type2)</pre>
<p>
+ where the last two types
+ define the set of Erlang terms one would expect.
+ </p>
+ <p>
Also for convenience, we allow for record notation to be used.
Records are just shorthands for the corresponding tuples.
</p>