Skip to content

Fix build with crypton; revive doctests; resolve #2 - #9

Merged
puffnfresh merged 8 commits into
puffnfresh:masterfrom
ulidtko:v0.12
Sep 25, 2026
Merged

puffnfresh merged 8 commits into
puffnfresh:masterfrom
ulidtko:v0.12

Conversation

@ulidtko

@ulidtko ulidtko commented Feb 20, 2026

Copy link
Copy Markdown
Contributor

Hi Brian @puffnfresh !

I was looking into what'd be needed to get "the" haskell jwt library 😃 back into Stackage LTS snapshots. Ended up with this maintenance patch series. 👀 Please review.

Apologies for piling up several things together; one thing led to another... The overall PR came out not that large, hoping won't be a big hassle to approve for merging.

On top of individual commit messages, some higher-level bullet points for context:

This means jwt is finally in good position to adopt +use_crypton, as the blocker hinted at in #8 is now resolved.

I took this deep-dive as opportunity to do a check-up on the doctests as well — which led to reverting 4390e2e and a few other minor changes. In particular, #2 becomes resolved by accident. Doctests do run and pass. ✅

One of the minor changes was dropping aeson <2 — its v2 is fairly mature by now, released 5 years ago, and has had good adoption in many packages across the ecosystem. LMK if you'd like to support aeson v1 anyway; I'll try to see what can be done to force CPP + doctests into good neighborship.

Resolves #2.
Supersedes #3.
Continues #5 and #8.

Since aeson 2.0.0.0 (~2021), its KeyMap is indexed by separate type Key
-- no longer by Text.

This commit then fixes typecheck error in tests:

> tests/src/Web/JWTInteropTests.hs:59:38: error: [GHC-83865]
>     • Couldn't match expected type ‘Key’ with actual type ‘T.Text’
>     • In the first argument of ‘key’, namely ‘key'’
>       In the second argument of ‘(^?)’, namely ‘key key'’
>       In the expression: toJSON claims' ^? key key'
>    |
> 59 |     let json = toJSON claims' ^? key key'
>    |                                      ^^^^

And correspondignly, the test can no longer build with aeson-v1; thus
the version requirement bump.
Aeson 2 has been released 5 years ago.

The MIN_VERSION_aeson CPP macros are presenting extra hurdles to doctests.
This reverts commit 4390e2e.

`cabal repl --with-compiler=doctest` is currently _the_ recommended
approach to invoke doctest from CI.

Other approaches hit various complications with dependencies (e.g.
doctest of the main JWT module requires importable crypton and others),
or are not yet mature enough (the `cabal doctest` command requires
fairly fresh cabal-install 3.12).

With this, `cabal test test:doctests` fails only 2 examples, not all 8.
@marinelli

Copy link
Copy Markdown

Kudos to @ocheron for handling the new package release 🎉

@puffnfresh
puffnfresh merged commit 7d93b94 into puffnfresh:master Sep 25, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

JWT hashes change between dependency changes

3 participants