h&t,      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~                                                                                                                                                                                                                                                                                                                                                ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! " " " " " " " " " " " " " " " " " " " " " " " " " # # # # # # # # # # # # $ % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & ' ' ' ' ' ' ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ) ) ) ) * * * * * * * * * * * * + + + + + + , , , , , , , , , , , , , , - . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ............//001111111111111122333333333333347 Safe-Inferred"(\" hledger-libAn error message arising during a regular expression operation. Eg: trying to compile a malformed regular expression, or trying to apply a malformed replacement pattern.# hledger-lib>A replacement pattern. May include numeric backreferences (N).$ hledger-libRegular expression. Extended regular expression-ish syntax ? But does not support eg (?i) syntax. hledger-lib-Make a nice error message for a regexp error.* hledger-lib=Test whether a Regexp matches a String. This is an alias for  for consistent naming.+ hledger-lib&Tests whether a Regexp matches a Text.This currently unpacks the Text to a String an works on that. This is due to a performance bug in regex-tdfa (#9), which may or may not be relevant here., hledger-libA memoising version of regexReplace. Caches the result for each search pattern, replacement pattern, target string tuple. This won't generate a regular expression parsing error since that is pre-compiled nowadays, but there can still be a runtime error from the replacement pattern, eg with a backreference referring to a nonexistent match group. "#$%&'()*+,-. $%&'()#"*+,-. Safe-Inferred"%&5;^6 hledger-libA Ledger has the journal it derives from, and the accounts derived from that. Accounts are accessible both list-wise and tree-wise, since each one knows its parent and subs; the first account is the root of the tree and always exists.: hledger-libWhether an account's balance is normally a positive number (in accounting terms, a debit balance) or a negative number (credit balance). Assets and expenses are normally positive (debit), while liabilities, equity and income are normally negative (credit). ,https://en.wikipedia.org/wiki/Normal_balance= hledger-libAn account, with its balances, parent/subaccount relationships, etc. Only the name is required; the other fields are added when needed.? hledger-libthis account's full name@ hledger-liboptional extra info from account directives relationships in the treeA hledger-libthis account's sub-accountsB hledger-libparent accountC hledger-libused in the accounts report to label elidable parents balance informationD hledger-lib&the number of postings to this accountE hledger-lib-this account's balance, excluding subaccountsF hledger-lib-this account's balance, including subaccountsG hledger-libExtra information about an account that can be derived from its account directive (and the other account directives).I hledger-libany comment lines following an account directive for this accountJ hledger-lib/tags extracted from the account comment, if anyK hledger-libthe order in which this account was declared, relative to other account declarations, during parsing (1..)L hledger-libsource file and positionM hledger-lib+Extra information found in a tag directive.O hledger-libany comment lines following the tag directive. No tags allowed here.P hledger-lib-Extra information found in a payee directive.R hledger-lib/any comment lines following the payee directiveS hledger-lib'tags extracted from the comment, if anyT hledger-lib2The id of a data format understood by hledger, eg journal or csv>. The --output-format option selects one of these for output.U hledger-libA journal in the process of being parsed, not yet finalised. The data is partial, and list fields are in reverse order.V hledger-libA Journal, containing transactions and various other things. The basic data model for hledger.This is used during parsing (as the type alias ParsedJournal), and then finalised/validated for use as a Journal. Some extra parsing-related fields are included for convenience, at least for now. In a ParsedJournal these are updated as parsing proceeds, in a Journal they represent the final state at end of parsing (used eg by the add command).X hledger-libthe current default year, specified by the most recent Y directive (or current date)Y hledger-libthe current default commodity and its format, specified by the most recent D directiveZ hledger-libthe character to always parse as decimal point, if set by CsvReader's decimal-mark (or a future journal directive)[ hledger-libthe current stack of parent account names, specified by apply account directives\ hledger-libthe current account name aliases in effect, specified by alias directives (& options ?) ,jparsetransactioncount :: Integer -- ^ the current count of transactions parsed so far (only journal format txns, currently)] hledger-lib2timeclock sessions which have not been clocked out_ hledger-libPayees declared by payee directives, in parse order (after journal finalisation)` hledger-libTags declared by tag directives, in parse order (after journal finalisation)a hledger-libAccounts declared by account directives, in parse order (after journal finalisation)b hledger-libAccounts which have tags declared in their directives, and those tags. (Does not include parents' tags.)c hledger-libAccounts whose type has been explicitly declared in their account directives, grouped by type.d hledger-libAll accounts for which a type has been declared or can be inferred from its parent or its name.e hledger-libper-commodity display styles declared globally, eg by command line option or import commandf hledger-lib8commodities and formats declared by commodity directivesg hledger-lib5commodities and formats inferred from journal amountsh hledger-libDeclarations of market prices by P directives, in parse order (after journal finalisation)i hledger-libMarket prices implied by transactions, in parse order (after journal finalisation)m hledger-lib6any final trailing comments in the (main) journal filen hledger-libthe file path and raw text of the main and any included journal files. The main file is first, followed by any included files in the order encountered. TODO: FilePath is a sloppy type here, don't assume it's a real file; values like "", "-", "(string)" can be seeno hledger-libwhen this journal was last read from its file(s) NOTE: after adding new fields, eg involving account names, consider updating the Anon instance in Hleger.Cli.Anonp hledger-libA historical market price (exchange rate) from one commodity to another. A more concise form of a PriceDirective, without the amount display info.r hledger-lib+Date on which this price becomes effective.s hledger-lib#The commodity being converted from.t hledger-lib!The commodity being converted to.u hledger-libOne unit of the "from" commodity is worth this quantity of the "to" commodity.v hledger-libA market price declaration made by the journal format's P directive. It declares two things: a historical exchange rate between two commodities, and an amount display style for the second commodity. hledger-libA periodic transaction rule, describing a transaction that recurs. hledger-lib the period expression as written hledger-lib-the interval at which this transaction recurs hledger-libthe (possibly unbounded) period during which this transaction recurs. Contains a whole number of intervals. hledger-libthe file position where the period expression starts, and where the last posting ends hledger-libsome of Transaction's fields hledger-libA transaction modifier transformation, which adds an extra posting to the matched posting's transaction. Can be like a regular posting, or can have the tmprIsMultiplier flag set, indicating that it's a multiplier for the matched posting's amount. hledger-libA transaction modifier rule. This has a query which matches postings in the journal, and a list of transformations to apply to those postings or their transactions. Currently there is one kind of transformation: the TMPostingRule, which adds a posting ("auto posting") to the transaction, optionally setting its amount to the matched posting's amount multiplied by a constant. hledger-libthis transaction's 1-based position in the transaction stream, or 0 when not available hledger-lib8any comment lines immediately preceding this transaction hledger-libthe file position where the date starts, and where the last posting ends hledger-libthis transaction's comment lines, as a single non-indented multi-line string hledger-lib0tag names and values, extracted from the comment hledger-libthis transaction's postings hledger-lib8this posting's date, if different from the transaction's hledger-libthis posting's secondary date, if different from the transaction's hledger-libthis posting's comment lines, as a single non-indented multi-line string hledger-libtag names and values, extracted from the posting comment and (after finalisation) the posting account's directive if any hledger-liban expected balance in the account after this posting, in a single commodity, excluding subaccounts. hledger-libthis posting's parent transaction (co-recursive types). Tying this knot gets tedious, Maybe makes it easier/optional. hledger-libWhen this posting has been transformed in some way (eg its amount or price was inferred, or the account name was changed by a pivot or budget report), this references the original untransformed posting (which will have Nothing in this field). hledger-libA balance assertion is a declaration about an account's expected balance at a certain point (posting date and parse order). They provide additional error checking and readability to a journal file.A balance assignments is an instruction to hledger to adjust an account's balance to a certain amount at a certain point.The - type is used for representing both of these.hledger supports multiple kinds of balance assertions/assignments, which differ in whether they refer to a single commodity or all commodities, and the (subaccount-)inclusive or exclusive account balance. hledger-lib.the expected balance in a particular commodity hledger-lib.disallow additional non-asserted commodities ? hledger-lib9include subaccounts when calculating the actual balance ? hledger-lib2the assertion's file position, for error reporting hledger-libThe status of a transaction or posting, recorded with a status mark (nothing, !, or *). What these mean is ultimately user defined. hledger-libStores the CommoditySymbol of the Amount, along with the CommoditySymbol of the price, and its unit price if being used. hledger-libTypes with this class have one or more amounts, which can have display styles applied to them. hledger-lib?the (fixed, transaction-specific) price for this amount, if any hledger-libA style for displaying digit groups in the integer part of a floating point number. It consists of the character used to separate groups (comma or period, whichever is not used as decimal point), and the size of each group, starting with the one nearest the decimal point. The last group size is assumed to repeat. Eg, comma between thousands is DigitGroups ',' [3]. hledger-libThe "display precision" for a hledger amount, by which we mean the number of decimal digits to display to the right of the decimal mark. hledger-lib&show this many decimal digits (0..255) hledger-lib5show all significant decimal digits stored internally hledger-libThe display style for an amount. (See also Amount.AmountDisplayOpts). hledger-lib*show the symbol on the left or the right ? hledger-lib*show a space between symbol and quantity ? hledger-lib:show the integer part with these digit group marks, or not hledger-libshow this character (should be . or ,) as decimal mark, or use the default (.) hledger-libshow this number of digits after the decimal point, or show as-is (leave precision unchanged) XXX Making asprecision a maybe simplifies code for styling with or without precision, but complicates the semantics (Nothing is useful only when setting style). hledger-libAn amount's per-unit or total cost/selling price in another commodity, as recorded in the journal entry eg with  or @. Cost, formerly AKA "transaction price". The amount is always positive. hledger-lib'The basic numeric type used in amounts. hledger-lib?GLKJHIMNOPSQRTUVonmlkjihgfedcba`_^]\[ZYWXputsqrvzywx{~|}6978:;<=FEDCBA@>?GLKJHIMNOPSQRTUVonmlkjihgfedcba`_^]\[ZYWXputsqrvzywx{~|} Safe-Inferred"p{ hledger-lib#Convert Periods to exact DateSpans.periodAsDateSpan (MonthPeriod 2000 1) == DateSpan (Just $ Flex $ fromGregorian 2000 1 1) (Just $ Flex $ fromGregorian 2000 2 1)True hledger-libConvert DateSpans to Periods.dateSpanAsPeriod $ DateSpan (Just $ Exact $ fromGregorian 2000 1 1) (Just $ Exact $ fromGregorian 2000 2 1)MonthPeriod 2000 1 hledger-libConvert PeriodBetweens to a more abstract period where possible.simplifyPeriod $ PeriodBetween (fromGregorian 1 1 1) (fromGregorian 2 1 1) YearPeriod 1simplifyPeriod $ PeriodBetween (fromGregorian 2000 10 1) (fromGregorian 2001 1 1)QuarterPeriod 2000 4simplifyPeriod $ PeriodBetween (fromGregorian 2000 2 1) (fromGregorian 2000 3 1)MonthPeriod 2000 2simplifyPeriod $ PeriodBetween (fromGregorian 2016 7 25) (fromGregorian 2016 8 1)WeekPeriod 2016-07-25simplifyPeriod $ PeriodBetween (fromGregorian 2000 1 1) (fromGregorian 2000 1 2)DayPeriod 2000-01-01simplifyPeriod $ PeriodBetween (fromGregorian 2000 2 28) (fromGregorian 2000 3 1)#PeriodBetween 2000-02-28 2000-03-01simplifyPeriod $ PeriodBetween (fromGregorian 2000 2 29) (fromGregorian 2000 3 1)DayPeriod 2000-02-29simplifyPeriod $ PeriodBetween (fromGregorian 2000 12 31) (fromGregorian 2001 1 1)DayPeriod 2000-12-31 hledger-libIs this period a "standard" period, referencing a particular day, week, month, quarter, or year ? Periods of other durations, or infinite duration, or not starting on a standard period boundary, are not. hledger-lib2The width of a period of this type when displayed. hledger-libRender a period as a compact display string suitable for user output.1showPeriod (WeekPeriod (fromGregorian 2016 7 25))"2016-07-25W30" hledger-libLike showPeriod, but if it's a month period show just the 3 letter month name abbreviation for the current locale. hledger-libMove a standard period to the following period of same duration. Non-standard periods are unaffected. hledger-libMove a standard period to the preceding period of same duration. Non-standard periods are unaffected. hledger-libMove a standard period to the following period of same duration, staying within enclosing dates. Non-standard periods are unaffected. hledger-libMove a standard period to the preceding period of same duration, staying within enclosing dates. Non-standard periods are unaffected. hledger-libMove a standard period stepwise so that it encloses the given date. Non-standard periods are unaffected. hledger-libEnlarge a standard period to the next larger enclosing standard period, if there is one. Eg, a day becomes the enclosing week. A week becomes whichever month the week's thursday falls into. A year becomes all (unlimited). Non-standard periods (arbitrary dates, or open-ended) are unaffected. hledger-libShrink a period to the next smaller standard period inside it, choosing the subperiod which contains today's date if possible, otherwise the first subperiod. It goes like this: unbounded periods and nonstandard periods (between two arbitrary dates) -> current year -> current quarter if it's in selected year, otherwise first quarter of selected year -> current month if it's in selected quarter, otherwise first month of selected quarter -> current week if it's in selected month, otherwise first week of selected month -> today if it's in selected week, otherwise first day of selected week, unless that's in previous month, in which case first day of month containing selected week. Shrinking a day has no effect.5 Safe-Inferredp6 Safe-Inferred 5< hledger-libA type bundling a  with its full source text, filepath, and stack of include files. Suitable for pretty-printing. Megaparsec's  type already bundles a parse error with its full source text and filepath, so we just add a stack of include files. hledger-libA type representing "final" parse errors that cannot be backtracked from and are guaranteed to halt parsing. The anti-backtracking behaviour is implemented by an < layer in the parser's monad stack, using this type as the  error type.We have three goals for this type: (1) it should be possible to convert any parse error into a "final" parse error, (2) it should be possible to take a parse error thrown from an include file and re-throw it in the parent file, and (3) the pretty-printing of "final" parse errors should be consistent with that of ordinary parse errors, but should also report a stack of files for errors thrown from include files.In order to pretty-print a "final" parse error (goal 3), it must be bundled with include filepaths and its full source text. When a "final" parse error is thrown from within a parser, we do not have access to the full source, so we must hold the parse error until it can be joined with its source (and include filepaths, if it was thrown from an include file) by the parser's caller.A parse error with include filepaths and its full source text is represented by the  type, while a parse error in need of either include filepaths, full source text, or both is represented by the  type. hledger-libA fragment of source suitable for "re-parsing". The purpose of this data type is to preserve the content and source position of the excerpt so that parse errors raised during "re-parsing" may properly reference the original source. hledger-libA specialised version of ParseErrorBundle: a non-empty collection of hledger parse errors, equipped with PosState to help pretty-print them. Specialised for a  parse stream. hledger-lib9Custom error data for hledger parsers. Specialised for a / parse stream. ReparseableTextParseErrorData ? hledger-libFail with a message at a specific source position interval. The interval must be contained within a single line. hledger-libRe-throw parse errors obtained from the "re-parsing" of an excerpt of the source text. hledger-libFail at a specific source position, given by the raw offset from the start of the input stream (the number of tokens processed at that point). hledger-libFail at a specific source interval, given by the raw offsets of its endpoints from the start of the input stream (the numbers of tokens processed at those points).Note that care must be taken to ensure that the specified interval does not span multiple lines of the input source. This will not be checked. hledger-lib%Get the raw text of a source excerpt. hledger-lib&'excerpt_ p' applies the given parser p5 and extracts the portion of the source consumed by p, along with the source position of this portion. This is the only way to create a source excerpt suitable for "re-parsing" by . hledger-lib4'reparseExcerpt s p' "re-parses" the source excerpt s using the parser p. Parse errors raised by p will be re-thrown at the source position of the source excerpt.In order for the correct source file to be displayed when re-throwing parse errors, we must ensure that the source file during the use of 'reparseExcerpt s p' is the same as that during the use of $ that generated the source excerpt s. However, we can usually expect this condition to be satisfied because, at the time of writing, the only changes of source file in the codebase take place through include files, and the parser for include files neither accepts nor returns s. hledger-libPretty-print our custom parse errors. It is necessary to use this instead of % when custom parse errors are thrown.This function intercepts our custom parse errors and applies final adjustments (finalizeCustomError) before passing them to . These adjustments are part of the implementation of the behaviour of our custom parse errors.,Note: We must ensure that the offset of the  of the provided . is no larger than the offset specified by a  constructor. This is guaranteed if this offset is set to 0 (that is, the beginning of the source file), which is the case for s returned from . hledger-lib;Convert a "regular" parse error into a "final" parse error. hledger-libLike megaparsec's , but as a "final" parse error. hledger-libLike , but as a "final" parse error. hledger-libLike megaparsec's , but as a "final" parse error. hledger-libPretty-print a "final" parse error: print the stack of include files, then apply the pretty-printer for parse error bundles. Note that  must be used on a "final" parse error before it can be pretty-printed. hledger-libSupply a filepath and source text to a "final" parse error so that it can be pretty-printed. You must ensure that you provide the appropriate source text and filepath. hledger-libParse a file with the given parser and initial state, discarding the final state and re-throwing any parse errors as "final" parse errors. hledger-lib Start offset hledger-libEnd end offset hledger-lib Error message7 Safe-Inferred hledger-libHelper for constructing Builders while keeping track of text width. hledger-lib'Convert a WideBuilder to a strict Text. hledger-lib'Convert a strict Text to a WideBuilder. hledger-lib"Convert a WideBuilder to a String.  Safe-Inferred" hledger-libHow to align text in a cell hledger-lib Cell contents along an alignment hledger-lib)The options to use for rendering a table. hledger-lib Pretty tables hledger-lib$Whether to display the outer borders hledger-lib%Whether to display spaces around bars hledger-libCreate a single-line cell from the given contents with its natural width. hledger-libCreate a multi-line cell from the given contents with its natural width. hledger-libReturn the width of a Cell. hledger-libRender a table according to common options, for backwards compatibility hledger-lib8Render a table according to various cell specifications> hledger-lib>A version of renderTable which returns the underlying Builder. hledger-lib>A version of renderTable that operates on rows (including the 8 of column headers) and returns the underlying Builder. hledger-lib5Render a single row according to cell specifications. hledger-libMonochrome version of pprint. This will never print in colour. hledger-libDisplay the given text on the terminal, using the user's $PAGER if the text is taller than the current terminal and stdout is interactive and TERM is not "dumb" (except on Windows, where a pager will not be used). If the text contains ANSI codes, because hledger thinks the current terminal supports those, the pager should be configured to display those, otherwise users will see junk on screen (#2015). We call "setLessR" at hledger startup to make that less likely. hledger-libAn alternative to ansi-terminal's getTerminalSize, based on the more robust-looking terminal-size package. Tries to get stdout's terminal's current height and width. hledger-libMake sure our $LESS and $MORE environment variables contain R, to help ensure the common pager less will show our ANSI output properly. less uses $LESS by default, and $MORE when it is invoked as more. What the original more program does, I'm not sure. If $PAGER is configured to something else, this probably will have no effect. hledger-libThe command line arguments that were used at program startup. Uses unsafePerformIO. hledger-libRead the value of the -o/--output-file command line option provided at program startup, if any, using unsafePerformIO. hledger-libCheck whether the -o/--output-file option has been used at program startup with an argument other than "-", using unsafePerformIO. hledger-libVersions of some of text-ansi's string colors/styles which are more careful to not print junk onscreen. These use our useColorOnStdout. hledger-libRead the value of the --color or --colour command line option provided at program startup using unsafePerformIO. If this option was not provided, returns the empty string. hledger-libCheck the IO environment to see if ANSI colour codes should be used on stdout. This is done using unsafePerformIO so it can be used anywhere, eg in low-level debug utilities, which should be ok since we are just reading. The logic is: use color if the program was started with --color=yes|always or ( the program was not started with --color=no|never and a NO_COLOR environment variable is not defined and stdout supports ANSI color and -o/--output-file was not used, or its value is "-" ). hledger-libLike useColorOnStdout, but checks for ANSI color support on stderr, and is not affected by -o/--output-file. hledger-libWrap a string in ANSI codes to set and reset foreground colour. ColorIntensity is Dull or Vivid( (ie normal and bold). Color is one of Black, Red, Green, Yellow, Blue, Magenta, Cyan, White. Eg: color Dull Red "text". hledger-lib?Wrap a string in ANSI codes to set and reset background colour. hledger-libWrap a WideBuilder in ANSI codes to set and reset foreground colour. hledger-libWrap a WideBuilder in ANSI codes to set and reset background colour. hledger-libDetect whether the terminal currently has a light background colour, if possible, using unsafePerformIO. If the terminal is transparent, its apparent light/darkness may be different. hledger-libDetect the terminal's current background lightness (0..1), if possible, using unsafePerformIO. If the terminal is transparent, its apparent lightness may be different. hledger-libDetect the terminal's current background colour, if possible, using unsafePerformIO. hledger-libDetect the terminal's current foreground colour, if possible, using unsafePerformIO. hledger-libDetect the terminal's current foreground or background colour, if possible, using unsafePerformIO. hledger-lib(Simpler alias for errorWithoutStackTrace hledger-lib;A version of errorWithoutStackTrace that adds a usage hint. hledger-libExpand a tilde (representing home directory) at the start of a file path. ~username is not supported. Can raise an error. hledger-libGiven a current directory, convert a possibly relative, possibly tilde-containing file path to an absolute one. ~username is not supported. Leaves "-" unchanged. Can raise an error. hledger-libLike expandPath, but treats the expanded path as a glob, and returns zero or more matched absolute file paths, alphabetically sorted. hledger-libGiven a list of existing file paths, sort them by modification time, most recent first. hledger-libRead text from a file, converting any rn line endings to n,, using the system locale's text encoding, ignoring any utf8 BOM prefix (as seen in paypal's 2018 CSV, eg) if that encoding is utf8. hledger-libLike readFilePortably, but read from standard input if the path is "-". hledger-libLike embedFile, but takes a path relative to the package directory.66 Safe-Inferred"  hledger-libAssert any Left value. hledger-libAssert any Right value. hledger-lib;Run a parser on the given text and display a helpful error. hledger-libRun a stateful parser in IO and process either a failure or success to produce an /. Suitable for hledger's JournalParser parsers. hledger-libAssert that this stateful parser runnable in IO successfully parses all of the given input text, showing the parse error if it fails. Suitable for hledger's JournalParser parsers. hledger-lib+Assert a parser produces an expected value. hledger-libLike assertParseEq, but transform the parse result with the given function before comparing it. hledger-libAssert that this stateful parser runnable in IO fails to parse the given input text, with a parse error containing the given string. hledger-libRun a stateful parser in IO like assertParse, then assert that the final state (the wrapped state, not megaparsec's internal state), transformed by the given function, matches the given expected value. hledger-libThese E variants of the above are suitable for hledger's ErroringJournalParser parsers.0! !  Safe-Inferred~ hledger-lib The program name as returned by  getProgName<. It's best to set this explicitly at program startup with  withProgName:, otherwise when running in GHCI (eg) it will change to " interactive". Setting it with a ".log" suffix causes some functions below to log instead of trace. hledger-lib0The progam name, with any ".log" suffix removed. hledger-libThe programs debug output verbosity. The default is 0 meaning no debug output. The --debug$ command line flag sets it to 1, or  --debug=N sets it to a higher value (the = is required). Uses unsafePerformIO. When running in GHCI, changing this requires reloading this module. hledger-lib?Trace a value with the given show function before returning it. hledger-libPretty-trace a showable value before returning it. Like Debug.Trace.traceShowId, but pretty-printing and easier to type. hledger-libTrace (print to stderr) a string if the global debug level is at or above the specified level. At level 0, always prints. Otherwise, uses unsafePerformIO. hledger-libTrace (print to stderr) a showable value using a custom show function, if the global debug level is at or above the specified level. At level 0, always prints. Otherwise, uses unsafePerformIO. hledger-libPretty-print a label and a showable value to the console if the global debug level is at or above the specified level. At level 0, always prints. Otherwise, uses unsafePerformIO. hledger-libLike ptraceAt, but convenient to insert in an IO monad and enforces monadic sequencing. hledger-libShould the "trace or log" functions output to a file instead of stderr ? True if the program name ends with ".log". hledger-libThe debug log file: PROGNAME.log in the current directory. See modifiedProgName. hledger-libLog a string to the debug log before returning the second argument. Uses unsafePerformIO. hledger-libLog a string to the debug log before returning the second argument, if the global debug level is at or above the specified level. At level 0, always logs. Otherwise, uses unsafePerformIO. hledger-lib+Like traceLog but sequences properly in IO. hledger-lib-Like traceLogAt, but convenient to use in IO. hledger-libLog a value to the debug log with the given show function before returning it. hledger-libLog a string to the debug log before returning the second argument, if the global debug level is at or above the specified level. At level 0, always logs. Otherwise, uses unsafePerformIO. hledger-libPretty-log a label and showable value to the debug log, if the global debug level is at or above the specified level. At level 0, always prints. Otherwise, uses unsafePerformIO. hledger-libLike ptraceAt, but convenient to insert in an IO monad and enforces monadic sequencing. hledger-libPretty-trace to stderr (or log to debug log) a label and showable value, then return it. hledger-libPretty-trace to stderr (or log to debug log) a label and showable value if the --debug level is high enough, then return the value. Uses unsafePerformIO. hledger-lib;Like dbg0, but also exit the program. Uses unsafePerformIO. hledger-lib'Like dbgN, but convenient to use in IO. hledger-lib9Like dbgN, but taking a show function instead of a label.66 Safe-Inferredk  hledger-lib)A parser of text that runs in some monad. hledger-lib%A parser of strict text to some type. hledger-lib A parser of string to some type. hledger-libTrace to stderr or log to debug log the provided label (if non-null) and current parser state (position and next input). See also: Hledger.Utils.Debug, megaparsec's dbg. Uses unsafePerformIO. hledger-libTrace to stderr or log to debug log the provided label (if non-null) and current parser state (position and next input), if the global debug level is at or above the specified level. Uses unsafePerformIO. hledger-libRender a pair of source positions in human-readable form, only displaying the range of lines. hledger-libBacktracking choice, use this when alternatives share a prefix. Consumes no input if all choices fail. hledger-libBacktracking choice, use this when alternatives share a prefix. Consumes no input if all choices fail. hledger-libRun a text parser in the identity monad. See also: parseWithState. hledger-libRun a text parser in the identity monad. See also: parseWithState. hledger-libRun a stateful parser with some initial state on a text. See also: runTextParser, runJournalParser.' '  Safe-Inferred hledger-lib%Take elements from the end of a list. hledger-lib'Remove leading and trailing whitespace. hledger-libRemove leading whitespace. hledger-libRemove trailing whitespace. hledger-libStrip the given starting and ending character from the start and end of a string if both are present. hledger-libStrip a run of zero or more characters matching the predicate from the start and end of a string. hledger-libStrip a single balanced enclosing pair of a character matching the predicate from the start and end of a string. hledger-lib.Remove all trailing newlines/carriage returns. hledger-libRemove all trailing newline/carriage returns, leaving just one trailing newline. hledger-libRemove consecutive line breaks, replacing them with single space hledger-lib7Clip and pad a string to a minimum & maximum width, andor leftright justify it. Works on multi-line strings too (but will rewrite non-unix line endings). hledger-libDouble-quote this string if it contains whitespace, single quotes or double-quotes, escaping the quotes as needed. hledger-libSingle-quote this string if it contains whitespace or double-quotes. Does not work for strings containing single quotes. hledger-lib-Prepend and append single quotes to a string. hledger-libTry to single- and backslash-quote a string as needed to make it usable as an argument on a (sh/bash) shell command line. At least, well enough to handle common currency symbols, like $. Probably broken in many ways.quoteForCommandLine "a""a"quoteForCommandLine "\"""'\"'"quoteForCommandLine "$""'\\$'" hledger-libTry to backslash-quote common shell-significant characters in this string. Doesn't handle single quotes, & probably others. hledger-libQuote-aware version of words - don't split on spaces which are inside quotes. NB correctly handles "a'b" but not "'a''". Can raise an error if parsing fails. hledger-libQuote-aware version of unwords - single-quote strings which contain whitespace hledger-libStrip one matching pair of single or double quotes on the ends of a string. hledger-libDouble-width-character-aware string truncation. Take as many characters as possible from a string without exceeding the specified width. Eg takeWidth 3 "aa`" = "a". hledger-libLike strWidth, but also strips ANSI escape sequences before calculating the width.This is no longer used in code, as widths are calculated before adding ANSI escape sequences, but is being kept around for now. hledger-lib Alias for . hledger-lib*Strip ANSI escape sequences from a string.stripAnsi "\ESC[31m-1\ESC[m""-1"  Safe-Inferred߆  hledger-libApply a function the specified number of times, which should be > 0 (otherwise does nothing). Possibly uses O(n) stack ? hledger-libLike mapM but uses sequence'. hledger-libThis is a version of sequence based on difference lists. It is slightly faster but we mostly use it because it uses the heap instead of the stack. This has the advantage that Neil Mitchell@s trick of limiting the stack size to discover space leaks doesn@t show this as a false positive. hledger-libTotal version of maximum, for integral types, giving 0 for an empty list. hledger-lib1Strict version of maximum that doesn@t leak space hledger-lib1Strict version of minimum that doesn@t leak space hledger-lib-Strict version of sum that doesn@t leak space hledger-libGet the leaves of this tree as a list. The topmost node ("root" in hledger account trees) is not counted as a leaf. hledger-libConvert a list of strings to a multi-line multi-column list fitting within the given width. Not wide character aware. hledger-lib Find the number of digits of an . hledger-libMake classy lenses for Hledger options fields. This is intended to be used with BalancingOpts, InputOpt, ReportOpts, ReportSpec, and CliOpts. When run on X, it will create a typeclass named HasX (except for ReportOpts, which will be named HasReportOptsNoUpdate) containing all the lenses for that type. If the field name starts with an underscore, the lens name will be created by stripping the underscore from the front on the name. If the field name ends with an underscore, the field name ends with an underscore, the lens name will be mostly created by stripping the underscore, but a few names for which this would create too many conflicts instead have a second underscore appended. ReportOpts fields for which updating them requires updating the query in ReportSpec are instead names by dropping the trailing underscore and appending NoUpdate to the name, e.g. querystring_ -> querystringNoUpdate.There are a few reasons for the complicated rules. - We have some legacy field names ending in an underscore (e.g. value_) which we want to temporarily accommodate, before eventually switching to a more modern style (e.g. _rsReportOpts) - Certain fields in ReportOpts need to update the enclosing ReportSpec when they are updated, and it is a common programming error to forget to do this. We append NoUpdate to those lenses which will not update the enclosing field, and reserve the shorter name for manually define lenses (or at least something lens-like) which will update the ReportSpec. cf. the lengthy discussion here and in surrounding comments: https://github.com/simonmichael/hledger/pull/1545#issuecomment-881974554 ! "#$%&'()*+,-.%  Safe-Inferred" Safe-Inferred  hledger-libThe result of running cmdargs: an association list of option names to string values. hledger-libIs the named flag present ? hledger-libLike boolopt, except if the flag is repeated on the command line it toggles the value. An even number of repetitions is equivalent to none. hledger-libFrom a list of RawOpts, get the last one (ie the right-most on the command line) for which the given predicate returns a Just value. Useful for exclusive choice flags like --daily|--weekly|--quarterly...import Safe (readMay)7choiceopt Just (RawOpts [("a",""), ("b",""), ("c","")])Just "c".choiceopt (const Nothing) (RawOpts [("a","")])Nothingchoiceopt readMay (RawOpts [("LT",""),("EQ",""),("Neither","")]) :: Maybe OrderingJust EQ hledger-libCollects processed and filtered list of options preserving their order0collectopts (const Nothing) (RawOpts [("x","")])[].collectopts Just (RawOpts [("a",""),("b","")])[("a",""),("b","")] hledger-libReads the named option's Int argument, if it is present. An argument that is too small or too large will raise an error. hledger-libReads the named option's natural-number argument, if it is present. An argument that is negative or too large will raise an error. hledger-libReads the named option's Int argument. If not present it will return 0. An argument that is too small or too large will raise an error. hledger-libReads the named option's natural-number argument. If not present it will return 0. An argument that is negative or too large will raise an error. hledger-libReads the named option's Int argument, if it is present. An argument that does not fit within the given bounds will raise an error. hledger-lib"parser" that returns  value for valid choice hledger-lib%actual options where to look for flag hledger-lib)exclusive choice among those returned as  from "parser" Safe-Inferred"(* hledger-libRender a datespan as a display string, abbreviating into a compact form if possible. Warning, hides whether dates are Exact or Flex. hledger-lib8Show a DateSpan with its begin/end dates, exact or flex. hledger-libLike showDateSpan, but show month spans as just the abbreviated month name in the current locale. hledger-libGet the current local date. hledger-lib#Get the current local month number. hledger-libGet the current local year. hledger-lib5Get the 0-2 years mentioned explicitly in a DateSpan. hledger-libGet overall span enclosing multiple sequentially ordered spans. The start and end date will be exact or flexible depending on the first span's start date and last span's end date. hledger-libSplit a DateSpan into consecutive exact spans of the specified Interval. If the first argument is true and the interval is Weeks, Months, Quarters or Years, the start date will be adjusted backward if needed to nearest natural interval boundary (a monday, first of month, first of quarter or first of year). If no interval is specified, the original span is returned. If the original span is the null date span, ie unbounded, the null date span is returned. If the original span is empty, eg if the end date is <= the start date, no spans are returned. Examples:let t i y1 m1 d1 y2 m2 d2 = splitSpan True i $ DateSpan (Just $ Flex $ fromGregorian y1 m1 d1) (Just $ Flex $ fromGregorian y2 m2 d2)"t NoInterval 2008 01 01 2009 01 01[DateSpan 2008]$t (Quarters 1) 2008 01 01 2009 01 01[DateSpan 2008Q1,DateSpan 2008Q2,DateSpan 2008Q3,DateSpan 2008Q4](splitSpan True (Quarters 1) nulldatespan [DateSpan ..]6t (Days 1) 2008 01 01 2008 01 01 -- an empty datespan[]$t (Quarters 1) 2008 01 01 2008 01 01[]"t (Months 1) 2008 01 01 2008 04 014[DateSpan 2008-01,DateSpan 2008-02,DateSpan 2008-03]"t (Months 2) 2008 01 01 2008 04 01[DateSpan 2008-01-01..2008-02-29,DateSpan 2008-03-01..2008-04-30]!t (Weeks 1) 2008 01 01 2008 01 15[DateSpan 2007-12-31W01,DateSpan 2008-01-07W02,DateSpan 2008-01-14W03]!t (Weeks 2) 2008 01 01 2008 01 15[DateSpan 2007-12-31..2008-01-13,DateSpan 2008-01-14..2008-01-27]&t (DayOfMonth 2) 2008 01 01 2008 04 01[DateSpan 2007-12-02..2008-01-01,DateSpan 2008-01-02..2008-02-01,DateSpan 2008-02-02..2008-03-01,DateSpan 2008-03-02..2008-04-01],t (WeekdayOfMonth 2 4) 2011 01 01 2011 02 15[DateSpan 2010-12-09..2011-01-12,DateSpan 2011-01-13..2011-02-09,DateSpan 2011-02-10..2011-03-09](t (DaysOfWeek [2]) 2011 01 01 2011 01 15[DateSpan 2010-12-28..2011-01-03,DateSpan 2011-01-04..2011-01-10,DateSpan 2011-01-11..2011-01-17])t (DayOfYear 11 29) 2011 10 01 2011 10 15![DateSpan 2010-11-29..2011-11-28])t (DayOfYear 11 29) 2011 12 01 2012 12 15[DateSpan 2011-11-29..2012-11-28,DateSpan 2012-11-29..2013-11-28] hledger-lib0Fill in missing start/end dates for calculating . hledger-libConstruct a list of exact >> DateSpan (Just $ Flex $ fromGregorian 2018 01 01) (Just $ Flex $ fromGregorian 2018 01 03)  DateSpan (Just $ Flex $ fromGregorian 2018 01 03) (Just $ Flex $ fromGregorian 2018 01 05) DateSpan 2018-01-03..2018-01-02 hledger-libFill any unspecified dates in the first span with the dates from the second one. Sort of a one-way spanIntersect. hledger-lib-Calculate the union of a number of datespans. hledger-lib%Calculate the union of two datespans. hledger-libCalculate the minimal DateSpan containing all of the given Days (in the usual exclusive-end-date sense: beginning on the earliest, and ending on the day after the latest). hledger-libSelect the DateSpan containing a given Day, if any, from a given list of DateSpans.If the DateSpans are non-overlapping, this returns the unique containing DateSpan, if it exists. If the DateSpans are overlapping, it will return the containing DateSpan with the latest start date, and then latest end date. hledger-libParse a period expression to an Interval and overall DateSpan using the provided reference date, or return a parse error. hledger-lib1Like parsePeriodExpr, but call error' on failure. hledger-libShow a DateSpan as a human-readable pseudo-period-expression string. dateSpanAsText :: DateSpan -> String dateSpanAsText (DateSpan Nothing Nothing) = "all" dateSpanAsText (DateSpan Nothing (Just e)) = printf "to %s" (show e) dateSpanAsText (DateSpan (Just b) Nothing) = printf "from %s" (show b) dateSpanAsText (DateSpan (Just b) (Just e)) = printf "%s to %s" (show b) (show e)Convert a single smart date string to a date span using the provided reference date, or raise an error. spanFromSmartDateString :: Day -> String -> DateSpan spanFromSmartDateString refdate s = spanFromSmartDate refdate sdate where sdate = fromparse $ parsewith smartdateonly s hledger-libConvert a smart date string to an explicit yyyy/mm/dd string using the provided reference date, or raise an error. hledger-lib"A safe version of fixSmartDateStr. hledger-libConvert a SmartDate to a specific date using the provided reference date. This date will be exact or flexible depending on whether the day was specified exactly. (Missing least-significant parts produces a flex date.) Examples: :set -XOverloadedStrings2let t = fixSmartDateStr (fromGregorian 2008 11 26)t "0000-01-01" "0000-01-01"t "1999-12-02" "1999-12-02"t "1999.12.02" "1999-12-02" t "1999/3/2" "1999-03-02" t "19990302" "1999-03-02" t "2008/2" "2008-02-01" t "0020/2" "0020-02-01"t "1000" "1000-01-01"t "4/2" "2008-04-02"t "2" "2008-11-02" t "January" "2008-01-01"t "feb" "2008-02-01" t "today" "2008-11-26" t "yesterday" "2008-11-25" t "tomorrow" "2008-11-27" t "this day" "2008-11-26" t "last day" "2008-11-25" t "next day" "2008-11-27"t "this week" -- last monday "2008-11-24"!t "last week" -- previous monday "2008-11-17"t "next week" -- next monday "2008-12-01"t "this month" "2008-11-01"t "last month" "2008-10-01"t "next month" "2008-12-01"t "this quarter" "2008-10-01"t "last quarter" "2008-07-01"t "next quarter" "2009-01-01" t "this year" "2008-01-01" t "last year" "2007-01-01" t "next year" "2009-01-01"t "last wed" "2008-11-19" t "next friday" "2008-11-28" t "next january" "2009-01-01" t "in 5 days" "2008-12-01"t "in 7 months" "2009-06-01"t "in -2 weeks" "2008-11-10"t "1 quarter ago" "2008-07-01"t "1 week ahead" "2008-12-01" hledger-libFor given date d find year-long interval that starts on given MM/DD of year and covers it. The given MM and DD should be basically valid (1-12 & 1-31), or an error is raised.Examples: lets take 2017-11-22. Year-long intervals covering it that starts before Nov 22 will start in 2017. However intervals that start after Nov 23rd should start in 2016: >>> let wed22nd = fromGregorian 2017 11 22 >>> nthdayofyearcontaining 11 21 wed22nd 2017-11-21 >>> nthdayofyearcontaining 11 22 wed22nd 2017-11-22 >>> nthdayofyearcontaining 11 23 wed22nd 2016-11-23 >>> nthdayofyearcontaining 12 02 wed22nd 2016-12-02 >>> nthdayofyearcontaining 12 31 wed22nd 2016-12-31 >>> nthdayofyearcontaining 1 1 wed22nd 2017-01-01 hledger-libFor a given date d find the month-long period that starts on day n of a month that includes d. (It will begin on day n or either d's month or the previous month.) The given day of month should be in the range 1-31, or an error will be raised.Examples: lets take 2017-11-22. Month-long intervals covering it that start on 1st-22nd of month will start in Nov. However intervals that start on 23rd-30th of month should start in Oct: >>> let wed22nd = fromGregorian 2017 11 22 >>> nthdayofmonthcontaining 1 wed22nd 2017-11-01 >>> nthdayofmonthcontaining 12 wed22nd 2017-11-12 >>> nthdayofmonthcontaining 22 wed22nd 2017-11-22 >>> nthdayofmonthcontaining 23 wed22nd 2017-10-23 >>> nthdayofmonthcontaining 30 wed22nd 2017-10-30 hledger-libFor given date d find week-long interval that starts on nth day of week and covers it.Examples: 2017-11-22 is Wed. Week-long intervals that cover it and start on Mon, Tue or Wed will start in the same week. However intervals that start on Thu or Fri should start in prev week: >>> let wed22nd = fromGregorian 2017 11 22 >>> nthdayofweekcontaining 1 wed22nd 2017-11-20 >>> nthdayofweekcontaining 2 wed22nd 2017-11-21 >>> nthdayofweekcontaining 3 wed22nd 2017-11-22 >>> nthdayofweekcontaining 4 wed22nd 2017-11-16 >>> nthdayofweekcontaining 5 wed22nd 2017-11-17 hledger-libFor given date d find month-long interval that starts on nth weekday of month and covers it.Examples: 2017-11-22 is 3rd Wed of Nov. Month-long intervals that cover it and start on 1st-4th Wed will start in Nov. However intervals that start on 4th Thu or Fri or later should start in Oct: >>> let wed22nd = fromGregorian 2017 11 22 >>> nthweekdayofmonthcontaining 1 3 wed22nd 2017-11-01 >>> nthweekdayofmonthcontaining 3 2 wed22nd 2017-11-21 >>> nthweekdayofmonthcontaining 4 3 wed22nd 2017-11-22 >>> nthweekdayofmonthcontaining 4 4 wed22nd 2017-10-26 >>> nthweekdayofmonthcontaining 4 5 wed22nd 2017-10-27 hledger-libAdvance to nth weekday wd after given start day s Can call error. hledger-libTry to parse a couple of date string formats: `YYYY-MM-DD`, `YYYYMMDD` or 89, with leading zeros required. For internal use, not quite the same as the journal's "simple dates". >>> parsedateM "200802*03" Just 2008-02-03 >>> parsedateM "200802#03/" Nothing >>> parsedateM "200802 30" Nothing hledger-libParse a date in any of the formats allowed in Ledger's period expressions, and some others. Assumes any text in the parse stream has been lowercased. Returns a SmartDate, to be converted to a full date later (see fixSmartDate). Examples: 2004 (start of year, which must have 4+ digits) 2004/10 (start of month, which must be 1-12) 2004/10/1 (exact date, day must be 1-31) 10/1 (month and day in current year) 21 (day in current month) october, oct (start of month in current year) yesterday, today, tomorrow (-1, 0, 1 days from today) last/this/next day/week/month/quarter/year (-1, 0, 1 periods from the current period) in n days/weeks/months/quarters/years (n periods from the current period) n days/weeks/months/quarters/years ago (-n periods from the current period) 20181201 (8 digit YYYYMMDD with valid year month and day) 201812 (6 digit YYYYMM with valid year and month)=Note malformed digit sequences might give surprising results: 201813 (6 digits with an invalid month is parsed as start of 6-digit year) 20181301 (8 digits with an invalid month is parsed as start of 8-digit year) 20181232 (8 digits with an invalid day gives an error) 201801012 (9+ digits beginning with a valid YYYYMMDD gives an error)Eg:YYYYMMDD is parsed as year-month-date if those parts are valid (>=4 digits, 1-12, and 1-31 respectively): >>> parsewith (smartdate <* eof) "20181201" Right (SmartCompleteDate 2018-12-01)YYYYMM is parsed as year-month-01 if year and month are valid: >>> parsewith (smartdate <* eof) "201804" Right (SmartAssumeStart 2018 (Just 4))With an invalid month, it's parsed as a year: >>> parsewith (smartdate <* eof) "201813" Right (SmartAssumeStart 201813 Nothing)A 9+ digit number beginning with valid YYYYMMDD gives an error: >>> parsewith (smartdate <* eof) "201801012" Left (...)Big numbers not beginning with a valid YYYYMMDD are parsed as a year: >>> parsewith (smartdate <* eof) "201813012" Right (SmartAssumeStart 201813012 Nothing) hledger-libLike smartdate, but there must be nothing other than whitespace after the date. hledger-libParse a year number from a Text, making sure that at least four digits are used. hledger-libParse a period expression, specifying a date span and optionally a reporting interval. Requires a reference "today" date for resolving any relative start/end dates (only; it is not needed for parsing the reporting interval).2let p = parsePeriodExpr (fromGregorian 2008 11 26)p "from Aug to Oct"2Right (NoInterval,DateSpan 2008-08-01..2008-09-30)p "aug to oct"2Right (NoInterval,DateSpan 2008-08-01..2008-09-30) p "2009q2""Right (NoInterval,DateSpan 2009Q2)p "Q3""Right (NoInterval,DateSpan 2008Q3)p "every 3 days in Aug"Right (Days 3,DateSpan 2008-08)p "daily from aug"$Right (Days 1,DateSpan 2008-08-01..)p "every week to 2009"%Right (Weeks 1,DateSpan ..2008-12-31)p "every 2nd day of month" Right (DayOfMonth 2,DateSpan ..)p "every 2nd day" Right (DayOfMonth 2,DateSpan ..)p "every 2nd day 2009.."*Right (DayOfMonth 2,DateSpan 2009-01-01..)p "every 2nd day 2009-"*Right (DayOfMonth 2,DateSpan 2009-01-01..)p "every 29th Nov"#Right (DayOfYear 11 29,DateSpan ..)p "every 29th nov ..2009"-Right (DayOfYear 11 29,DateSpan ..2008-12-31)p "every nov 29th"#Right (DayOfYear 11 29,DateSpan ..)p "every Nov 29th 2009.."-Right (DayOfYear 11 29,DateSpan 2009-01-01..)p "every 11/29 from 2009"-Right (DayOfYear 11 29,DateSpan 2009-01-01..)p "every 11/29 since 2009"-Right (DayOfYear 11 29,DateSpan 2009-01-01..)'p "every 2nd Thursday of month to 2009"0Right (WeekdayOfMonth 2 4,DateSpan ..2008-12-31)%p "every 1st monday of month to 2009"0Right (WeekdayOfMonth 1 1,DateSpan ..2008-12-31) p "every tue""Right (DaysOfWeek [2],DateSpan ..)p "every 2nd day of week""Right (DaysOfWeek [2],DateSpan ..)p "every 2nd day of month" Right (DayOfMonth 2,DateSpan ..)p "every 2nd day" Right (DayOfMonth 2,DateSpan ..)p "every 2nd day 2009.."*Right (DayOfMonth 2,DateSpan 2009-01-01..)!p "every 2nd day of month 2009.."*Right (DayOfMonth 2,DateSpan 2009-01-01..) hledger-libparsewith (doubledatespanp (fromGregorian 2018 01 01) <* eof) "20180101-201804"Right DateSpan 2018Q1parsewith (doubledatespanp (fromGregorian 2018 01 01) <* eof) "2017..2018"Right DateSpan 2017parsewith (doubledatespanp (fromGregorian 2018 01 01) <* eof) "2017-2018"Right DateSpan 2017parsewith (doubledatespanp (fromGregorian 2018 01 01) <* eof) "2017-01-2018"Right DateSpan 2017parsewith (doubledatespanp (fromGregorian 2018 01 01) <* eof) "2017-01-01-2018"Right DateSpan 2017 hledger-libparsewith (quarterdatespanp (fromGregorian 2018 01 01) <* eof) "q1"Right DateSpan 2018Q1parsewith (quarterdatespanp (fromGregorian 2018 01 01) <* eof) "Q1"Right DateSpan 2018Q1parsewith (quarterdatespanp (fromGregorian 2018 01 01) <* eof) "2020q4"Right DateSpan 2020Q4 hledger-lib7An exact datespan of zero length, that matches no date.11 Safe-Inferred"7 hledger-libTruncate all account name components but the last to two characters. hledger-libRegular expressions matching common English top-level account names, used as a fallback when account types are not declared. hledger-libTry to guess an account's type from its name, matching common English top-level account names. hledger-libA top-level account prefixed to some accounts in budget reports. Defined here so it can be ignored by accountNameDrop. hledger-libPrefix one account name to another, preserving posting type indicators like concatAccountNames. hledger-libJoin account names into one. If any of them has () or [] posting type indicators, these (the first type encountered) will also be applied to the resulting account name. hledger-libRewrite an account name using all matching aliases from the given list, in sequence. Each alias sees the result of applying the previous aliases. Or, return any error arising from a bad regular expression in the aliases. hledger-lib=Memoising version of accountNameApplyAliases, maybe overkill. hledger-libRemove some number of account name components from the front of the account name. If the special " unbudgeted" top-level account is present, it is preserved and dropping affects the rest of the account name. hledger-libSorted unique account names implied by these account names, ie these plus all their parent accounts up to the root. Eg: ["a:b:c","d:e"] -> ["a","a:b","a:b:c","d","d:e"] hledger-lib"a:b:c" -> ["a","a:b","a:b:c"] hledger-lib  "a:b:c","d:e" -> ["a","d"] hledger-libIs the first account a parent or other ancestor of (and not the same as) the second ? hledger-libFrom a list of account names, select those which are direct subaccounts of the given account name. hledger-lib*Convert a list of account names to a tree. hledger-libElide an account name to fit in the specified width. From the ledger 2.6 news:  What Ledger now does is that if an account name is too long, it will start abbreviating the first parts of the account name down to two letters in length. If this results in a string that is still too long, the front will be elided -- not the end. For example: Expenses:Cash ; OK, not too long Ex:Wednesday:Cash ; Expenses6 was abbreviated to fit Ex:We:Afternoon:Cash ; Expenses and  Wednesday abbreviated ; Expenses:Wednesday:Afternoon:Lunch:Snack:Candy:Chocolate:Cash ..:Af:Lu:Sn:Ca:Ch:Cash ; Abbreviated and elided!  hledger-libKeep only the first n components of an account name, where n is a positive integer. If n is Just 0, returns the empty string, if n is Nothing, return the full name. hledger-libKeep only the first n components of an account name, where n is a positive integer. If n is Just 0, returns "...", if n is Nothing, return the full name. hledger-libEscape an AccountName for use within a regular expression. >>> putStr . T.unpack $ escapeName "First?!#$*?$(*) ! ^#*? %)*!#" First?!#$*?$(*) ! ^#*? %)*!# hledger-libConvert an account name to a regular expression matching it and its subaccounts. hledger-libConvert an account name to a regular expression matching it and its subaccounts, case insensitively. hledger-libConvert an account name to a regular expression matching it but not its subaccounts. hledger-libConvert an account name to a regular expression matching it but not its subaccounts, case insensitively.++ Safe-Inferred"A: hledger-libAn id identifying which report item field to interpolate. These are drawn from several hledger report types, so are not all applicable for a given report. hledger-lib/A posting or balance report item's account name hledger-lib1A posting or register or entry report item's date hledger-lib8A posting or register or entry report item's description hledger-libA balance or posting report item's balance or running total. Always rendered right-justified. hledger-libA balance report item's indent level (which may be different from the account name depth). Rendered as this number of spaces, multiplied by the minimum width spec if any. hledger-lib0A report item's nth field. May be unimplemented. hledger-lib!Literal text to be rendered as-is hledger-lib:A data field to be formatted and interpolated. Parameters:'Left justify ? Right justified if false:Minimum width ? Will be space-padded if narrower than this2Maximum width ? Will be clipped if wider than this?Which of the standard hledger report item fields to interpolate hledger-libA format specification/template to use when rendering a report line item as text.A format is a sequence of components; each is either a literal string, or a hledger report item field with specified width and justification whose value will be interpolated at render time.A component's value may be a multi-line string (or a multi-commodity amount), in which case the final string will be either single-line or a top or bottom-aligned multi-line string depending on the StringFormat variant used.Currently this is only used in the balance command's single-column mode, which provides a limited StringFormat renderer. hledger-lib?multi-line values will be rendered on one line, comma-separated hledger-libvalues will be top-aligned (and bottom-padded to the same height) hledger-lib.values will be bottom-aligned (and top-padded) hledger-libDefault line format for balance report: "%20(total) %2(depth_spacer)%-(account)" hledger-lib=Parse a string format specification, or return a parse error. Safe-Inferred"%&K hledger-lib#String representation of the Amount hledger-libCumulative length of MixedAmount this Amount is part of, including separators hledger-libOptions for the display of Amount and MixedAmount. (See also Types.AmountStyle) hledger-lib*Whether to display the Price of an Amount. hledger-libIf the Amount rounds to 0, whether to display its commodity string. hledger-lib(Whether to display thousands separators. hledger-lib&Whether to colourise negative Amounts. hledger-libWhether to display on one line. hledger-libMinimum width to pad to hledger-libMaximum width to clip to | Display amounts in this order (without the commodity symbol) and display a 0 in case a corresponding commodity does not exist hledger-libShow space-containing commodity symbols quoted, as they are in a journal. hledger-libDisplay amounts without colour, and with various other defaults. hledger-lib.Display Amount and MixedAmount with no prices. hledger-lib:Display Amount and MixedAmount on one line with no prices. hledger-libDisplay Amount and MixedAmount in a form suitable for CSV output. hledger-libDefault amount style hledger-libThe empty simple amount - a zero with no commodity symbol or cost and the default amount display style. hledger-libA special amount used as a marker, meaning "no explicit amount provided here, infer it when needed". It is nullamt with commodity symbol AUTO. hledger-libApply a binary arithmetic operator to two amounts, which should be in the same commodity if non-zero (warning, this is not checked). A zero result keeps the commodity of the second amount. The result's display style is that of the second amount, with precision set to the highest of either amount. Prices are ignored and discarded. Remember: the caller is responsible for ensuring both amounts have the same commodity. hledger-libConvert an amount to the specified commodity, ignoring and discarding any assigned prices and assuming an exchange rate of 1. hledger-libConvert a amount to its "cost" or "selling price" in another commodity, using its attached transaction price if it has one. Notes:price amounts must be MixedAmounts with exactly one component Amount (or there will be a runtime error XXX)price amounts should be positive in the Journal (though this is currently not enforced) hledger-libApply a function to an amount's quantity (and its total price, if it has one). hledger-libDivide an amount's quantity (and its total price, if it has one) by a constant. hledger-libMultiply an amount's quantity (and its total price, if it has one) by a constant. hledger-lib/Is this amount negative ? The price is ignored. hledger-libRound an Amount's Quantity (internally) to match its display precision. If that is unset or NaturalPrecision, this does nothing. hledger-libApply a test to both an Amount and its total price, if it has one. hledger-libDo this Amount and (and its total price, if it has one) appear to be zero when rendered with its display precision ? The display precision should usually have a specific value here; if unset, it will be treated like NaturalPrecision. hledger-libIs this Amount (and its total price, if it has one) exactly zero, ignoring its display precision ? hledger-lib+Set an amount's display precision, flipped. hledger-lib"Set an amount's display precision. hledger-libIncrease an amount's display precision, if needed, to enough decimal places to show it exactly (showing all significant decimal digits, without trailing zeros). If the amount's display precision is unset, it is will be treated as precision 0. hledger-libSet an amount's internal precision, ie rounds the Decimal representing the amount's quantity to some number of decimal places. Rounding is done with Data.Decimal's default roundTo function: "If the value ends in 5 then it is rounded to the nearest even value (Banker's Rounding)". Does not change the amount's display precision. Intended mainly for internal use, eg when comparing amounts in tests. hledger-libSet an amount's internal precision, flipped. Intended mainly for internal use, eg when comparing amounts in tests. hledger-lib1Set (or clear) an amount's display decimal point. hledger-lib:Set (or clear) an amount's display decimal point, flipped. hledger-libStrip all prices from an Amount hledger-libCanonicalise an amount's display style using the provided commodity style map. Its cost amount, if any, is not affected. hledger-libGiven a map of standard commodity display styles, apply the appropriate one to this amount. If there's no standard style for this amount's commodity, return the amount unchanged. Also do the same for the cost amount if any, but leave its precision unchanged. hledger-libGiven some commodity display styles, find and apply the appropriate display style to this amount, and do the same for its cost amount if any (and then stop; we assume costs don't have costs). The main amount's display precision is set or not, according to its style; the cost amount's display precision is left unchanged, regardless of its style. If no style is found for an amount, it is left unchanged. hledger-libLike amountSetStyles, but leave the display precision unchanged in both main and cost amounts. hledger-libFind and apply the appropriate display style, if any, to this amount. The display precision is set or not, according to the style. hledger-libFind and apply the appropriate display style, if any, to this amount's cost, if any. The display precision is left unchanged, regardless of the style. hledger-lib1Reset this amount's display style to the default. hledger-libGet the string representation of an amount, based on its commodity's display settings. String representations equivalent to zero are converted to just "0". The special "missing" amount is displayed as the empty string. ,showAmount = wbUnpack . showAmountB noColour hledger-libGeneral function to generate a WideBuilder for an Amount, according the supplied AmountDisplayOpts. This is the main function to use for showing Amounts, constructing a builder; it can then be converted to a Text with wbToText, or to a String with wbUnpack. Some special cases:?The special "missing" amount is displayed as the empty string. If an amount is showing digit group separators but no decimal places, we force showing a decimal mark (with nothing after it) to make it easier to parse correctly. hledger-libColour version. For a negative amount, adds ANSI codes to change the colour, currently to hard-coded red. Is this mixed amount non-zero, ignoring its display precision?/A convenient alias for not . mixedAmountIsZero. hledger-libGet a mixed amount's component amounts, with some cleanups. The following descriptions are old and possibly wrong:amounts in the same commodity are combined unless they have different prices or total pricesmultiple zero amounts, all with the same non-null commodity, are replaced by just the last of them, preserving the commodity and amount style (all but the last zero amount are discarded)multiple zero amounts with multiple commodities, or no commodities, are replaced by one commodity-less zero amountan empty amount list is replaced by one commodity-less zero amount4the special "missing" mixed amount remains unchanged hledger-libGet a mixed amount's component amounts, with some cleanups. This is a new version of amounts/, with updated descriptions and optimised for print to show commodityful zeros.If it contains the "missing amount" marker, only that is returned (discarding any additional amounts).Or if it contains any non-zero amounts, only those are returned (discarding any zeroes).Or if it contains any zero amounts (possibly more than one, possibly in different commodities), all of those are returned.&Otherwise the null amount is returned. hledger-libGet a mixed amount's component amounts without normalising zero and missing amounts. This is used for JSON serialisation, so the order is important. In particular, we want the Amounts given in the order of the MixedAmountKeys, i.e. lexicographically first by commodity, then by price commodity, then by unit price from most negative to most positive. hledger-libGet this mixed amount's commodities as a set. Returns an empty set if there are no amounts. hledger-libUnify a MixedAmount to a single commodity value if possible. This consolidates amounts of the same commodity and discards zero amounts; but this one insists on simplifying to a single commodity, and will return Nothing if this is not possible. hledger-libSum same-commodity amounts in a lossy way, applying the first price to the result and discarding any other prices. Only used as a rendering helper. hledger-lib9Filter a mixed amount's component amounts by a predicate. hledger-libReturn an unnormalised MixedAmount containing exactly one Amount with the specified commodity and the quantity of that commodity found in the original. NB if Amount's quantity is zero it will be discarded next time the MixedAmount gets normalised. hledger-lib0Apply a transform to a mixed amount's component s. hledger-lib0Apply a transform to a mixed amount's component s, which does not affect the key of the amount (i.e. doesn't change the commodity, price commodity, or unit price amount). This condition is not checked. hledger-libConvert all component amounts to cost/selling price where possible (see amountCost). hledger-libCanonicalise a mixed amount's display styles using the provided commodity style map. Cost amounts, if any, are not affected. hledger-libGiven a map of standard commodity display styles, find and apply the appropriate style to each individual amount. hledger-libEUR and one EUR->USD. hledger-libThe default valuation commodity for each source commodity. These are used when a valuation commodity is not specified (-V). They are the destination commodity of each source commodity's latest (declared or inferred, but not reverse) market price (on the date of this graph). hledger-libA price oracle is a magic memoising function that efficiently looks up market prices (exchange rates) from one commodity to another (or if unspecified, to a default valuation commodity) on a given date. hledger-libWhat kind of value conversion should be done on amounts ? CLI: --value=then|end|now|DATE[,COMM] hledger-libconvert to default or given valuation commodity, using market prices at each posting's date hledger-libconvert to default or given valuation commodity, using market prices at period end(s) hledger-libconvert to default or given valuation commodity, using current market prices hledger-libconvert to default or given valuation commodity, using market prices on some date hledger-libWhich operation to perform on conversion transactions. (There was also an "infer equity postings" operation, but that is now done earlier, in journal finalisation.) hledger-libGenerate a price oracle (memoising price lookup function) from a journal's directive-declared and transaction-inferred market prices. For best performance, generate this only once per journal, reusing it across reports if there are more than one, as compoundBalanceCommand does. The boolean argument is whether to infer market prices from transactions or not. hledger-libMake one or more p from an  and its price directives. hledger-libConvert all component amounts to cost/selling price if requested, and style them. hledger-libApply a specified valuation to this mixed amount, using the provided price oracle, commodity styles, and reference dates. See amountApplyValuation. hledger-libConvert an Amount to its cost if requested, and style it appropriately. hledger-libApply a specified valuation to this amount, using the provided price oracle, and reference dates. Also fix up its display style using the provided commodity styles.When the valuation requires converting to another commodity, a valuation (conversion) date is chosen based on the valuation type and the provided reference dates. It will be one of:-the date of the posting itself (--value=then)the provided "period end" date - this is typically the last day of a subperiod (--value=end with a multi-period report), or of the specified report period or the journal (--value=end with a single-period report).(the provided "today" date (--value=now).a fixed date specified by the ValuationType itself (--value=DATE).9This is all a bit complicated. See the reference doc at  ?https://hledger.org/hledger.html#effect-of-valuation-on-reports (hledger_options.m4.md "Effect of valuation on reports"), and #1083. hledger-libFind the market value of each component amount in the given commodity, or its default valuation commodity, at the given valuation date, using the given market price oracle. When market prices available on that date are not sufficient to calculate the value, amounts are left unchanged. hledger-libFind the market value of this amount in the given valuation commodity if any, otherwise the default valuation commodity, at the given valuation date. (The default valuation commodity is the commodity of the latest applicable market price before the valuation date.)The returned amount will have its commodity's canonical style applied, but with the precision adjusted to show all significant decimal digits up to a maximum of 8. (experimental)If the market prices available on that date are not sufficient to calculate this value, the amount is left unchanged. hledger-libCalculate the gain of each component amount, that is the difference between the valued amount and the value of the cost basis (see mixedAmountApplyValuation).If the commodity we are valuing in is not the same as the commodity of the cost, this will value the cost at the same date as the primary amount. This may not be what you want; for example you may want the cost valued at the posting date. If so, let us know and we can change this behaviour. hledger-libCalculate the gain of each component amount, that is the difference between the valued amount and the value of the cost basis.If the commodity we are valuing in is not the same as the commodity of the cost, this will value the cost at the same date as the primary amount. This may not be what you want; for example you may want the cost valued at the posting date. If so, let us know and we can change this behaviour. hledger-libGiven a memoising price graph generator, a valuation date, a source commodity and an optional valuation commodity, find the value on that date of one unit of the source commodity in the valuation commodity, or in a default valuation commodity. Returns the valuation commodity that was specified or chosen, and the quantity of it that one unit of the source commodity is worth. Or if no applicable market price can be found or calculated, or if the source commodity and the valuation commodity are the same, returns Nothing.See makePriceGraph for how prices are determined. Note that both market prices and default valuation commodities can vary with valuation date, since that determines which market prices are visible. hledger-libFind the shortest path and corresponding conversion rate, if any, from one commodity to another using the provided market prices which form the edges of a directed graph. There should be at most one edge between each directed pair of commodities, eg there can be one USD->EUR price and one EUR->USD price. hledger-libA snapshot of the known exchange rates between commodity pairs at a given date. This is a home-made version, more tailored to our needs. | Build the graph of commodity conversion prices for a given day. Converts a list of declared market prices in parse order, and a list of transaction-inferred market prices in parse order, to: a graph of all known exchange rates declared or inferred from one commodity to another in effect on that daya second graph which includes any additional exchange rates that can be inferred by reversing known rates>a map of each commodity's default valuation commodity, if any.These allow price lookup and valuation to be performed as described in hledger.m4.md -> Valuation:"hledger looks for a market price (exchange rate) from commodity A to commodity B in one or more of these ways, in this order of preference: A *declared market price* or *inferred market price*: A's latest market price in B on or before the valuation date as declared by a P directive, or (with the `--infer-market-prices` flag) inferred from transaction prices.A *reverse market price*: the inverse of a declared or inferred market price from B to A.A *a forward chain of market prices*: a synthetic price formed by combining the shortest chain of "forward" (only 1 above) market prices, leading from A to B.A *any chain of market prices*: a chain of any market prices, including both forward and reverse prices (1 and 2 above), leading from A to B."and: "For each commodity A, hledger picks a default valuation commodity as follows, in this order of preference: The price commodity from the latest declared market price for A on or before valuation date.The price commodity from the latest declared market price for A on any date. (Allows conversion to proceed if there are inferred prices before the valuation date.)If there are no P directives at all (any commodity or date), and the `--infer-market-prices` flag is used, then the price commodity from the latest transaction price for A on or before valuation date." hledger-libGiven a list of P-declared market prices in parse order and a list of transaction-inferred market prices in parse order, select just the latest prices that are in effect for each commodity pair. That is, for each commodity pair, the latest price by date then parse order, with declared prices having precedence over inferred prices on the same day. Safe-Inferred"'ç& hledger-libMake a posting to an account. hledger-lib2Make a virtual (unbalanced) posting to an account. hledger-lib=Make a posting to an account, maybe with a balance assertion. hledger-libMake a virtual (unbalanced) posting to an account, maybe with a balance assertion. hledger-lib,Make a partial, exclusive balance assertion. hledger-lib*Make a total, exclusive balance assertion. hledger-lib,Make a partial, inclusive balance assertion. hledger-lib*Make a total, inclusive balance assertion. hledger-libRender a balance assertion, as the =[=][*] symbol and expected amount. hledger-libRender a posting, at the appropriate width for aligning with its siblings if any. Used by the rewrite command. hledger-libGiven a transaction and its postings, render the postings, suitable for  output. Normally this output will be valid journal syntax which hledger can reparse (though it may include no-longer-valid balance assertions).9Explicit amounts are shown, any implicit amounts are not.Postings with multicommodity explicit amounts are handled as follows: if onelineamounts is true, these amounts are shown on one line, comma-separated, and the output will not be valid journal syntax. Otherwise, they are shown as several similar postings, one per commodity. When the posting has a balance assertion, it is attached to the last of these postings.The output will appear to be a balanced transaction. Amounts' display precisions, which may have been limited by commodity directives, will be increased if necessary to ensure this.Posting amounts will be aligned with each other, starting about 4 columns beyond the widest account name (see postingAsLines for details). hledger-lib7Render one posting, on one or more lines, suitable for  output. There will be an indented account name, plus one or more of status flag, posting amount, balance assertion, same-line comment, next-line comments.If the posting's amount is implicit or if elideamount is true, no amount is shown.If the posting's amount is explicit and multi-commodity, multiple similar postings are shown, one for each commodity, to help produce parseable journal syntax. Or if onelineamounts is true, such amounts are shown on one line, comma-separated (and the output will not be valid journal syntax).If an amount is zero, any commodity symbol attached to it is shown (and the corresponding commodity display style is used).By default, 4 spaces (2 if there's a status flag) are shown between account name and start of amount area, which is typically 12 chars wide and contains a right-aligned amount (so 10-12 visible spaces between account name and amount is typical). When given a list of postings to be aligned with, the whitespace will be increased if needed to match the posting with the longest account name. This is used to align the amounts of a transaction's postings.5Also returns the account width and amount width used. hledger-libShow an account name, clipped to the given width if any, and appropriately bracketed/parenthesised for the given posting type. hledger-libRender a transaction or posting's comment as indented, semicolon-prefixed comment lines. The first line (unless empty) will have leading space, subsequent lines will have a larger indent. hledger-libPrepend a suitable indent for a posting (or transaction/posting comment) line. hledger-lib6Prepend the space required before a same-line comment. hledger-lib9Sorted unique account names referenced by these postings. hledger-lib(Sum all amounts from a list of postings. hledger-lib Strip all prices from a Posting. hledger-libGet a posting's (primary) date - it's own primary date if specified, otherwise the parent transaction's primary date, or the null date if there is no parent transaction. hledger-libGet a posting's secondary (secondary) date, which is the first of: posting's secondary date, transaction's secondary date, posting's primary date, transaction's primary date, or the null date if there is no parent transaction. hledger-lib8Get a posting's primary or secondary date, as specified. hledger-libGet a posting's status. This is cleared or pending if those are explicitly set on the posting, otherwise the status of its parent transaction, or unmarked if there is no parent transaction. (Note the ambiguity, unmarked can mean "posting and transaction are both unmarked" or "posting is unmarked and don't know about the transaction". hledger-libTags for this posting including any inherited from its parent transaction. hledger-lib:Tags for this transaction including any from its postings. hledger-lib3Does this posting fall within the given date span ? hledger-libApply some account aliases to the posting's account name, as described by accountNameApplyAliases. This can fail due to a bad replacement pattern in a regular expression alias. hledger-libFind and apply the appropriate display style to the posting amounts in each commodity (see journalCommodityStyles). Main amount precisions may be set or not according to the styles, but cost precisions are not set. hledger-libLike postingApplyCommodityStyles, but neither main amount precisions or cost precisions are set. hledger-libAdd tags to a posting, discarding any for which the posting already has a value. hledger-libApply a specified valuation to this posting's amount, using the provided price oracle, commodity styles, and reference dates. See amountApplyValuation. hledger-libMaybe convert this s amount to cost. hledger-lib)Generate inferred equity postings from a  using transaction prices. Make sure not to generate equity postings when there are already matched conversion postings. hledger-libMake a market price equivalent to this posting's amount's unit price, if any. hledger-lib4Apply a transform function to this posting's amount. hledger-libJoin two parts of a comment, eg a tag and another tag, or a tag and a non-tag, on a single line. Interpolates a comma and space unless one of the parts is empty. hledger-libAdd a tag to a comment, comma-separated from any prior content. A space is inserted following the colon, before the value. hledger-libAdd a tag on its own line to a comment, preserving any prior content. A space is inserted following the colon, before the value.33 Safe-Inferred"'} hledger-lib;Make a simple transaction with the given date and postings. hledger-libParse a transaction's description into payee and note (aka narration) fields, assuming a convention of separating these with | (like Beancount). Ie, everything up to the first | is the payee, everything after it is the note. When there's no |, payee == note == description. hledger-libRender a journal transaction as text similar to the style of Ledger's print command.0Adapted from Ledger 2.x and 3.x standard format: yyyy-mm-dd[ *][ CODE] description......... [ ; comment...............] account name 1..................... ...$amount1[ ; comment...............] account name 2..................... ..$-amount1[ ; comment...............] pcodewidth = no limit -- 10 -- mimicking ledger layout. pdescwidth = no limit -- 20 -- I don't remember what these mean, pacctwidth = 35 minimum, no maximum -- they were important at the time. pamtwidth = 11 pcommentwidth = no limit -- 22 The output will be parseable journal syntax. To facilitate this, postings with explicit multi-commodity amounts are displayed as multiple similar postings, one per commodity. (Normally does not happen with this function). hledger-libLike showTransaction, but explicit multi-commodity amounts are shown on one line, comma-separated. In this case the output will not be parseable journal syntax. hledger-libHelper for showTransaction*. hledger-libEnsure a transaction's postings refer back to it, so that eg relatedPostings works right. hledger-libEnsure a transaction's postings do not refer back to it, so that eg recursiveSize and GHCI's :sprint work right. hledger-lib#Set a posting's parent transaction. hledger-lib9Apply a transform function to this transaction's amounts. hledger-libApply a specified valuation to this transaction's amounts, using the provided price oracle, commodity styles, and reference dates. See amountApplyValuation. hledger-libMaybe convert this s amounts to cost. hledger-lib"Add inferred equity postings to a  using transaction prices. hledger-libAdd costs inferred from equity postings in this transaction. For every adjacent pair of conversion postings, it will first search the postings with costs to see if any match. If so, it will tag these as matched. If no postings with costs match, it will then search the postings without costs, and will match the first such posting which matches one of the conversion amounts. If it finds a match, it will add a cost and then tag it. If the first argument is true, do a dry run instead: identify and tag the costful and conversion postings, but don't add costs. hledger-lib1Get a posting's amount if it is single-commodity. hledger-libApply some account aliases to all posting account names in the transaction, as described by accountNameApplyAliases. This can fail due to a bad replacement pattern in a regular expression alias. hledger-lib3Apply a transformation to a transaction's postings. hledger-lib:Apply a transformation to a transaction's posting amounts. hledger-lib5The file path from which this transaction was parsed. Safe-Inferred"( hledger-libA query option changes a query's/report's behaviour and output in some way. hledger-lib1show an account register focussed on this account hledger-libas above but include sub-accounts in the account register | QueryOptCostBasis -- ^ show amounts converted to cost where possible | QueryOptDate2 -- ^ show secondary dates instead of primary dates hledger-libA more expressive Ord, used for amt: queries. The Abs* variants compare with the absolute value of a number, ignoring sign. hledger-libA query is a composition of search criteria, which can be used to match postings, transactions, accounts and more. hledger-libnegate this match hledger-libmatch if all of these match hledger-lib*match if any of these match no-op queries hledger-lib always match hledger-libnever match data queries (in "standard" order, roughly as they appear in a transaction) hledger-lib%match primary dates in this date span hledger-lib'match secondary dates in this date span hledger-libmatch this txn/posting status hledger-lib,match txn codes infix-matched by this regexp hledger-lib3match txn descriptions infix-matched by this regexp hledger-libmatch if a tag's name, and optionally its value, is infix-matched by the respective regexps hledger-lib0match account names infix-matched by this regexp hledger-libmatch accounts whose type is one of these (or with no types, any account) hledger-libmatch if account depth is less than or equal to this value (or, sometimes used as a display option) hledger-lib)match postings with this "realness" value hledger-lib3match if the amount's numeric quantity is less than greater than'equal to/unsignedly equal to some value hledger-lib=match if the commodity symbol is fully-matched by this regexp hledger-libConstruct a payee tag hledger-libConstruct a note tag hledger-lib%Construct a generated-transaction tag hledger-libA version of parseQueryList which acts on a single Text of space-separated terms.The usual shell quoting rules are assumed. When a pattern contains whitespace, it (or the whole term including prefix) should be enclosed in single or double quotes.A query term is either: :a search pattern, which matches on one or more fields, eg:acct:REGEXP - match the account name with a regular expression desc:REGEXP - match the transaction description date:PERIODEXP - match the date with a period expressionThe prefix indicates the field to match, or if there is no prefix account name is assumed. a query option, which modifies the reporting behaviour in some way. There is currently one of these, which may appear only once:inacct:FULLACCTNAMEPeriod expressions may contain relative dates, so a reference date is required to fully parse these.)parseQuery nulldate "expenses:dining out"Right (Or [Acct (RegexpCI "expenses:dining"),Acct (RegexpCI "out")],[])-parseQuery nulldate "\"expenses:dining out\""0Right (Acct (RegexpCI "expenses:dining out"),[]) hledger-lib;Convert a list of space-separated queries to a single queryMultiple terms are combined as follows: 1. multiple account patterns are OR'd together 2. multiple description patterns are OR'd together 3. multiple status patterns are OR'd together 4. then all terms are AND'd together hledger-libQuote-and-prefix-aware version of words - don't split on spaces which are inside quotes, including quotes which may have one of the specified prefixes in front, and maybe an additional not: prefix in front of that. hledger-libParse a single query term as either a query or a query option, or return an error message if parsing fails. hledger-lib"Parses a boolean query expression.Boolean queries combine smaller queries into larger ones. The boolean operators made available through this function are "NOT e", "e AND e", "e OR e", and "e e". Query options defined in multiple sub-queries are simply combined by concatenating all options into one list.Boolean operators in queries take precedence over one another. For instance, the prefix-operator "NOT e" is always parsed before "e AND e", "e AND e" before "e OR e", and "e OR e" before "e e".The space-separation operator is left as it was the default before the introduction of boolean operators. It takes the behaviour defined in the interpretQueryList function, whereas the NOT, OR, and AND operators simply wrap a list of queries with the associatedThe result of this function is either an error encountered during parsing of the expression or the combined query and query options.4parseBooleanQuery nulldate "expenses:dining AND out"Right (And [Acct (RegexpCI "expenses:dining"),Acct (RegexpCI "out")],[])parseBooleanQuery nulldate "expenses:dining AND desc:a OR desc:b"Right (Or [And [Acct (RegexpCI "expenses:dining"),Desc (RegexpCI "a")],Desc (RegexpCI "b")],[]) hledger-libParse the argument of an amt query term ([OP][SIGN]NUM), to an OrdPlus and a Quantity, or if parsing fails, an error message. OP can be  =,<,=, >, or = . NUM can be a simple integer or decimal. If a decimal, the decimal mark must be period, and it must have digits preceding it. Digit group marks are not allowed. hledger-libParse one or more account type code letters to a query matching any of those types. hledger-libCase-insensitively parse one single-letter code, or one long-form word if permitted, to an account type. On failure, returns the unparseable text. hledger-lib>Parse the value part of a "status:" query, or return an error. hledger-libParse the boolean value part of a "status:" query. "1" means true, anything else will be parsed as false without error. hledger-libRemove query terms (or whole sub-expressions) from this query which do not match the given predicate. XXX Semantics not completely clear. Also calls simplifyQuery on the result. hledger-libLike filterQuery, but returns the filtered query as is, without simplifying. hledger-libRemove query terms (or whole sub-expressions) from this query which match neither the given predicate nor that predicate negated (eg, if predicate is queryIsAcct, this will keep both "acct:" and "not:acct:" terms). Also calls simplifyQuery on the result. (Since 1.24.1, might be merged into filterQuery in future.) XXX Semantics not completely clear. hledger-libDoes this simple query predicate match any part of this possibly compound query ? hledger-lib"Does this query match everything ? hledger-libIs this a simple query of this type (date:) ? Does not match a compound query involving andor+not. Likewise for the following functions. hledger-libDoes this query specify a start date and nothing else (that would filter postings prior to the date) ? When the flag is true, look for a starting secondary date instead. hledger-libDoes this query involve a property of transactions (or their postings), making it inapplicable to account declarations ? hledger-libWhat start date (or secondary date) does this query specify, if any ? For OR expressions, use the earliest of the dates. NOT is ignored. hledger-libWhat end date (or secondary date) does this query specify, if any ? For OR expressions, use the latest of the dates. NOT is ignored. hledger-libWhat date span (or with a true argument, what secondary date span) does this query specify ? OR clauses specifying multiple spans return their union (the span enclosing all of them). AND clauses specifying multiple spans return their intersection. NOT clauses are ignored.  hledger-libWhat date span does this query specify, treating primary and secondary dates as equivalent ? OR clauses specifying multiple spans return their union (the span enclosing all of them). AND clauses specifying multiple spans return their intersection. NOT clauses are ignored. hledger-libWhat is the earliest of these dates, where Nothing is earliest ? hledger-lib>What is the latest of these dates, where Nothing is earliest ? hledger-libWhat is the earliest of these dates, where Nothing is the latest ? hledger-libWhat is the latest of these dates, where Nothing is the latest ?  hledger-lib3The depth limit this query specifies, if it has one  hledger-libThe account we are currently focussed on, if any, and whether subaccounts are included. Just looks at the first query option.  hledger-libA query for the account(s) we are currently focussed on, if any. Just looks at the first query option.  hledger-lib6Does the match expression match this (simple) amount ? hledger-libIs this amount's quantity less than, greater than, equal to, or unsignedly equal to this number ?  hledger-libDoes the query match this account name ? A matching in: clause is also considered a match.  hledger-lib?Like matchesAccount, but with optional extra matching features:If the account's type is provided, any type: terms in the query must match it (and any negated type: terms must not match it).If the account's tags are provided, any tag: terms must match at least one of them (and any negated tag: terms must match none).  hledger-libDoes the match expression match this posting ? When matching account name, and the posting has been transformed in some way, we will match either the original or transformed name.  hledger-libLike matchesPosting, but if the posting's account's type is provided, any type: terms in the query must match it (and any negated type: terms must not match it).  hledger-lib2Does the match expression match this transaction ?  hledger-libLike matchesTransaction, but if the journal's account types are provided, any type: terms in the query must match at least one posting's account type (and any negated type: terms must match none).  hledger-libDoes the query match this transaction description ? Tests desc: terms, any other terms are ignored.  hledger-libDoes the query match this transaction payee ? Tests desc: (and payee: ?) terms, any other terms are ignored. XXX Currently an alias for matchDescription. I'm not sure if more is needed, There's some shenanigan with payee: and "payeeTag" to figure out.  hledger-libDoes the query match the name and optionally the value of any of these tags ?  hledger-lib(Does the query match this market price ?    Safe-Inferred"'(  hledger-libApply all the given transaction modifiers, in turn, to each transaction. Or if any of them fails to be parsed, return the first error. A reference date is provided to help interpret relative dates in transaction modifier queries. hledger-lib Converts a  to a -transforming function which applies the modification(s) specified by the TransactionModifier. Or, returns the error message there is a problem parsing the TransactionModifier's query. A reference date is provided to help interpret relative dates in the query.The postings of the transformed transaction will reference it in the usual way (ie,  is called).Currently the only kind of modification possible is adding automated postings when certain other postings are present."import qualified Data.Text.IO as T4t = nulltransaction{tpostings=["ping" `post` usd 1]}5tmpost acc amt = TMPostingRule (acc `post` amt) Falsetest = either putStr (T.putStr.showTransaction) . fmap ($ t) . transactionModifierToFunction (const Nothing) (const []) mempty nulldate True5test $ TransactionModifier "" ["pong" `tmpost` usd 2] 0000-01-01 ping $1.000 pong $2.00 ; generated-posting: =9test $ TransactionModifier "miss" ["pong" `tmpost` usd 2] 0000-01-01 ping $1.00test $ TransactionModifier "ping" [("pong" `tmpost` nullamt{aquantity=3}){tmprIsMultiplier=True}] 0000-01-01 ping $1.005 pong $3.00 ; generated-posting: = ping hledger-lib Converts a TransactionModifier's posting rule to a -generating function, which will be used to make a new posting based on the old one (an "automated posting"). The new posting's amount can optionally be the old posting's amount multiplied by a constant. If the old posting had a total-priced amount, the new posting's multiplied amount will be unit-priced. The new posting will have a hidden _generated-posting: tag added, and with a true first argument, also a visible generated-posting: tag. The provided TransactionModifier's query text is saved as the tags' value.   Safe-Inferred"  hledger-libConvert time log entries to journal transactions. When there is no clockout, add one with the provided current time. Sessions crossing midnight are split into days to give accurate per-day totals. hledger-libConvert a timeclock clockin and clockout entry to an equivalent journal transaction, representing the time expenditure. Note this entry is not balanced, since we omit the "assets:time" transaction for simpler output.   Safe-Inferred"%&  hledger-libGiven an account name and its account directive, and a problem tag within the latter: render it as a megaparsec-style excerpt, showing the original line number and marked column or region. Returns the file path, line number, column(s) if known, and the rendered excerpt, or as much of these as is possible. The returned columns will be accurate for the rendered error message but not for the original journal data. hledger-libAdd megaparsec-style left margin, line number, and optional column marker(s).  hledger-libGiven a problem transaction and a function calculating the best column(s) for marking the error region: render it as a megaparsec-style excerpt, showing the original line number on the transaction line, and a column(s) marker. Returns the file path, line number, column(s) if known, and the rendered excerpt, or as much of these as is possible. The returned columns will be accurate for the rendered error message but not for the original journal data. hledger-libAdd megaparsec-style left margin, line number, and optional column marker(s).  hledger-libGiven a problem posting and a function calculating the best column(s) for marking the error region: look up error info from the parent transaction, and render the transaction as a megaparsec-style excerpt, showing the original line number on the problem posting's line, and a column indicator. Returns the file path, line number, column(s) if known, and the rendered excerpt, or as much of these as is possible. A limitation: columns will be accurate for the rendered error message but not for the original journal data. hledger-libAdd megaparsec-style left margin, line number, and optional column marker(s).  hledger-libFind the 1-based index of the first posting in this transaction satisfying the given predicate.  hledger-libFrom the given posting, make an error excerpt showing the transaction with this posting's account part highlighted.  hledger-libFrom the given posting, make an error excerpt showing the transaction with the balance assertion highlighted.   Safe-Inferred\   Safe-Inferred"%&"  hledger-libGenerate transactions from  within a . This should be a closed span with both start and end dates specified; an open ended span will generate no transactions.#Note that new transactions require  post-processing. The new transactions will have three tags added: - a recur:PERIODICEXPR tag whose value is the generating periodic expression - a generated-transaction: tag - a hidden _generated-transaction: tag which does not appear in the comment.  import Data.Time (fromGregorian)&_ptgen "monthly from 2017/1 to 2017/4" 2017-01-01< ; generated-transaction: ~ monthly from 2017/1 to 2017/4 a $1.00 2017-02-01< ; generated-transaction: ~ monthly from 2017/1 to 2017/4 a $1.00 2017-03-01< ; generated-transaction: ~ monthly from 2017/1 to 2017/4 a $1.00&_ptgen "monthly from 2017/1 to 2017/5" 2017-01-01< ; generated-transaction: ~ monthly from 2017/1 to 2017/5 a $1.00 2017-02-01< ; generated-transaction: ~ monthly from 2017/1 to 2017/5 a $1.00 2017-03-01< ; generated-transaction: ~ monthly from 2017/1 to 2017/5 a $1.00 2017-04-01< ; generated-transaction: ~ monthly from 2017/1 to 2017/5 a $1.007_ptgen "every 2nd day of month from 2017/02 to 2017/04" 2017-01-02 ; generated-transaction: ~ every 2nd day of month from 2017/02 to 2017/04 a $1.00 2017-02-02 ; generated-transaction: ~ every 2nd day of month from 2017/02 to 2017/04 a $1.00 2017-03-02 ; generated-transaction: ~ every 2nd day of month from 2017/02 to 2017/04 a $1.006_ptgen "every 30th day of month from 2017/1 to 2017/5" 2016-12-30 ; generated-transaction: ~ every 30th day of month from 2017/1 to 2017/5 a $1.00 2017-01-30 ; generated-transaction: ~ every 30th day of month from 2017/1 to 2017/5 a $1.00 2017-02-28 ; generated-transaction: ~ every 30th day of month from 2017/1 to 2017/5 a $1.00 2017-03-30 ; generated-transaction: ~ every 30th day of month from 2017/1 to 2017/5 a $1.00 2017-04-30 ; generated-transaction: ~ every 30th day of month from 2017/1 to 2017/5 a $1.00:_ptgen "every 2nd Thursday of month from 2017/1 to 2017/4" 2016-12-08 ; generated-transaction: ~ every 2nd Thursday of month from 2017/1 to 2017/4 a $1.00 2017-01-12 ; generated-transaction: ~ every 2nd Thursday of month from 2017/1 to 2017/4 a $1.00 2017-02-09 ; generated-transaction: ~ every 2nd Thursday of month from 2017/1 to 2017/4 a $1.00 2017-03-09 ; generated-transaction: ~ every 2nd Thursday of month from 2017/1 to 2017/4 a $1.00)_ptgen "every nov 29th from 2017 to 2019" 2016-11-29? ; generated-transaction: ~ every nov 29th from 2017 to 2019 a $1.00 2017-11-29? ; generated-transaction: ~ every nov 29th from 2017 to 2019 a $1.00 2018-11-29? ; generated-transaction: ~ every nov 29th from 2017 to 2019 a $1.00_ptgen "2017/1" 2017-01-01% ; generated-transaction: ~ 2017/1 a $1.00let reportperiod="daily from 2018/01/03" in let (i,s) = parsePeriodExpr' nulldate reportperiod in runPeriodicTransaction True (nullperiodictransaction{ptperiodexpr=reportperiod, ptspan=s, ptinterval=i, ptpostings=["a" `post` usd 1]}) (DateSpan (Just $ Flex $ fromGregorian 2018 01 01) (Just $ Flex $ fromGregorian 2018 01 03))[]_ptgenspan "every 3 months from 2019-05" (DateSpan (Just $ Flex $ fromGregorian 2020 01 01) (Just $ Flex $ fromGregorian 2020 02 01))_ptgenspan "every 3 months from 2019-05" (DateSpan (Just $ Flex $ fromGregorian 2020 02 01) (Just $ Flex $ fromGregorian 2020 03 01)) 2020-02-01: ; generated-transaction: ~ every 3 months from 2019-05 a $1.00_ptgenspan "every 3 days from 2018" (DateSpan (Just $ Flex $ fromGregorian 2018 01 01) (Just $ Flex $ fromGregorian 2018 01 05)) 2018-01-015 ; generated-transaction: ~ every 3 days from 2018 a $1.00 2018-01-045 ; generated-transaction: ~ every 3 days from 2018 a $1.00_ptgenspan "every 3 days from 2018" (DateSpan (Just $ Flex $ fromGregorian 2018 01 02) (Just $ Flex $ fromGregorian 2018 01 05)) 2018-01-045 ; generated-transaction: ~ every 3 days from 2018 a $1.00  hledger-libCheck that this date span begins at a boundary of this interval, or return an explanatory error message including the provided period expression (from which the span and interval are derived).   Safe-Inferred"%&$ hledger-lib'Config for pretty printing JSON output.  hledger-libShow a JSON-convertible haskell value as pretty-printed JSON text.  hledger-libWrite a JSON-convertible haskell value to a pretty-printed JSON file. Eg: writeJsonFile "a.json" nulltransaction  hledger-libRead a JSON file and decode it to the target type, or raise an error if we can't. Eg: readJsonFile "a.json" :: IO Transaction   Safe-Inferred"%&'R  hledger-libA parser of text that runs in some monad, keeping a Journal as state, that can throw an exception to end parsing, preventing further parser backtracking.  hledger-libA parser of text that runs in some monad, keeping a Journal as state.  hledger-libMerge two journals into one. Transaction counts are summed, map fields are combined, the second's list fields are appended to the first's, the second's parse state is kept.  hledger-libRenumber all the account declarations. This is useful to call when finalising or concatenating Journals, to give account declarations a total order across files.  hledger-libDebug log the ordering of a journal's account declarations (at debug level 5+).  hledger-libGet the transaction with this index (its 1-based position in the input stream), if any.  hledger-libGet the transaction that appeared immediately after this one in the input stream, if any.  hledger-libGet the transaction that appeared immediately before this one in the input stream, if any.  hledger-lib8All postings from this journal's transactions, in order.  hledger-libSorted unique commodity symbols declared by commodity directives in this journal.  hledger-libSorted unique commodity symbols declared or inferred from this journal.  hledger-lib5Unique transaction descriptions used in this journal.  hledger-libSorted unique payees declared by payee directives in this journal.  hledger-lib:Sorted unique payees used by transactions in this journal.  hledger-libSorted unique payees used in transactions or declared by payee directives in this journal.  hledger-libSorted unique tag names declared by tag directives in this journal.  hledger-libSorted unique tag names used in this journal (in account directives, transactions, postings..)  hledger-libSorted unique tag names used in transactions or declared by tag directives in this journal.  hledger-libSorted unique account names posted to by this journal's transactions.  hledger-libSorted unique account names implied by this journal's transactions - accounts posted to and all their implied parent accounts.  hledger-libSorted unique account names declared by account directives in this journal.  hledger-libSorted unique account names declared by account directives in this journal, which have no children.  hledger-libSorted unique account names declared by account directives or posted to by transactions in this journal.  hledger-libSorted unique account names declared by account directives, or posted to or implied as parents by transactions in this journal.  hledger-libConvenience/compatibility alias for journalAccountNamesDeclaredOrImplied.  hledger-libSorted unique account names declared or implied in this journal which have no children.  hledger-libWhich tags have been declared explicitly for this account, if any ?  hledger-libWhich tags are in effect for this account, including tags inherited from parent accounts ?  hledger-libFind up to N most similar and most recent transactions matching the given transaction description and query and exceeding the given description similarity score (0 to 1, see compareDescriptions). Returns transactions along with their age in days compared to the latest transaction date, their description similarity score, and a heuristically date-weighted variant of this that favours more recent transactions. hledger-libReturn a similarity score from 0 to 1.5 for two transaction descriptions. This is based on compareStrings, with the following modifications:4numbers are stripped out before measuring similarityif the (unstripped) first description appears in its entirety within the second, the score is boosted by 0.5. hledger-libReturn a similarity score from 0 to 1 for two strings. This was based on Simon White's string similarity algorithm (http:/www.catalysoft.com0articles/StrikeAMatch.html), later found to be  https://en.wikipedia.org/wiki/S%C3%B8rensen%E2%80%93Dice_coefficient, and modified to handle short strings better. Todo: check out  6http://nlp.fi.muni.cz/raslan/2008/raslan08.pdf#page=14 .  hledger-libThe 8 to use for automatically generated conversion postings.  hledger-lib4Add a map of all known account types to the journal.  hledger-libBuild a map of all known account types, explicitly declared or inferred from the account's parent or name. hledger-lib5Build a map of the account types explicitly declared.  hledger-libTo all postings in the journal, add any tags from their account (including those inherited from parent accounts). If the same tag exists on posting and account, the latter is ignored.  hledger-lib5Keep only transactions matching the query expression.  hledger-libKeep only postings matching the query expression. This can leave unbalanced transactions.  hledger-libKeep only postings which do not match the query expression, but for which a related posting does. This can leave unbalanced transactions.  hledger-libWithin each posting's amount, keep only the parts matching the query, and remove any postings with all amounts removed. This can leave unbalanced transactions.  hledger-libFilter out all parts of this transaction's amounts which do not match the query, and remove any postings with all amounts removed. This can leave the transaction unbalanced.  hledger-libFilter out all parts of this posting's amount which do not match the query, and remove the posting if this removes all amounts.  hledger-lib3Apply a transformation to a journal's transactions.  hledger-lib/Apply a transformation to a journal's postings.  hledger-lib6Apply a transformation to a journal's posting amounts.  hledger-libReverse all lists of parsed items, which during parsing were prepended to, so that the items are in parse order. Part of post-parse finalisation.  hledger-libSet this journal's last read time, ie when its files were last read.  hledger-libNumber (set the tindex field) this journal's transactions, counting upward from 1. hledger-libTie the knot in all of this journal's transactions, ensuring their postings refer to them. This should be done last, after any other transaction-modifying operations.  hledger-libUntie all transaction-posting knots in this journal, so that eg recursiveSize and GHCI's :sprint can work on it.  hledger-libApply any transaction modifier rules in the journal (adding automated postings to transactions, eg). Or if a modifier rule fails to parse, return the error message. A reference date is provided to help interpret relative dates in transaction modifier queries. The first argument selects whether to add visible tags to generated postings & modified transactions.  hledger-libChoose and apply a consistent display style to the posting amounts in each commodity (see journalCommodityStyles), keeping all display precisions unchanged. Can return an error message eg if inconsistent number formats are found.  hledger-libGet the canonical amount styles for this journal, whether (in order of precedence): set globally in InputOpts, declared by commodity directives, declared by a default commodity (D) directive, or inferred from posting amounts, as a map from symbol to style. Styles from directives are assumed to specify the decimal mark. hledger-libCollect and save inferred amount styles for each commodity based on the posting amounts in that commodity (excluding price amounts), ie: "the format of the first amount, adjusted to the highest precision of all amounts". Can return an error message eg if inconsistent number formats are found.  hledger-libGiven a list of amounts, in parse order (roughly speaking; see journalStyleInfluencingAmounts), build a map from their commodity names to standard commodity display formats. Can return an error message eg if inconsistent number formats are found.Though, these amounts may have come from multiple files, so we shouldn't assume they use consistent number formats. Currently we don't enforce that even within a single file, and this function never reports an error.  hledger-libGiven a list of amount styles (assumed to be from parsed amounts in a single commodity), in parse order, choose a canonical style. hledger-libGiven a pair of AmountStyles, choose a canonical style. This is: the general style of the first amount, with the first digit group style seen, with the maximum precision of all.  hledger-libInfer transaction-implied market prices from commodity-exchanging transactions, if any. It's best to call this after transactions have been balanced and posting amounts have appropriate prices attached.  hledger-libConvert all this journal's amounts to cost using their attached prices, if any.  hledger-libAdd equity postings inferred from costs, where needed and possible. See hledger manual > Cost reporting.  hledger-libAdd costs inferred from equity conversion postings, where needed and possible. See hledger manual > Cost reporting.  hledger-libDo just the internal tagging that is normally done by journalInferCostsFromEquity, identifying equity conversion postings and, in particular, postings which have redundant costs. Tagging the latter is useful as it allows them to be ignored during transaction balancedness checking. And that allows journalInferCostsFromEquity to be postponed till after transaction balancing, when it will have more information (amounts) to work with. hledger-libGet an ordered list of amounts in this journal which can influence canonical amount display styles. Those amounts are, in the following order:7amounts in market price (P) directives (in parse order)0posting amounts in transactions (in parse order)7the amount in the final default commodity (D) directiveTransaction price amounts (posting amounts' aprice field) are not included.  hledger-libThe fully specified exact date span enclosing the dates (primary or secondary) of all this journal's transactions and postings, or DateSpan Nothing Nothing if there are none.  hledger-libThe fully specified date span enclosing the dates (primary and secondary) of all this journal's transactions and postings, or DateSpan Nothing Nothing if there are none. hledger-libA helper for journalDateSpan which takes Maybe WhichDate directly. Nothing uses both primary and secondary dates.  hledger-libThe earliest of this journal's transaction and posting dates, or Nothing if there are none.  hledger-libThe "exclusive end date" of this journal: the day following its latest transaction or posting date, or Nothing if there are none.  hledger-libThe latest of this journal's transaction and posting dates, or Nothing if there are none.  hledger-libApply the pivot transformation to all postings in a journal, replacing their account name by their value for the given field or tag. hledger-libReplace this transaction's postings' account names with the value of the given field or tag, if any. hledger-libReplace this posting's account name with the value of the given field or tag, if any, otherwise the empty string.  hledger-libApply some account aliases to all posting account names in the journal, as described by accountNameApplyAliases. This can fail due to a bad replacement pattern in a regular expression alias.  Safe-Inferred"T  hledger-libCheck that all the journal's postings are to accounts with a unique leaf name. Otherwise, return an error message for the first offending posting.   Safe-Inferred"'Z  hledger-libCheck that all the journal's postings are to accounts with account directives, returning an error message otherwise.  hledger-libCheck that all the commodities used in this journal's postings have been declared by commodity directives, returning an error message otherwise.  hledger-libCheck that all the journal's transactions have payees declared with payee directives, returning an error message otherwise.  hledger-libCheck that all the journal's tags (on accounts, transactions, postings..) have been declared with tag directives, returning an error message otherwise.  hledger-libIn each tranaction, check that any conversion postings occur in adjacent pairs. hledger-libThe number of days allowed between an account's latest balance assertion and latest posting (7).  hledger-libCheck that accounts with balance assertions have no posting more than maxlag days after their latest balance assertion. Today's date is provided for error messages. hledger-libDo the recentassertions check for one account: given a list of postings to the account, if any of them contain a balance assertion, identify the latest balance assertion, and if any postings are >maxlag days later than the assertion, return an error message identifying the first of them. Postings on the same date will be handled in parse order (hopefully).   Safe-Inferred"'" hledger-lib:The state used while balancing a sequence of transactions. hledger-libcommodity display styles hledger-libaccounts where balance assignments may not be used (because of auto posting rules) hledger-lib,whether to check balance assertions mutable hledger-lib)running account balances, initially empty hledger-liba mutable array of the transactions being balanced (for efficiency ? journalBalanceTransactions says: not strictly necessary but avoids a sort at the end I think) hledger-lib#Monad used for statefully balancingamount-inferringassertion-checking a sequence of transactions. Perhaps can be simplified, or would a different ordering of layers make sense ? If you see a way, let us know.  hledger-lib.should failing balance assertions be ignored ?  hledger-libAre we permitted to infer missing costs to balance transactions ? Distinct from InputOpts{infer_costs_}.  hledger-libcommodity display styles hledger-libCheck that this transaction would appear balanced to a human when displayed. On success, returns the empty list, otherwise one or more error messages.In more detail: For the real postings, and separately for the balanced virtual postings: &Convert amounts to cost where possibleWhen there are two or more non-zero amounts (appearing non-zero when displayed, using the given display styles if provided), are they a mix of positives and negatives ? This is checked separately to give a clearer error message. (Best effort; could be confused by postings with multicommodity amounts.)Does the amounts' sum appear non-zero when displayed ? (using the given display styles if provided)  hledger-lib(Legacy form of transactionCheckBalanced.  hledger-libBalance this transaction, ensuring that its postings (and its balanced virtual postings) sum to 0, by inferring a missing amount or conversion price(s) if needed. Or if balancing is not possible, because the amounts don't sum to 0 or because there's more than one missing amount, return an error message.Transactions with balance assignments can have more than one missing amount; to balance those you should use the more powerful journalBalanceTransactions.The "sum to 0" test is done using commodity display precisions, if provided, so that the result agrees with the numbers users can see.  hledger-libHelper used by balanceTransaction and balanceTransactionWithBalanceAssignmentAndCheckAssertionsB; use one of those instead. It also returns a list of accounts and amounts that were inferred. hledger-libGenerate a transaction balancing error message, given the transaction and one or more suberror messages. hledger-libInfer up to one missing amount for this transactions's real postings, and likewise for its balanced virtual postings, if needed; or return an error message if we can't. Returns the updated transaction and any inferred posting amounts, with the corresponding accounts, in order).We can infer a missing amount when there are multiple postings and exactly one of them is amountless. If the amounts had price(s) the inferred amount have the same price(s), and will be converted to the price commodity. hledger-libInfer costs for this transaction's posting amounts, if needed to make the postings balance, and if permitted. This is done once for the real postings and again (separately) for the balanced virtual postings. When it's not possible, the transaction is left unchanged.The simplest example is a transaction with two postings, each in a different commodity, with no costs specified. In this case we'll add a cost to the first posting such that it can be converted to the commodity of the second posting (with -B), and such that the postings balance.In general, we can infer a cost (conversion rate) when the sum of posting amounts contains exactly two different commodities and no explicit costs. Also all postings are expected to contain an explicit amount (no missing amounts) in a single commodity. Otherwise no cost inferring is attempted.The transaction itself could contain more than two commodities, and/or costs, if they cancel out; what matters is that the sum of posting amounts contains exactly two commodities and zero costs.There can also be more than two postings in either of the commodities.We want to avoid excessive display of digits when the calculated cost is an irrational number, while hopefully also ensuring the displayed numbers make sense if the user does a manual calculation. This is (mostly) achieved in two ways:when there is only one posting in the "from" commodity, a total cost (@@) is used, and all available decimal digits are shownotherwise, a suitable averaged unit cost (@) is applied to the relevant postings, with display precision equal to the summed display precisions of the two commodities being converted between, or 2, whichever is larger.(We don't always calculate a good-looking display precision for unit costs when the commodity display precisions are low, eg when a journal doesn't use any decimal places. The minimum of 2 helps make the costs shown by the print command a bit less surprising in this case. Could do better.) hledger-libGenerate a posting update function which assigns a suitable cost to balance the posting, if and as appropriate for the given transaction and posting type (real or balanced virtual) (or if we cannot or should not infer costs, leaves the posting unchanged).  hledger-libCheck any balance assertions in the journal and return an error message if any of them fail (or if the transaction balancing they require fails). hledger-libAccess the current balancing state, and possibly modify the mutable bits, lifting through the Except and Reader layers into the Balancing monad. hledger-lib5Get this account's current exclusive running balance. hledger-libAdd this amount to this account's exclusive running balance. Returns the new running balance. hledger-libSet this account's exclusive running balance to this amount. Returns the change in exclusive running balance. hledger-libSet this account's exclusive running balance to whatever amount makes its *inclusive* running balance (the sum of exclusive running balances of this account and any subaccounts) be the given amount. Returns the change in exclusive running balance. hledger-lib;Update (overwrite) this transaction in the balancing state.  hledger-libInfer any missing amounts and/or conversion costs (as needed to balance transactions and satisfy balance assignments); and check that all transactions are balanced; and (optional) check that all balance assertions pass. Or, return an error message (just the first error encountered).Assumes journalInferCommodityStyles has been called, since those affect transaction balancing.This does multiple things at once because amount inferring, balance assignments, balance assertions and posting dates are interdependent. hledger-libThis function is called statefully on each of a date-ordered sequence of 1. fully explicit postings from already-balanced transactions and 2. not-yet-balanced transactions containing balance assignments. It executes balance assignments and finishes balancing the transactions, and checks balance assertions on each posting as it goes. An error will be thrown if a transaction can't be balanced or if an illegal balance assignment is found (cf checkIllegalBalanceAssignment). Transaction prices are removed, which helps eg balance-assertions.test: 15. Mix different commodities and assignments. This stores the balanced transactions in case 2 but not in case 1. hledger-libIf this posting has an explicit amount, add it to the account's running balance. If it has a missing amount and a balance assignment, infer the amount from, and reset the running balance to, the assigned balance. If it has a missing amount and no balance assignment, leave it for later. Then test the balance assertion if any. hledger-libAdd the posting's amount to its account's running balance, and optionally check the posting's balance assertion if any. The posting is expected to have an explicit amount (otherwise this does nothing). Adding and checking balance assertions are tightly paired because we need to see the balance as it stands after each individual posting. hledger-libCheck a posting's balance assertion against the given actual balance, and return an error if the assertion is not satisfied. If the assertion is partial, unasserted commodities in the actual balance are ignored; if it is total, they will cause the assertion to fail. hledger-libDoes this (single commodity) expected balance match the amount of that commodity in the given (multicommodity) actual balance ? If not, returns a balance assertion failure message based on the provided posting. To match, the amounts must be exactly equal (display precision is ignored here). If the assertion is inclusive, the expected amount is compared with the account's subaccount-inclusive balance; otherwise, with the subaccount-exclusive balance. hledger-libThrow an error if this posting is trying to do an illegal balance assignment. hledger-libThrow an error if this posting is trying to do a balance assignment and has a custom posting date (which makes amount inference too hard/impossible). hledger-libThrow an error if this posting is trying to do a balance assignment and the account does not allow balance assignments (eg because it is referenced by an auto posting rule, which might generate additional postings to it). hledger-libcommodity display styles  ! Safe-Inferred~  hledger-liba file/storage format to try, unless overridden by a filename prefix. Nothing means try all.  hledger-lib1a conversion rules file to use (when reading CSV)  hledger-libaccount name aliases to apply  hledger-lib.do light anonymisation/obfuscation of the data  hledger-lib8read only new transactions since this file was last read  hledger-lib0save latest new transactions state for next time  hledger-lib/use the given field's value as the account name  hledger-lib/span in which to generate forecast transactions  hledger-libadd user-visible tags when generating/modifying transactions & postings ?  hledger-liba dirty hack keeping the query dates in InputOpts. This rightfully lives in ReportSpec, but is duplicated here.  hledger-lib4generate automatic postings when journal is parsed ?  hledger-lib-infer equity conversion postings from costs ?  hledger-libinfer costs from equity conversion postings ? distinct from BalancingOpts{infer_balancing_costs_}  hledger-lib"options for balancing transactions  hledger-libdo extra error checking (eg, all posted accounts are declared, no prices are inferred)  hledger-libtoday's date, for use with forecast transactions XXX this duplicates _rsDay, and should eventually be removed when it's not needed anymore.  hledger-libGet the Maybe the DateSpan to generate forecast options from. This begins on: - the start date supplied to the `--forecast` argument, if present - otherwise, the later of - the report start date if specified with -b-pdate: - the day after the latest normal (non-periodic) transaction in the journal, if any - otherwise today. It ends on: - the end date supplied to the `--forecast` argument, if present - otherwise the report end date if specified with -e-p2date: - otherwise 180 days (6 months) from today.& & " Safe-Inferred"%&k hledger-libAn efficient-to-build tree suggested by Cale Gibbard, probably better than accountNameTreeFrom.  hledger-libDerive 1. an account tree and 2. each account's total exclusive and inclusive changes from a list of postings. This is the core of the balance command (and of *ledger). The accounts are returned as a list in flattened tree order, and also reference each other as a tree. (The first account is the root of the tree.)  hledger-libConvert a list of account names to a tree of Account objects, with just the account names filled in. A single root account with the given name is added. hledger-lib;Tie the knot so all subaccounts' parents are set correctly.  hledger-libGet this account's parent accounts, from the nearest up to the root.  hledger-lib4List the accounts at each level of the account tree.  hledger-libMap a (non-tree-structure-modifying) function over this and sub accounts.  hledger-libIs the predicate true on any of this account or its subaccounts ?  hledger-lib5Add subaccount-inclusive balances to an account tree.  hledger-lib-Remove all subaccounts below a certain depth.  hledger-libRemove subaccounts below the specified depth, aggregating their balance at the depth limit (accounts at the depth limit will have any sub-balances merged into their exclusive balance). If the depth is Nothing, return the original accounts  hledger-lib;Remove all leaf accounts and subtrees matching a predicate.  hledger-libFlatten an account tree into a list, which is sometimes convenient. Note since accounts link to their parents/subs, the tree's structure remains intact and can still be used. It's a tree/list!  hledger-lib#Filter an account tree (to a list).  hledger-libSort each group of siblings in an account tree by inclusive amount, so that the accounts with largest normal balances are listed first. The provided normal balance sign determines whether normal balances are negative or positive, affecting the sort order. Ie, if balances are normally negative, then the most negative balances sort first, and vice versa.  hledger-libAdd extra info for this account derived from the Journal's account directives, if any (comment, tags, declaration order..).  hledger-libSort account names by the order in which they were declared in the journal, at each level of the account tree (ie within each group of siblings). Undeclared accounts are sorted last and alphabetically. This is hledger's default sort for reports organised by account. The account list is converted to a tree temporarily, adding any missing parents; these can be kept (suitable for a tree-mode report) or removed (suitable for a flat-mode report). hledger-libSort each group of siblings in an account tree by declaration order, then account name. So each group will contain first the declared accounts, in the same order as their account directives were parsed, and then the undeclared accounts, sorted by account name.  hledger-libSearch an account list by name.  # Safe-Inferred"8  hledger-libFilter a journal's transactions with the given query, then build a Ledger, containing the journal plus the tree of all its accounts with their subaccount-inclusive and subaccount-exclusive balances. If the query includes a depth limit, the ledger's journal will be depth limited, but the ledger's account tree will not.  hledger-libList a ledger's account names.  hledger-lib$Get the named account from a ledger.  hledger-libGet this ledger's root account, which is a dummy "root" account above all others. This should always be first in the account list, if somehow not this returns a null account.  hledger-libList a ledger's top-level accounts (the ones below the root), in tree order.  hledger-libList a ledger's bottom-level (subaccount-less) accounts, in tree order.  hledger-lib.List a ledger's postings, in the order parsed.  hledger-libThe (fully specified) date span containing all the ledger's (filtered) transactions, or DateSpan Nothing Nothing if there are none.  hledger-lib$All commodities used in this ledger. $ Safe-Inferred"6978:;<=FEDCBA@>?GLKJHIMNOPSQRTUVonmlkjihgfedcba`_^]\[ZYWXputsqrvzywx{~|} 6978:;<=FEDCBA@>?GLKJHIMNOPSQRTUVonmlkjihgfedcba`_^]\[ZYWXputsqrvzywx{~|} % Safe-Inferred"%&@=  hledger-libA fully-determined set of report parameters (report options with all partial values made total, eg the begin and end dates are known, avoiding date/regex errors; plus the reporting date), and the query successfully calculated from them.If you change the report options or date in one of these, you should use  7 to regenerate the whole thing, avoiding inconsistency.  hledger-lib:The underlying ReportOpts used to generate this ReportSpec  hledger-lib(The Day this ReportSpec is generated for  hledger-lib%The generated Query for the given day  hledger-lib%A list of QueryOpts for the given day  hledger-libStandard options for customising report filtering and output. Most of these correspond to standard hledger command-line options or query arguments, but not all. Some are used only by certain commands, as noted below.  hledger-lib(Zero, one, or two statuses to be matched  hledger-lib;Which operation should we apply to conversion transactions?  hledger-lib+What value should amounts be converted to ?  hledger-lib'Infer market prices from transactions ?  hledger-lib)What to calculate in balance report cells  hledger-lib1How to accumulate balance report values over time  hledger-libA case-insensitive description substring to select periodic transactions for budget reports. (Not a regexp, nor a full hledger query, for now.)  hledger-lib1Include accounts declared but not yet posted to ?  hledger-lib7Show costs for reports which normally don't show them ?  hledger-lib"Flip all amount signs in reports ?  hledger-libThis can be set when running balance reports on a set of accounts with the same normal balance type (eg all assets, or all incomes). - It helps --sort-amount know how to sort negative numbers (eg in the income section of an income statement) - It helps compound balance report commands (is, bs etc.) do sign normalisation, converting normally negative subreports to normally positive for a more conventional display.  hledger-libWhether to use ANSI color codes in text output. Influenced by the --color/colour flag (cf CliOptions), whether stdout is an interactive terminal, and the value of TERM and existence of NO_COLOR environment variables.  hledger-libShould accounts be displayed: in the command's default style, hierarchically, or as a flat list ?  hledger-libHow to accumulate calculated values across periods (columns) in a balance report. "Balance report types -> Accumulation type" in the hledger manual.  hledger-libNo accumulation. Eg, shows the change of balance in each period.  hledger-libAccumulate changes across periods, starting from zero at report start.  hledger-libAccumulate changes across periods, including any from before report start. Eg, shows the historical end balance of each period.  hledger-libWhat to calculate for each cell in a balance report. "Balance report types -> Calculation type" in the hledger manual.  hledger-lib%Sum of posting amounts in the period.  hledger-lib3Sum of posting amounts and the goal for the period.  hledger-libChange from previous period's historical end value to this period's historical end value.  hledger-libChange from previous period's gain, i.e. valuation minus cost basis.  hledger-lib!Number of postings in the period.  hledger-libGenerate a ReportOpts from raw command-line input, given a day. This will fail with a usage error if it is passed - an invalid --format argument, - an invalid --value argument, - if --valuechange is called with a valuation type other than -V/--value=end. - an invalid --pretty argument,  hledger-libSet the default ConversionOp.  hledger-libGet the report interval, if any, specified by the last of -p/--period, -D --daily, -W--weekly, -M/--monthly etc. options. An interval from --period counts only if it is explicitly defined. hledger-libExtract the interval from the parsed -p/--period expression. Return Nothing if an interval is not explicitly defined. hledger-libGet any statuses to be matched, as specified by -U/--unmarked, -P --pending, -C--cleared flags. -UPC is equivalent to no flags, so this returns a list of 0-2 unique statuses.  hledger-libReduce a list of statuses to just one of each status, and if all statuses are present return the empty list.  hledger-libAdd/remove this status from the status list. Used by hledger-ui. hledger-libParse the type of valuation to be performed, if any, specified by -V, -X/--exchange, or --value flags. If there's more than one valuation type, the rightmost flag wins. This will fail with a usage error if an invalid argument is passed to --value, or if --valuechange is called with a valuation type other than -V/--value=end. hledger-libParse the type of costing to be performed, if any, specified by -B/--cost or --value flags. If there's more than one costing type, the rightmost flag wins. This will fail with a usage error if an invalid argument is passed to --cost or if a costing type is requested with --gain.  hledger-lib6Select the Transaction date accessor based on --date2.  hledger-lib2Select the Posting date accessor based on --date2.  hledger-lib5Report which date we will report on based on --date2.  hledger-lib;Legacy-compatible convenience aliases for accountlistmode_.  hledger-lib Convert a Journal'(s amounts to cost and/or to value (see  ), and filter by the   .We make sure to first filter by amt: and cur: terms, then value the V%, then filter by the remaining terms.  hledger-libLike  , but takes a  as an argument.  hledger-libConvert this journal's postings' amounts to cost and/or to value, if specified by options (-B--cost-V-X--value etc.). Strip prices if not needed. This should be the main stop for performing costing and valuation. The exception is whenever you need to perform valuation _after_ summing up amounts, as in a historical balance report with --value=end. valuationAfterSum will check for this condition.  hledger-libLike journalApplyValuationFromOpts, but takes PriceOracle as an argument.  hledger-libSelect the Account valuation functions required for performing valuation after summing amounts. Used in MultiBalanceReport to value historical and similar reports.  hledger-libIf the ReportOpts specify that we are performing valuation after summing amounts, return Just of the commodity symbol we're converting to, Just Nothing for the default, and otherwise return Nothing. Used for example with historical reports with --value=end.  hledger-libConvert report options to a query, ignoring any non-flag command line arguments.  hledger-libThe effective report span is the start and end dates specified by options or queries, or otherwise the earliest and latest transaction or posting dates in the journal. If no dates are specified by options/queries and the journal is empty, returns the null date span. Also return the intervals if they are requested.  hledger-libLike reportSpan, but uses both primary and secondary dates when calculating the span. hledger-libA helper for reportSpan, which takes a Bool indicating whether to use both primary and secondary dates.  hledger-libMake a name for the given period in a multiperiod report, given the type of balance being reported and the full set of report periods. This will be used as a column heading (or row heading, in a register summary report). We try to pick a useful name as follows:-ending-balance reports: the period's end datebalance change reports where the periods are months and all in the same year: the short month name in the current localeall other balance change reports: a description of the datespan, abbreviated to compact form if possible (see showDateSpan).  hledger-lib4Apply a function over a lens, but report on failure.  hledger-lib0Set a field using a lens, but report on failure.  hledger-libLenses for ReportOpts.  hledger-libSpecial lenses for ReportOpts which also update the Query and QueryOpts in ReportSpec. Note that these are not true lenses, as they have a further restriction on the functor. This will work as a normal lens for all common uses, but since they don't obey the lens laws for some fancy cases, they may fail in some exotic circumstances.Note that setEither/overEither should only be necessary with querystring and reportOpts: the other lenses should never fail. Examples:import Lens.Micro (set);_rsQuery <$> setEither querystring ["assets"] defreportspec Right (Acct (RegexpCI "assets"))<_rsQuery <$> setEither querystring ["(assets"] defreportspecLeft "This regular expression is malformed, please correct it:\n(assets"3_rsQuery $ set querystring ["assets"] defreportspecAcct (RegexpCI "assets")4_rsQuery $ set querystring ["(assets"] defreportspec*** Exception: Error: Updating ReportSpec failed: try using overEither instead of over or setEither instead of set9_rsQuery $ set period (MonthPeriod 2021 08) defreportspecDate DateSpan 2021-08  hledger-lib>Generate a ReportSpec from a set of ReportOpts on a given day.  hledger-libUpdate the ReportOpts and the fields derived from it in a ReportSpec, or return an error message if there is a problem such as missing or unparseable options data. This is the safe way to change a ReportSpec, ensuring that all fields (_rsQuery, _rsReportOpts, querystring_, etc.) are in sync.  hledger-libLike updateReportSpec, but takes a ReportOpts-modifying function.  hledger-libGenerate a ReportSpec from RawOpts and a provided day, or return an error string if there are regular expression errors.   & Safe-Inferred'8;=  hledger-lib4A full name, display name, and depth for an account.  hledger-libDescription of one subreport within a compound balance report. Part of a CompoundBalanceCommandSpec, but also used in hledger-lib.  hledger-lib"The title to use for the subreport  hledger-lib"The Query to use for the subreport  hledger-libA function to transform the ReportOpts used to produce the subreport  hledger-lib3A function to transform the result of the subreport  hledger-libWhether the subreport and overall report total are of the same sign (e.g. Assets are normally positive in a balance sheet report, as is the overall total. Liabilities are normally of the opposite sign.)  hledger-libA compound balance report has:an overall title%the period (date span) of each columnone or more named, normal-positive multi balance reports, with columns corresponding to the above, and a flag indicating whether they increased or decreased the overall totalsa list of overall totals for each column, and their grand total and averageIt is used in compound balance report commands like balancesheet, cashflow and incomestatement.  hledger-libA periodic report is a generic tabular report, where each row corresponds to some label (usually an account name) and each column to a date period. The column periods are usually consecutive subperiods formed by splitting the overall report period by some report interval (daily, weekly, etc.). It has: *a list of each column's period (date span) a list of rows, each containing:an account labelthe account's depthA list of amounts, one for each column. Depending on the value type, these can represent balance changes, ending balances, budget performance, etc. (for example, see BalanceAccumulation and Hledger.Cli.Commands.Balance).the total of the row's amounts for a periodic report, or zero for cumulative/historical reports (since summing end balances generally doesn't make sense). the average of the row's amounts the column totals, and the overall grand total (or zero for cumulative/historical reports) and grand average.  hledger-libAdd two PeriodicReportRows#, preserving the name of the first. hledger-lib Version of  which will not end on the shortest list, but will copy the rest of the longer list.  hledger-lib4Figure out the overall date span of a PeriodicReport  hledger-lib"Map a function over the row names.  hledger-lib CSV FORMAT > Tips > Setting amounts. (Just "csv", "-"). hledger-libParse and post-process a Journal7 from hledger's journal file format, or give an error. hledger-lib,A journal parser. Accumulates and returns a  ParsedJournal2, which should be finalised/validated before use.*rejp (journalp <* eof) "2015/1/1\n a 0\n"?Right (Right Journal (unknown) with 1 transactions, 1 accounts) hledger-libA side-effecting parser; parses any kind of journal item and updates the parse state accordingly. hledger-libParse any journal directive and update the parse state accordingly. Cf  *http://hledger.org/hledger.html#directives, =http://ledger-cli.org/3.0/doc/ledger3.html#Command-Directives hledger-libParse an include directive. include's argument is an optionally file-format-prefixed file path or glob pattern. In the latter case, the prefix is applied to each matched path. Examples: foo.j, foobar.j, timedot:foo2020*.md hledger-libLift an IO action into the exception monad, rethrowing any IO error with the given message prepended. hledger-lib3Parse a one-line or multi-line commodity directive.4Right _ <- rjp commoditydirectivep "commodity $1.00"Right _ <- rjp commoditydirectivep "commodity $\n format $1.00"Right _ <- rjp commoditydirectivep "commodity $\n\n" -- a commodity with no formatRight _ <- rjp commoditydirectivep "commodity $1.00\n format $1.00" -- both, what happens ? hledger-lib%Parse a one-line commodity directive.;Right _ <- rjp commoditydirectiveonelinep "commodity $1.00"Right _ <- rjp commoditydirectiveonelinep "commodity $1.00 ; blah\n" hledger-libParse a multi-line commodity directive, containing 0 or more format subdirectives.Right _ <- rjp commoditydirectivemultilinep "commodity $ ; blah \n format $1.00 ; blah" hledger-libParse a format (sub)directive, throwing a parse error if its symbol does not match the one given. hledger-libBacktracking parser similar to string, but allows varying amount of space between words hledger-lib=Read a valid decimal mark from the decimal-mark directive e.gdecimal-mark , hledger-lib2Parse a transaction modifier (auto postings) rule. hledger-lib"Parse a periodic transaction rule.This reuses periodexprp which parses period expressions on the command line. This is awkward because periodexprp supports relative and partial dates, which we don't really need here, and it doesn't support the notion of a default year set by a Y directive, which we do need to consider here. We resolve it as follows: in periodic transactions' period expressions, if there is a default year Y in effect, partial/relative dates are calculated relative to Y191. If not, they are calculated related to today as usual. hledger-lib*Parse a (possibly unbalanced) transaction.      Safe-Inferred" hledger-libA file path optionally prefixed by a reader name and colon (journal:, csv:, timedot:, etc.). hledger-libRead the default journal file specified by the environment, or raise an error. hledger-libGet the default journal file path specified by the environment. Like ledger, we look first for the LEDGER_FILE environment variable, and if that does not exist, for the legacy LEDGER environment variable. If neither is set, or the value is blank, return the hard-coded default, which is .hledger.journal in the users's home directory (or in the current directory, if we cannot determine a home directory). hledger-lib readJournal iopts mfile txt:Read a Journal from some text, or return an error message.;The reader (data format) is chosen based on, in this order:a reader name provided in ioptsa reader prefix in the mfile patha file extension in mfileIf none of these is available, or if the reader name is unrecognised, we use the journal reader. (We used to try all readers in this case; since hledger 1.17, we prefer predictability.) hledger-libRead a Journal from this file, or from stdin if the file path is -, or return an error message. The file path can have a READER: prefix.The reader (data format) to use is determined from (in priority order): the mformat_ specified in the input options, if any; the file path's READER: prefix, if any; a recognised file name extension. if none of these identify a known reader, the journal reader is used.The input options can also configure balance assertion checking, automated posting generation, a rules file for converting CSV data, etc. hledger-libRead a Journal from each specified file path and combine them into one. Or, return the first error message.Combining Journals means concatenating them, basically. The parse state resets at the start of each file, which means that directives & aliases do not affect subsequent sibling or parent files. They do affect included child files though. Also the final parse state saved in the Journal does span all files. hledger-libAn easy version of ; which assumes default options, and fails in the IO monad. hledger-libAn easy version of ; which assumes default options, and fails in the IO monad. hledger-libAn easy version of ; which assumes default options, and fails in the IO monad. hledger-libExtract ExceptT to the IO monad, failing with an error message if necessary. hledger-libIf the specified journal file does not exist (and is not "-"), give a helpful error and quit. hledger-libEnsure there is a journal file at the given path, creating an empty one if needed. On Windows, also ensure that the path contains no trailing dots which could cause data loss (see ). hledger-libDoes any part of this path contain non-. characters and end with a . ? Such paths are not safe to use on Windows (cf #1056). hledger-lib5Give the content for a new auto-created journal file. hledger-libGet all instances of the latest date in an unsorted list of dates. Ie, if the latest date appears once, return it in a one-element list, if it appears three times (anywhere), return three of it. hledger-libRemember that these transaction dates were the latest seen when reading this journal file. hledger-libWhat were the latest transaction dates seen the last time this journal file was read ? If there were multiple transactions on the latest date, that number of dates is returned, otherwise just one. Or none if no transactions were read, or if latest dates info is not available for this file. hledger-libWhere to save latest transaction dates for the given file path. (.latest.FILE) hledger-libGiven zero or more latest dates (all the same, representing the latest previously seen transaction date, and how many transactions were seen on that date), remove transactions with earlier dates from the journal, and the same number of transactions on the latest date, if any, leaving only transactions that we can assume are newer. Also returns the new latest dates of the new journal. 4 Safe-Inferred"  ! "#$%&'()*+,-.6978:;<=FEDCBA@>?GLKJHIMNOPSQRTUVonmlkjihgfedcba`_^]\[ZYWXputsqrvzywx{~|} :;<=>?:;@:;ABCDEFGEFHEFIEFJEFKEFLEFMEFNEFNOPQRSTRSURSVRSWRSXRYZR[\R]^R]_R]`R]aR]bR]cR]dR]eRfgRfhRfiRfijklmnopqrstuvwxyz{|}~~?6667777777                                                                                                                                                                                                                                                                                                                                                                                        ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! " " " " " " " " " " " " " " " " " " " " " " " " " # # # # # # # # # # # # $ % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & ' ' ' ' ' ' ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ) ) ) ) * * * * * * * * * * * * + + + + + + , , , , , , , , , , , , , , - . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ..............................................//00111111111111112233333333333334555555556EE6OP6666666666EEE66E6:6E666    :BC::                          """%%%%%&:&&''''''((((((((((((**,,.............///////001111111111111111111111111111111111111111111111111233333333333333'hledger-lib-1.31-3w8fQDAYbFqDBykHhgbYOoHledger.Utils.DebugHledger.Data.TypesHledger.Utils.StringHledger.Utils.Parse Hledger.ReadHledger.Utils.TestHledger.Utils.RegexHledger.Data.PeriodHledger.Utils.TextText.Tabular.AsciiWideHledger.Utils.IO Hledger.UtilsHledger.Read.CsvUtilsHledger.Data.RawOptionsHledger.Data.DatesHledger.Data.AccountNameHledger.Data.StringFormatHledger.Data.AmountHledger.Data.ValuationHledger.Data.PostingHledger.Data.Transaction Hledger.Query Hledger.Data.TransactionModifierHledger.Data.TimeclockHledger.Data.Errors'Hledger.Data.JournalChecks.Ordereddates Hledger.Data.PeriodicTransactionHledger.Data.JsonHledger.Data.Journal*Hledger.Data.JournalChecks.UniqueleafnamesHledger.Data.JournalChecksHledger.Data.BalancingHledger.Read.InputOptionsHledger.Data.AccountHledger.Data.Ledger Hledger.DataHledger.Reports.ReportOptionsHledger.Reports.ReportTypesHledger.Reports.PostingsReport"Hledger.Reports.MultiBalanceReportHledger.Reports.EntriesReportHledger.Reports.BudgetReportHledger.Reports.BalanceReport)Hledger.Reports.AccountTransactionsReportHledger.ReportsHledger.Read.CommonHledger.Read.TimedotReaderHledger.Read.TimeclockReaderHledger.Read.RulesReaderHledger.Read.CsvReaderHledger.Read.JournalReaderHledgerPaths_hledger_libText.Megaparsec.CustomText.WideStringYYYY.MMDDbase Debug.Tracetrace time-1.11.1.1Data.Time.Calendar.TypesYear traceShowIdtraceIO(doclayout-0.4.0.1-Bxl43chHKvQGa4hLMUT4gFText.DocLayout charWidth&megaparsec-9.5.0-nV6NFlDOdsDHucVPlnquIText.Megaparsec.PossourcePosPretty initialPosunPosmkPos sourceColumn sourceLine sourceName SourcePostransformers-0.5.6.2Control.Monad.Trans.Except runExceptT"tasty-1.4.3-GkiQrrFhkPG1fHukwE7SQN Test.Tasty withResource askOption localOption adjustOptiondefaultIngredientsTest.Tasty.CmdLinedefaultMainWithIngredients'Test.Tasty.Ingredients.IncludingOptionsincludingOptionsTest.Tasty.Coreafterafter_ testGroupTestName AllFinish AllSucceedDependencyTypeTestTreeTest.Tasty.Options.Core mkTimeout NoTimeoutTimeout RegexError ReplacementRegexpreStringtoRegex toRegexCItoRegex' toRegexCI' regexMatchregexMatchText regexReplaceregexReplaceUnmemoregexReplaceAllBy$fRegexContextRegexp[][]$fRegexLikeRegexp[]$fToJSONRegexp $fReadRegexp $fShowRegexp $fOrdRegexp $fEqRegexpLedgerljournal laccounts NormalSignNormallyPositiveNormallyNegativeAccountanameadeclarationinfoasubsaparentaboring anumpostings aebalance aibalanceAccountDeclarationInfo adicommentaditagsadideclarationorder adisourceposTagDeclarationInfo tdicommentPayeeDeclarationInfo pdicommentpditags StorageFormat ParsedJournalJournaljparsedefaultyearjparsedefaultcommodityjparsedecimalmarkjparseparentaccounts jparsealiasesjparsetimeclockentriesjincludefilestackjdeclaredpayees jdeclaredtagsjdeclaredaccountsjdeclaredaccounttagsjdeclaredaccounttypes jaccounttypesjglobalcommoditystyles jcommoditiesjinferredcommoditiesjpricedirectivesjinferredmarketprices jtxnmodifiers jperiodictxnsjtxnsjfinalcommentlinesjfiles jlastreadtime MarketPricempdatempfrommptompratePriceDirectivepddate pdcommoditypdamountTimeclockEntry tlsourcepostlcode tldatetime tlaccount tldescription tlcommenttltags TimeclockCode SetBalanceSetRequiredHoursInOutFinalOutPeriodicTransaction ptperiodexpr ptintervalptspan ptsourceposptstatusptcode ptdescription ptcommentpttags ptpostings TMPostingRule tmprPostingtmprIsMultiplierTransactionModifier tmquerytxttmpostingrules Transactiontindextprecedingcomment tsourcepostdatetdate2tstatustcode tdescriptiontcommentttags tpostingsPostingpdatepdate2pstatuspaccountpamountpcommentptypeptagspbalanceassertion ptransaction poriginalBalanceAssertionbaamountbatotal bainclusive bapositionStatusUnmarkedPendingClearedDateTagTagTagValueTagName PostingTypeRegularPostingVirtualPostingBalancedVirtualPostingMixedAmountKeyMixedAmountKeyNoPriceMixedAmountKeyTotalPriceMixedAmountKeyUnitPrice MixedAmountMixed HasAmounts styleAmountsAmount acommodity aquantityastyleaprice CommoditycsymbolcformatCommoditySymbolDigitGroupStyle DigitGroupsAmountPrecision PrecisionNaturalPrecision AmountStyleascommoditysideascommodityspaced asdigitgroups asdecimalmark asprecision AmountPrice UnitPrice TotalPriceQuantity DecimalMarkSideLR AccountAlias BasicAlias RegexAlias AccountTypeAsset LiabilityEquityRevenueExpenseCash Conversion AccountNamePayeeInterval NoIntervalDaysWeeksMonthsQuartersYears DayOfMonthWeekdayOfMonth DaysOfWeek DayOfYearPeriod DayPeriod WeekPeriod MonthPeriod QuarterPeriod YearPeriod PeriodBetween PeriodFromPeriodTo PeriodAllDateSpanEFDayExactFlex WhichDate PrimaryDate SecondaryDate SmartIntervalDayWeekMonthQuarter SmartDateSmartCompleteDateSmartAssumeStartSmartFromReference SmartMonth SmartRelativeWeekDayMonthDayYearDay MonthWeekYearWeek fromEFDay modifyEFDayisBalanceSheetAccountTypeisIncomeStatementAccountTypeisAccountSubtypeOf isDecimalMark maComparenulltransactionmodifiernullperiodictransactionnullpayeedeclarationinfonulltagdeclarationinfonullaccountdeclarationinfo $fOrdEFDay$fDefaultDateSpan$fDefaultPeriod$fDefaultInterval$fShowAccountType$fToMarkupDecimalRaw$fShowAmountStyle$fHasAmountsMaybe$fHasAmounts(,)$fHasAmounts[]$fOrdMixedAmountKey$fOrdMixedAmount$fEqMixedAmount $fShowStatus $fShowPosting $fEqPosting$fGenericLedger$fShowNormalSign$fEqNormalSign$fGenericAccount $fEqJournal$fGenericJournal$fEqAccountDeclarationInfo$fShowAccountDeclarationInfo$fGenericAccountDeclarationInfo$fEqTagDeclarationInfo$fShowTagDeclarationInfo$fGenericTagDeclarationInfo$fEqPayeeDeclarationInfo$fShowPayeeDeclarationInfo$fGenericPayeeDeclarationInfo$fEqMarketPrice$fOrdMarketPrice$fGenericMarketPrice$fShowMarketPrice$fEqPriceDirective$fOrdPriceDirective$fGenericPriceDirective$fShowPriceDirective$fEqTimeclockEntry$fOrdTimeclockEntry$fGenericTimeclockEntry$fEqTimeclockCode$fOrdTimeclockCode$fGenericTimeclockCode$fEqPeriodicTransaction$fGenericPeriodicTransaction$fEqTransactionModifier$fGenericTransactionModifier$fShowTransactionModifier$fEqTMPostingRule$fGenericTMPostingRule$fShowTMPostingRule$fEqTransaction$fGenericTransaction$fShowTransaction$fGenericPosting$fEqBalanceAssertion$fGenericBalanceAssertion$fShowBalanceAssertion $fEqStatus $fOrdStatus$fBoundedStatus $fEnumStatus$fGenericStatus$fEqPostingType$fShowPostingType$fGenericPostingType$fGenericMixedAmount$fShowMixedAmount$fEqMixedAmountKey$fGenericMixedAmountKey$fShowMixedAmountKey $fEqAmount $fOrdAmount$fGenericAmount $fShowAmount$fEqAmountPrice$fOrdAmountPrice$fGenericAmountPrice$fShowAmountPrice$fShowCommodity $fEqCommodity$fGenericCommodity$fEqAmountStyle$fOrdAmountStyle$fReadAmountStyle$fGenericAmountStyle$fEqDigitGroupStyle$fOrdDigitGroupStyle$fReadDigitGroupStyle$fShowDigitGroupStyle$fGenericDigitGroupStyle$fEqAmountPrecision$fOrdAmountPrecision$fReadAmountPrecision$fShowAmountPrecision$fGenericAmountPrecision$fEqSide $fShowSide $fReadSide $fOrdSide $fGenericSide$fEqAccountAlias$fReadAccountAlias$fShowAccountAlias$fOrdAccountAlias$fGenericAccountAlias$fEqAccountType$fOrdAccountType$fGenericAccountType $fEqInterval$fShowInterval $fOrdInterval$fGenericInterval $fEqPeriod $fOrdPeriod $fShowPeriod$fGenericPeriod $fEqDateSpan $fOrdDateSpan$fGenericDateSpan $fEqEFDay$fGenericEFDay $fShowEFDay $fEqWhichDate$fShowWhichDate$fShowSmartDate$fShowSmartInterval$fGenericDecimalRawperiodAsDateSpandateSpanAsPeriodsimplifyPeriodisLastDayOfMonthisStandardPeriodperiodTextWidth showPeriodshowPeriodMonthAbbrev periodStart periodEnd periodNextperiodPrevious periodNextInperiodPreviousIn periodMoveTo periodGrow periodShrink mondayBeforeyearMonthContainingWeekStartingquarterContainingMonthfirstMonthOfQuarterstartOfFirstWeekInMonthHledgerParseErrorsHledgerParseErrorDatacustomErrorBundlePretty WideBuilder wbBuilderwbWidthwbToText wbFromTextwbUnpackAlignTopRight BottomRight BottomLeftTopLeftCell TableOpts prettyTable tableBorders borderSpaces emptyCelltextCell textsCell cellWidthrender renderTable renderTableBrenderTableByRowsB renderRow renderRowB renderColumns concatTables$fDefaultTableOpts $fShowAlign$fShowTableOptstextElideRightwrap textChomp formatText quoteIfSpacedtextQuoteIfNeededescapeDoubleQuotes stripquotes textUnbrackettextConcatTopPaddedtextConcatBottomPaddedfitText textTakeWidth linesPrepend linesPrepend2unlinesB readDecimal tests_Textpshowpshow'pprintpprint'pagergetTerminalHeightWidthgetTerminalHeightgetTerminalWidth setupPagerprogArgsoutputFileOption hasOutputFilebold'faint'black'red'green'yellow'blue'magenta'cyan'white' brightBlack' brightRed' brightGreen' brightYellow' brightBlue'brightMagenta' brightCyan' brightWhite'rgb' colorOptionuseColorOnStdoutuseColorOnStderrcolorbgColorcolorBbgColorBterminalIsLightterminalLightnessterminalBgColorterminalFgColorerror' usageErrorexpandHomePath expandPath expandGlob sortByModTimereadFilePortablyreadFileOrStdinPortablyreadHandlePortablyembedFileRelativegetCurrentLocalTimegetCurrentZonedTime assertLeft assertRight assertParse assertParseEqassertParseEqOnassertParseErrorassertParseStateOn assertParseEassertParseEqEassertParseErrorE debugLevel traceWithptracetraceAt traceAtWithptraceAt ptraceAtIOtraceLog traceLogAt traceLogIO traceLogAtIO traceLogWithtraceLogAtWith ptraceLogAt ptraceLogAtIO traceOrLog traceOrLogAt ptraceOrLogAtptraceOrLogAtIOtraceOrLogAtWithdbg0dbg1dbg2dbg3dbg4dbg5dbg6dbg7dbg8dbg9dbgExitdbg0IOdbg1IOdbg2IOdbg3IOdbg4IOdbg5IOdbg6IOdbg7IOdbg8IOdbg9IOdbg0Withdbg1Withdbg2Withdbg3Withdbg4Withdbg5Withdbg6Withdbg7Withdbg8Withdbg9With TextParserSimpleTextParserSimpleStringParsertraceOrLogParsedbgparsesourcePosPairPrettychoice' choiceInState surroundedBy parsewith runTextParserrtpparsewithStringparseWithStateparseWithState' fromparse parseerrorshowDateParseError isNewlinenonspaceisNonNewlineSpacespacenonewline restoflineskipNonNewlineSpacesskipNonNewlineSpaces1skipNonNewlineSpaces'eoloftakeEnd lowercase uppercasestriplstriprstrip strip1CharstripBystrip1Bychompchomp1 singleline stripbrackets elideLeft elideRight formatString underline quoteIfNeededsingleQuoteIfNeededquoteForCommandLinewords'unwords' takeWidth strWidthAnsistrWidth stripAnsiapplyNmapM' sequence'curry2uncurry2curry3uncurry3curry4uncurry4maximum' maximumStrict minimumStrictsplitAtElement sumStrict treeLeavesfirst3second3third3first4second4third4fourth4first5second5third5fourth5fifth5first6second6third6fourth6fifth6sixth6multicol numDigitsIntmakeHledgerClassyLenses tests_UtilsCsvValue CsvRecordCSVprintCSVtests_CsvUtilsRawOpts overRawOptssetopt setboolopt unsetboolopt appendoptsboolopt toggleopt choiceopt collectoptsmaybestringopt stringopt maybecharoptlistofstringopt maybeintoptmaybeposintoptintopt posintopt$fDefaultRawOpts $fShowRawOptsshowDate showEFDate showDateSpanshowDateSpanDebugshowDateSpanMonthAbbrev getCurrentDaygetCurrentMonthgetCurrentYearelapsedSeconds spanStartspanEnd spanStartYear spanEndYear spanYears spansSpan splitSpanspansFromBoundaries daysInSpanspanContainsDateperiodContainsDategroupByDateSpanspansIntersect spanIntersectspanDefaultsFrom spansUnion spanUniondaysSpanlatestSpanContainingparsePeriodExprparsePeriodExpr'fixSmartDateStrfixSmartDateStrEitherfixSmartDateStrEither' fixSmartDateprevdayintervalBoundaryBefore parsedateM smartdate datesepchars datesepchar isDateSepCharyearp periodexprp nulldatespan emptydatespannulldate tests_Dates$fShowDateSpan acctsepcharacctsepaccountNameComponentsaccountNameFromComponentsaccountLeafNameaccountSummarisedNameassetAccountRegexcashAccountRegexliabilityAccountRegexequityAccountRegexconversionAccountRegexrevenueAccountRegexexpenseAccountRegexaccountNameInferTypeaccountNameTypeaccountNameLevelunbudgetedAccountNameaccountNamePostingTypeaccountNameWithoutPostingTypeaccountNameWithPostingTypejoinAccountNamesconcatAccountNamesaccountNameApplyAliasesaccountNameApplyAliasesMemoaccountNameDropexpandAccountNamesexpandAccountNametopAccountNamesparentAccountNameparentAccountNamesisAccountNamePrefixOfisSubAccountNameOfsubAccountNamesFromaccountNameTreeFromelideAccountNameclipAccountNameclipOrEllipsifyAccountName escapeNameaccountNameToAccountRegexaccountNameToAccountRegexCIaccountNameToAccountOnlyRegexaccountNameToAccountOnlyRegexCItests_AccountNameReportItemField AccountFieldDefaultDateFieldDescriptionField TotalFieldDepthSpacerFieldFieldNoStringFormatComponent FormatLiteral FormatField StringFormatOneLine TopAligned BottomAligneddefaultBalanceLineFormatparseStringFormatdefaultStringFormatStyletests_StringFormat$fDefaultStringFormat$fShowStringFormat$fEqStringFormat$fShowStringFormatComponent$fEqStringFormatComponent$fShowReportItemField$fEqReportItemFieldAmountDisplayOpts displayPricedisplayZeroCommoditydisplayThousandsSep displayColourdisplayOneLinedisplayMinWidthdisplayMaxWidth displayOrdershowCommoditySymbolisNonsimpleCommodityCharquoteCommoditySymbolIfNeedednoColournoPriceoneLine csvDisplay amountstylenullamt missingamtnumhrsusdeurgbpperat@@amountWithCommodity amountCost divideAmountmultiplyAmountisNegativeAmountamountLooksZero amountIsZero withPrecisionamountSetPrecisionamountSetFullPrecisionsetAmountInternalPrecisionwithInternalPrecisionsetAmountDecimalPointwithDecimalPointamountStripPricesshowAmountPricecanonicaliseAmount styleAmountamountSetStylesamountSetStylesExceptPrecisionamountStyleUnsetPrecisionamountSetMainStyleamountSetCostStyleamountUnstyled showAmount showAmountB cshowAmountshowAmountWithoutPriceshowAmountWithZeroCommodityshowAmountDebug nullmixedamtmissingmixedamtisMissingMixedAmountmixed mixedAmount maAddAmount maAddAmountsmaNegatemaPlusmaMinusmaSumdivideMixedAmountmultiplyMixedAmountaverageMixedAmountsisNegativeMixedAmountmixedAmountLooksZeromixedAmountIsZeromaIsZero maIsNonZeroamountsamountsPreservingZeros amountsRaw maCommoditiesunifyMixedAmountfilterMixedAmountfilterMixedAmountByCommoditymapMixedAmountmixedAmountCostcanonicaliseMixedAmountstyleMixedAmountmixedAmountSetStyles#mixedAmountSetStylesExceptPrecisionmixedAmountUnstyledshowMixedAmountshowMixedAmountOneLine showMixedAmountWithZeroCommodityshowMixedAmountWithoutPrice"showMixedAmountOneLineWithoutPriceshowMixedAmountElidedshowMixedAmountDebugshowMixedAmountBshowMixedAmountLinesBmixedAmountSetPrecisionmixedAmountSetFullPrecisionmixedAmountStripPrices tests_Amount$fNumMixedAmount$fMonoidMixedAmount$fSemigroupMixedAmount$fHasAmountsMixedAmount $fNumAmount$fHasAmountsAmount$fDefaultAmountDisplayOpts$fShowAmountDisplay$fShowAmountDisplayOpts PriceOracle ValuationTypeAtThenAtEndAtNowAtDate ConversionOpNoConversionOpToCostjournalPriceOraclepriceDirectiveToMarketPriceamountPriceDirectiveFromCostmixedAmountToCostmixedAmountApplyValuationmixedAmountValueAtDatemixedAmountApplyGainmixedAmountGainAtDatemarketPriceReversetests_Valuation$fShowPriceGraph$fGenericPriceGraph$fShowValuationType$fEqValuationType$fShowConversionOp$fEqConversionOp nullpostingpostingpostvpostpost'vpost' nullsourcepos nullassertion balassert balassertTotbalassertParIncbalassertTotIncshowBalanceAssertionoriginalPosting showPostingshowPostingLinespostingsAsLinespostingAsLinesshowAccountNamerenderCommentLinesisReal isVirtualisBalancedVirtual hasAmounthasBalanceAssignmentaccountNamesFromPostings sumPostingspostingStripPrices postingDate postingDate2postingDateOrDate2 postingStatuspostingAllTagstransactionAllTagsrelatedPostingsisPostingInDateSpanisPostingInDateSpan'isEmptyPostingpostingApplyAliasespostingApplyCommodityStyles*postingApplyCommodityStylesExceptPrecisionpostingAddTagspostingApplyValuation postingToCost postingAddInferredEquityPostingspostingPriceDirectivesFromCostpostingTransformAmount commentJoin commentAddTagcommentAddTagNextLine tests_Posting$fHasAmountsPosting$fHasAmountsBalanceAssertionnulltransaction transactiontransactionPayeetransactionNoteshowTransactionshowTransactionOneLineAmountsshowTransactionLineFirstParthasRealPostings realPostingsassignmentPostingsvirtualPostingsbalancedVirtualPostingstransactionsPostingstransactionDate2transactionDateOrDate2 txnTieKnot txnUntieKnottransactionTransformPostingstransactionApplyValuationtransactionToCost$transactionAddInferredEquityPostingstransactionInferCostsFromEquity#partitionAndCheckConversionPostingstransactionApplyAliasestransactionMapPostingstransactionMapPostingAmountstransactionFileannotateErrorWithTransactiontests_Transaction$fHasAmountsTransactionQueryOptQueryOptInAcctOnlyQueryOptInAcctOrdPlusLtLtEqGtGtEqEqAbsLtAbsLtEqAbsGtAbsGtEqAbsEqQueryNotAndOrAnyNoneDateDate2StatusQCodeDescAcctTypeDepthRealAmtSympayeeTagnoteTaggeneratedTransactionTag parseQueryparseQueryListwords'' queryprefixesparseQueryTermparseAccountType simplifyQuery filterQueryfilterQueryOrNotQuery matchesQuery queryIsNull queryIsDate queryIsDate2queryIsDateOrDate2 queryIsStatus queryIsCode queryIsDesc queryIsTag queryIsAcct queryIsType queryIsDepth queryIsReal queryIsAmt queryIsSymqueryIsStartDateOnlyqueryIsTransactionRelatedqueryStartDate queryEndDate queryDateSpanqueryDateSpan' queryDepth inAccountinAccountQuerymatchesCommodity matchesAmountmatchesMixedAmountmatchesAccountmatchesAccountExtramatchesPostingmatchesPostingExtramatchesTransactionmatchesTransactionExtramatchesDescriptionmatchesPayeeWIP matchesTagsmatchesPriceDirective tests_Query$fDefaultQuery$fShowQueryOpt $fEqQueryOpt $fEqQuery $fShowQuery $fShowOrdPlus $fEqOrdPlusmodifyTransactionstimeclockEntriesToTransactionstests_Timeclock$fReadTimeclockCode$fShowTimeclockCode$fShowTimeclockEntrymakeAccountTagErrorExcerptmakeTransactionErrorExcerptmakePostingErrorExcerpttransactionFindPostingIndexmakePostingAccountErrorExcerpt makeBalanceAssertionErrorExcerptjournalCheckOrdereddatesrunPeriodicTransaction!checkPeriodicTransactionStartDate$fShowPeriodicTransaction toJsonText writeJsonFile readJsonFile$fFromJSONDecimalRaw$fFromJSONAccount $fFromJSONAccountDeclarationInfo$fFromJSONTransaction$fFromJSONPosting$fFromJSONPostingType$fFromJSONMarketPrice$fFromJSONAmountPrice$fFromJSONBalanceAssertion$fFromJSONMixedAmount$fFromJSONDigitGroupStyle$fFromJSONSide$fFromJSONAmountPrecision$fFromJSONAmountStyle$fFromJSONAmount $fFromJSONPos$fFromJSONSourcePos$fFromJSONStatus$fToJSONLedger$fToJSONAccount$fToJSONJournal$fToJSONTimeclockEntry$fToJSONTimeclockCode$fToJSONCommodity$fToJSONTagDeclarationInfo$fToJSONPayeeDeclarationInfo$fToJSONAccountDeclarationInfo$fToJSONKeyAccountType$fToJSONAccountType$fToJSONAccountAlias$fToJSONPeriod$fToJSONInterval$fToJSONDateSpan $fToJSONEFDay$fToJSONPriceDirective$fToJSONPeriodicTransaction$fToJSONTMPostingRule$fToJSONTransactionModifier$fToJSONTransaction$fToJSONPosting$fToJSONPostingType$fToJSONMarketPrice$fToJSONAmountPrice$fToJSONBalanceAssertion$fToJSONMixedAmount$fToJSONDigitGroupStyle $fToJSONSide$fToJSONAmountPrecision$fToJSONAmountStyle$fToJSONAmount$fToJSONDecimalRaw $fToJSONPos$fToJSONSourcePos$fToJSONStatusErroringJournalParser JournalParser journalConcat"journalRenumberAccountDeclarationsdbgJournalAcctDeclOrder nulljournaljournalFilePathjournalFilePathsaddTransactionaddTransactionModifieraddPeriodicTransactionaddPriceDirectivejournalTransactionAtjournalNextTransactionjournalPrevTransactionjournalPostingsjournalCommoditiesDeclaredjournalCommoditiesjournalDescriptionsjournalPayeesDeclaredjournalPayeesUsedjournalPayeesDeclaredOrUsedjournalTagsDeclaredjournalTagsUsedjournalTagsDeclaredOrUsedjournalAccountNamesUsedjournalAccountNamesImpliedjournalAccountNamesDeclaredjournalLeafAccountNamesDeclared!journalAccountNamesDeclaredOrUsed$journalAccountNamesDeclaredOrImpliedjournalAccountNamesjournalLeafAccountNamesjournalAccountNameTreejournalAccountTagsjournalInheritedAccountTagsjournalTransactionsSimilarTojournalConversionAccountjournalAccountTypejournalAddAccountTypesjournalAccountTypesjournalPostingsAddAccountTagsfilterJournalTransactionsfilterJournalPostingsfilterJournalRelatedPostingsfilterJournalAmountsfilterTransactionAmountsfilterPostingAmountfilterTransactionPostingsfilterTransactionPostingsExtra filterTransactionRelatedPostingsjournalMapTransactionsjournalMapPostingsjournalMapPostingAmountsjournalReversejournalSetLastReadTimejournalNumberAndTieTransactionsjournalNumberTransactionsjournalUntieTransactionsjournalModifyTransactionsjournalApplyCommodityStylesjournalCommodityStylescommodityStylesFromAmountscanonicalStyleFrom(journalInferMarketPricesFromTransactions journalToCostjournalInferEquityFromCostsjournalInferCostsFromEquityjournalMarkRedundantCostsjournalDateSpanjournalDateSpanBothDatesjournalStartDatejournalEndDatejournalLastDay journalPivotjournalApplyAliases samplejournalsamplejournalMaybeExplicit tests_Journal$fDefaultJournal$fSemigroupJournal $fShowJournaljournalCheckUniqueleafnamesjournalCheckAccountsjournalCheckCommoditiesjournalCheckPayeesjournalCheckTags$journalCheckPairedConversionPostingsjournalCheckRecentAssertions BalancingOptsignore_assertions_infer_balancing_costs_commodity_styles_defbalancingoptsisTransactionBalancedbalanceTransactionbalanceTransactionHelperjournalCheckBalanceAssertionsjournalBalanceTransactions$fShowBalancingOptsHasBalancingOpts balancingOptscommodity_stylesignore_assertionsinfer_balancing_coststests_Balancing$fHasBalancingOptsBalancingOpts InputOptsmformat_ mrules_file_aliases_anon_new_ new_save_pivot_ forecast_ verbose_tags_ reportspan_auto_ infer_equity_ infer_costs_balancingopts_strict__ioDay definputoptsforecastPeriod$fShowInputOpts HasInputOpts inputOptsaliasesanon__auto__ balancingoptsforecast infer_costs infer_equityioDaymformat mrules_filenew__new_savepivot reportspanstrict verbose_tags$fHasBalancingOptsInputOpts$fHasInputOptsInputOptsnullacctaccountsFromPostings accountTreeparentAccountsaccountsLevels mapAccounts anyAccounts sumAccounts clipAccountsclipAccountsAndAggregate pruneAccountsflattenAccountsfilterAccountssortAccountTreeByAmountaccountSetDeclarationInfosortAccountNamesByDeclaration lookupAccount printAccounts showAccountsshowAccountsBoringFlag $fEqAccount $fShowAccount$fShowFastTree $fEqFastTree $fOrdFastTree nullledgerledgerFromJournalledgerAccountNames ledgerAccountledgerRootAccountledgerTopAccountsledgerLeafAccountsledgerPostingsledgerDateSpanledgerCommodities tests_Ledger $fShowLedger tests_Data ReportSpec _rsReportOpts_rsDay_rsQuery _rsQueryOpts ReportOptsperiod_ interval_ statuses_ conversionop_value_ infer_prices_depth_date2_empty_ no_elide_real_format_pretty_ querystring_average_related_ txn_dates_ balancecalc_ balanceaccum_ budgetpat_accountlistmode_drop_ declared_ row_total_ no_total_ show_costs_ sort_amount_percent_invert_normalbalance_color_ transpose_layout_Layout LayoutWide LayoutTall LayoutBare LayoutTidyAccountListModeALFlatALTreeBalanceAccumulation PerPeriod Cumulative HistoricalBalanceCalculation CalcChange CalcBudgetCalcValueChangeCalcGainCalcPostingsCount defreportoptsrawOptsToReportOpts defreportspecsetDefaultConversionOpbalanceAccumulationOverrideintervalFromRawOptssimplifyStatusesreportOptsToggleStatustransactionDateFn postingDateFn whichDatetree_flat_journalValueAndFilterPostings!journalValueAndFilterPostingsWithjournalApplyValuationFromOpts!journalApplyValuationFromOptsWith-mixedAmountApplyValuationAfterSumFromOptsWithvaluationAfterSumqueryFromFlags reportSpanreportSpanBothDatesreportStartDate reportEndDatereportPeriodStartreportPeriodOrJournalStartreportPeriodLastDayreportPeriodOrJournalLastDayreportPeriodName overEither setEither$fDefaultBalanceCalculation$fDefaultBalanceAccumulation$fDefaultAccountListMode$fDefaultReportOpts$fDefaultReportSpec$fReportableEithere$fReportableMaybee$fReportableIdentitye$fReportableConste$fShowReportSpec$fShowReportOpts $fEqLayout $fShowLayout$fEqAccountListMode$fShowAccountListMode$fEqBalanceAccumulation$fShowBalanceAccumulation$fEqBalanceCalculation$fShowBalanceCalculationHasReportOptsNoUpdatereportOptsNoUpdateaccountlistmodeaverage balanceaccum balancecalc budgetpatcolor__ conversionop date2NoUpdatedeclared depthNoUpdatedrop__empty__format infer_pricesintervalinvertlayoutno_elideno_total normalbalancepercentperiodNoUpdateprettyquerystringNoUpdate realNoUpdaterelated row_total show_costs sort_amountstatusesNoUpdate transpose__ txn_datesvalue!$fHasReportOptsNoUpdateReportOpts HasReportOpts reportOptsperiodstatusesdepthdate2real querystring HasReportSpec reportSpecrsDayrsQuery rsQueryOpts rsReportOptsreportOptsToSpecupdateReportSpecupdateReportSpecWithrawOptsToReportSpec!$fHasReportOptsNoUpdateReportSpec$fHasReportSpecReportSpec$fHasReportOptsReportSpec$fHasReportOptsReportOpts DisplayName displayFull displayName displayDepthCBCSubreportSpeccbcsubreporttitlecbcsubreportquerycbcsubreportoptionscbcsubreporttransformcbcsubreportincreasestotalCompoundPeriodicReportcbrTitlecbrDates cbrSubreports cbrTotalsPeriodicReportRowprrName prrAmountsprrTotal prrAveragePeriodicReportprDatesprRowsprTotalsAverageTotalBalanceChange PercentageprrAddperiodicReportSpan prMapNameprMapMaybeNameflatDisplayNametreeDisplayName prrFullNameprrDisplayNameprrDepth$fHasAmountsPeriodicReportRow$fSemigroupPeriodicReportRow$fBifunctorPeriodicReportRow$fHasAmounts(,,)$fHasAmountsPeriodicReport$fBifunctorPeriodicReport"$fHasAmountsCompoundPeriodicReport$fToJSONDisplayName$fShowDisplayName$fEqDisplayName$fOrdDisplayName$fShowCompoundPeriodicReport$fFunctorCompoundPeriodicReport$fGenericCompoundPeriodicReport$fToJSONCompoundPeriodicReport$fShowPeriodicReport$fFunctorPeriodicReport$fGenericPeriodicReport$fToJSONPeriodicReport$fShowPeriodicReportRow$fFunctorPeriodicReportRow$fGenericPeriodicReportRow$fToJSONPeriodicReportRowPostingsReportItemPostingsReportpostingsReportmkpostingsReportItemtests_PostingsReport$fHasAmounts(,,,,)MultiBalanceReportRowMultiBalanceReportmultiBalanceReportmultiBalanceReportWithcompoundBalanceReportcompoundBalanceReportWithstartingPostingsmakeReportQuerygetPostingsByColumn getPostingsgenerateMultiBalanceReportsortRows sortRowsLikebalanceReportTableAsTexttests_MultiBalanceReportEntriesReportItem EntriesReport entriesReporttests_EntriesReport BudgetReportBudgetReportRow BudgetCell BudgetAverage BudgetTotal BudgetGoal budgetReportcombineBudgetAndActualbudgetReportAsTextbudgetReportAsTablebudgetReportAsCsvtests_BudgetReportBalanceReportItem BalanceReportflatShowsExclusiveBalance balanceReporttests_BalanceReport$fHasAmounts(,,,)AccountTransactionsReportItemAccountTransactionsReporttriOrigTransactiontriDate triAmount triBalancetriCommodityAmounttriCommodityBalanceaccountTransactionsReportaccountTransactionsReportItemstransactionRegisterDate$accountTransactionsReportByCommoditytests_AccountTransactionsReport$fHasAmounts(,,,,,) tests_ReportsReaderrFormat rExtensionsrReadFnrParserrawOptsToInputOptsparseAndFinaliseJournalinitialiseAndParseJournaljournalFinalisejournalAddAutoPostingsjournalAddForecastsetYeargetYearsetDefaultCommodityAndStylegetDefaultCommodityAndStylegetDefaultAmountStylegetAmountStyleaddDeclaredAccountTagsaddDeclaredAccountTypepushParentAccountpopParentAccountgetParentAccountaddAccountAliasgetAccountAliasesclearAccountAliasesjournalAddFilestatuspcodep descriptionpdatep datetimepsecondarydatepmodifiedaccountnamep accountnamepnoncommenttextpnoncommenttext1psinglespacedtext1psinglespacednoncommenttext1psinglespacedtextsatisfying1p singlespacepspaceandamountormissingpamountpamountp' parseamount parseamount'parsemixedamountparsemixedamount'commoditysymbolpcostpbalanceassertionplotcostpnumberp fromRawNumber rawnumberpmultilinecommentpemptyorcommentlinepisLineCommentStartisSameLineCommentStartfollowingcommentptransactioncommentppostingcommentpbracketeddatetagspaliasesFromOpts accountaliasp tests_Common $fShowReader$fMonoidDigitGrp$fSemigroupDigitGrp$fShowDigitGrp$fShowRawNumber $fEqRawNumber$fShowAmbiguousNumber$fEqAmbiguousNumber $fEqDigitGrpreader timedotfileptimeclockfilep dataFileFor rulesFileForreadJournalFromCsvtests_RulesReader$fShowErrorComponent[]$fShowCsvRules' $fEqCsvRules'$fShowConditionalBlock$fEqConditionalBlock $fShowMatcher $fEqMatcher$fShowMatcherPrefix$fEqMatcherPrefixtests_CsvReaderrunJournalParserrjprunErroringJournalParserrejp findReadersplitReaderPrefixjournalp directivepdefaultyeardirectivepmarketpricedirectiveptmpostingruleptests_JournalReaderPrefixedFilePathdefaultJournaldefaultJournalPath readJournalreadJournalFilereadJournalFiles readJournal'readJournalFile'readJournalFiles' orDieTryingrequireJournalFileExistsensureJournalFileExists tests_Read tests_Hledger mkRegexErr*regex-base-0.94.0.2-FWjlLj8yoeA2Uo08cxwNcPText.Regex.Base.RegexLike matchTestversiongetDataFileName getBinDir getLibDir getDynLibDir getDataDir getLibexecDir getSysconfDirFinalParseErrorBundle'Text.Megaparsec.Error ParseErrorParseErrorBundleFinalParseError'ExceptTFinalParseErrorBundleFinalParseError SourceExcerpt text-1.2.5.0Data.Text.InternalText ErrorFailAtErrorReparsing parseErrorAtparseErrorAtRegiongetExcerptTextexcerpt_reparseExcerpterrorBundlePrettyText.Megaparsec.StatePosStateText.Megaparsec runParserT finalErrorfinalFancyFailure fancyFailure finalFailControl.Monad.FailfailfinalCustomFailure customFailurefinalErrorBundlePretty attachSourceparseIncludeFile&tabular-0.2.2.8-J3KKeu2hpWEHJRfazs60S6 Text.Tabularrow renderHLine+====++----++.+^||^^|^^..^belowbesiderowHcolHcolemptysquish flattenHeader zipHeaderheaderContents Properties DoubleLineNoLine SingleLineHeaderGroupTable SemiTable prettyoptsprettyoptsNoColor terminalColor parseHelperassertParseHelper+tasty-hunit-0.10.0.3-AnvLUalYJJR58xAawxY5rATest.Tasty.HUnit.Orig Assertion parseHelperEGHC.Stack.Types HasCallStackTest.Tasty.HUnit testCaseInfotestCaseTest.Tasty.HUnit.Steps testCaseSteps assertString@?@?=@=? assertEqual assertBool assertFailureAssertionPredicableassertionPredicate HUnitFailure AssertableassertAssertionPredicatemodifiedProgNameprogName shouldLog debugLogFile singleQuotequoteShellChars realLengthghc-prim GHC.TypesIntmaybeclippedintopt GHC.MaybeJustdateSpanSplitLimits isEmptySpanspanFromSmartDatenthdayofyearcontainingnthdayofmonthcontainingnthdayofweekcontainingnthweekdayofmonthcontainingadvancetonthweekday smartdateonlydoubledatespanpquarterdatespanp adBuilderadTotalsimilarAmountsOptransformAmountamountRoundedQuantitytestAmountAndTotalPriceshowamountquantityapplyDigitGroupStyle amountKeytransformMixedAmount sumSimilarAmountsUsingFirstPricemapMixedAmountUnsafeshowMixedAmountOneLineBpgDatepgEdges pgEdgesRevpgDefaultValuationCommodities amountToCostamountApplyValuationamountValueAtDate priceLookuppricesShortestPathmakePriceGrapheffectiveMarketPrices System.IOprint lineIndent commentSpacepayeeAndNoteFromDescriptionshowTransactionHelperpostingSetTransactionpostingSingleAmountparseBooleanQueryparseAmountQueryTermparseTypeCodes parseStatus parseBool filterQuery'earliestMaybeDatelatestMaybeDateearliestMaybeDate'latestMaybeDate' compareAmounttransactionModifierToFunctiontmPostingRuleToFunctionentryFromTimeclockInOutdecorateTagErrorExcerptdecorateTransactionErrorExcerptdecoratePostingErrorExcerptjsonConfcompareDescriptionscompareStringsjournalDeclaredAccountTypesjournalTieTransactionsjournalInferCommodityStylescanonicalStylejournalStyleInfluencingAmountsjournalDateSpanHelpertransactionPivot postingPivotmaxlagfindRecentAssertionErrorBalancingStatebsStylesbsUnassignablebsAssrt bsBalancesbsTransactions BalancingtransactionCheckBalancedtransactionBalanceErrortransactionInferBalancingAmounttransactionInferBalancingCostscostInferrerForwithRunningBalancegetRunningBalanceBaddToRunningBalanceBsetRunningBalanceBsetInclusiveRunningBalanceBupdateTransactionB%balanceTransactionAndCheckAssertionsB#addOrAssignAmountAndCheckAssertionBaddAmountAndCheckAssertionBcheckBalanceAssertionB"checkBalanceAssertionOneCommodityBcheckIllegalBalanceAssignmentB"checkBalanceAssignmentPostingDateB*checkBalanceAssignmentUnassignableAccountBFastTreetieAccountParentssortAccountTreeByDeclarationextractIntervalOrNothingstatusesFromRawOptsvaluationTypeFromRawOptsconversionOpFromRawOptsreportSpanHelper zipWithPaddedGHC.ListzipWith prrMapNameprrMapMaybeNameSummaryPostingregisterRunningCalculationFnmatchedPostingsBeforeAndDuringpostingsReportItemssummarisePostingsByIntervalsummarisePostingsInDateSpanstartingBalances acctChangescalculateReportMatrixbuildReportRowsdisplayedAccountscalculateTotalsRow reportPercent transposeMapsubaccountTallies perdivide periodChanges cumulativeSum journalAddBudgetGoalTransactionsjournalWithBudgetAccountNamessummarisePostingAccounts*filterAccountTransactionsReportByCommodityDigitGrpdigitGroupLengthdigitGroupNumberAmbiguousNumber RawNumber NoSeparatorsWithSeparatorsforecastPeriodFromRawOptscommodityStyleFromRawOptsgetDecimalMarkStyle yearorintpsignpvaluationexprpparsedayp commentlinesp timedotentrypnumericquantityp dotquantityptimeclockentrypConditionalBlockMatcher RecordMatcher FieldMatcher MatcherPrefix DateFormat FieldTemplateHledgerFieldNameCsvFieldReference CsvFieldIndex CsvFieldName DirectiveNameCsvRulesCsvRulesParsed CsvRules' rdirectivesrcsvfieldindexes rassignmentsrconditionalblocksrblocksassigning readRulesFileexpandIncludesparseAndValidateCsvRules parseCsvRulesvalidateCsvRulesmkrules fieldmatcherpcsvRule hledgerFieldhledgerFieldValuegetEffectiveAssignmentrenderTemplatereplaceCsvFieldReference csvFieldValueparseSeparatorapplyConditionalSkips validateCsv#parseDateWithCustomOrDefaultFormats getAmount getBalance parseAmount showRules showRecordparseBalanceAmountmkBalanceAssertion getAccountunknownExpenseAccount simplifySignaddJournalItemPincludedirectiveporRethrowIOErrorcommoditydirectivepcommoditydirectiveonelinepcommoditydirectivemultilinepformatdirectivep keywordspdecimalmarkdirectiveptransactionmodifierpperiodictransactionp transactionpisWindowsUnsafeDotPathnewJournalContent latestDatessaveLatestDatespreviousLatestDateslatestDatesFileForjournalFilterSinceLatestDates