Commit Graph

313 Commits

Author SHA1 Message Date
Simon Michael
525f3e76e3 pkg: package.yaml files cleanup, consistency 2025-09-29 19:08:50 -10:00
Simon Michael
64832c65e8 ;dev: build everything with at least GHC2021 language extensions by default
Previously everything was built with hpack's default, which is Haskell2010.
2025-09-29 18:27:19 -10: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
7ee721eab0 ;pkg: set version to 1.50.99 2025-09-03 20:22:40 +01:00
Simon Michael
80e659b51c ;pkg: bump minimum supported GHC from 8.10.7 to 9.6 (and base 4.18)
System.IO.hGetContents' was the latest paper cut; I could keep
supporting ghc 8.10.7, or at least 9.0-9.4, released 2021-2023;
but feck it. Debian Stable has 9.6 and this time can be better spent.
2025-09-03 20:02:59 +01:00
Simon Michael
4f03d22501 ;pkg: update tested-with 2025-09-03 20:00:16 +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
a0a539cb66 ;pkg: set version to 1.43.99 2025-06-04 07:31:12 -10:00
Simon Michael
c2972b3d5d ;pkg: update tested-with 2025-06-03 18:44:40 -10:00
Simon Michael
ee3b6c29ce ;pkg: allow ghc 9.12 2025-04-09 10:58:52 -10:00
Simon Michael
ed6cef5c00 ;pkg: clean up package.yaml files
Consistent layout.
Group metadata at the top in similar order to `cabal format`.
2025-03-31 17:25:41 -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
cb6a9b2f97 ;pkg:cabal: update tested-with in all package.yamls 2025-03-31 16:27:40 -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
10c523c057 ;pkg: set version to 1.42.99 2025-03-07 18:49:07 -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
20f1f51a9d ;pkg: set version to 1.41.99 2024-12-09 17:58:24 -10:00
Simon Michael
fd9c64a4ad pkg: allow megaparsec 9.7 [stackage#7585] 2024-12-03 08:46:29 -10:00
Simon Michael
657fc1551f !fix: respect --color=yes in a few places that didn't; drop text-ansi dep
Hledger.Utils.IO's ansi style/color helpers now respect --color=yes,
so that eg `hledger --color=yes | less -R` shows bold headings as
you'd expect.

Hledger.Utils.IO.rgb' now takes Float arguments instead of Word8.
2024-11-01 10:40:25 -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
7325b75d5b imp: rename ghcdebug build flag to debug, and enable stack traces with it
Builds made with ghc 9.10+ and the 'debug' build flag, will show
(some kind of, partial) stack traces when the program ends with an
error. (And also will have ghc-debug support enabled.)

The stack traces will probably improve in due course.
2024-10-19 18:47:03 -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
6dd9c92d32 lib: add Hledger.Data.Currency, currencySymbolToCode, currencyCodeToSymbol 2024-10-11 14:56:03 -10:00
Simon Michael
66fce53c0b dev: extract beancount output helpers to Hledger.Write.Beancount 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
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
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
c079725836 ;pkg: bump version to 1.40.99 2024-09-09 14:06:06 -07:00
Simon Michael
eaa494a4cb ;pkg: allow doclayout 0.5 2024-09-09 14:04:43 -07: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
aec28842c7 ;pkg: bump version to 1.34.99 2024-06-01 13:30:20 -10:00
Simon Michael
8d62af8ae0 imp: Revert problematic process-1.6.19.0 bound, it seems not strictly needed [#2149] 2024-05-01 23:04:08 -10:00
Simon Michael
96caa8f352 fix: detect ghc-debug support more accurately, checking hledger-lib also 2024-05-01 15:27:42 -10:00
Simon Michael
f5c4d99291 ;pkg: bump version to 1.33.99 2024-04-18 13:33:42 -10:00
Simon Michael
e4cbd88367 ;pkg:lib: disable doctests for now to allow use of process-1.6.19.0 2024-04-11 11:14:46 -10:00
Simon Michael
3798a3baef pkg: require safe >=0.3.20, for ghc 9.8 head/tail helpers 2024-02-28 14:39:53 -10:00
Simon Michael
2a99b3d456 imp: stack: build with ghc 9.8, latest stackage nightly 2024-01-04 08:24:50 -10:00
Simon Michael
a3290bfaeb pkg: allow megaparsec 9.6* 2023-12-14 08:57:42 -10:00
Simon Michael
80d1da2db9 ;pkg: bump version to 1.32.99 2023-12-02 09:09:07 -10:00
Simon Michael
e2cc2d7e24 feat:print: add a basic beancount output format
This prints journal output more likely (but not guaranteed) to
be readable by Beancount.

All packages now require text 1.2.4.1 or greater.
2023-11-22 22:57:36 -10:00