mirror of
https://github.com/idris-lang/Idris2.git
synced 2024-12-14 13:56:13 +03:00
26e6e1ed82
If we don't do this, we don't look inside case blocks to check they cover, and so we might miss coverage errors in nested case blocks. Fixes #202
22 lines
458 B
Idris
22 lines
458 B
Idris
module Main
|
|
|
|
import Data.Strings
|
|
import Data.Vect
|
|
import System
|
|
|
|
%default total
|
|
|
|
ints : Vect 4 Int
|
|
ints = [1, 2, 3, 4]
|
|
|
|
main : IO ()
|
|
main = do
|
|
[_, arg] <- getArgs
|
|
| _ => do putStrLn "One argument expected."
|
|
exitFailure
|
|
let n = stringToNatOrZ arg
|
|
case natToFin n (length ints + 1) of
|
|
Nothing => do putStrLn "Invalid number."
|
|
exitFailure
|
|
Just (FS i) => putStrLn $ "Value: " ++ show (index i ints)
|