-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/

-- | Parse command-line arguments
--   
--   Full-featured command-line argument parsing library.
@package parseargs
@version 0.2.0.9

-- | ParseArgs is a full-featured command-line argument parsing
--   library.
--   
--   This module supplies an argument parser. Given a description of type
--   [Arg] of the legal arguments to the program, a list of argument
--   strings, and a bit of extra information, the parseArgs function
--   in this module returns an Args data structure suitable for
--   querying using the provided functions gotArg, getArg,
--   etc.
module System.Console.ParseArgs

-- | The description of an argument, suitable for messages and for parsing.
--   The argData field is used both for flags with a data argument,
--   and for positional data arguments.
--   
--   There are two cases:
--   
--   
--   
- The argument is a flag, in which case at least one of
--   argAbbr and argName is provided;
--   
- The argument is positional, in which case neither argAbbr
--   nor argName are provided, but argData is.
--   
--   
--   If none of argAbbr, argName, or argData are
--   provided, this is an error. See also the argDataRequired,
--   argDataOptional, and argDataDefaulted functions below,
--   which are used to generate argData.
data Ord a => Arg a
Arg :: a -> Maybe Char -> Maybe String -> Maybe DataArg -> String -> Arg a

-- | Connects the input description to the output argument.
[argIndex] :: Arg a -> a

-- | One-character flag name.
[argAbbr] :: Arg a -> Maybe Char

-- | "Long name" of flag.
[argName] :: Arg a -> Maybe String

-- | Datum description.
[argData] :: Arg a -> Maybe DataArg

-- | Documentation for the argument.
[argDesc] :: Arg a -> String

-- | The types of an argument carrying data. The constructor argument is
--   used to carry a default value.
--   
--   The constructor argument should really be hidden. Values of this type
--   are normally constructed within the pseudo-constructors
--   pseudo-constructors argDataRequired, argDataOptional,
--   and argDataDefaulted, to which only the constructor function
--   itself is passed.
data Argtype
ArgtypeString :: Maybe String -> Argtype
ArgtypeInteger :: Maybe Integer -> Argtype
ArgtypeInt :: Maybe Int -> Argtype
ArgtypeDouble :: Maybe Double -> Argtype
ArgtypeFloat :: Maybe Float -> Argtype

-- | How "sloppy" the parse is.
data ArgsComplete

-- | Any extraneous arguments (unparseable from description) will cause the
--   parser to fail.
ArgsComplete :: ArgsComplete

-- | Trailing extraneous arguments are permitted, and will be skipped,
--   saved, and returned. The constructor argument is the name of the args.
ArgsTrailing :: String -> ArgsComplete

-- | All extraneous arguments are permitted, and will be skipped, saved,
--   and returned.
ArgsInterspersed :: ArgsComplete

-- | Whether to always treat an unknown argument beginning with "-" as an
--   error, or to allow it to be used as a positional argument when
--   possible.
data ArgsDash

-- | If an argument begins with a "-", it will always be treated as an
--   error unless it corresponds to a flag description.
ArgsHardDash :: ArgsDash

-- | If an argument beginning with a "-" is unrecognized as a flag, treat
--   it as a positional argument if possible. Otherwise it is an error.
ArgsSoftDash :: ArgsDash

-- | Class for building parse control information, for backward
--   compatibility.
class APCData a
getAPCData :: APCData a => a -> ArgsParseControl

-- | Record containing the collective parse control information.
data ArgsParseControl
ArgsParseControl :: ArgsComplete -> ArgsDash -> ArgsParseControl

-- | Level of completeness of parse.
[apcComplete] :: ArgsParseControl -> ArgsComplete

-- | Handling of dashes in parse.
[apcDash] :: ArgsParseControl -> ArgsDash

-- | Information specific to an argument carrying a datum. This is an
--   opaque type, whose instances are constructed using the
--   pseudo-constructors argDataRequired, argDataOptional,
--   and argDataDefaulted.
data DataArg

-- | Generate the argData for the given non-optional argument.
argDataRequired :: String -> (Maybe a -> Argtype) -> Maybe DataArg

-- | Generate the argData for the given optional argument with no
--   default.
argDataOptional :: String -> (Maybe a -> Argtype) -> Maybe DataArg

-- | Generate the argData for the given optional argument with the
--   given default.
argDataDefaulted :: String -> (Maybe a -> Argtype) -> a -> Maybe DataArg

-- | The data structure parseArgs produces. There is a
--   should-be-hidden field that describes the parse.
data Ord a => Args a
Args :: ArgRecord a -> String -> String -> [String] -> Args a

-- | The argument parse, only listed here to work around a Haddock bug. See
--   https://github.com/haskell/haddock/issues/456.
[__args] :: Args a -> ArgRecord a

