@@ -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