Safe Haskell | Safe |
---|---|
Language | Haskell98 |
ReadArgs
- 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 #
parse the desired argument tuple from the command line or print a simple usage statment and quit
readArgsFrom :: ArgumentTuple a => [String] -> IO a #
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
Methods
name's argument will usually be undefined, so when defining instances of Arguable, it should be lazy in its argument
Instances
Arguable Char # | char is a special case, so that we don't force the user to single-quote their input |
(Typeable * t, Read t) => Arguable t # | all types that are typeable and readable can be used as simple arguments |
Arguable String # | string is a special case, so that we don't force the user to double-quote their input |
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
Methods
parseArg :: [String] -> [(a, [String])] #
argName's argument will usually be undefined, so when defining instances of Arguable, it should be lazy in its argument
Instances
Arguable a => Argument a # | use the arguable tyep to just parse a single argument |
Argument String # | make sure strings are handled as a separate type, not a list of chars |
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
Constructors
NonGreedy | |
Fields
|
class ArgumentTuple a where #
a class for tuples of types that can be parsed from the entire list of arguments
Minimal complete definition
Methods
parseArgsFrom :: [String] -> Maybe a #
usageFor's argument will usually be undefined, so when defining instances of Arguable, it should be lazy in its argument
Instances