Stephen Morgan
5d664fc528
lib: Expose textConcatBottomPadded.
2021-01-15 12:56:48 -08:00
Stephen Morgan
217bfc5e74
lib: Rename alignCell to textCell, minor cleanups.
2021-01-15 12:56:48 -08:00
Stephen Morgan
9ad0eef69b
lib: Update textConcatTopPadded to use Tabular.AsciiWide, same as concatTopPadded.
2021-01-15 12:56:48 -08:00
Stephen Morgan
2c2bd8b27e
lib: Refactor unlinesB to be cleaner and more efficient.
2021-01-15 12:56:48 -08:00
Stephen Morgan
b203822cd1
lib: Make sure to add a newline to the end of aregister report.
2021-01-10 20:50:46 -08:00
Simon Michael
1ad919bc6d
lib: add level argument to fix traceAtWith
2021-01-07 08:57:25 -08:00
Stephen Morgan
e63138ef7d
lib,cli: Assorted fixes for older GHC.
2021-01-02 15:08:09 +11:00
Stephen Morgan
e4e533eb9f
lib,cli,ui: Replace some uses of String with Text, get rid of some unpacks, clean up showMixed options.
2021-01-02 15:08:09 +11:00
Stephen Morgan
07a7c3d3a8
lib: Use Text and Text builder only in postingAsLines.
2021-01-02 15:08:09 +11:00
Stephen Morgan
13c111da73
lib,cli,ui: Use WideBuilder for Tabular.AsciiWide.
...
Move WideBuilder to Text.WideString.
2021-01-02 15:08:09 +11:00
Stephen Morgan
0a686e220e
lib: Use AmountDisplayOpts for showAmount*, reducing need for many different named functions.
2021-01-02 15:08:09 +11:00
Stephen Morgan
5dedec83da
lib: showamountquantity shows directly, rather than parsing string output of show instance for Quantity.
2021-01-02 15:08:09 +11:00
Stephen Morgan
f998a791cf
lib: Remove unused optional width argument for StringFormat.
2021-01-02 15:08:09 +11:00
Stephen Morgan
462a13cad7
lib,cli: Use Text Builder for Balance commands.
2021-01-02 15:08:09 +11:00
Stephen Morgan
74b296f865
lib,cli: Make showTransaction return Text rather than String.
2021-01-02 15:08:09 +11:00
Stephen Morgan
12a6435c51
lib: Add wrap convenience function.
2021-01-02 15:08:09 +11:00
Simon Michael
31ea37a785
;check: accounts, commodities, payees, ordereddates: improve errors
...
Error messages for these four are now a bit fancier and more
consistent. But not yet optimised for machine readability.
Cf #1436 .
Added to hledger-lib: chomp1, linesPrepend[2].
2020-12-30 18:13:34 -08:00
Simon Michael
12447ffab7
;lib: restore list of hledger debug levels
2020-12-26 17:27:28 -08:00
Simon Michael
a10f9f4ea9
;lib: comment
2020-12-11 11:11:15 -08:00
Simon Michael
44d59eab23
;lib: Hledger.Utils.Debug: haddock
2020-12-09 13:55:55 -08:00
Simon Michael
51e3e9cbfa
;lib: Hledger.Utils.Debug: improve module haddock
2020-12-09 13:23:30 -08:00
Simon Michael
0dc8eca68a
lib: remove partial code from journalApplyAliases etc.
2020-11-25 21:06:31 -08:00
Simon Michael
9b9f2543d8
;lib: regexReplace: note the kind of RegexError still possible
2020-11-24 09:16:08 -08:00
Simon Michael
a97daaf322
lib: replace pretty-show with pretty-simple
...
pretty-simple, already used in .ghci, will hopefully give nicer debug
output, including for values which don't have Read-able Show output.
This should mean that we can start removing custom string-like Show
instances that were a workaround for pretty-show.
We are using the latest version (4.0.0.0) to get compact output.
Here's some old pretty-show output:
CsvRules
{ rdirectives = [ ( "skip" , "1" ) ]
, rcsvfieldindexes = [ ( "date" , 1 ) , ( "amount" , 2 ) ]
, rassignments = [ ( "amount" , "%2" ) , ( "date" , "%1" ) ]
, rconditionalblocks = []
}
And the new pretty-simple output:
CsvRules
{ rdirectives=
[ ( "skip", "1" ) ]
, rcsvfieldindexes=
[ ( "date", 1 ), ( "amount", 2 ) ]
, rassignments=
[ ( "amount", "%2" ), ( "date", "%1" ) ]
, rconditionalblocks= []
}
Non-compact pretty-simple output would be:
CsvRules
{ rdirectives=
[
( "skip"
, "1B"
)
]
, rcsvfieldindexes=
[
( "date"
, 1
)
,
( "amount"
, 2
)
]
, rassignments=
[
( "amount"
, "%2"
)
,
( "date"
, "%1"
)
]
, rconditionalblocks=[]
}
Also:
- Account's Show instance no longer converts : to _ in account names
- drop unused pretty-show dependency from hledger, hledger-ui packages
- regenerate hledger-lib with the older hpack that's shipped in stack
2020-11-10 08:06:11 -08:00
Stephen Morgan
6d7bd9e475
lib: Implement concat(Top|Bottom)Padded in terms of renderRow, allowing them to be width aware.
2020-11-04 14:25:21 +11:00
Stephen Morgan
a2b7a03fc4
lib,cli: bal uses new amount display functions, no longer needs to strip ansi.
2020-11-04 14:25:20 +11:00
Stephen Morgan
97545018f4
lib: quoteIfNeeded should not escape the backslashes in unicode code points.
2020-10-18 21:08:25 -07:00
Simon Michael
f78dc639a5
fix a slowdown with report rendering in 1.19.1 ( #1350 )
...
stripAnsi is called many times during rendering (by strWidth), so
should be fast. It was originally a regex replacement, and more
recently a custom parser. The parser was slower, particularly the one
in 1.19.1. See #1350 , and this rough test:
time118ish = timeIt $ print $ length $ concat $ map (fromRight undefined . regexReplace (toRegex' "\ESC\\[([0-9]+;)*([0-9]+)?[ABCDHJKfmsu]") "") testdata
time119 = timeparser (many (takeWhile1P Nothing (/='\ESC') <|> "" <$ ansi))
time1191 = timeparser (many ("" <$ try ansi <|> pure <$> anySingle))
timeparser p = timeIt $ print $ length $ concat $ map (concat . fromJust . parseMaybe p) testdata
testdata = concat $ replicate 10000
[ "2008-01-01 income assets🏦 checking $1 $1"
, "2008-06-01 gift assets🏦 checking $1 $2"
, "2008-06-02 save assets🏦 saving $1 $3"
, " assets🏦 checking ..m$-1\ESC[m\ESC[m $2"
, "2008-06-03 eat & shop assets:cash ..m$-2\ESC[m\ESC[m 0"
, "2008-12-31 pay off assets🏦 checking ..m$-1\ESC[m\ESC[m ..m$-1\ESC[m\ESC[m"
]
ghci> time118ish
4560000
CPU time: 0.17s
ghci> time119
4560000
CPU time: 0.91s
ghci> time1191
4560000
CPU time: 2.76s
Possibly a more careful parser could beat regexReplace. Note the
latter does memoisation, which could be faster and/or could also use
more resident memory in some situations.
Ideally we would calculate all widths before adding ANSI colour codes,
so we wouldn't have to wastefully strip them.
2020-09-10 18:07:40 -07:00
Stephen Morgan
600dab3976
lib: Correctly strip ansi sequences with no numbers/semicolons.
2020-09-06 19:11:28 -07:00
Simon Michael
a9fbaaf284
;partial comment cleanups
2020-09-03 09:52:00 -07:00
Stephen Morgan
7d1e6d7d12
lib: Fix quoteIfNeeded so it actually escapes quotes.
2020-09-01 11:41:55 +10:00
Stephen Morgan
07dd30c1e5
lib,cli,ui: Change to consistent naming scheme for Hledger.Utils.Regex.
2020-09-01 11:36:34 +10:00
Stephen Morgan
b91b391d08
lib: Replace some regex functions with parsers.
2020-08-31 22:44:41 +10:00
Stephen Morgan
af31d6e140
lib,cli,ui: Remove redundant Typeable and Data instances.
...
Also add some explicit import lists.
2020-08-31 15:41:30 +10:00
Stephen Morgan
01f5a92761
lib: Improve Read and Show instances for Regexp, get rid of custom show instance for Query.
2020-08-31 12:04:47 +10:00
Stephen Morgan
e3b2c94353
lib: Remove unneeded total Query code.
2020-08-31 12:04:47 +10:00
Stephen Morgan
e5371d5a6a
lib,cli,ui,web: Make Regexp a wrapper for Regex.
2020-08-31 12:04:45 +10:00
Stephen Morgan
ccd6fdd7b9
lib: Remove unused Tree functions.
2020-08-31 11:51:25 +10:00
Stephen Morgan
ba59fed6b2
lib: Replace more instances of fromIntegral with safer versions.
2020-08-30 22:20:58 +10:00
Simon Michael
3822c27bfe
;lib: regex: rename & export RegexError, export toRegex_, docs ( #1312 )
2020-08-06 15:25:58 -07:00
Simon Michael
4957008890
;lib: regex utilities: cleanup ( #1312 )
2020-08-06 11:35:04 -07:00
Simon Michael
a112085092
lib: add alternate regex utilities that don't call error ( #1312 )
2020-08-06 11:18:08 -07:00
Simon Michael
ede4bfd5b4
;mark more partial functions ( #1312 )
2020-08-05 17:29:43 -07:00
Simon Michael
3f55c23603
;review, tag all error calls with an easier to find PARTIAL: comment ( #1312 )
2020-08-05 16:08:33 -07:00
Stephen Morgan
ffb5cf0773
lib: Ensure parsed years have at least 4 digits.
2020-07-31 17:22:27 -07:00
Stephen Morgan
081ee390ab
lib: Change skipMany spacenonewline to takeWhileP Nothing isNonNewlineSpace.
2020-07-22 14:58:53 -07:00
Stephen Morgan
dc076b0d5b
lib: Use text library functions for stripping.
2020-07-16 10:03:25 -07:00
Stephen Morgan
ed99aea7d5
lib: Introduce takeEnd to get rid of some reverse . take n . reverse.
2020-07-16 10:03:25 -07:00
Simon Michael
765fb732c9
debug: move command parsing debug output down to level 8
2020-07-03 11:37:01 -07:00
Simon Michael
122309ced7
;lib: Debug comment
2020-06-19 14:39:32 -07:00