5 | parseNat : String -> Maybe Nat
7 | n <- parseInteger {a = Integer} s
8 | if n >= 0 then Just (cast n) else Nothing
10 | applyArg : RunConfig -> String -> RunConfig
11 | applyArg cfg "--fail-fast" = { failFast := True } cfg
12 | applyArg cfg "--randomize" = { randomize := True } cfg
13 | applyArg cfg "--times" = { showTiming := True } cfg
14 | applyArg cfg "--rerun" = { rerun := True } cfg
16 | let (key, rest) = break (== '=') arg
17 | val = substr 1 (length rest) rest
18 | in if val == "" then cfg
20 | "--match" => { match := Just val } cfg
21 | "--skip" => { skip := Just val } cfg
22 | "--seed" => { seed := parseNat val } cfg
23 | "--junit" => { junitOutput := Just val } cfg
24 | "--jobs" => case parseNat val of
25 | Just j => { jobs := j } cfg
31 | parseArgs : List String -> RunConfig
32 | parseArgs = foldl applyArg defaultConfig