hledger/hledger-lib/Hledger/Data
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
..
JournalChecks dev: switch all qualifed imports to ImportQualifiedPost style 2025-09-29 19:28:59 -10:00
Account.hs fix:PeriodData: use Integer keys to avoid date wraparound bugs [#2479] 2025-10-11 11:27:58 -10:00
AccountName.hs dev: switch all qualifed imports to ImportQualifiedPost style 2025-09-29 19:28:59 -10:00
Amount.hs dev: switch all qualifed imports to ImportQualifiedPost style 2025-09-29 19:28:59 -10:00
BalanceData.hs !dev: lib: Allow Account to store date-indexed balances. 2025-06-04 23:10:00 -10:00
Balancing.hs dev: switch all qualifed imports to ImportQualifiedPost style 2025-09-29 19:28:59 -10:00
Currency.hs dev: switch all qualifed imports to ImportQualifiedPost style 2025-09-29 19:28:59 -10:00
Dates.hs dev!: lib: Refactor splitSpan to return Maybe DayPartition. 2025-10-09 15:31:28 -10:00
DayPartition.hs fix:PeriodData: use Integer keys to avoid date wraparound bugs [#2479] 2025-10-11 11:27:58 -10:00
Errors.hs dev: switch all qualifed imports to ImportQualifiedPost style 2025-09-29 19:28:59 -10:00
Journal.hs dev:Hledger.Data.Journal: fix a recent ghc 9.6 / old base breakage 2025-09-29 19:31:49 -10:00
JournalChecks.hs fix:check accounts: don't garble non-ascii account names in errors [#2469] 2025-10-01 14:40:08 -10:00
Json.hs fix:PeriodData: use Integer keys to avoid date wraparound bugs [#2479] 2025-10-11 11:27:58 -10:00
Ledger.hs dev: switch all qualifed imports to ImportQualifiedPost style 2025-09-29 19:28:59 -10:00
Period.hs dev: switch all qualifed imports to ImportQualifiedPost style 2025-09-29 19:28:59 -10:00
PeriodData.hs fix:PeriodData: use Integer keys to avoid date wraparound bugs [#2479] 2025-10-11 11:27:58 -10:00
PeriodicTransaction.hs dev!: lib: Refactor splitSpan to return Maybe DayPartition. 2025-10-09 15:31:28 -10:00
Posting.hs dev: switch all qualifed imports to ImportQualifiedPost style 2025-09-29 19:28:59 -10:00
RawOptions.hs lib: add dropRawOpt, cliOptsDropArgs 2025-01-21 22:02:05 -10:00
StringFormat.hs dev: switch all qualifed imports to ImportQualifiedPost style 2025-09-29 19:28:59 -10:00
Timeclock.hs dev: switch all qualifed imports to ImportQualifiedPost style 2025-09-29 19:28:59 -10:00
Transaction.hs dev: switch all qualifed imports to ImportQualifiedPost style 2025-09-29 19:28:59 -10:00
TransactionModifier.hs dev: switch all qualifed imports to ImportQualifiedPost style 2025-09-29 19:28:59 -10:00
Types.hs fix:PeriodData: use Integer keys to avoid date wraparound bugs [#2479] 2025-10-11 11:27:58 -10:00
Valuation.hs dev: switch all qualifed imports to ImportQualifiedPost style 2025-09-29 19:28:59 -10:00