| 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. | ||
|---|---|---|
| .github | ||
| .sandstorm | ||
| bin | ||
| checks | ||
| doc | ||
| docker | ||
| examples | ||
| hledger | ||
| hledger-install | ||
| hledger-lib | ||
| hledger-ui | ||
| hledger-web | ||
| shell-completion | ||
| tests | ||
| tools | ||
| .appveyor.yml | ||
| .ci | ||
| .ctags | ||
| .dockerignore | ||
| .editorconfig | ||
| .ghci | ||
| .gitignore | ||
| .hlint.yaml | ||
| .mailmap | ||
| .travis.yml | ||
| .version | ||
| azure-pipelines.yml | ||
| bench.sh | ||
| cabal.project | ||
| CHANGES.md | ||
| CONTRIBUTING.md | ||
| CREDITS.md | ||
| dev.hs | ||
| Dockerfile | ||
| LICENSE | ||
| Makefile | ||
| Makefile.helpsys | ||
| README.md | ||
| ROADMAP.md | ||
| Shake.hs | ||
| stack7.10.yaml.disabled | ||
| stack8.0.yaml | ||
| stack8.2.yaml | ||
| stack8.4.yaml | ||
| stack8.6.yaml | ||
| stack8.10.yaml | ||
| stack.yaml | ||
hledger project README
lightweight, portable, dependable accounting tools
hledger is a computer program for easily tracking money, time, or other commodities, on unix, mac and windows (and web-capable mobile devices, to some extent).
It is first a command-line tool, but there are also terminal and web interfaces, and a Haskell library for building your own programs and scripts (hledger is written in Haskell). hledger was inspired by and is largely compatible with Ledger. hledger is free software available under the GNU General Public License v3+.
hledger aims to help both computer experts and regular folks to gain clarity and control in their finances and time management, but currently it is a bit more suited to techies. I use it every day to:
- track spending and income
- see time reports by day/week/month/project
- get accurate numbers for client billing and tax filing
- track invoices
Though limited in features, hledger is lightweight, usable and reliable. For some, it is a simpler, less distracting, more future-proof alternative to Quicken or GnuCash.
For more, see the home page: https://hledger.org
Sponsorship
Your support, large or small, helps keep this project strong!
See also https://hledger.org#sponsorship.
Sponsor Simon (project leader):  

Sponsor the hledger project as an organisation:  
 
 
 
 
 
 
 
 
 
Sponsor the hledger project as an individual: