Compare commits

...

25 Commits

Author SHA1 Message Date
thielema
611dd6d3b6
Merge f84d9c30ff into 5591be7724 2024-10-01 12:41:57 +02:00
Henning Thielemann
f84d9c30ff cli: Cli.Commands.Balance.budgetReportAsSpreadsheet: support for tree mode
use renderPeriodicAcct
2024-10-01 12:41:38 +02:00
Henning Thielemann
763a04d1ca cli: Cli.Commands.Balance: use normal space for indentation in text output format 2024-10-01 12:38:27 +02:00
Henning Thielemann
f01c72f7d3 cli: Cli.Commands.Balance: support tree mode for HTML, CSV and FODS output
indentation using non-breakable space character
2024-10-01 12:38:27 +02:00
Henning Thielemann
0f4404e8f3 cli: Cli.Commands.Balance.budgetReportAsSpreadsheet: vertically merge duplicate account name cells
This is consistent with simple balance and multi-period balance reports.
2024-10-01 11:09:56 +02:00
Simon Michael
5591be7724 dev: stack: silence wizards bounds warning, hopefully 2024-09-30 17:21:26 -10:00
Simon Michael
167303deb6 ;ci: windows, mac, linux-x64-stack: list dep versions before building hledger
For troubleshooting. stack doesn't do this itself, unlike cabal.
2024-09-30 17:21:26 -10:00
Simon Michael
f4bc6308ae ;ci: add trigger summaries as well 2024-09-30 17:21:26 -10:00
Simon Michael
4dc4dbc917 ;ci: windows, linux-x64-stack: add unit testing to these 2024-09-30 17:21:26 -10:00
Simon Michael
d8d236385d ;ci: linux: expect linux builds to be warning free like the rest 2024-09-30 17:21:23 -10:00
Simon Michael
bba77abcf6 ;ci: add consistent greppable summaries for all workflows 2024-09-30 17:21:02 -10:00
Simon Michael
1b643eb3e9 ;ci: mac: cleanup 2024-09-30 17:21:02 -10:00
Simon Michael
fd930ff567 dev: make func tests compatible with ghc 9.10
Work around ghc 9.10's extra newline in error output.
https://gitlab.haskell.org/ghc/ghc/-/issues/25116
2024-09-30 17:20:53 -10:00
Simon Michael
1c45496f1c dev: web: fix build with ghc <9.2 2024-09-30 17:20:13 -10:00
Simon Michael
10465ffbe5 ;ci: update all stack/cabal versions installed by ghcup to latest 2024-09-30 17:20:13 -10:00
Simon Michael
e157bb4a6b dev: Hledger.Write.Ods: fix build with ghc <9.6 2024-09-30 17:20:13 -10:00
Simon Michael
6773e92361 dev: Hledger.Write.Ods: follow global-then-local-imports convention 2024-09-30 17:20:13 -10:00
Simon Michael
daa3010c3e ;ci: binaries-linux-x64: fix addition of manuals to bindist 2024-09-30 17:20:13 -10:00
Simon Michael
bb551bf0dc ;doc: update changelogs 2024-09-30 17:20:13 -10:00
Simon Michael
8fdbcdda5d ;dev: stack: additional extra deps required on windows 2024-09-30 17:20:13 -10:00
Simon Michael
1a0b1034b6 dev: make ghc 9.10 the default for dev builds and some github actions 2024-09-30 17:20:13 -10:00
Simon Michael
ebd8a87177 dev: rename stack.yaml to 9.8 2024-09-30 17:20:13 -10:00
Simon Michael
c92b601028 dev: fix warnings with ghc 9.10 / base 4.20
Older ghc versions should also still build cleanly (tested with 9.8 so far).

I don't like enabling CPP in so many modules but it's easier that
figuring out how to do it with base-compat; hopefully no noticeable
compilation impact.
2024-09-30 17:20:13 -10:00
Simon Michael
1b60ebb61f ;cabal: update cabal files 2024-09-30 17:20:13 -10:00
Simon Michael
6225ac8a22 imp!: support ghc 9.10 / base 4.20
When built with ghc 9.10.1, hledger error messages are displayed
with an extra newline following them.
https://gitlab.haskell.org/ghc/ghc/-/issues/25116
2024-09-30 17:15:59 -10:00
47 changed files with 423 additions and 244 deletions

View File

@ -1,5 +1,8 @@
hledger github actions workflows.
The hledger project's github actions workflows.
They have greppable one-line TRIGGER: and ACTION: comments near the top,
summarising their current intended behaviour.
These are carefully worded and should be kept up to date.
docs:

View File

@ -1,9 +1,7 @@
# This was used for certain raspberry pi hardware and perhaps needs update.
# Runs on any push to binaries-linux-arm32v7.
# Produces optimised static arm32v7 linux binaries,
# using GHC 8.10.4 and cabal.
# Currently runs no tests.
# Slow, will probably time out.
# This was once used for certain raspberry pi hardware, may need update.
# TRIGGER: Runs on any push to binaries-linux-arm32v7 branch.
# ACTION: Builds and saves linux arm32v7 static binaries, using docker-arm32v7/Dockerfile and cabal and the ghc specified there.
# XXX Slow, may time out.
name: binaries-linux-arm32v7
on:

View File

@ -1,5 +1,6 @@
# Runs on any push to binaries-linux-x64-stack.
# Like binaries-linux-x64.yml except it builds with stack instead of cabal.
# TRIGGER: Runs on any push to binaries-linux-x64-stack branch. Not normally used.
# ACTION: Builds, unit-tests and saves mac x64 static binaries with stack and the default ghc. May not work,
# the cabal-based binaries-linux-x64.yml is normally used instead.
name: binaries-linux-x64-stack
on:
@ -98,22 +99,22 @@ jobs:
- name: Install haskell tools with ghcup if needed
run: |
if [[ ! -x ~/.ghcup/bin/ghcup ]]; then mkdir -p ~/.ghcup/bin && curl https://downloads.haskell.org/~ghcup/x86_64-linux-ghcup > ~/.ghcup/bin/ghcup && chmod +x ~/.ghcup/bin/ghcup; fi; printf "ghcup: "; ghcup --version
if [[ ! -x ~/.ghcup/bin/stack ]]; then ~/.ghcup/bin/ghcup install stack 2.15.5 && ~/.ghcup/bin/ghcup set stack 2.15.5; fi; printf "stack: "; stack --version
if [[ ! -x ~/.ghcup/bin/stack ]]; then ~/.ghcup/bin/ghcup install stack 3.1.1 && ~/.ghcup/bin/ghcup set stack 3.1.1; fi; printf "stack: "; stack --version
# --allow-different-user is needed because of #863 above (or because stack didn't notice we're in a docker container)
- name: Install GHC with stack
run: |
stack --allow-different-user setup --install-ghc
- name: Build with stack
- name: List dep versions
run: |
stack --allow-different-user build --ghc-options='-optl-static -fPIC' hledger # || (echo "ERROR: building hledger failed"; false)
stack --allow-different-user build --ghc-options='-optl-static -fPIC' hledger-ui # || (echo "ERROR: building hledger-ui failed"; false)
stack --allow-different-user build --ghc-options='-optl-static -fPIC' hledger-web # || (echo "ERROR: building hledger-web failed"; false)
$stack exec -- ghc-pkg list
- name: Run built-in unit tests
- name: Build with stack and run unit tests
run: |
stack exec -- hledger test
stack --allow-different-user build --test --ghc-options='-optl-static -fPIC' --ghc-options=-Werror hledger # || (echo "ERROR: building hledger failed"; false)
stack --allow-different-user build --test --ghc-options='-optl-static -fPIC' --ghc-options=-Werror hledger-ui # || (echo "ERROR: building hledger-ui failed"; false)
stack --allow-different-user build --test --ghc-options='-optl-static -fPIC' --ghc-options=-Werror hledger-web # || (echo "ERROR: building hledger-web failed"; false)
- name: Gather binaries
run: |

