2020-05-30 23:53:29 +03:00
|
|
|
module Main
|
|
|
|
|
2021-06-28 15:48:37 +03:00
|
|
|
import Data.String
|
2020-05-30 23:53:29 +03:00
|
|
|
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
|
2020-07-18 21:22:03 +03:00
|
|
|
-- case block in a case block, which is needed to test this properly
|
2020-05-30 23:53:29 +03:00
|
|
|
case natToFin n (length ints + 1) of
|
|
|
|
Nothing => do putStrLn "Invalid number."
|
|
|
|
exitFailure
|
|
|
|
Just (FS i) => putStrLn $ "Value: " ++ show (index i ints)
|