/usr/share/doc/libghc-readargs-doc/html/ReadArgs.txt is in libghc-readargs-doc 1.2.1-2build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 | -- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | Simple command line argument parsing
--
-- ReadArgs provides the <tt>readArgs</tt> IO action, which lets you tell
-- the compiler to parse the command line arguments to fit the type
-- signature you give.
--
-- For example <tt>(a :: Int, b :: String, c :: Float) <-
-- readArgs</tt> would parse the first runtime argument as an
-- <tt>Int</tt>, the second as a <tt>String</tt> (no quotes required) and
-- the third as a <tt>Float</tt>.
--
-- If the runtime arguments are incompatible with the type signature,
-- then a simple usage statement is given of the types needed.
--
-- Continuing the previous example, if it was used in a program named
-- <tt>Example</tt>, the error message for the above action would be:
--
-- <pre>
-- usage: Example Int String Float
-- </pre>
--
-- Any type that has both <tt>Typeable</tt> and <tt>Read</tt> instances
-- can be used. <tt>Char</tt>, <tt>String</tt>, and <tt>Text</tt> are
-- handled specially so that command line arguments for both do not
-- require quotes (as their <tt>Read</tt> instances do). A special
-- instance is provided for <tt>FilePath</tt> so that no constructor or
-- quotes are required.
--
-- <tt>readArgs</tt> also supports optional arguments and variadic
-- arguments. Optional arguments are specified using <tt>Maybe</tt>, and
-- variadic arguments using a list. <tt>(a :: Int, b :: Maybe String, c
-- :: [Float]) <- readArgs</tt> would successfully parse any of the
-- following sets of command line arguments:
--
-- <pre>
-- Example 1
-- Example 1 2 3 4
-- Example 1 foo
-- Example 1 foo 2 3 4
-- </pre>
--
-- But not
--
-- <pre>
-- Example
-- Example foo
-- Example 1.0
-- </pre>
--
-- Usage statements for optional and variadic arguments use command-line
-- parlance:
--
-- <pre>
-- usage: Example Int [String] [Float..]
-- </pre>
--
-- Note that both optional and variadic parsers are greedy by default (so
-- <tt>Example 1 2 3 4</tt> was parsed as <tt>(1, <a>2</a>,
-- [3.0,4.0])</tt>. They may both be made non-greedy through use of the
-- <tt>NonGreedy</tt> constructor:
--
-- <pre>
-- ( a :: Int
-- , NonGreedy b :: NonGreedy Maybe String
-- , NonGreedy c :: NonGreedy [] Float
-- ) <- readArgs
-- </pre>
@package ReadArgs
@version 1.2.1
module ReadArgs
-- | parse the desired argument tuple from the command line or print a
-- simple usage statment and quit
readArgs :: ArgumentTuple a => IO a
-- | read args from the given strings or print a simple usage statment and
-- quit (so you can do option parsing first)
readArgsFrom :: ArgumentTuple a => [String] -> IO a
-- | a class for types that can be parsed from exactly one command line
-- argument
class Arguable a
parse :: Arguable a => String -> Maybe a
name :: Arguable a => a -> String
-- | a class for types that can be parsed from some number of command line
-- arguments
class Argument a
parseArg :: Argument a => [String] -> [(a, [String])]
argName :: Argument a => a -> String
-- | a wrapper type to indicate a non-greedy list or maybe
newtype NonGreedy m a
NonGreedy :: m a -> NonGreedy m a
unNonGreedy :: NonGreedy m a -> m a
-- | a class for tuples of types that can be parsed from the entire list of
-- arguments
class ArgumentTuple a
parseArgsFrom :: ArgumentTuple a => [String] -> Maybe a
usageFor :: ArgumentTuple a => a -> String
-- | use :& to construct arbitrary length tuples of any parsable
-- arguments
data (:&) a b
(:&) :: a -> b -> :& a b
instance [overlap ok] Show (m a) => Show (NonGreedy m a)
instance [overlap ok] Eq (m a) => Eq (NonGreedy m a)
instance [overlap ok] (Show a, Show b) => Show (a :& b)
instance [overlap ok] (Eq a, Eq b) => Eq (a :& b)
instance [overlap ok] (Argument o, Argument n, Argument m, Argument l, Argument k, Argument j, Argument i, Argument h, Argument g, Argument f, Argument e, Argument d, Argument c, Argument b, Argument a) => ArgumentTuple (o, n, m, l, k, j, i, h, g, f, e, d, c, b, a)
instance [overlap ok] (Argument n, Argument m, Argument l, Argument k, Argument j, Argument i, Argument h, Argument g, Argument f, Argument e, Argument d, Argument c, Argument b, Argument a) => ArgumentTuple (n, m, l, k, j, i, h, g, f, e, d, c, b, a)
instance [overlap ok] (Argument m, Argument l, Argument k, Argument j, Argument i, Argument h, Argument g, Argument f, Argument e, Argument d, Argument c, Argument b, Argument a) => ArgumentTuple (m, l, k, j, i, h, g, f, e, d, c, b, a)
instance [overlap ok] (Argument l, Argument k, Argument j, Argument i, Argument h, Argument g, Argument f, Argument e, Argument d, Argument c, Argument b, Argument a) => ArgumentTuple (l, k, j, i, h, g, f, e, d, c, b, a)
instance [overlap ok] (Argument k, Argument j, Argument i, Argument h, Argument g, Argument f, Argument e, Argument d, Argument c, Argument b, Argument a) => ArgumentTuple (k, j, i, h, g, f, e, d, c, b, a)
instance [overlap ok] (Argument j, Argument i, Argument h, Argument g, Argument f, Argument e, Argument d, Argument c, Argument b, Argument a) => ArgumentTuple (j, i, h, g, f, e, d, c, b, a)
instance [overlap ok] (Argument i, Argument h, Argument g, Argument f, Argument e, Argument d, Argument c, Argument b, Argument a) => ArgumentTuple (i, h, g, f, e, d, c, b, a)
instance [overlap ok] (Argument h, Argument g, Argument f, Argument e, Argument d, Argument c, Argument b, Argument a) => ArgumentTuple (h, g, f, e, d, c, b, a)
instance [overlap ok] (Argument g, Argument f, Argument e, Argument d, Argument c, Argument b, Argument a) => ArgumentTuple (g, f, e, d, c, b, a)
instance [overlap ok] (Argument f, Argument e, Argument d, Argument c, Argument b, Argument a) => ArgumentTuple (f, e, d, c, b, a)
instance [overlap ok] (Argument e, Argument d, Argument c, Argument b, Argument a) => ArgumentTuple (e, d, c, b, a)
instance [overlap ok] (Argument d, Argument c, Argument b, Argument a) => ArgumentTuple (d, c, b, a)
instance [overlap ok] (Argument c, Argument b, Argument a) => ArgumentTuple (c, b, a)
instance [overlap ok] (Argument b, Argument a) => ArgumentTuple (b, a)
instance [overlap ok] Argument a => ArgumentTuple a
instance [overlap ok] (Argument a, ArgumentTuple y) => ArgumentTuple (a :& y)
instance [overlap ok] ArgumentTuple ()
instance [overlap ok] Argument String
instance [overlap ok] Argument (m a) => Argument (NonGreedy m a)
instance [overlap ok] Arguable a => Argument [a]
instance [overlap ok] Arguable a => Argument (Maybe a)
instance [overlap ok] Arguable a => Argument a
instance [overlap ok] Arguable Char
instance [overlap ok] Arguable FilePath
instance [overlap ok] Arguable Text
instance [overlap ok] Arguable String
instance [overlap ok] (Typeable t, Read t) => Arguable t
|