hledger/hledger-lib/Hledger/Reports
Simon Michael 438c4a0469 fix:PeriodData: use Integer keys to avoid date wraparound bugs [#2479]
PeriodData's use of Int keys caused wrong results with periodic
reports involving dates outside the machine-specific limits of Int.
Those were:

64 bits: -25252734927764696-04-22..25252734927768413-06-12
32 bits: -5877752-05-08..5881469-05-27
16 bits:  1769-02-28..1948-08-04
 8 bits:  1858-07-12..1859-03-24

32 bits is supported by MicroHS; 16 and 8 bits aren't supported by
any known haskell version, but that could change in future.

For example, on 64 bit machines we got:

25252734927768413-06-12 PeriodData's max date
   (expenses)   1

25252734927768414-01-01 next year past PeriodData's max date
   (expenses)   2

$ hledger reg -O csv --yearly
"txnidx","date","code","description","account","amount","total"
"0","-25252734927764696-11-10","","","expenses","1","1"

Now it uses Integer (like the time package), fixing the bug.
And benchmarking shows memory and time usage slightly improved
(surprisingly; tested with up to 500 subperiods, eg
hledger -f examples/10ktxns-1kaccts.journal reg -1 cur:A -D >/dev/null)
2025-10-11 11:27:58 -10:00
..
AccountTransactionsReport.hs dev: switch all qualifed imports to ImportQualifiedPost style 2025-09-29 19:28:59 -10:00
BalanceReport.hs imp: queries: Allow regular expression depth queries 2024-12-03 08:33:21 -10:00
BudgetReport.hs dev!: balance: Use DayPartition for multibalance reports. 2025-10-09 15:31:28 -10:00
EntriesReport.hs imp:print: support --invert [#2314] 2025-01-27 05:21:36 -10:00
MultiBalanceReport.hs fix:PeriodData: use Integer keys to avoid date wraparound bugs [#2479] 2025-10-11 11:27:58 -10:00
PostingsReport.hs dev!: balance: Use DayPartition for multibalance reports. 2025-10-09 15:31:28 -10:00
ReportOptions.hs ;dev: lookupDayPartition -> dayPartitionFind 2025-10-11 11:02:18 -10:00
ReportTypes.hs dev: switch all qualifed imports to ImportQualifiedPost style 2025-09-29 19:28:59 -10:00