From 7c6b3a81a15e9e5ad91093722f4832c967ffbe33 Mon Sep 17 00:00:00 2001 From: Magnus Madsen Date: Tue, 10 Mar 2026 13:46:30 +0100 Subject: [PATCH] refactor: add `use Time.Clock` import for relocated Clock effect The Clock effect has moved to Time.Clock. Add `use Time.Clock` imports to all code snippets that reference Clock. Co-Authored-By: Claude Opus 4.6 --- src/default-handlers.md | 8 ++++++-- src/effect-polymorphism.md | 7 ++++--- src/http-and-https.md | 3 +++ 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/default-handlers.md b/src/default-handlers.md index 5e2ebad5..baa2bc8e 100644 --- a/src/default-handlers.md +++ b/src/default-handlers.md @@ -8,7 +8,9 @@ providing a handler in a `run-with` block. For example, we can write: ```flix -def main(): Unit \ {Clock, Env, Logger} = +use Time.Clock + +def main(): Unit \ {Clock, Env, Logger} = let ts = Clock.currentTime(TimeUnit.Milliseconds); let os = Env.getOsName(); Logger.info("UNIX Timestamp: ${ts}"); @@ -19,7 +21,9 @@ def main(): Unit \ {Clock, Env, Logger} = which the Flix compiler translates to: ```flix -def main(): Unit \ IO = +use Time.Clock + +def main(): Unit \ IO = run { let ts = Clock.currentTime(TimeUnit.Milliseconds); let os = Env.getOsName(); diff --git a/src/effect-polymorphism.md b/src/effect-polymorphism.md index cd9336f7..5fd9184c 100644 --- a/src/effect-polymorphism.md +++ b/src/effect-polymorphism.md @@ -52,12 +52,13 @@ Here the `nth` function has a heap effect in the region `r`. We can also write functions that mix different effects: ```flix -def strange(a: Array[t, r]): Unit \ {r, Clock, Net, IO} +use Time.Clock + +def strange(a: Array[t, r]): Unit \ {r, Clock, Http, IO} // ^^^^^^^^^^^^^^^^^^^ a mixture of effects ``` -This function has a heap effect `r` and three primitive effects: `Clock`, -`Net`, and `IO`. +This function has a heap effect `r` and three effects: `Clock`, `Http`, and `IO`. ## Higher-Order Functions diff --git a/src/http-and-https.md b/src/http-and-https.md index 0e745970..28b57d0a 100644 --- a/src/http-and-https.md +++ b/src/http-and-https.md @@ -281,6 +281,7 @@ appears in the type signature: ```flix use Net.Http use Net.HttpResponse +use Time.Clock use Time.Duration.seconds def main(): Unit \ { Clock, Http, IO } = @@ -309,6 +310,7 @@ All three require the `Clock` effect: ```flix use Net.Http use Net.HttpResponse +use Time.Clock use Time.Duration.{milliseconds, seconds} def main(): Unit \ { Clock, Http, IO } = @@ -362,6 +364,7 @@ URL, default headers, retry, circuit breaker, rate limiting, and logging: use Net.Http use Net.Retry use Net.HttpResponse +use Time.Clock use Time.Duration.{milliseconds, seconds} def main(): Unit \ { Clock, Http, Logger, IO } =