butcher- Chops a command or program invocation into digestable pieces.

Safe HaskellNone



Types used in the butcher interface.



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.


Functor CommandDesc Source # 


fmap :: (a -> b) -> CommandDesc a -> CommandDesc b #

(<$) :: a -> CommandDesc b -> CommandDesc a #

Show (CommandDesc out) Source # 


showsPrec :: Int -> CommandDesc out -> ShowS #

show :: CommandDesc out -> String #

showList :: [CommandDesc out] -> ShowS #

cmd_out :: forall out. Lens' (CommandDesc out) (Maybe out) Source #

type CmdParser f out = Free (CmdParserF f out) Source #

The CmdParser monad type. It is a free monad over some functor but users of butcher don't need to know more than that CmdParser is a Monad.

data Input 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.)


Eq Input Source # 


(==) :: Input -> Input -> Bool #

(/=) :: Input -> Input -> Bool #

Show Input Source # 


showsPrec :: Int -> Input -> ShowS #

show :: Input -> String #

showList :: [Input] -> ShowS #

data ParsingError Source #

Information about an error that occured when trying to parse some Input using some CmdParser.



data PartDesc Source #

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.