| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
PlutusCore.Executable.Parsers
Description
Common option parsers for executables
Synopsis
- input ∷ Parser Input
- fileInput ∷ Parser Input
- stdInput ∷ Parser Input
- output ∷ Parser Output
- fileOutput ∷ Parser Output
- stdOutput ∷ Parser Output
- noOutput ∷ Parser Output
- showByTable ∷ Show a ⇒ [(String, a)] → a → String
- formatTable ∷ [(String, Maybe String, Format)]
- formatHelp ∷ String
- formatReader ∷ String → Maybe Format
- formatNames ∷ [String]
- inputformat ∷ Parser Format
- nonTextualExtensionTable ∷ [(String, Format)]
- formatFromExtension ∷ String → FilePath → Maybe Format
- extensionHelp ∷ String → [(String, Maybe String, Format)] → String
- extensionDeductionSentence ∷ String → String
- extensionDeductionNote ∷ String → [(String, Maybe String, Format)] → String
- formatOptionHelp ∷ String → String → String → String
- supportedFormats ∷ [(String, Maybe String, Format)] → [Format]
- deduceInputFormat ∷ (FilePath → Maybe fmt) → fmt → Maybe fmt → Input → fmt
- deduceOutputFormat ∷ (FilePath → Maybe fmt) → fmt → Maybe fmt → Output → fmt
- resolveInputFormat ∷ String → [Format] → Maybe Format → Input → Format
- resolveOutputFormat ∷ String → [Format] → Maybe Format → Output → Format
- supportedFormatFromExtension ∷ String → [Format] → FilePath → Maybe Format
- inputformatOptional ∷ Parser (Maybe Format)
- inputWithFormat ∷ Parser (Input, Format)
- filesWithFormats ∷ Parser [(FilePath, Format)]
- outputformat ∷ Parser Format
- outputformatOptional ∷ Parser (Maybe Format)
- outputWithFormat ∷ Parser (Output, Format)
- tracemode ∷ Parser TraceMode
- files ∷ Parser Files
- applyOpts ∷ Parser ApplyOptions
- printmode ∷ Parser PrintMode
- nameformat ∷ Parser NameFormat
- certifier ∷ Parser Certifier
- printOpts ∷ Parser PrintOptions
- convertOpts ∷ Parser ConvertOptions
- certifierOutputMode ∷ Parser CertifierOutputMode
- cseWhichSubtermsTable ∷ [(String, CseWhichSubterms)]
- optimizeOpts ∷ Parser (OptimizeOpts name a)
- evalArgKindTable ∷ [(String, EvalArgKind)]
- optimiseEvalOpts ∷ Parser OptimiseEvalOpts
- optimiseOpts ∷ Parser (OptimiseOptions name a)
- exampleMode ∷ Parser ExampleMode
- exampleAvailable ∷ Parser ExampleMode
- exampleName ∷ Parser ExampleName
- exampleSingle ∷ Parser ExampleMode
- exampleOpts ∷ Parser ExampleOptions
- builtinSemanticsVariantTable ∷ [(String, BuiltinSemanticsVariant DefaultFun)]
- builtinSemanticsVariantReader ∷ String → Maybe (BuiltinSemanticsVariant DefaultFun)
- showBuiltinSemanticsVariant ∷ BuiltinSemanticsVariant DefaultFun → String
- builtinSemanticsVariant ∷ Parser (BuiltinSemanticsVariant DefaultFun)
- plcFormatTable ∷ [(String, Maybe String, Format)]
- plcFormatHelp ∷ String
- plcFormatReader ∷ String → Maybe Format
- plcFormatNames ∷ [String]
- plcInputFormatOptional ∷ Parser (Maybe Format)
- plcOutputFormatOptional ∷ Parser (Maybe Format)
- plcInputWithFormat ∷ Parser (Input, Format)
- plcFilesWithFormats ∷ Parser [(FilePath, Format)]
- plcOutputWithFormat ∷ Parser (Output, Format)
- plcApplyOpts ∷ Parser ApplyOptions
- plcConvertOpts ∷ Parser ConvertOptions
- plcOptimiseOpts ∷ Parser (OptimiseOptions name a)
- pirFormatTable ∷ [(String, Maybe String, PirFormat)]
- pirFormatHelp ∷ String
- pirFormatReader ∷ String → Maybe PirFormat
- pirFormatNames ∷ [String]
- pirExtensionTable ∷ [(String, PirFormat)]
- pirFormatFromExtension ∷ FilePath → Maybe PirFormat
- pirExtensionDeductionNote ∷ String
- resolvePirInputFormat ∷ Maybe PirFormat → Input → PirFormat
- resolvePirOutputFormat ∷ Maybe PirFormat → Output → PirFormat
- pPirInputFormatOptional ∷ Parser (Maybe PirFormat)
- pPirOutputFormatOptional ∷ Parser (Maybe PirFormat)
- pPirInputWithFormat ∷ Parser (Input, PirFormat)
- pPirOutputWithFormat ∷ Parser (Output, PirFormat)
- languageTable ∷ [(String, Language)]
- languageReader ∷ String → Maybe Language
- pLanguage ∷ Parser Language
Documentation
Parser for an input stream. If none is specified, default to stdin for ease of use in pipeline.
output ∷ Parser Output Source #
Parser for an output stream. If none is specified, default to stdout for ease of use in pipeline.
formatNames ∷ [String] Source #
nonTextualExtensionTable ∷ [(String, Format)] Source #
extensionHelp ∷ String → [(String, Maybe String, Format)] → String Source #
Describe, for the --if/--of help text, which extensions are deduced to
which format for this language's textualExt, restricted to the formats in
the given table (an extension whose format isn't in table is omitted, since
it falls back to textual instead).
extensionDeductionSentence ∷ String → String Source #
The shared wording every language's --if/--of "default:" help text is
built from, wrapped around that language's own ext -> format list.
formatOptionHelp ∷ String → String → String → String Source #
Build the full --if/--of help text for a format option: kind (e.g.
Input or Output), the list of allowed values, and a note on how the
default is chosen. Kept as two separate sentences, so the note (e.g. "deduced
from the file extension") doesn't read as if it's parenthetically attached to
the last format in the list (e.g. blueprint).
supportedFormats ∷ [(String, Maybe String, Format)] → [Format] Source #
The formats named in a format table.
deduceInputFormat ∷ (FilePath → Maybe fmt) → fmt → Maybe fmt → Input → fmt Source #
Generic extension-based format deduction, shared by every language's
input-format resolver: an explicit --if always wins; otherwise look up the
input file's extension with fromExt, falling back to deflt for stdin or an
extension fromExt doesn't recognise.
deduceOutputFormat ∷ (FilePath → Maybe fmt) → fmt → Maybe fmt → Output → fmt Source #
The output-format counterpart of deduceInputFormat: an explicit --of
always wins; otherwise look up the output file's extension with fromExt,
falling back to deflt for stdout, the silent sink, or an unrecognised
extension.
resolveInputFormat ∷ String → [Format] → Maybe Format → Input → Format Source #
Work out which input format to use, deducing from the input file's
extension (using textualExt as this language's own textual extension)
restricted to supported (eg .hex isn't deduced for the plc command,
which only handles textual and Flat).
resolveOutputFormat ∷ String → [Format] → Maybe Format → Output → Format Source #
The output-format counterpart of resolveInputFormat.
supportedFormatFromExtension ∷ String → [Format] → FilePath → Maybe Format Source #
formatFromExtension, restricted to the formats in supported.
inputformatOptional ∷ Parser (Maybe Format) Source #
The --if/--input-format option without a default, so we can tell whether
the user supplied it and deduce the format from the file extension if not.
inputWithFormat ∷ Parser (Input, Format) Source #
An input stream together with its format, deducing the format from the
file extension when --if is not given. See resolveInputFormat.
filesWithFormats ∷ Parser [(FilePath, Format)] Source #
Like inputWithFormat but for commands taking a list of input files: each
file is paired with the format to read it with. When --if is given it forces
that format for every file; otherwise each file's format is deduced
independently from its own extension.
outputformatOptional ∷ Parser (Maybe Format) Source #
The --of/--output-format option without a default, so we can tell
whether the user supplied it and deduce the format from the -o file extension
if not.
outputWithFormat ∷ Parser (Output, Format) Source #
An output stream together with its format, deducing the format from the
file extension when --of is not given. See resolveOutputFormat.
optimizeOpts ∷ Parser (OptimizeOpts name a) Source #
evalArgKindTable ∷ [(String, EvalArgKind)] Source #
optimiseOpts ∷ Parser (OptimiseOptions name a) Source #
plcFormatNames ∷ [String] Source #
plcInputFormatOptional ∷ Parser (Maybe Format) Source #
The --if option for plc, without a default so the format can be deduced
from the file extension when it isn't given.
plcOutputFormatOptional ∷ Parser (Maybe Format) Source #
The --of option for plc, without a default so the format can be deduced
from the file extension when it isn't given.
plcOptimiseOpts ∷ Parser (OptimiseOptions name a) Source #
pirFormatNames ∷ [String] Source #
pirExtensionTable ∷ [(String, PirFormat)] Source #
pirFormatFromExtension ∷ FilePath → Maybe PirFormat Source #
Guess the PIR format from a file name's extension. Returns Nothing for
an unrecognised extension, in which case callers fall back to TextualPir.
resolvePirInputFormat ∷ Maybe PirFormat → Input → PirFormat Source #
Work out which PIR format to use. An explicit --if/--of always wins;
otherwise the format is deduced from the file's extension, falling back to
TextualPir for stdin/stdout or an unrecognised extension.
resolvePirOutputFormat ∷ Maybe PirFormat → Output → PirFormat Source #
The output-format counterpart of resolvePirInputFormat.
pPirInputFormatOptional ∷ Parser (Maybe PirFormat) Source #
The --if option for pir, without a default so the format can be deduced
from the file extension when it isn't given.
pPirOutputFormatOptional ∷ Parser (Maybe PirFormat) Source #
The --of option for pir, without a default so the format can be deduced
from the file extension when it isn't given.
pPirInputWithFormat ∷ Parser (Input, PirFormat) Source #
An input stream together with its PIR format, deducing the format from the
file extension when --if is not given. See resolvePirInputFormat.
pPirOutputWithFormat ∷ Parser (Output, PirFormat) Source #
An output stream together with its PIR format, deducing the format from
the file extension when --of is not given. See resolvePirOutputFormat.
languageTable ∷ [(String, Language)] Source #