Skip to content

Commit fbad514

Browse files
authored
refactor: remove flix-files dependency (#164)
1 parent 86daf80 commit fbad514

2 files changed

Lines changed: 17 additions & 16 deletions

File tree

flix.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,3 @@ authors = ["Matthew Lutze", "Jonathan Starup"]
88
[dependencies]
99
"github:JonathanStarup/Flix-ANSI-Terminal" = "1.8.0"
1010
"github:mlutze/flix-json" = "0.12.17"
11-
"github:mlutze/flix-files" = "1.0.2"

src/Main.flix

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,21 @@ mod Flixball.Main {
1717
use Flixball.Version.version
1818

1919
pub def main(): Unit \ {IO, Sys, NonDet} = {
20-
Environment.handle(() ->
21-
let args = Environment.getArgs();
22-
match parse(args) {
23-
case Action.Version => println(version())
24-
case Action.Help => println(usage())
25-
case Action.Run(runOpts, dispOpts) =>
26-
match mkRunConfig(runOpts, dispOpts) {
27-
case Ok(config) => runFlixball(config)
28-
case Err(s) => println("Error: ${s}")
29-
}
30-
case Action.Replay(_, _) => println("Replay not implemented")
31-
case Action.Error => println(usage())
32-
})()
20+
run {
21+
let args = Environment.getArgs();
22+
match parse(args) {
23+
case Action.Version => println(version())
24+
case Action.Help => println(usage())
25+
case Action.Run(runOpts, dispOpts) =>
26+
match mkRunConfig(runOpts, dispOpts) {
27+
case Ok(config) => runFlixball(config)
28+
case Err(s) => println("Error: ${s}")
29+
}
30+
case Action.Replay(_, _) => println("Replay not implemented")
31+
case Action.Error => println(usage())
32+
}
33+
} with Environment.runWithIO
34+
with FileReadWithResult.runWithIO
3335
}
3436

3537
def runFlixball(config: RunConfig): Unit \ IO = {
@@ -47,7 +49,7 @@ mod Flixball.Main {
4749
}
4850
}
4951

50-
def mkRunConfig(runOpts: List[RunOption], dispOpts: List[DisplayOption]): Result[String, RunConfig] \ IO + NonDet = {
52+
def mkRunConfig(runOpts: List[RunOption], dispOpts: List[DisplayOption]): Result[String, RunConfig] \ IO + FileReadWithResult + NonDet = {
5153
use Result.flatMap;
5254
let seed = runOpts
5355
|> List.findMap(x -> match x {
@@ -62,7 +64,7 @@ mod Flixball.Main {
6264
case _ => None
6365
})
6466
|> Option.toOk("missing config");
65-
file <- Files.read(configPath) |> Result.mapErr(ToString.toString);
67+
file <- FileReadWithResult.read(configPath) |> Result.mapErr(ToString.toString);
6668
config <- readConfig(file)
6769
) yield {
6870
let quiet = runOpts |> List.memberOf(RunOption.Quiet);

0 commit comments

Comments
 (0)