View File

@ -1,6 +1,5 @@
# Runs on any push to binaries-linux-x64 or binaries.
# Produces optimised static x64 linux binaries,
# using the GHC version below and cabal and Alpine linux,
# TRIGGER: Runs on any push to binaries-linux-x64 or binaries branches.
# ACTION: Builds, unit-tests and saves linux x64 static binaries with cabal and the ghc version below and Alpine linux,
# which provides the statically-linkable musl.
name: binaries-linux-x64
@ -54,7 +53,7 @@ jobs:
run: |
if [[ ! -x ~/.ghcup/bin/ghcup ]]; then mkdir -p ~/.ghcup/bin && curl https://downloads.haskell.org/~ghcup/x86_64-linux-ghcup > ~/.ghcup/bin/ghcup && chmod +x ~/.ghcup/bin/ghcup; fi; printf "ghcup: "; ghcup --version
if [[ ! -x ~/.ghcup/bin/ghc-9.8.2 ]]; then ~/.ghcup/bin/ghcup install ghc 9.8.2 && ~/.ghcup/bin/ghcup set ghc 9.8.2; fi; printf "ghc: "; ghc --version
if [[ ! -x ~/.ghcup/bin/cabal ]]; then ~/.ghcup/bin/ghcup install cabal 3.10.3.0 && ~/.ghcup/bin/ghcup set cabal 3.10.3.0; fi; printf "cabal: "; cabal --version
if [[ ! -x ~/.ghcup/bin/cabal ]]; then ~/.ghcup/bin/ghcup install cabal 3.12.1.0 && ~/.ghcup/bin/ghcup set cabal 3.12.1.0; fi; printf "cabal: "; cabal --version
- name: Update cabal package index
run: |
@ -62,9 +61,9 @@ jobs:
- name: Build with cabal
run: |
cabal build --enable-executable-static hledger || (echo "ERROR: building hledger failed"; false)
cabal build --enable-executable-static hledger-ui || (echo "ERROR: building hledger-ui failed"; false)
cabal build --enable-executable-static hledger-web || (echo "ERROR: building hledger-web failed"; false)
cabal build --enable-executable-static --ghc-options=-Werror hledger || (echo "ERROR: building hledger failed"; false)
cabal build --enable-executable-static --ghc-options=-Werror hledger-ui || (echo "ERROR: building hledger-ui failed"; false)
cabal build --enable-executable-static --ghc-options=-Werror hledger-web || (echo "ERROR: building hledger-web failed"; false)
- name: Gather binaries
run: |
@ -72,7 +71,7 @@ jobs:
cp dist-newstyle/build/x86_64-linux/ghc-*/hledger-*/x/hledger/build/hledger/hledger tmp
cp dist-newstyle/build/x86_64-linux/ghc-*/hledger-ui-*/x/hledger-ui/build/hledger-ui/hledger-ui tmp
cp dist-newstyle/build/x86_64-linux/ghc-*/hledger-web-*/x/hledger-web/build/hledger-web/hledger-web tmp
cp hledger/shell-completion/hledger-completion.bash hledger/embeddedfiles/*.{1,info} tmp
cp hledger/shell-completion/hledger-completion.bash hledger/embeddedfiles/*.1 hledger/embeddedfiles/*.info tmp
cd tmp
strip hledger
strip hledger-ui

View File

@ -1,6 +1,5 @@
# Runs on any push to binaries-mac-arm64 or binaries.
# Produces optimised mac arm64 binaries and runs unit/doc/functional tests,
# using the default stack.yaml's GHC version.
# TRIGGER: Runs on any push to binaries-mac-arm64 or binaries branches.
# ACTION: Builds, tests and saves mac arm64 dynamic binaries with stack and the default ghc.
name: binaries-mac-arm64
on:
@ -12,7 +11,6 @@ jobs:
# arm64
runs-on: macos-14
env:
ghc: 98
stack: stack
steps:
@ -105,7 +103,7 @@ jobs:
fi
ghcup --version
if [[ ! -x ~/.ghcup/bin/stack ]]; then
~/.ghcup/bin/ghcup install stack 2.15.5 && ~/.ghcup/bin/ghcup set stack 2.15.5
~/.ghcup/bin/ghcup install stack 3.1.1 && ~/.ghcup/bin/ghcup set stack 3.1.1
fi
stack --version
@ -124,6 +122,10 @@ jobs:
$stack build --test --only-dependencies --dry-run
$stack build --test --only-dependencies
- name: List dep versions
run: |
$stack exec -- ghc-pkg list
- name: Build hledger and test unit tests, doc tests
run: |
$stack install --test --force-dirty --ghc-options=-fforce-recomp --ghc-options=-Werror

View File

@ -1,6 +1,5 @@
# Runs on any push to binaries-mac-x64 or binaries.
# Produces optimised mac x64 binaries and runs unit/doc/functional tests,
# using the default stack.yaml's GHC version.
# TRIGGER: Runs on any push to binaries-mac-x64 or binaries branches.
# ACTION: Builds, tests and saves mac x64 dynamic binaries with stack and the default ghc.
name: binaries-mac-x64
on:
@ -12,7 +11,6 @@ jobs:
# x64
runs-on: macos-13
env:
ghc: 98
stack: stack
steps:
@ -98,10 +96,11 @@ jobs:
run: |
echo "$HOME/.ghcup/bin/" >> $GITHUB_PATH
# XXX occasionally we need to force a cache flush, or tools eventually become too old (Cabal tends to break old stack, eg)
- name: Install haskell tools with ghcup if needed
run: |
if [[ ! -x ~/.ghcup/bin/ghcup ]]; then mkdir -p ~/.ghcup/bin && curl https://downloads.haskell.org/~ghcup/x86_64-apple-darwin-ghcup > ~/.ghcup/bin/ghcup && chmod +x ~/.ghcup/bin/ghcup; fi; printf "ghcup: "; ghcup --version
if [[ ! -x ~/.ghcup/bin/stack ]]; then ~/.ghcup/bin/ghcup install stack 2.15.5 && ~/.ghcup/bin/ghcup set stack 2.15.5; fi; printf "stack: "; stack --version
if [[ ! -x ~/.ghcup/bin/stack ]]; then ~/.ghcup/bin/ghcup install stack 3.1.1 && ~/.ghcup/bin/ghcup set stack 3.1.1; fi; printf "stack: "; stack --version
#if [[ ! -x ~/.ghcup/bin/ghc-9.8.2 ]]; then ~/.ghcup/bin/ghcup install ghc 9.8.2 && ~/.ghcup/bin/ghcup set ghc 9.8.2; fi; printf "ghc: "; ghc --version
- name: Install GHC with stack
@ -119,6 +118,10 @@ jobs:
$stack build --test --only-dependencies --dry-run
$stack build --test --only-dependencies
- name: List dep versions
run: |
$stack exec -- ghc-pkg list
- name: Build hledger and test unit tests, doc tests
run: |
$stack install --test --force-dirty --ghc-options=-fforce-recomp --ghc-options=-Werror

View File

@ -1,7 +1,5 @@
# Runs on any push to binaries-windows-x64 or binaries.
# Produces optimised windows binaries,
# using the default stack.yaml's GHC version.
# Currently runs no tests.
# TRIGGER: Runs on any push to binaries-windows-x64 or binaries branches.
# ACTION: Builds, unit-tests and saves windows x64 binaries with stack and the default ghc.
name: binaries-windows-x64
on:
@ -120,24 +118,26 @@ jobs:
run: |
./stack --no-terminal setup --install-ghc
- name: Install haskell deps
run: |
./stack --no-terminal build --test --only-dependencies --dry-run
./stack --no-terminal build --test --only-dependencies
- name: List dep versions
run: |
$stack exec -- ghc-pkg list
- name: Build all hledger modules warning free, optimised and minimised
run: |
./stack --no-terminal install --test --force-dirty --ghc-options=-fforce-recomp --ghc-options=-Werror
# --ghc-options=-split-sections doesn't work on windows, "too many sections"
# --pedantic
# - name: Install shelltestrunner
## - export PATH=~/.local/bin:$PATH
# - if [[ ! -x ~/.local/bin/shelltest ]]; then stack install shelltestrunner-1.10; fi
# - shelltest --version
- name: Install haskell deps
run: |
./stack --no-terminal build --only-dependencies --dry-run
./stack --no-terminal build --only-dependencies
# use whichever GHC is in default stack.yaml
- name: Build all hledger modules warning free, optimised and minimised
run: |
./stack --no-terminal install --force-dirty --ghc-options=-fforce-recomp --ghc-options=-Werror
# --ghc-options=-split-sections doesn't work on windows, "too many sections"
# --pedantic
# run hledger-lib/hledger functional tests, skipping the ones for addons
## - export PATH=~/.local/bin:$PATH
#- COLUMNS=80 stack exec -- shelltest --execdir -j16 hledger/test -x /_ -x /addons -x ledger-compat/ledger-baseline -x ledger-compat/ledger-regress -x ledger-compat/ledger-collected

View File

@ -1,8 +1,8 @@
# The main hledger continuous integration tests.
# Builds all packages expecting no warnings, runs lots of tests,
# and on success, saves the binaries as an artifact.
# Code must pass this successfully before it can be merged or pushed to master
# (https://github.com/simonmichael/hledger/settings/branch_protection_rules/17386787).
# Code must pass this successfully before it can be merged or pushed to master.
# https://github.com/simonmichael/hledger/settings/branch_protection_rules/17386787
# TRIGGER: Runs on any push to ci branch or any pull request against master.
# ACTION: Builds, tests and saves linux x64 dynamic binaries with stack and the default ghc.
name: ci
@ -51,7 +51,8 @@ jobs:
# Keep these synced with the latest ghc version at https://github.com/actions/runner-images/blob/ubuntu22/20240514.2/images/ubuntu/Ubuntu2404-Readme.md#haskell-tools
#
# caching id for this ghc's build artifacts:
ghc: 982
# XXX ideally should match the default ghc in stack.yaml, though it's not critical
ghc: 910
# stack config for this ghc:
stack: stack --system-ghc

View File

@ -1,4 +1,5 @@
# Test that hledger still builds with the oldest supported GHC version.
# TRIGGER: Runs on any push to oldest branch.
# ACTION: Builds and tests with stack and the oldest supported ghc.
name: oldest
@ -137,15 +138,18 @@ jobs:
run: |
$stack install --test --bench hledger-web --fast --ghc-options=-Werror
# XXX disable until this is fixed: shelltestrunner-1.10/src/shelltest.hs:125:20: error:
# shelltestrunner > Not in scope: configFailFast
# shelltestrunner > Perhaps you meant configFastFail (imported from Test.Hspec.Core.Runner)
- name: Install shelltestrunner
run: |
export PATH=~/.local/bin:$PATH
if [[ ! -x ~/.local/bin/shelltest ]]; then $stack install shelltestrunner-1.10; fi
shelltest --version
# - name: Install shelltestrunner
# run: |
# export PATH=~/.local/bin:$PATH
# if [[ ! -x ~/.local/bin/shelltest ]]; then $stack install shelltestrunner-1.10; fi
# shelltest --version
- name: Test functional tests (excluding addons)
run: |
export PATH=~/.local/bin:$PATH
COLUMNS=80 $stack exec -- shelltest --execdir -j16 hledger/test -x /_ -x /addons -x ledger-compat/ledger-baseline -x ledger-compat/ledger-regress -x ledger-compat/ledger-collected
# XXX run the bin/ func tests corresponding to the GHC version enabled above, only
# - name: Test functional tests (excluding addons)
# run: |
# export PATH=~/.local/bin:$PATH
# COLUMNS=80 $stack exec -- shelltest --execdir -j16 hledger/test -x /_ -x /addons -x ledger-compat/ledger-baseline -x ledger-compat/ledger-regress -x ledger-compat/ledger-collected
# # XXX run the bin/ func tests corresponding to the GHC version enabled above, only

View File

@ -1,6 +1,7 @@
# Create/update a draft release when a release tag is pushed.
# Expects that the main binaries* workflows have been completed first.
# XXX Triggers too much, eg on pushing VER.99 dev tags; those releases must be deleted manually.
# TRIGGER: Runs when a release tag like "1.*" is pushed to the repo.
# XXX Triggers too much, eg for 1.x.99 dev tags; those releases must be deleted manually.
# ACTION: Creates/updates a draft release with binaries from the latest successful binaries-* runs.
# The main binaries* workflows should be completed before triggering this.
name: release

View File

@ -19,10 +19,11 @@ General changes in the hledger project.
For package-specific changes, see the hledger package changelogs.
# 69da3c0a1
# 81167e81a
Docs
- REGRESSIONS: new table format; updates.
- CODE: notes on the use of haddock [#2222]
- Simplify github bug report template
- Add man pages and info manuals to the release bindists on github
@ -34,6 +35,7 @@ Scripts/addons
Infrastructure/Misc
- Add bash shell completion script to the release bindists ([#2223], gesh/hseg, Simon Michael)
- hledger is now 35th among Github-starred haskell projects (up from 36th).
# 1.40 2024-09-09

View File

@ -33,7 +33,7 @@ RUN cabal update
COPY . /hledger
# Build static hledger binary
RUN cd /hledger && cabal build --enable-executable-static --with-compiler=/usr/local/bin/ghc-8.10.4 hledger
RUN cd /hledger && cabal build --enable-executable-static --with-compiler=/usr/local/bin/ghc-8.10.4 --ghc-options=-Werror hledger
# Strip symbols from binary
RUN cp /hledger/dist-newstyle/build/arm-linux/ghc-*/hledger-*/x/hledger/build/hledger/hledger /root/ && strip /root/hledger

