diff --git a/src/default-handlers.md b/src/default-handlers.md index baa2bc8e..3833b110 100644 --- a/src/default-handlers.md +++ b/src/default-handlers.md @@ -8,6 +8,7 @@ providing a handler in a `run-with` block. For example, we can write: ```flix +use Sys.Env use Time.Clock def main(): Unit \ {Clock, Env, Logger} = @@ -21,6 +22,7 @@ def main(): Unit \ {Clock, Env, Logger} = which the Flix compiler translates to: ```flix +use Sys.Env use Time.Clock def main(): Unit \ IO = @@ -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 = ... ``` 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) ```