8data MyErr = NotANumber | OutOfRange
10parseNumber : Int -> String -> { [EXCEPTION MyErr] } Eff Int
12 = if all isDigit (unpack str)
13 then let x = cast str in
14 if (x >=0 && x <= num)
19guess : Int -> { [STDIO] } Eff ()
22 case run {m=Maybe} (parseNumber 100 (trim !getStr)) of
23 Nothing => do putStrLn "Invalid input"
25 Just v => case compare v target of
26 LT => do putStrLn "Too low"
28 EQ => putStrLn "You win!"
29 GT => do putStrLn "Too high"
32game : { [RND, STDIO] } Eff ()
33game = do srand 123456789
34 guess (fromInteger !(rndInt 0 100))
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list