Commit Graph

473 Commits

Author SHA1 Message Date
Simon Michael
b59bce2137 ;cabal: update cabal files 2025-12-05 01:10:17 -10:00
Stephen Morgan
b9caa4d948 dev!: balance: Use DayPartition for multibalance reports.
This allows us to guarantee that the report periods are well-formed and
don't contain errors (e.g. empty spans, spans not contiguous, spans not
a partition).

Note the underlying representation is now for disjoint spans, whereas
previously the end date of a span was equal to the start date of the
next span, and then was adjusted backwards one day when needed.
2025-10-09 15:31:28 -10:00
Simon Michael
e10f51e3ae ;cabal: update cabal files 2025-09-29 19:12:00 -10:00
Simon Michael
19620ba61b ;pkg:lib: make hashtables bounds consistent in cabal file 2025-09-21 11:44:06 -07:00
hseg
240757b259
Avoid hashtables 1.3.x for best gcc compatibility [#2463]
* Forbid solving for hashtables 1.3

On modern gccs, this sometimes causes build failures, see
https://github.com/gregorycollins/hashtables/issues/97

* Propagate constraint to package.yaml too

* stack98: include valid hashtables version

* stack92: add valid hashtables version

* stack94: add valid hashtables version

* stack96: add valid hashtables version
2025-09-21 11:41:57 -07:00
Simon Michael
8c4e2e08b6 ;cabal: update cabal files 2025-09-13 06:57:22 +01:00
Simon Michael
8be3e85676 ;cabal: update cabal files 2025-09-03 20:22:40 +01:00
Simon Michael
dc84d54ae1 ;cabal: update cabal files 2025-09-03 20:07:41 +01:00
Stephen Morgan
80cf1d1995 !dev: lib: Allow Account to store date-indexed balances.
This upgrades Account to enable it to store a multiperiod balance, with
a separate balance for each date period. This enables it do the hard
work in MultiBalanceReport.

Some new types are created to enable convenient operation of accounts.
- `BalanceData` is a type which stores an exclusive balance, inclusive
  balance, and number of postings. This was previously directly stored
  in Account, but is now factored into a separate data type.
- `PeriodData` is a container which stores date-indexed data, as well as
  pre-period data. In post cases, this represents the report spans,
  along with the historical data.
- Account becomes polymorphic, allowing customisation of the type of
  data it stores. This will usually be `BalanceData`, but in
  `BudgetReport` it can use `These BalanceData BalanceData` to store
  both actuals and budgets in the same structure. The data structure
  changes to contain a `PeriodData`, allowing multiperiod accounts.

Some minor changes are made to behaviour for consistency:
- --declared treats parent accounts consistently.
- --flat --empty ensures that implied accounts with no postings are not displayed, but
  accounts with zero balance and actual postings are.
2025-06-04 23:10:00 -10:00
Simon Michael
af9822a60a ;cabal: update cabal files 2025-06-04 07:31:13 -10:00
Simon Michael
c2972b3d5d ;pkg: update tested-with 2025-06-03 18:44:40 -10:00
Simon Michael
9b6d3da677 ;cabal: update cabal files 2025-04-09 10:58:54 -10:00
Simon Michael
8d1a8d3799 ;cabal: update cabal files 2025-03-31 17:40:30 -10:00
Simon Michael
775507c2d4 ;pkg:cabal: specify GPLv3+ exactly; require cabal 2.2+ [#2359]
Previously our cabal files used cabal-version 1.12, and were in theory
buildable with any ancient version of cabal.  Now at least cabal 2.2
(or a version of stack built with with similar Cabal version) is
required to build hledger.
2025-03-31 16:55:36 -10:00
Simon Michael
b6ec245647 ;cabal: update cabal files 2025-03-31 16:33:50 -10:00
Thomas Miedema
e7cc2f1066 ;dev: lib: drop base-compat dependency 2025-03-31 16:21:38 -10:00
Thomas Miedema
bf3d1b6b49 ;dev: extra >= 1.7.11 is required
Commit ff28aa32 introduced usage of Data.List.Extra.groupOnKey, which
first came with extra-1.7.11.

Fixes stack8.10.yaml build hopefully.
2025-03-31 16:18:09 -10:00
Simon Michael
4e5506da1e ;cabal: update cabal files 2025-03-07 18:49:08 -10:00
Thomas Miedema
5129a94bd7
;cln: unittest.hs: remove bothersome PackageImports (#2337)
When running `cd hledger-lib && ghci test/unittest.hs`, ghci complains
with:

```
  test/unittest.hs:7:1: error:
      Could not find module ‘Hledger’
      It is not a module in the current program, or in any known package.
    |
  7 | import "hledger-lib" Hledger (tests_Hledger)
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  Failed, no modules loaded.
```

This commit removes the "hledger-lib" package-qualified import, such
that above ghci command works as expected.

However, there is a comment in hledger-lib/test/unittest.hs that says:

> package-qualified import to avoid cabal missing-home-modules warning
> (and double-building ?)

The missing-home-modules warning and the double building can indeed be
reproduced by running (after removing the "hledger-lib"
package-qualified import): `cd hledger-lib && cabal build unittest`. It
will first build `hledger-lib`, then show a warning about
missing-home-modules, and then build `hledger-lib` again.

After comparing the unittest sections of hledger.cabal and
hledger-lib.cabal, the solution turned out to be to remove `./` from
hs-source-dirs for unittest. Don't ask me why though!

Overall it's a nice cleanup.
2025-02-26 11:54:59 -10:00
Joschua Kesper
5114962b2a feat:csv: add an encoding rule, allowing non-UTF8 CSV to be read [#2319]
Previously, hledger could read CSV files containing non-ascii
characters only if they are UTF8-encoded.  Now there is a new CSV
rule, encoding ENCODING, which allows reading CSV files with other
encodings.

This adds a dependency on the encoding library, which supports fewer
encodings than text-icu but does not require a third-party C library.
To avoid build issues on various platforms, we require version 0.10+.

This adds some use of the ImplicitParams language extension, required
by encoding's API, but only in a small code region.

This also changes the type of Reader's rReadFn; it now takes
a `Handle` rather than a `Text`, allowing more flexibility.
2025-02-15 14:48:30 -10:00
Simon Michael
29885d15fa dev: refactor Hledger.Write.Html etc, reducing Lucid references
Clarify the HTML lib situation a bit, and clean up some imports.

Related: #2244
2025-01-25 11:53:51 -10:00
Simon Michael
f2cb3cd023 ;cabal: update cabal files 2024-12-09 17:58:25 -10:00
Simon Michael
fd9c64a4ad pkg: allow megaparsec 9.7 [stackage#7585] 2024-12-03 08:46:29 -10:00
Simon Michael
75ff6c8218 ;cabal: update cabal files 2024-11-02 08:42:10 -10:00
Simon Michael
30086ae249 imp: run pager more robustly; drop pager lib [#2272]
This fixes the error displayed when quitting the pager with long output.
It also replaces the pager lib with more robust homegrown pager utilities,
which should prevent a number of failure modes.
2024-10-31 18:55:09 -10:00
Simon Michael
50bf401ea6 dev: split debug/ghcdebug flags, comment out the latter for now
Compilation with ghc-debug is failing, and it has not yet been used
for anything. Separate the flag and leave it in place but commented for now.
2024-10-24 10:44:28 -10:00
Simon Michael
5bf48d721a cabal: update cabal files 2024-10-19 18:50:40 -10:00
Simon Michael
db748465a8 fix📟 when the $PAGER is not in PATH, print instead of failing 2024-10-19 16:28:36 -10:00
Simon Michael
4eff3ed8a0 ;cabal: update cabal files 2024-10-11 14:56:03 -10:00
Simon Michael
5f92fbd99a ;cabal: update cabal files 2024-10-10 23:25:07 -10:00
Simon Michael
1c45496f1c dev: web: fix build with ghc <9.2 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
2cbea889f5 dev: lib: fix package.yaml, regen .cabal [#2244] 2024-09-29 13:27:51 -10:00
Henning Thielemann
2f9a8031b0 lib: Write.Html -> Write.Html.Lucid
Write.Html: keep common definitions for both HTML backends
2024-09-29 13:27:51 -10:00
Henning Thielemann
cc7e034d64 lib: Write.Html.Blaze: alternative to Lucid based export
for compatibility with hledger-web/yesod
2024-09-29 13:27:51 -10:00
Henning Thielemann
6ce6c72fd4 lib: Write.Html.Attributes: extracted HTML output helpers from Cli.Commands.Balance 2024-09-24 22:51:30 -10:00
Simon Michael
27e6eb0024 ;cabal: update cabal files 2024-09-09 14:06:06 -07:00
Simon Michael
dda3855ba2 ;cabal: update cabal files 2024-09-09 14:04:43 -07:00
Michael Rees
b4a9f87fe4 Move SortSpec to Hledger.Reports.ReportOptions
As part of this migration, I also switched from using Data.List.splitOn
to Hledger.Utils.splitAtElement.
2024-09-05 11:56:07 +01:00
Michael Rees
00eb0aa16b feat: register: add --sort as in ledger 2024-09-05 11:56:07 +01:00
Simon Michael
6fc117fa15 ;cabal: update cabal files [#2213] 2024-08-29 23:20:39 +01:00
Henning Thielemann
f306df6d61 imp: lib: Write.Html: use Lucid to generate HTML 2024-08-16 16:57:38 +02:00
Henning Thielemann
8c42a735c2 cli: lib: Write.Spreadsheet: common data types for Write.Ods and Write.Html
Write.Html: write spreadsheet data to a HTML table

enables HTML export for the balance command
2024-08-16 16:57:38 +02:00
Henning Thielemann
0e158d0c3e cli: lib: Hledger.Write.Ods: basic support for FODS export
used in Commands.Balance
2024-08-16 16:57:38 +02:00
Henning Thielemann
14b5a1f82a imp: Hledger.Read.CsvUtils -> Write.Csv 2024-08-16 16:57:38 +02:00
Simon Michael
4175dc50ac ;cabal: update cabal files 2024-06-25 18:37:54 +01:00
Simon Michael
d18c00e1ec ;cabal: update cabal files 2024-06-01 13:30:21 -10:00
Simon Michael
7525014c7d ;cabal: update cabal files 2024-05-01 23:04:18 -10:00
Simon Michael
929f050c43 ;cabal: update cabal files 2024-05-01 16:21:13 -10:00
Simon Michael
f59cb5ff3c ;cabal: update cabal files 2024-04-18 13:33:43 -10:00