Skip to content

Switch from template-haskell to template-haskell-lift#717

Open
TeofilC wants to merge 1 commit intohaskell:masterfrom
TeofilC:wip/th-lift
Open

Switch from template-haskell to template-haskell-lift#717
TeofilC wants to merge 1 commit intohaskell:masterfrom
TeofilC:wip/th-lift

Conversation

@TeofilC
Copy link

@TeofilC TeofilC commented Oct 10, 2025

We switch our dependency on template-haskell to a dependency on template-haskell-lift. This smaller library is more stabler. If we can remove the template-haskell dependency from all boot libraries then template-haskell will be much easier to re-install since it no longer needs to be in GHC's dependency closure.

For more information see the GHC proposal that introduced this library: ghc-proposals/ghc-proposals#696

This GHC MR tests this PR against GHC-HEAD: https://gitlab.haskell.o

@TeofilC TeofilC changed the title Wip/th lift Switch from template-haskell to template-haskell-lift Oct 10, 2025
@TeofilC TeofilC force-pushed the wip/th-lift branch 4 times, most recently from 54ef253 to d85e62d Compare October 10, 2025 17:40
@Bodigrim
Copy link
Contributor

We strive for new releases to be backportable to older GHC major series, which do not yet have template-haskell-lift as a boot library. To keep it possible, I imagine you need something like

if impl(ghc>9.15)
  build-depends: template-haskell-lift
else 
  build-depends: template-haskell 

@TeofilC
Copy link
Author

TeofilC commented Oct 10, 2025

Good point. template-haskell-lift itself is buildable with older major versions (where it just re exports tenplate-haskell) but unless we backport it as a boot library to those versions then indeed you wouldn't be able to use the new bytestring as a boot library.

I'll implement what you suggest

@TeofilC TeofilC force-pushed the wip/th-lift branch 3 times, most recently from e1fb704 to 800ee4c Compare October 12, 2025 11:22
@Bodigrim
Copy link
Contributor

@TeofilC please rebase.

@Bodigrim
Copy link
Contributor

@TeofilC could you please raise a draft GHC MR, which updates bytestring submodule to your commit? Otherwise I cannot test it.

@TeofilC TeofilC force-pushed the wip/th-lift branch 2 times, most recently from afc9dd0 to 99ec2e9 Compare October 16, 2025 22:58
@TeofilC
Copy link
Author

TeofilC commented Jan 10, 2026

Since I last looked at this, bytestring has gained a dependency on liftCode. This is not exposed by template-haskell-lift, so for now this PR is stalled.

This shows a gap in the interface of template-haskell-lift. Exporting unsafeCodeCoerce from template-haskell-lift should allow this code to be written. I didn't spot this when designing the interface since so few people use the typed TH API, but this is a reasonable thing to want.

@TeofilC
Copy link
Author

TeofilC commented Jan 10, 2026

Actually we can just use error and we get a similar message!

@TeofilC TeofilC force-pushed the wip/th-lift branch 3 times, most recently from 1d486d1 to 754b7a7 Compare January 10, 2026 21:23
This new boot library should be more stable than template-haskell and
should eventually allow us to remove much of the CPP around TH.

It will also make it easier for end-users to reinstall template-haskell
as it will no longer be used by any boot libraries
@TeofilC
Copy link
Author

TeofilC commented Jan 10, 2026

Not sure about the CI failure on 9.0. I can't reproduce it locally

@TeofilC TeofilC marked this pull request as ready for review January 10, 2026 22:14
@Bodigrim
Copy link
Contributor

Not sure about the CI failure on 9.0. I can't reproduce it locally

It's unrelated to your changes, I have the same failure in #718 (comment).

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