silo:std.effects.temporal

Source src/silo:std.effects.temporal

1##! Temporal effect — wall-clock and sleep.
2##!
3##! Host implementations may draw from either monotonic or system time.
4##! The value types (`Instant`, `IDuration`, `UDuration`, …) live in
5##! `silo:std.temporal`; this file only declares the effect.
6
7:use
8  :open core AnyInt
9  :open effects.io IO
10:end
11
12## Wall-clock and sleep effect. Host-provided implementations may use either
13## monotonic or system time.
14:effect(pub) Temporal IO
15  ## Returns the current timestamp as an integer (host-defined epoch and unit).
16  .now ( -> AnyInt )
17  ## Sleeps the current fibre for the given number of units.
18  .sleep ( AnyInt -> )
19:end