butcher-1.3.3.1: Chops a command or program invocation into digestable pieces.
Safe HaskellNone
LanguageHaskell2010

UI.Butcher.Monadic.Types

Description

Types used in the butcher interface.

Synopsis

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.

Constructors

CommandDesc 

Fields

Instances

Instances details
Functor CommandDesc Source # 
Instance details

Defined in UI.Butcher.Monadic.Internal.Types

Methods

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

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

Show (CommandDesc out) Source # 
Instance details

Defined in UI.Butcher.Monadic.Internal.Types

Methods

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

Constructors

InputString String 
InputArgs [String] 

Instances

Instances details
Eq Input Source # 
Instance details

Defined in UI.Butcher.Monadic.Internal.Types

Methods

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

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

Show Input Source # 
Instance details

Defined in UI.Butcher.Monadic.Internal.Types

Methods

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.

Constructors

ParsingError 

Fields

Instances

Instances details
Eq ParsingError Source # 
Instance details

Defined in UI.Butcher.Monadic.Internal.Types

Methods

(==) :: ParsingError -> ParsingError -> Bool

(/=) :: ParsingError -> ParsingError -> Bool

Show ParsingError Source # 
Instance details

Defined in UI.Butcher.Monadic.Internal.Types

Methods

showsPrec :: Int -> ParsingError -> ShowS

show :: ParsingError -> String

showList :: [ParsingError] -> ShowS

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.

Instances

Instances details
Show PartDesc Source # 
Instance details

Defined in UI.Butcher.Monadic.Internal.Types

Methods

showsPrec :: Int -> PartDesc -> ShowS

show :: PartDesc -> String

showList :: [PartDesc] -> ShowS

emptyCommandDesc :: CommandDesc out Source #

Empty CommandDesc value. Mostly for butcher-internal usage.

data Visibility Source #

Constructors

Visible 
Hidden 

Instances

Instances details
Eq Visibility Source # 
Instance details

Defined in UI.Butcher.Monadic.Internal.Types

Methods

(==) :: Visibility -> Visibility -> Bool

(/=) :: Visibility -> Visibility -> Bool

Show Visibility Source # 
Instance details

Defined in UI.Butcher.Monadic.Internal.Types

Methods

showsPrec :: Int -> Visibility -> ShowS

show :: Visibility -> String

showList :: [Visibility] -> ShowS