Skip to content

Commit

Permalink
add safe integer parsing to cliRunner
Browse files Browse the repository at this point in the history
unsafeInt is not defined in all backends
also bad style
  • Loading branch information
IR0NSIGHT committed Feb 6, 2024
1 parent a1dc9da commit 8d98883
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/effekt/cliRunner.effekt
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@ def runFromCli{ miniBench: () => Unit }{ bench: () =>Unit }: String = {
case Cons(_,Cons(arg,_)) => (arg == "--verify")
case _ => false
}

val iterations: Int = commandLineArgs() match {
case Cons(its,_) => its.unsafeToInt() //FIXME compiler doesnt choose correct overload for "toInt"
case Cons(its,_) => toInt(its) match {
case None() => println("illegal value for iterations, default to 3"); 3
case Some(i) => i
}
case _ => panic("cli runner was not given cmd arg for iterations!")
}

Expand Down

0 comments on commit 8d98883

Please sign in to comment.