simpleargs-0.1: Provides a more flexible getArgs function with better error reporting.ContentsIndex
System.SimpleArgs
Description

Provide a getArgs function that returns a tuple (including the 0-tuple () or 1-tuple) if the supplied arguments match the demands of the program, in number and in type. The returned tuple must contain elements that are in the Typeable and Read classes.

Here's how to do a line count, getArgs takes a single argument, returning it as a String:

 main = getArgs >>= readFile >>= print . length . lines

Two different parameters, a Char and a String:

 main = do
    (ch,name) <- getArgs
    putStrLn (ch:"Name is: "++name)
Synopsis
class Args a where
getArgs :: IO a
getArgs :: Args a => IO a
Documentation
class Args a where
Methods
getArgs :: IO a
Return appropriately typed program arguments.
getArgs :: Args a => IO a
Return appropriately typed program arguments.
Produced by Haddock version 2.1.0