-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add compatibility shims for TypeAbstractions
in GHC 9.8
#104
Conversation
Does not build with GHC 9.9.20230703, is this expected?
|
This is expected—at least for the time being. GHC's This should be addressed once https://gitlab.haskell.org/ghc/ghc/-/merge_requests/10936 lands in GHC's |
GHC 9.8 implements [GHC proposal #425](https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0425-decl-invis-binders.rst), which adds support for invisible binders for type-level declarations. This impacts Template Haskell, as various `TyVarBndr`s are now parameterized by a new `BndrVis` type instead of `()`. As such, `th-abstraction` must be updated accordingly. This patch does so by: * Backporting `BndrVis` to `Language.Haskell.TH.Datatype.TyVarBndr`, as well as related types and utility functions. With these changes, one can write `BndrVis`-related code that will compile on all GHC versions without CPP. * Changing `dataDCompat` and `newtypeDCompat` in `Language.Haskell.TH.Datatype` to use `TyVarBndrVis` instead of `TyVarBndrUnit` to make it compile on GHC 9.8, matching similar changes in `DataD` and `NewtypeD` in `template-haskell`. Because `BndrVis` is a synonym for `()` on pre-9.8 versions of GHC, this change is unlikely to break any existing code, but do be aware of this change if you write code that needs to support GHC 9.8 or later. See the `th-abstraction` changelog for the full details. Fixes #103.
a331459
to
0b8e0c4
Compare
Just looking at this - is there any intention to change the type of |
No, I intentionally did not change data family D a
data instance D (Either a b) = MkD Then when you call For this reason, I opted not to change that part of the API. |
@RyanGlScott I have some code:
that compiled with
So it seems that |
You can convert the |
So close:
|
|
Awesome. Thanks @RyanGlScott ! |
GHC 9.8 implements GHC proposal #425, which adds support for invisible binders for type-level declarations. This impacts Template Haskell, as various
TyVarBndr
s are now parameterized by a newBndrVis
type instead of()
.As such,
th-abstraction
must be updated accordingly. This patch does so by:Backporting
BndrVis
toLanguage.Haskell.TH.Datatype.TyVarBndr
, as well as related types and utility functions. With these changes, one can writeBndrVis
-related code that will compile on all GHC versions without CPP.Changing
dataDCompat
andnewtypeDCompat
inLanguage.Haskell.TH.Datatype
to useTyVarBndrVis
instead ofTyVarBndrUnit
to make it compile on GHC 9.8, matching similar changes inDataD
andNewtypeD
intemplate-haskell
. BecauseBndrVis
is a synonym for()
on pre-9.8 versions of GHC, this change is unlikely to break any existing code, but do be aware of this change if you write code that needs to support GHC 9.8 or later.See the
th-abstraction
changelog for the full details.Fixes #103.