aboutsummaryrefslogtreecommitdiffstats
path: root/lib/stdlib/src/io_lib.erl
diff options
context:
space:
mode:
authorHans Bolinder <[email protected]>2012-12-31 15:24:44 +0100
committerHans Bolinder <[email protected]>2013-01-02 10:15:18 +0100
commit6f86a3a6ba3b975016aab80b3f5b3f2807304b24 (patch)
tree789b7b4073d8ed48d3fa2dcae10470046c4543eb /lib/stdlib/src/io_lib.erl
parent4b42bf9358eca2c4597837e87dd10e49c1b60bc7 (diff)
downloadotp-6f86a3a6ba3b975016aab80b3f5b3f2807304b24.tar.gz
otp-6f86a3a6ba3b975016aab80b3f5b3f2807304b24.tar.bz2
otp-6f86a3a6ba3b975016aab80b3f5b3f2807304b24.zip
Improve and correct contracts and types of the IO modules
Diffstat (limited to 'lib/stdlib/src/io_lib.erl')
-rw-r--r--lib/stdlib/src/io_lib.erl17
1 files changed, 14 insertions, 3 deletions
diff --git a/lib/stdlib/src/io_lib.erl b/lib/stdlib/src/io_lib.erl
index 5f57a2fa42..461da422ef 100644
--- a/lib/stdlib/src/io_lib.erl
+++ b/lib/stdlib/src/io_lib.erl
@@ -78,7 +78,8 @@
collect_line/2, collect_line/3, collect_line/4,
get_until/3, get_until/4]).
--export_type([chars/0, unicode_chars/0, unicode_string/0, continuation/0]).
+-export_type([chars/0, unicode_chars/0, unicode_string/0, continuation/0,
+ fread_error/0]).
%%----------------------------------------------------------------------
@@ -92,6 +93,16 @@
Nchars :: non_neg_integer(),
Results :: [term()]}.
+-type fread_error() :: 'atom'
+ | 'based'
+ | 'character'
+ | 'float'
+ | 'format'
+ | 'input'
+ | 'integer'
+ | 'string'
+ | 'unsigned'.
+
%%----------------------------------------------------------------------
%% Interface calls to sub-modules.
@@ -112,7 +123,7 @@ fwrite(Format, Args) ->
| {'more', RestFormat :: string(),
Nchars :: non_neg_integer(),
InputStack :: chars()}
- | {'error', What :: term()}.
+ | {'error', What :: fread_error()}.
fread(Chars, Format) ->
io_lib_fread:fread(Chars, Format).
@@ -125,7 +136,7 @@ fread(Chars, Format) ->
| {'done', Result, LeftOverChars :: string()},
Result :: {'ok', InputList :: [term()]}
| 'eof'
- | {'error', What :: term()}.
+ | {'error', What :: fread_error()}.
fread(Cont, Chars, Format) ->
io_lib_fread:fread(Cont, Chars, Format).