Skip to content

Replace lens with microlens{,-mtl,-th}#323

Draft
langston-barrett wants to merge 1 commit intomasterfrom
microlens
Draft

Replace lens with microlens{,-mtl,-th}#323
langston-barrett wants to merge 1 commit intomasterfrom
microlens

Conversation

@langston-barrett
Copy link
Contributor

The motivation is that lens has many, many (transitive) dependencies. This leads to:

  • Slow build times (the microlens README claims that it compiles in 3.5s whereas lens takes 4m10s)
  • Longer GHC upgrade latency (we have to wait until all of lens's dependencies support a new GHC version)
  • Smaller GHC support windows (our GHC support window is limited by that of all of our transitive dependencies)
  • Supply chain risks such as lack of maintenance and even supply chain attacks (see recent NPM attacks)

This currently depends on GaloisInc/parameterized-utils#208, it should wait until that PR is merged and released.

The motivation is that `lens` has many, many (transitive) dependencies.
This leads to:

- Slow build times (the `microlens` README claims that it compiles in
  3.5s whereas `lens` takes  4m10s)
- Longer GHC upgrade latency (we have to wait until all of `lens`'s
  dependencies support a new GHC version)
- Smaller GHC support windows (our GHC support window is limited by that
  of all of our transitive dependencies)
- Supply chain risks such as lack of maintenance and even supply chain
  attacks (see recent NPM attacks)
@langston-barrett
Copy link
Contributor Author

Hmm, the build succeeds for me locally, and the error message barely mentions microlens...

@RyanGlScott
Copy link
Contributor

That error message is confusing indeed. It turns out that this happens because one of the test suites depends on singletons-th (via units), and its transitive constraints on th-abstraction conflict with microlens-pro's lower version bounds on th-abstraction. Specifically:

  • singletons-th-3.1.1 requires th-desugar-1.14.*, which in turn requires th-abstraction-0.4.*.
  • All releases of microlens-pro require th-abstraction-0.6 or later.

To see this a bit more easily:

$ cabal -v0 build what4 --enable-tests -fdRealTestDisable -fsolverTests --minimize-conflict-set --constraint="singletons-th==3.1.1" --constraint="th-desugar==1.14.*" --constraint="th-abstraction==0.4.*"
Error: [Cabal-7107]
Could not resolve dependencies:
[__0] trying: parameterized-utils-2.2.0.0 (user goal)
[__1] next goal: th-abstraction (dependency of parameterized-utils)
[__1] rejecting: th-abstraction; 0.7.2.0, 0.7.1.0, 0.7.0.0, 0.6.0.0, 0.5.0.0 (constraint from command line flag requires >=0.4 && <0.5)
[__1] trying: th-abstraction-0.4.5.0
[__2] next goal: microlens-pro (dependency of parameterized-utils)
[__2] rejecting: microlens-pro-0.2.0.5 (conflict: th-abstraction==0.4.5.0, microlens-pro => th-abstraction>=0.6.0 && <0.8)
[__2] skipping: microlens-pro; 0.2.0.4, 0.2.0.3, 0.2.0.2, 0.2.0.1, 0.2.0, 0.1.0 (has the same characteristics that caused the previous version to fail: excludes 'th-abstraction' version 0.4.5.0)
[__2] fail (backjumping, conflict set: microlens-pro, parameterized-utils, th-abstraction)
After searching the rest of the dependency tree exhaustively, these were the goals I've had most trouble fulfilling: th-abstraction, microlens-pro, parameterized-utils

@langston-barrett
Copy link
Contributor Author

langston-barrett commented Jan 23, 2026

Ah, well perhaps this would be fixed by the next release of parameterized-utils, which drops the dependency on microlens-pro then.

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.

2 participants