-- | Basename of 0th argument.
[argsProgName] :: Args a -> String

-- | Full usage string.
[argsUsage] :: Args a -> String

-- | Remaining unprocessed arguments.
[argsRest] :: Args a -> [String]

-- | Given a description of the arguments, parseArgs produces a map
--   from the arguments to their "values" and some other useful byproducts.
--   parseArgs requires that the argument descriptions occur in the
--   order 1) flag arguments, then 2) positional arguments; otherwise a
--   runtime error will be thrown.
parseArgs :: (Show a, Ord a, APCData b) => b -> [Arg a] -> String -> [String] -> Args a

-- | Most of the time, you just want the environment's arguments and are
--   willing to live in the IO monad. This version of parseArgs digs
--   the pathname and arguments out of the system directly.
parseArgsIO :: (Show a, Ord a, APCData b) => b -> [Arg a] -> IO (Args a)

-- | Check whether a given optional argument was supplied. Works on all
--   types.
gotArg :: Ord a => Args a -> a -> Bool

-- | Type of values that can be parsed by the argument parser.
class ArgType b

-- | Fetch an argument's value if it is present.
getArg :: (ArgType b, Show a, Ord a) => Args a -> a -> Maybe b

-- | Fetch the value of a required argument.
getRequiredArg :: (ArgType b, Show a, Ord a) => Args a -> a -> b

-- | 
--   
- Deprecated Return the String value, if any, of the
--   given argument.
--   
getArgString :: (Show a, Ord a) => Args a -> a -> Maybe String

-- | 
--   
- Deprecated Treat the String value, if any, of the
--   given argument as a file handle and try to open it as requested.
--   
getArgFile :: (Show a, Ord a) => Args a -> a -> IOMode -> IO (Maybe Handle)

-- | Treat the String value, if any, of the given argument as a file
--   handle and try to open it as requested. If not present, substitute the
--   appropriate one of stdin or stdout as indicated by IOMode.
getArgStdio :: (Show a, Ord a) => Args a -> a -> IOMode -> IO Handle

-- | 
--   
- Deprecated Return the Integer value, if any, of the
--   given argument.
--   
getArgInteger :: (Show a, Ord a) => Args a -> a -> Maybe Integer

-- | 
--   
- Deprecated Return the Int value, if any, of the
--   given argument.
--   
getArgInt :: (Show a, Ord a) => Args a -> a -> Maybe Int

-- | 
--   
- Deprecated Return the Double value, if any, of the
--   given argument.
--   
getArgDouble :: (Show a, Ord a) => Args a -> a -> Maybe Double

-- | 
--   
- Deprecated Return the Float value, if any, of the
--   given argument.
--   
getArgFloat :: (Show a, Ord a) => Args a -> a -> Maybe Float

-- | ArgType instance for opening a file from its string name.
newtype ArgFileOpener
ArgFileOpener :: (IOMode -> IO Handle) -> ArgFileOpener

-- | Function to open the file
[argFileOpener] :: ArgFileOpener -> IOMode -> IO Handle

-- | This exception is raised with an appropriate error message when
--   argument parsing fails. The first argument is the usage message, the
--   second the actual error message from the parser.
data ParseArgsException
ParseArgsException :: String -> String -> ParseArgsException

-- | Return the filename part of a pathname. Unnecessarily efficient
--   implementation does a single tail-call traversal with no construction.
baseName :: String -> String

-- | Generate a usage error with the given supplementary message string.
parseError :: String -> String -> a

-- | Generate a usage error with the given supplementary message string.
usageError :: Ord a => Args a -> String -> b

-- | See openFile
data IOMode
ReadMode :: IOMode
WriteMode :: IOMode
AppendMode :: IOMode
instance System.Console.ParseArgs.APCData System.Console.ParseArgs.ArgsComplete
instance System.Console.ParseArgs.APCData System.Console.ParseArgs.ArgsParseControl
instance System.Console.ParseArgs.ArgType System.Console.ParseArgs.ArgFileOpener
instance System.Console.ParseArgs.ArgType GHC.Types.Double
instance System.Console.ParseArgs.ArgType GHC.Types.Float
instance System.Console.ParseArgs.ArgType GHC.Types.Int
instance System.Console.ParseArgs.ArgType GHC.Num.Integer.Integer
instance System.Console.ParseArgs.ArgType [GHC.Types.Char]
instance System.Console.ParseArgs.ArgType ()
instance GHC.Classes.Eq System.Console.ParseArgs.ArgsDash
instance GHC.Classes.Eq System.Console.ParseArgs.ParseArgsException
instance GHC.Internal.Exception.Type.Exception System.Console.ParseArgs.ParseArgsException
instance GHC.Internal.Show.Show System.Console.ParseArgs.ParseArgsException
