module Main where import Stail import System.Environment data StailOption = Stail | Stail2 | Stail2Fold deriving Read main :: IO () main = do args <- getArgs case args of ostr:nstr:_ -> let o = read ostr :: StailOption n = read nstr :: Integer l = [1..(n ^ 2)] helper h = putStrLn $ (case h l of Nothing -> "empty" Just [] -> "singleton" Just _ -> "at least two elements") in case o of Stail -> helper stail Stail2 -> helper stail2 Stail2Fold -> putStrLn $ (case stail2Fold l of Nothing -> "empty" Just (_ , []) -> "singleton" _ -> "at least two elements") _ -> putStrLn "Run with one command-line argument, a list length"