View File

@ -22,25 +22,20 @@ Internal/api/developer-ish changes in the hledger-lib (and hledger) packages.
For user-visible changes, see the hledger package changelog.
# ff397f79c
- lib: Write.Spreadsheet.Cell: add cellClass field for HTML style class (Henning Thielemann)
cmd: Commands.Balance.multiBalanceRowAsCellBuilders: add HTML style class attributes here
This way we do not need to dissect table rows in
multiBalanceReportHtmlHeadRow, multiBalanceReportHtmlBodyRow, multiBalanceReportHtmlFootRow
Eventually removed these three functions.
- cli: Commands.Balance.budgetReportAsSpreadsheet: also transpose border (Henning Thielemann)
- lib: Write.Spreadsheet: support for borders like in existing HTML export (Henning Thielemann)
cli: Commands.Balance: use for FODS export and balance and budget export to HTML
# 81167e81a
Breaking changes
- New/refactored modules (Hledger.Write.*) and types (Spreadsheet) to help abstract the rendering of
tables in various output formats, eg HTML and FODS.
(Spreadsheet is in addition to the tabular package we already in use; there may be some overlap.)
(XXX Review module changes)
Fixes
Improvements
- dependency changes:
# 1.40 2024-09-09

View File

@ -34,7 +34,10 @@ module Hledger.Data.Account
import qualified Data.HashSet as HS
import qualified Data.HashMap.Strict as HM
import Data.List (find, foldl', sortOn)
import Data.List (find, sortOn)
#if !MIN_VERSION_base(4,20,0)
import Data.List (foldl')
#endif
import Data.List.Extra (groupOn)
import qualified Data.Map as M
import Data.Ord (Down(..))

View File

@ -39,6 +39,7 @@ with similar amounts since it mostly ignores costss and commodity exchange rates
-}
{-# LANGUAGE CPP #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE NamedFieldPuns #-}
@ -175,7 +176,10 @@ import Data.Char (isDigit)
import Data.Decimal (DecimalRaw(..), decimalPlaces, normalizeDecimal, roundTo)
import Data.Default (Default(..))
import Data.Foldable (toList)
import Data.List (find, foldl', intercalate, intersperse, mapAccumL, partition)
import Data.List (find, intercalate, intersperse, mapAccumL, partition)
#if !MIN_VERSION_base(4,20,0)
import Data.List (foldl')
#endif
import Data.List.NonEmpty (NonEmpty(..), nonEmpty)
import qualified Data.Map.Strict as M
import qualified Data.Set as S

View File

@ -1,9 +1,10 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE Rank2Types #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TupleSections #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE RecordWildCards #-}
{-|
@ -122,7 +123,10 @@ import Control.Monad.State.Strict (StateT)
import Data.Char (toUpper, isDigit)
import Data.Default (Default(..))
import Data.Foldable (toList)
import Data.List ((\\), find, foldl', sortBy, union, intercalate)
import Data.List ((\\), find, sortBy, union, intercalate)
#if !MIN_VERSION_base(4,20,0)
import Data.List (foldl')
#endif
import Data.List.Extra (nubSort)
import qualified Data.Map.Strict as M
import Data.Maybe (catMaybes, fromMaybe, mapMaybe, maybeToList)

View File

@ -1,4 +1,3 @@
{-# LANGUAGE NamedFieldPuns #-}
{-|
A 'Posting' represents a change (by some 'MixedAmount') of the balance in
@ -8,6 +7,8 @@ look up the date or description there.
-}
{-# LANGUAGE CPP #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
module Hledger.Data.Posting (
@ -82,7 +83,10 @@ import Data.Foldable (asum)
import Data.Function ((&))
import qualified Data.Map as M
import Data.Maybe (fromMaybe, isJust, mapMaybe)
import Data.List (foldl', sort, union)
import Data.List (sort, union)
#if !MIN_VERSION_base(4,20,0)
import Data.List (foldl')
#endif
import qualified Data.Set as S
import Data.Text (Text)
import qualified Data.Text as T

View File

@ -14,6 +14,7 @@ Most of the code for reading rules files and csv files is in this module.
-- stack haddock hledger-lib --fast --no-haddock-deps --haddock-arguments='--ignore-all-exports' --open
--- ** language
{-# LANGUAGE CPP #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
@ -52,7 +53,10 @@ import Control.Monad.Trans.Class (lift)
import Data.Char (toLower, isDigit, isSpace, isAlphaNum, ord)
import Data.Bifunctor (first)
import Data.Functor ((<&>))
import Data.List (elemIndex, foldl', mapAccumL, nub, sortOn)
import Data.List (elemIndex, mapAccumL, nub, sortOn)
#if !MIN_VERSION_base(4,20,0)
import Data.List (foldl')
#endif
import Data.List.Extra (groupOn)
import Data.Maybe (catMaybes, fromMaybe, isJust)
import Data.MemoUgly (memo)
@ -1325,9 +1329,7 @@ parseAmount rules record currency s =
,showRules rules record
-- ,"the default-currency is: "++fromMaybe "unspecified" (getDirective "default-currency" rules)
,"the parse error is: " <> T.pack (customErrorBundlePretty e)
,"you may need to \
\change your amount*, balance*, or currency* rules, \
\or add or change your skip rule"
,"you may need to change your amount*, balance*, or currency* rules, or add or change your skip rule"
]
-- | Show the values assigned to each journal field.

View File

@ -3,6 +3,8 @@ Utilities used throughout hledger, or needed low in the module hierarchy.
These are the bottom of hledger's module graph.
-}
{-# LANGUAGE CPP #-}
module Hledger.Utils (
-- * Functions
@ -69,7 +71,10 @@ where
import Data.Char (toLower)
import Data.List (intersperse)
import Data.List.Extra (chunksOf, foldl', foldl1', uncons, unsnoc)
import Data.List.Extra (chunksOf, foldl1', uncons, unsnoc)
#if !MIN_VERSION_base(4,20,0)
import Data.List (foldl')
#endif
import qualified Data.Set as Set
import qualified Data.Text as T (pack, unpack)
import Data.Tree (foldTree, Tree (Node, subForest))

View File

@ -1,7 +1,3 @@
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-|
Easy regular expression helpers, currently based on regex-tdfa. These should:
@ -42,6 +38,12 @@ Current limitations:
-}
{-# LANGUAGE CPP #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
module Hledger.Utils.Regex (
-- * Regexp type and constructors
Regexp(reString)
@ -66,7 +68,9 @@ import Control.Monad (foldM)
import Data.Aeson (ToJSON(..), Value(String))
import Data.Array ((!), elems, indices)
import Data.Char (isDigit)
#if !MIN_VERSION_base(4,20,0)
import Data.List (foldl')
#endif
import Data.MemoUgly (memo)
import Data.Text (Text)
import qualified Data.Text as T

View File

@ -12,10 +12,8 @@ module Hledger.Write.Ods (
printFods,
) where
import qualified Hledger.Write.Spreadsheet as Spr
import Hledger.Write.Spreadsheet (Type(..), Style(..), Emphasis(..), Cell(..))
import Hledger.Data.Types (CommoditySymbol, AmountPrecision(..))
import Hledger.Data.Types (acommodity, aquantity, astyle, asprecision)
import Prelude hiding (Applicative(..))
import Control.Applicative (Applicative(..))
import qualified Data.Text.Lazy as TL
import qualified Data.Text as T
@ -33,6 +31,10 @@ import Data.Maybe (catMaybes)
import qualified System.IO as IO
import Text.Printf (printf)
import qualified Hledger.Write.Spreadsheet as Spr
import Hledger.Write.Spreadsheet (Type(..), Style(..), Emphasis(..), Cell(..))
import Hledger.Data.Types (CommoditySymbol, AmountPrecision(..))
import Hledger.Data.Types (acommodity, aquantity, astyle, asprecision)
printFods ::
IO.TextEncoding ->

View File

@ -123,8 +123,8 @@ library
, aeson-pretty
, ansi-terminal >=0.9
, array
, base >=4.14 && <4.20
, base-compat
, base >=4.14 && <4.21
, base-compat >=0.14.0
, blaze-html
, blaze-markup >=0.5.1
, bytestring
@ -187,8 +187,8 @@ test-suite doctest
, aeson-pretty
, ansi-terminal >=0.9
, array
, base >=4.14 && <4.20
, base-compat
, base >=4.14 && <4.21
, base-compat >=0.14.0
, blaze-html
, blaze-markup >=0.5.1
, bytestring
@ -254,8 +254,8 @@ test-suite unittest
, aeson-pretty
, ansi-terminal >=0.9
, array
, base >=4.14 && <4.20
, base-compat
, base >=4.14 && <4.21
, base-compat >=0.14.0
, blaze-html
, blaze-markup >=0.5.1
, bytestring

View File

@ -39,8 +39,8 @@ extra-source-files:
#data-files:
dependencies:
- base >=4.14 && <4.20
- base-compat
- base >=4.14 && <4.21
- base-compat >=0.14.0
- aeson >=1 && <2.3
- aeson-pretty
- ansi-terminal >=0.9

View File

@ -22,8 +22,7 @@ User-visible changes in hledger-ui.
See also the hledger changelog.
# ff0fe62fa
# 81167e81a
Breaking changes

View File

@ -379,7 +379,7 @@ withBorderAttr attr = updateAttrMap (applyAttrMappings [(attrName "border", attr
-- | Scroll a list's viewport so that the selected item is centered in the
-- middle of the display area.
scrollSelectionToMiddle :: List Name item -> EventM Name UIState ()
scrollSelectionToMiddle :: Brick.Widgets.List.List Name item -> EventM Name UIState ()
scrollSelectionToMiddle list = do
case list^.listSelectedL of
Nothing -> return ()
@ -429,7 +429,7 @@ reportSpecSetFutureAndForecast fcast rspec =
-- Vertically scroll the named list's viewport with the given number of non-empty items
-- by the given positive or negative number of items (usually 1 or -1).
-- The selection will be moved when necessary to keep it visible and allow the scroll.
listScrollPushingSelection :: Name -> Int -> Int -> EventM Name (List Name item) (GenericList Name Vector item)
listScrollPushingSelection :: Name -> Int -> Int -> EventM Name (Brick.Widgets.List.List Name item) (GenericList Name Vector item)
listScrollPushingSelection name listheight scrollamt = do
list <- get
viewportScroll name `vScrollBy` scrollamt

View File

@ -77,7 +77,7 @@ library
build-depends:
ansi-terminal >=0.9
, async
, base >=4.14 && <4.20
, base >=4.14 && <4.21
, brick >=2.1.1 && <2.3.2 || >2.3.2 && <2.5
, cmdargs >=0.8
, containers >=0.5.9
@ -125,7 +125,7 @@ executable hledger-ui
ghc-options: -Wall -Wno-incomplete-uni-patterns -Wno-missing-signatures -Wno-orphans -Wno-type-defaults -Wno-unused-do-bind
cpp-options: -DVERSION="1.40.99"
build-depends:
base >=4.14 && <4.20
base >=4.14 && <4.21
, hledger-ui
default-language: Haskell2010
if (flag(ghcdebug))

View File

@ -53,7 +53,7 @@ ghc-options:
- -Wno-unused-do-bind
dependencies:
- base >=4.14 && <4.20
- base >=4.14 && <4.21
when:
- condition: (flag(ghcdebug))
@ -125,7 +125,7 @@ executables:
source-dirs: app
main: hledger-ui.hs
dependencies:
- base >=4.14 && <4.20
- base >=4.14 && <4.21
- hledger-ui
when:
- condition: flag(threaded)

View File

@ -22,7 +22,23 @@ User-visible changes in hledger-web.
See also the hledger changelog.
# ff0fe62fa
# 81167e81a
- web: RegisterR.getRegisterR.addCommas: do not drop last account (Henning Thielemann)
Bug was introduced in commit 2a99b3d45634f26cd62745ddce6136361001b3f8
in an effort to get rid of partial List.tail,
because GHC-9.8 started to warn about it.
Problem is that the rewritten code with tailDef always removes the last account,
whereas the original intention was to replace all accounts by a comma except the last one.
addCommas should prepare a comma separated list like List.intercalate.
- fix: web: enable autocomplete in newly created account fields [#2215]
- dev: web: cleanup: more explicit globals; and match inputs more carefully [#2215]
(Don't match the hidden duplicate inputs created by typeahead.js)
- ;doc: update changelogs
Breaking changes

View File

@ -9,7 +9,7 @@
module Hledger.Web.Handler.RegisterR where
import qualified Data.List.NonEmpty as NonEmpty
import qualified Data.List.NonEmpty.Compat as NonEmpty -- from base-compat for ghc 8.10
import Data.List (intersperse, nub, partition)
import qualified Data.Text as T
import Text.Hamlet (hamletFile)

View File

@ -160,7 +160,8 @@ library
build-depends:
Decimal >=0.5.1
, aeson >=1 && <2.3
, base >=4.14 && <4.20
, base >=4.14 && <4.21
, base-compat >=0.14.0
, base64
, blaze-html
, blaze-markup
@ -225,7 +226,8 @@ executable hledger-web
ghc-options: -Wall -Wredundant-constraints -Wincomplete-record-updates -Wincomplete-uni-patterns
cpp-options: -DVERSION="1.40.99"
build-depends:
base >=4.14 && <4.20
base >=4.14 && <4.21
, base-compat >=0.14.0
, hledger-web
default-language: Haskell2010
if (flag(dev)) || (flag(library-only))
@ -249,7 +251,8 @@ test-suite test
ghc-options: -Wall -Wredundant-constraints -Wincomplete-record-updates -Wincomplete-uni-patterns
cpp-options: -DVERSION="1.40.99"
build-depends:
base >=4.14 && <4.20
base >=4.14 && <4.21
, base-compat >=0.14.0
, hledger-web
default-language: Haskell2010
if (flag(dev)) || (flag(library-only))

View File

@ -86,7 +86,8 @@ when:
- ghc-debug-stub >=0.6.0.0 && <0.7
dependencies:
- base >=4.14 && <4.20
- base >=4.14 && <4.21
- base-compat >=0.14.0
library:
source-dirs: .

View File

@ -23,44 +23,57 @@ API
User-visible changes in the hledger command line tool and library.
# ff0fe62fa
- cli: Commands.Balance.multiBalanceReportAsSpreadsheetHelper: return header separately (Henning Thielemann)
- cli: Commands.Balance.multiBalanceRowAsTextBuilders, multiBalanceReportAsCsvHelper: helper functions removed (Henning Thielemann)
- lib: Write.Spreadsheet.Cell: add cellClass field for HTML style class (Henning Thielemann)
cmd: Commands.Balance.multiBalanceRowAsCellBuilders: add HTML style class attributes here
This way we do not need to dissect table rows in
multiBalanceReportHtmlHeadRow, multiBalanceReportHtmlBodyRow, multiBalanceReportHtmlFootRow
Eventually removed these three functions.
- cli: Commands.Cli.Balance.rawTableContent: helper function for extracting CSV from Spreadsheet cells (Henning Thielemann)
- cli: Commands.Balance.balanceReportAsSpreadsheet, multiBalanceReportAsSpreadsheet: support for transposition (Henning Thielemann)
- cli: Commands.Balance.budgetReportAsSpreadsheet: also transpose border (Henning Thielemann)
- lib: Write.Spreadsheet: support for borders like in existing HTML export (Henning Thielemann)
cli: Commands.Balance: use for FODS export and balance and budget export to HTML
# 81167e81a
Breaking changes
Fixes
- Bring bash shell completions up to date.
- In a multi-line comment generated by csv rules, tags on all lines now work (ie, can be matched).
Posting dates in comments generated from csv also now [work](https://hledger.org/hledger.html#comment-field).
(#2241)
- In the HTML output of bs/bse/cf/is reports, Net amounts in the Net row are now formatted like the others.
(Bas van Dijk)
- In bs/bse/cf/is HTML output, fixed some extra TH cells generated unnecessarily.
[#2225] (Henning Thielemann)
- hledger's bash shell completions are now up to date with latest options.
[#986]
Features
- When generating HTML output with the balance commands, you can now
add the `--base-url` option to add hyperlinks to hledger-web,
allowing you to view the transactions involved.
(Henning Thielemann)
Improvements
- `balance` and `aregister`'s HTML output will now use a hledger.css file if present, like `bs`/`bse`/`cf`/`is`.
- In the balance commands' HTML output, row headings now span multiple rows when appropriate,
rather than being repeated.
(Henning Thielemann)
- All balance commands' HTML and FODS output now show table borders consistently.
- The balance commands' options help has had some consistency/readability tweaks.
- `bs`/`bse`/`cf`/`is` now support the `--count` (postings count) report type, like `balance`.
- hledger now builds cleanly with GHC 9.10.
Docs
- bal: note that tree mode doesn't work in html output [#1846]
- bal: also mention hledger.css and text encoding in balance doc
- html: note safari text encoding issue
- timedot: mention the common journal+timedot file setup [#2238]
- Install, manual: new shell completions doc. [#986]
- Config files: rewrite [#2231]
Scripts/addons
API

View File

@ -233,6 +233,7 @@ Currently, empty cells show 0.
-}
{-# LANGUAGE CPP #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE RecordWildCards #-}
@ -272,7 +273,10 @@ import Control.Monad (guard)
import Data.Decimal (roundTo)
import Data.Default (def)
import Data.Function (on)
import Data.List (find, transpose, foldl')
import Data.List (find, transpose)
#if !MIN_VERSION_base(4,20,0)
import Data.List (foldl')
#endif
import qualified Data.Map as Map
import qualified Data.Set as S
import Data.Maybe (mapMaybe, fromMaybe)
@ -688,9 +692,10 @@ balanceReportAsSpreadsheet ::
balanceReportAsSpreadsheet opts (items, total) =
(if transpose_ opts then Ods.transpose else id) $
headers :
concatMap (\(a, _, _, b) -> rows Value a b) items ++
concatMap (rows Value) items ++
if no_total_ opts then []
else addTotalBorders $ rows Total totalRowHeadingSpreadsheet total
else addTotalBorders $
rows Total (totalRowHeadingSpreadsheet, totalRowHeadingSpreadsheet, 0, total)
where
cell = Ods.defaultCell
headers =
@ -699,14 +704,14 @@ balanceReportAsSpreadsheet opts (items, total) =
LayoutBare -> ["commodity", "balance"]
_ -> ["balance"]
rows ::
RowClass -> AccountName ->
MixedAmount -> [[Ods.Cell Ods.NumLines Text]]
rows rc name ma =
RowClass -> BalanceReportItem ->
[[Ods.Cell Ods.NumLines Text]]
rows rc (name, dispName, dep, ma) =
let accountCell =
setAccountAnchor
(guard (rc==Value) >> balance_base_url_ opts)
(querystring_ opts) name $
cell $ accountNameDrop (drop_ opts) name in
cell $ renderBalanceAcct opts nbsp (name, dispName, dep) in
addRowSpanHeader accountCell $
case layout_ opts of
LayoutBare ->
@ -803,7 +808,7 @@ multiBalanceReportAsSpreadsheetHelper ishtml opts@ReportOpts{..} (PeriodicReport
where acctName = prrFullName row
anchorCell =
setAccountAnchor balance_base_url_ querystring_ acctName $
accountCell $ accountNameDrop drop_ acctName
accountCell $ renderPeriodicAcct opts nbsp row
totalrows =
if no_total_
then []
@ -1048,7 +1053,7 @@ budgetReportAsText ropts@ReportOpts{..} budgetr = TB.toLazyText $
-- | Build a 'Table' from a multi-column balance report.
budgetReportAsTable :: ReportOpts -> BudgetReport -> Table Text Text WideBuilder
budgetReportAsTable ReportOpts{..} (PeriodicReport spans items totrow) =
budgetReportAsTable ropts@ReportOpts{..} (PeriodicReport spans items totrow) =
maybetransposetable $
addtotalrow $
Table
@ -1154,17 +1159,10 @@ budgetReportAsTable ReportOpts{..} (PeriodicReport spans items totrow) =
shownitems =
map (\i ->
let
addacctcolumn = map (\(cs, cvals) -> (renderacct i, cs, cvals))
addacctcolumn = map (\(cs, cvals) -> (renderPeriodicAcct ropts " " i, cs, cvals))
isunbudgetedrow = displayFull (prrName i) == unbudgetedAccountName
in addacctcolumn $ showrow isunbudgetedrow $ rowToBudgetCells i)
items
where
-- FIXME. Have to check explicitly for which to render here, since
-- budgetReport sets accountlistmode to ALTree. Find a principled way to do
-- this.
renderacct row = case accountlistmode_ of
ALTree -> T.replicate ((prrDepth row - 1)*2) " " <> prrDisplayName row
ALFlat -> accountNameDrop (drop_) $ prrFullName row
(totrowcs, totrowtexts) = unzip $ concat showntotrow
where
@ -1273,7 +1271,7 @@ budgetReportAsCsv ropts report
budgetReportAsSpreadsheet ::
ReportOpts -> BudgetReport -> [[Ods.Cell Ods.NumLines Text]]
budgetReportAsSpreadsheet
ReportOpts{..}
ropts@ReportOpts{..}
(PeriodicReport colspans items totrow)
= (if transpose_ then Ods.transpose else id) $
@ -1287,14 +1285,18 @@ budgetReportAsSpreadsheet
) :
-- account rows
concatMap (rowAsTexts Value prrFullName) items
concatMap (\row -> rowAsTexts Value (accountCell row) row) items
-- totals row
++ addTotalBorders
(concat [ rowAsTexts Total (const totalRowHeadingBudgetCsv) totrow | not no_total_ ])
(concat [ rowAsTexts Total (cell totalRowHeadingBudgetCsv) totrow | not no_total_ ])
where
cell = Ods.defaultCell
accountCell row =
let name = prrFullName row in
setAccountAnchor (balance_base_url_) querystring_ name $
cell $ renderPeriodicAcct ropts nbsp row
{-
ToDo: The chosen HTML cell class names are not put in stone.
If you find you need more systematic names,
@ -1306,16 +1308,18 @@ budgetReportAsSpreadsheet
maybe Ods.emptyCell (fmap wbToText . curry (cellFromMixedAmount oneLineNoCostFmt) cls) mval
rowAsTexts :: RowClass
-> (PeriodicReportRow a BudgetCell -> Text)
-> Ods.Cell Ods.NumLines Text
-> PeriodicReportRow a BudgetCell
-> [[Ods.Cell Ods.NumLines Text]]
rowAsTexts rc render row@(PeriodicReportRow _ as (rowtot,budgettot) (rowavg, budgetavg))
| layout_ /= LayoutBare = [accountCell : map showNorm vals]
| otherwise =
joinNames . zipWith (:) (map cell cs) -- add symbols and names
rowAsTexts rc acctCell (PeriodicReportRow _ as (rowtot,budgettot) (rowavg, budgetavg)) =
addRowSpanHeader acctCell $
case layout_ of
LayoutBare ->
zipWith (:) (map cell cs) -- add symbols
. transpose -- each row becomes a list of Text quantities
. map (map (fmap wbToText) . cellsFromMixedAmount dopts . second (fromMaybe nullmixedamt))
$ vals
_ -> [map showNorm vals]
where
cs = S.toList . mconcat . map maCommodities $ mapMaybe snd vals
dopts = oneLineNoCostFmt{displayCommodity=layout_ /= LayoutBare, displayCommodityOrder=Just cs, displayMinWidth=Nothing}
@ -1327,11 +1331,25 @@ budgetReportAsSpreadsheet
(budgetAverageClass rc, budgetavg)]
| average_]
joinNames = map (accountCell :)
accountCell =
let name = render row in
setAccountAnchor (guard (rc==Value) >> balance_base_url_)
querystring_ name (cell name)
nbsp :: Text
nbsp = "\160"
renderBalanceAcct ::
ReportOpts -> Text -> (AccountName, AccountName, Int) -> Text
renderBalanceAcct opts space (fullName, displayName, dep) =
case accountlistmode_ opts of
ALTree -> T.replicate ((dep - 1)*2) space <> displayName
ALFlat -> accountNameDrop (drop_ opts) fullName
-- FIXME. Have to check explicitly for which to render here, since
-- budgetReport sets accountlistmode to ALTree. Find a principled way to do
-- this.
renderPeriodicAcct ::
ReportOpts -> Text -> PeriodicReportRow DisplayName a -> Text
renderPeriodicAcct opts space row =
renderBalanceAcct opts space
(prrFullName row, prrDisplayName row, prrDepth row)
-- tests

View File

@ -1,3 +1,4 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE DeriveTraversable #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE OverloadedStrings #-}
@ -11,7 +12,10 @@ module Hledger.Cli.Commands.Rewrite (
where
import Data.Functor.Identity
import Data.List (sortOn, foldl')
import Data.List (sortOn)
#if !MIN_VERSION_base(4,20,0)
import Data.List (foldl')
#endif
import Data.Text (Text)
import qualified Data.Text as T
import qualified Data.Text.IO as T

View File

@ -1,3 +1,4 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE LambdaCase #-}
@ -14,7 +15,9 @@ module Hledger.Cli.CompoundBalanceCommand (
,compoundBalanceCommand
) where
#if !MIN_VERSION_base(4,20,0)
import Data.List (foldl')
#endif
import Data.Maybe (fromMaybe, mapMaybe)
import qualified Data.Text as T
import qualified Data.Text.Lazy as TL

View File

@ -156,7 +156,7 @@ library
, Diff >=0.2
, aeson >=1 && <2.3
, ansi-terminal >=0.9
, base >=4.14 && <4.20
, base >=4.14 && <4.21
, bytestring
, cmdargs >=0.10
, containers >=0.5.9
@ -212,7 +212,7 @@ executable hledger
Decimal >=0.5.1
, aeson >=1 && <2.3
, ansi-terminal >=0.9
, base >=4.14 && <4.20
, base >=4.14 && <4.21
, bytestring
, cmdargs >=0.10
, containers >=0.5.9
@ -267,7 +267,7 @@ test-suite unittest
Decimal >=0.5.1
, aeson >=1 && <2.3
, ansi-terminal >=0.9
, base >=4.14 && <4.20
, base >=4.14 && <4.21
, bytestring
, cmdargs >=0.10
, containers >=0.5.9
@ -319,7 +319,7 @@ benchmark bench
Decimal >=0.5.1
, aeson >=1 && <2.3
, ansi-terminal >=0.9
, base >=4.14 && <4.20
, base >=4.14 && <4.21
, bytestring
, cmdargs >=0.10
, containers >=0.5.9

View File

@ -115,7 +115,7 @@ ghc-options:
- -optP-Wno-nonportable-include-path
dependencies:
- base >=4.14 && <4.20
- base >=4.14 && <4.21
- hledger-lib >=1.40.99 && <1.41
- aeson >=1 && <2.3
- ansi-terminal >=0.9

View File

@ -26,6 +26,9 @@ and a test number (`1. `), useful for running individual tests.
A few tests invoke unix commands; these won't run in a Windows CMD shell.
2024-09-30 Note: tests of error output must use regexps for now to work
around ghc 9.10's extra newline in error output: https://gitlab.haskell.org/ghc/ghc/-/issues/25116
[Developer docs > TESTS]: https://hledger.org/TESTS.html
[component]: https://hledger.org/CONTRIBUTING.html#components
[shelltestrunner]: https://github.com/simonmichael/shelltestrunner#readme

View File

@ -774,14 +774,15 @@ if|account2|comment
%amount 150|acct2
%description Flubber|acct|
$ ./csvtest.sh
>2
hledger: Error: input.rules:6:1:
|
6 | %amount 150|acct2
| ^
>2 /hledger: Error: input.rules:6:1:
\|
6 \| %amount 150\|acct2
\| \^
line of conditional table should have 2 values, but this one has only 1
/
>=1
# XXX regex needed for error tests with ghc 9.10, https://gitlab.haskell.org/ghc/ghc/-/issues/25116
# ** 40. unindented condition block error
<
@ -796,15 +797,16 @@ if Flubber
account2 acct
comment cmt
$ ./csvtest.sh
>2
hledger: Error: input.rules:5:1:
|
5 | if Flubber
| ^
>2 /hledger: Error: input.rules:5:1:
\|
5 \| if Flubber
\| \^
start of conditional block found, but no assignment rules afterward
(assignment rules in a conditional block should be indented)
\(assignment rules in a conditional block should be indented\)
/
>=1
# XXX
# ** 41. Assignment to custom field (#1264) + spaces after the if (#1120)
<
@ -822,15 +824,16 @@ if Flubber
account2 %myaccount2
$ ./csvtest.sh
>2
hledger: Error: input.rules:6:3:
|
6 | myaccount2 acct
| ^^^^^^^^^^^^
>2 /hledger: Error: input.rules:6:3:
\|
6 \| myaccount2 acct
\| \^\^\^\^\^\^\^\^\^\^\^\^
unexpected "myaccount2 a"
expecting conditional block
/
>=1
# XXX
# ** 42. Rules override each other in the order listed in the file
<
@ -870,15 +873,16 @@ if account2 comment
%amount 150 acct2
%description Flubber acct
$ ./csvtest.sh
>2
hledger: Error: input.rules:5:1:
|
5 | if account2 comment
| ^
>2 /hledger: Error: input.rules:5:1:
\|
5 \| if account2 comment
\| \^
start of conditional block found, but no assignment rules afterward
(assignment rules in a conditional block should be indented)
\(assignment rules in a conditional block should be indented\)
/
>=1
# XXX
# ** 44. handle conditions with & operator
<

View File

@ -170,15 +170,16 @@ Balance changes in 2016-10-01..2017-01-31:
# ** 9. Parse error in malformed forecast period expression
$ hledger bal -M -b 2016-10 -e 2017-02 -f - --forecast=20160801-foobar
>
>2
hledger: Error: could not parse forecast period : 1:10:
|
1 | 20160801-foobar
| ^
>2 /hledger: Error: could not parse forecast period : 1:10:
\|
1 \| 20160801-foobar
\| \^
unexpected 'f'
expecting end of input
(use -h to see usage)
\(use -h to see usage\)
/
>=1
# XXX regex needed for error tests with ghc 9.10, https://gitlab.haskell.org/ghc/ghc/-/issues/25116
<
commodity 1,000.00 USD

View File

@ -73,30 +73,32 @@ Expenses:Food
account (a)
$ hledger -f- accounts
>2
hledger: Error: -:1:9:
|
1 | account (a)
| ^
unexpected '('
>2 /hledger: Error: -:1:9:
\|
1 \| account \(a\)
\| \^
unexpected '\('
expecting account name without brackets
/
>=1
# XXX regex needed for error tests with ghc 9.10, https://gitlab.haskell.org/ghc/ghc/-/issues/25116
# ** 6. It does not allow brackets in names.
<
account [a]
$ hledger -f- accounts
>2
hledger: Error: -:1:9:
|
1 | account [a]
| ^
unexpected '['
>2 /hledger: Error: -:1:9:
\|
1 \| account \[a\]
\| \^
unexpected '\['
expecting account name without brackets
/
>=1
# XXX regex needed for error tests with ghc 9.10, https://gitlab.haskell.org/ghc/ghc/-/issues/25116
# TODO
# a trailing : should give a clear error

View File

@ -6,15 +6,16 @@
2018
$ hledger -f - print
>2
hledger: Error: -:1:5:
|
1 | 2018
| ^
>2 /hledger: Error: -:1:5:
\|
1 \| 2018
\| \^
unexpected newline
expecting date separator or digit
/
>=1
# XXX regex needed for error tests with ghc 9.10, https://gitlab.haskell.org/ghc/ghc/-/issues/25116
# A journal with an unbalanced transaction.
<
@ -122,18 +123,17 @@ $ hledger -f- print
b 1B
$ hledger -f- print
>2
hledger: Error: -:1-3:
1 | 2020-01-01
| a 1A
| b 1B
>2 /hledger: Error: -:1-3:
1 \| 2020-01-01
\| a 1A
\| b 1B
This multi-commodity transaction is unbalanced.
The real postings all have the same sign. Consider negating some of them.
Consider adjusting this entry's amounts, adding missing postings,
or recording conversion price(s) with @, @@ or equity postings.
/
>=1
#'
# XXX regex needed for error tests with ghc 9.10, https://gitlab.haskell.org/ghc/ghc/-/issues/25116
# ** 12. Typical "hledger equity --close" transaction does not trigger sign error.
<

View File

@ -129,10 +129,11 @@ $ hledger -f - print expr:"not tag:transactiontag=B"
# ** 9. Having parentheses directly follow 'not' sees 'not' as part of a query.
$ hledger -f - print expr:"not(tag:transactiontag=B)"
>2
hledger: Error: This regular expression is invalid or unsupported, please correct it:
not(tag:transactiontag=B
>2 /hledger: Error: This regular expression is invalid or unsupported, please correct it:
not\(tag:transactiontag=B
/
>=1
# XXX regex needed for error tests with ghc 9.10, https://gitlab.haskell.org/ghc/ghc/-/issues/25116
# ** 10. ... whereas parentheses with a space between 'not' and '(' is fine.
$ hledger -f - print expr:"not (tag:transactiontag=B)"

View File

@ -236,10 +236,7 @@ $ hledger -f- roi -p 2019-11
Assets:Checking 101 A
Unrealized PnL
$ hledger -f- roi -p 2019-11 --inv Investment --pnl PnL
>2
hledger: Error: Amounts could not be converted to a single commodity: ["10 B","-9 B @@ 100 A","100 C"]
Consider using --value to force all costs to be in a single commodity.
For example, "--value=end,<commodity> --infer-market-prices", where commodity is the one that was used for investment valuations.
>2 /hledger: Error: Amounts could not be converted to a single commodity: \["10 B","-9 B @@ 100 A","100 C"\]/
>= 1
# ** 10. Forcing valuation via --value

View File

@ -1,6 +1,11 @@
# stack build plan using GHC 9.8.2
# stack build plan using GHC 9.10.1
# https://gitlab.haskell.org/ghc/ghc/-/wikis/migration/9.10
# https://downloads.haskell.org/ghc/9.10.1/docs/users_guide/9.10.1-notes.html
resolver: nightly-2024-09-26
compiler: ghc-9.10.1
notify-if-ghc-untested: false
notify-if-cabal-untested: false
packages:
- hledger-lib
@ -9,7 +14,27 @@ packages:
- hledger-web
extra-deps:
# needed only for dev builds when the ghcdebug flag is enabled:
- base-compat-0.14.0
- base-compat-batteries-0.14.0
# for hledger-lib
- Cabal-3.12.0.0
- Cabal-syntax-3.12.0.0
- directory-1.3.8.3@rev:3
- filepath-1.4.300.2
#- filepath-1.5.3.0 # not accepted for hledger-lib for some reason
- ghc-boot-9.10.1@rev:1
- process-1.6.24.0
- unix-2.8.5.1
# for windows
- Win32-2.14.0.0
- time-1.12.2
# for hledger
- haskeline-0.8.2.1
# to silence a warning
- wizards-1.0.3@rev:3
# for dev builds when the ghcdebug flag is enabled:
- ghc-debug-convention-0.6.0.0
- ghc-debug-stub-0.6.0.0

View File

@ -8,8 +8,21 @@ packages:
- hledger-ui
- hledger-web
# I give up, go with this for now
allow-newer: true
extra-deps:
- safe-0.3.21
- base-compat-0.14.0
# needed for the above:
- base-compat-batteries-0.14.0
- data-array-byte-0.1.0.1
- foldable1-classes-compat-0.1
- hashable-1.4.7.0
- OneTuple-0.4.2
# etc etc etc.
# for hledger-lib:
- doctest-0.20.0
- ansi-terminal-0.11.4
@ -19,6 +32,8 @@ extra-deps:
- text-builder-dev-0.3.3.2
- isomorphism-class-0.1.0.7
# for hledger:
# silence a warning
- wizards-1.0.3@rev:3
# for hledger-ui:
- brick-2.3.1
- bimap-0.5.0

37
stack9.8.yaml Normal file
View File

@ -0,0 +1,37 @@
# stack build plan using GHC 9.8.2
resolver: nightly-2024-09-26
packages:
- hledger-lib
- hledger
- hledger-ui
- hledger-web
extra-deps:
# needed only for dev builds when the ghcdebug flag is enabled:
- ghc-debug-convention-0.6.0.0
- ghc-debug-stub-0.6.0.0
nix:
pure: false
packages: [perl gmp ncurses zlib]
# ghc-options:
# "$locals": -Wno-x-partial
# "$locals": -fplugin Debug.Breakpoint
# # for precise profiling, per https://www.tweag.io/posts/2020-01-30-haskell-profiling.html:
# # apply-ghc-options: everything
# # rebuild-ghc-options: true
# # stack build --profile --ghc-options="-fno-prof-auto"
# # tell GHC to write hie files, eg for weeder. Rumoured to be slow.
# # ghc-options:
# # "$locals": -fwrite-ide-info
# # ghc-options:
# # "$locals": -ddump-timings
# # "$targets": -Werror
# # "$everything": -O2
# # some-package: -DSOME_CPP_FLAG