Safe Haskell | None |
---|
Liberty - Penny command line parsing utilities
Both Cabin and Zinc share various functions that aid in parsing command lines. For instance both the Postings report and the Zinc postings filter use common command-line options. However, Zinc already depends on Cabin. To avoid a cyclic dependency whereby Cabin would also depend on Zinc, functions formerly in Zinc that Cabin will also find useful are relocated here, to Liberty.
- type MatcherFactory = CaseSensitive -> Text -> Exceptional Text Matcher
- newtype FilteredNum = FilteredNum {}
- newtype SortedNum = SortedNum {}
- data LibertyMeta
- xactionsToFiltered :: LPdct -> [PostFilterFn] -> (PostFam -> PostFam -> Ordering) -> [Transaction] -> ([Chunk], [Box LibertyMeta])
- newtype ListLength = ListLength {
- unListLength :: Int
- newtype ItemIndex = ItemIndex {
- unItemIndex :: Int
- type PostFilterFn = ListLength -> ItemIndex -> Bool
- parseComparer :: String -> Exceptional Error Comp
- processPostFilters :: [PostFilterFn] -> [a] -> [a]
- parsePredicate :: ExprDesc -> [Token a] -> Exceptional Error (Pdct a)
- parseInt :: String -> Exceptional Error Int
- parseInfix :: OptSpec ExprDesc
- parseRPN :: OptSpec ExprDesc
- exprDesc :: [OptSpec ExprDesc]
- showExpression :: OptSpec ()
- verboseFilter :: OptSpec ()
- type Operand = Pdct PostFam
- operandSpecs :: DateTime -> [OptSpec (CaseSensitive -> MatcherFactory -> Exceptional Error Operand)]
- postFilterSpecs :: (OptSpec (Exceptional Error PostFilterFn), OptSpec (Exceptional Error PostFilterFn))
- matcherSelectSpecs :: [OptSpec MatcherFactory]
- caseSelectSpecs :: [OptSpec CaseSensitive]
- operatorSpecs :: [OptSpec (Token a)]
- type Error = Text
Documentation
type MatcherFactory = CaseSensitive -> Text -> Exceptional Text MatcherSource
newtype FilteredNum Source
A serial indicating how a post relates to all other postings that made it through the filtering phase.
A serial indicating how a posting relates to all other postings that have been sorted.
:: LPdct | The predicate to filter the transactions |
-> [PostFilterFn] | Post filter specs |
-> (PostFam -> PostFam -> Ordering) | The sorter |
-> [Transaction] | The transactions to work on (probably parsed in from Copper) |
-> ([Chunk], [Box LibertyMeta]) | Sorted, filtered postings |
Takes a list of transactions, splits them into PostingChild instances, filters them, post-filters them, sorts them, and places them in Box instances with Filtered serials. Also returns a Text containing a description of the evalutation process.
newtype ListLength Source
type PostFilterFn = ListLength -> ItemIndex -> BoolSource
Specifies options for the post-filter stage.
parseComparer :: String -> Exceptional Error CompSource
Parses comparers given on command line to a function. Fails if the string given is invalid.
processPostFilters :: [PostFilterFn] -> [a] -> [a]Source
parsePredicate :: ExprDesc -> [Token a] -> Exceptional Error (Pdct a)Source
Parses a list of tokens to obtain a predicate. Deals with an empty list of tokens by returning a predicate that is always True. Fails if the list of tokens is not empty and the parse fails.
parseInt :: String -> Exceptional Error IntSource
Parses exactly one integer; fails if it cannot read exactly one.
showExpression :: OptSpec ()Source
verboseFilter :: OptSpec ()Source
Parsers
operandSpecs :: DateTime -> [OptSpec (CaseSensitive -> MatcherFactory -> Exceptional Error Operand)]Source
All operand OptSpec.
postFilterSpecs :: (OptSpec (Exceptional Error PostFilterFn), OptSpec (Exceptional Error PostFilterFn))Source
operatorSpecs :: [OptSpec (Token a)]Source