Safe Haskell | Safe |
---|---|
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
- 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)
class Arguable a where Source #
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 Source # | char is a special case, so that we don't force the user to single-quote their input |
(Typeable * t, Read t) => Arguable t Source # | all types that are typeable and readable can be used as simple arguments |
Arguable String Source # | string is a special case, so that we don't force the user to double-quote their input |
Arguable Text Source # | Text is a special case, so that we don't force the user to double-quote their input |
Arguable FilePath Source # | FilePath is a special case, so that we don't force the user to double-quote their input |
class Argument a where Source #
a class for types that can be parsed from some number of command line arguments
parseArg :: [String] -> [(a, [String])] Source #
argName :: a -> String Source #
argName's argument will usually be undefined, so when defining instances of Arguable, it should be lazy in its argument
Arguable a => Argument a Source # | use the arguable tyep to just parse a single argument |
Argument String Source # | make sure strings are handled as a separate type, not a list of chars |
Arguable a => Argument [a] Source # | use a list when it should be parsed from zero or more (greedily) |
Arguable a => Argument (Maybe a) Source # | use Maybe when it should be parsed from one or zero (greedily) |
Argument (m a) => Argument (NonGreedy m a) Source # | use NonGreedy when it should be parsed non-greedily
(e.g. |
newtype NonGreedy m a Source #
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