Clock

eff ClockSource

An effect used to access the current (real-world) time.

Operations

def currentTime(u: TimeUnit): Int64 Source

Returns a measure of time since the epoch in the given time unit u.

Definitions

def handle(f: a -> b \ ef): a -> b \ (ef & (~Clock)) + IO Source

Handles the Clock effect of the given function f.

In other words, re-interprets the Clock effect using the IO effect.

def now(): Int64 \ Clock Source

Returns the number of milliseconds since the epoch.

Equivalent to currentTime(TimeUnit.Milliseconds).

def runWithIO(f: Unit -> a \ ef): a \ (ef & (~Clock)) + IO Source

Runs the Clock effect of the given function f.

In other words, re-interprets the Clock effect using the IO effect.