Safe Haskell | None |
---|---|
Language | Haskell98 |
- readArgs :: ArgumentTuple a => IO a
- readArgsFrom :: ArgumentTuple a => [String] -> IO a
- class Arguable a where
- class Argument a where
- newtype NonGreedy m a = NonGreedy {
- unNonGreedy :: m a
- class ArgumentTuple a where
- parseArgsFrom :: [String] -> Maybe a
- usageFor :: a -> String
- data a :& b = a :& b
Documentation
readArgs :: ArgumentTuple a => IO a Source
parse the desired argument tuple from the command line or print a simple usage statment and quit
readArgsFrom :: ArgumentTuple a => [String] -> IO a Source
read args from the given strings or print a simple usage statment and quit (so you can do option parsing first)
a class for types that can be parsed from exactly one command line argument
parse :: String -> Maybe a Source
name's argument will usually be undefined, so when defining instances of Arguable, it should be lazy in its argument
Arguable Char | char is a special case, so that we don't force the user to single-quote their input |
Arguable String | string is a special case, so that we don't force the user to double-quote their input |
(Typeable * t, Read t) => Arguable t | all types that are typeable and readable can be used as simple arguments |
Arguable Text | Text is a special case, so that we don't force the user to double-quote their input |
Arguable FilePath | FilePath is a special case, so that we don't force the user to double-quote their input |
a class for types that can be parsed from some number of command line arguments
parseArg :: [String] -> [(a, [String])] Source
argName's argument will usually be undefined, so when defining instances of Arguable, it should be lazy in its argument
Argument String | make sure strings are handled as a separate type, not a list of chars |
Arguable a => Argument a | use the arguable tyep to just parse a single argument |
Arguable a => Argument [a] | use a list when it should be parsed from zero or more (greedily) |
Arguable a => Argument (Maybe a) | use Maybe when it should be parsed from one or zero (greedily) |
Argument (m a) => Argument (NonGreedy m a) | use NonGreedy when it should be parsed non-greedily
(e.g. |
a wrapper type to indicate a non-greedy list or maybe
NonGreedy | |
|
class ArgumentTuple a where Source
a class for tuples of types that can be parsed from the entire list of arguments
parseArgsFrom :: [String] -> Maybe a Source
usageFor :: a -> String Source
usageFor's argument will usually be undefined, so when defining instances of Arguable, it should be lazy in its argument