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)
Documentation
Instances
| Args () | |
| (Read b, Typeable b) => Args b | |
| (Read x, Typeable x, Read y, Typeable y) => Args (x, y) | |
| (Read t1, Typeable t1, Read t2, Typeable t2, Read t3, Typeable t3) => Args (t1, t2, t3) | |
| (Read t1, Typeable t1, Read t2, Typeable t2, Read t3, Typeable t3, Read t4, Typeable t4) => Args (t1, t2, t3, t4) | |
| (Read t1, Typeable t1, Read t2, Typeable t2, Read t3, Typeable t3, Read t4, Typeable t4, Read t5, Typeable t5) => Args (t1, t2, t3, t4, t5) |