Arg package:base

Arg isn't itself a Semigroup in its own right, but it can be placed inside Min and Max to compute an arg min or arg max. In the event of ties, the leftmost qualifying Arg is chosen; contrast with the behavior of minimum and maximum for many other types, where ties are broken by considering elements to the left in the structure to be less than elements to the right.

Examples

>>> minimum [ Arg (x * x) x | x <- [-10 .. 10] ]
Arg 0 0
>>> maximum [ Arg (-0.2*x^2 + 1.5*x + 1) x | x <- [-10 .. 10] ]
Arg 3.8 4.0
>>> minimum [ Arg (-0.2*x^2 + 1.5*x + 1) x | x <- [-10 .. 10] ]
Arg (-34.0) (-10.0)

Examples

>>> Max (Arg 0 ()) <> Max (Arg 1 ())
Max {getMax = Arg 1 ()}
>>> maximum [ Arg (length name) name | name <- ["violencia", "lea", "pixie"]]
Arg 9 "violencia"

Examples

>>> Min (Arg 0 ()) <> Min (Arg 1 ())
Min {getMin = Arg 0 ()}
>>> minimum [ Arg (length name) name | name <- ["violencia", "lea", "pixie"]]
Arg 3 "lea"
Describes whether an option takes an argument or not, and if so how the argument is injected into a value of type a.
What to do with options following non-options
Internal encoding of argv
Observe the argument types of a type representation
no argument expected
optional argument
option requires argument
Computation getArgs returns a list of the program's command line arguments (not including the program name).
withArgs args act - while executing action act, have getArgs return args.
Typeclass of printf-formattable values. The formatArg method takes a value and a field format descriptor and either fails due to a bad descriptor or produces a ShowS as the result. The default parseFormat expects no modifiers: this is the normal case. Minimal instance: formatArg.
Calls perror to indicate that there is a type error or similar in the given argument.
Calls perror to indicate that there is a missing argument in the argument list.
The byte ordering of the target machine.
Computation getFullArgs is the "raw" version of getArgs, similar to argv in other languages. It returns a list of the program's command line arguments, starting with the program name, and including those normally eaten by the RTS (+RTS ... -RTS).