22
22
last_modified :: timestamp ()}).
23
23
-opaque statebox () :: # statebox {}.
24
24
-type event () :: {timestamp (), op ()}.
25
- -type timestamp () :: integer ().
25
+ -type timestamp () :: statebox_clock : timestamp ().
26
26
-type timedelta () :: integer ().
27
27
-type basic_op () :: {module (), atom (), [term ()]} |
28
28
{fun ((...) -> statebox ()), [term ()]}.
29
29
-type op () :: basic_op () | [op ()].
30
+ -export_type ([statebox / 0 , event / 0 , timestamp / 0 , timedelta / 0 , basic_op / 0 , op / 0 ]).
30
31
31
32
% % Used in a test, must be done before function definitions.
32
33
-ifdef (TEST ).
35
36
36
37
% % @doc Return <code>true</code> if the argument is a statebox, <code>false</code>
37
38
% % otherwise.
38
- -spec is_statebox (term ()) -> boolean ().
39
+ -spec is_statebox (statebox () | term ()) -> boolean ().
39
40
is_statebox (# statebox {}) ->
40
41
true ;
41
42
is_statebox (_T ) ->
@@ -46,6 +47,7 @@ is_statebox(_T) ->
46
47
% % return an "empty" object of the desired type, such as
47
48
% % <code>fun gb_trees:empty/0</code>.
48
49
% % @equiv new(timestamp(), Constructor)
50
+ -spec new (fun (() -> term ())) -> statebox ().
49
51
new (Constructor ) ->
50
52
new (statebox_clock :timestamp (), Constructor ).
51
53
0 commit comments