From e8828382b23544020abecd29ef1034f7f85d4967 Mon Sep 17 00:00:00 2001 From: Magnus Madsen Date: Tue, 10 Mar 2026 14:12:00 +0100 Subject: [PATCH 1/3] refactor: add `use` imports for relocated Env and Exit effects Co-Authored-By: Claude Opus 4.6 --- src/default-handlers.md | 8 ++++++-- src/main.md | 7 +++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/default-handlers.md b/src/default-handlers.md index 5e2ebad5..a10c276a 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 Sys.Env + +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 Sys.Env + +def main(): Unit \ IO = run { let ts = Clock.currentTime(TimeUnit.Milliseconds); let os = Env.getOsName(); diff --git a/src/main.md b/src/main.md index 02ea3843..9ab745f5 100644 --- a/src/main.md +++ b/src/main.md @@ -22,6 +22,9 @@ compiler. See [Default Handlers](./default-handlers.md) for details. For example, main can use the `Env` and `Exit` effects: ```flix +use Sys.Env +use Sys.Exit + def main(): Unit \ {Env, Exit} = let args = Env.getArgs(); match List.head(args) { @@ -39,6 +42,8 @@ The command line arguments passed to the program can be accessed by calling `Env.getArgs()` through the `Env` effect: ```flix +use Sys.Env + def main(): Unit \ {Env, IO} = let args = Env.getArgs(); println("Arguments: ${args}") @@ -49,6 +54,8 @@ def main(): Unit \ {Env, IO} = The program can be terminated with a specific exit code using `Exit.exit`: ```flix +use Sys.Exit + def main(): Unit \ Exit = Exit.exit(0) ``` From 5da65c8126958fee2f020c8145db3622012063b5 Mon Sep 17 00:00:00 2001 From: Magnus Madsen Date: Tue, 10 Mar 2026 14:13:13 +0100 Subject: [PATCH 2/3] refactor: add `use Time.Clock` imports to default-handlers.md code blocks Co-Authored-By: Claude Opus 4.6 --- src/default-handlers.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/default-handlers.md b/src/default-handlers.md index a10c276a..3833b110 100644 --- a/src/default-handlers.md +++ b/src/default-handlers.md @@ -9,6 +9,7 @@ For example, we can write: ```flix use Sys.Env +use Time.Clock def main(): Unit \ {Clock, Env, Logger} = let ts = Clock.currentTime(TimeUnit.Milliseconds); @@ -22,6 +23,7 @@ which the Flix compiler translates to: ```flix use Sys.Env +use Time.Clock def main(): Unit \ IO = run { @@ -41,6 +43,8 @@ respective effects. For example, `Clock.runWithIO` is declared as: ```flix +use Time.Clock + @DefaultHandler pub def runWithIO(f: Unit -> a \ ef): a \ (ef - Clock) + IO = ... ``` From 296085fb78fca7c2551ac2e9063bd5974208eeb4 Mon Sep 17 00:00:00 2001 From: Magnus Madsen Date: Tue, 10 Mar 2026 14:14:01 +0100 Subject: [PATCH 3/3] refactor: add `use Time.Clock` imports to http-and-https.md code blocks Co-Authored-By: Claude Opus 4.6 --- src/http-and-https.md | 3 +++ 1 file changed, 3 insertions(+) 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 } =