Safe Haskell | None |
---|---|
Language | Haskell2010 |
Types used in the butcher interface.
- data CommandDesc out = CommandDesc {
- _cmd_mParent :: Maybe (String, CommandDesc out)
- _cmd_synopsis :: Maybe Doc
- _cmd_help :: Maybe Doc
- _cmd_parts :: [PartDesc]
- _cmd_out :: Maybe out
- _cmd_children :: Deque (String, CommandDesc out)
- cmd_out :: forall out. Lens' (CommandDesc out) (Maybe out)
- type CmdParser f out = Free (CmdParserF f out)
- data Input
- = InputString String
- | InputArgs [String]
- data ParsingError = ParsingError {
- _pe_messages :: [String]
- _pe_remaining :: Input
- data PartDesc
Documentation
data CommandDesc out Source #
A representation/description of a command parser built via the
CmdParser
monad. Can be transformed into a pretty Doc to display
as usage/help via ppUsage
and related functions.
Note that there is the _cmd_out
accessor that contains Maybe out
which
might be useful after successful parsing.
CommandDesc | |
|
Functor CommandDesc Source # | |
Show (CommandDesc out) Source # | |
Butcher supports two input modi: String
and [String]
. Program
arguments have the latter form, while parsing interactive command input
(e.g. when you implement a terminal of sorts) is easier when you can
process the full String
without having to wordify it first by some
means (and List.words is not the right approach in many situations.)
data ParsingError Source #
Information about an error that occured when trying to parse some Input
using some CmdParser
.
ParsingError | |
|
A representation/description of a command's parts, i.e. flags or params.
As a butcher user, the higher-level pretty-printing functions for
CommandDesc
are probably sufficient.