Skip to content

Commit

Permalink
v0.12.0.0 with GHC 9.12 support
Browse files Browse the repository at this point in the history
  • Loading branch information
sheaf committed Oct 21, 2024
1 parent 74489d7 commit 520be16
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 15 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,16 @@ jobs:
strategy:
matrix:
cfg:
- { os: ubuntu-latest , ghc: "9.10.1" }
- { os: ubuntu-latest , ghc: "9.8.2" }
- { os: ubuntu-latest , ghc: "9.6.2" }
- { os: ubuntu-latest , ghc: "9.4.7" }
- { os: ubuntu-latest , ghc: "9.2.8" }
- { os: ubuntu-latest , ghc: "9.2.3" }
- { os: ubuntu-latest , ghc: "9.0.2" }
- { os: ubuntu-latest , ghc: "8.10.7" }
- { os: ubuntu-latest , ghc: "8.8.4" }
- { os: macOS-latest , ghc: "9.6.2" }
- { os: windows-latest , ghc: "9.6.2" }
- { os: macOS-latest , ghc: "9.10.1" }
- { os: windows-latest , ghc: "9.10.1" }

steps:
- name: Checkout commit
Expand Down
11 changes: 11 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
# Version 0.12.0.0 (2024-21-10)

- Add support for GHC 9.12.

- Re-export `GHC.Types.Unique.Set` and `GHC.Types.Unique.DSet`.

- `mkPluginUnivCo`, `mkPluginUnivEvTerm` and `mkTyFamAppReduction` now all take
an additional `DCoVarSet` argument which allows specifying coercions that we
depend on. This stops terms being floated out past any Givens that we depend
on ([GHC issue #23923](https://gitlab.haskell.org/ghc/ghc/-/issues/23923)).

# Version 0.11.0.0 (2023-08-29)

- Add support for GHC 9.8.
Expand Down
6 changes: 4 additions & 2 deletions ghc-tcplugin-api.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ library

build-depends:
base
>= 4.13.0 && < 4.21,
>= 4.13.0 && < 4.22,
containers
>= 0.6 && < 0.8,
ghc
>= 8.8 && < 9.11,
>= 8.8 && < 9.13,
transformers
>= 0.5 && < 0.7,

Expand Down Expand Up @@ -68,6 +68,8 @@ library
, GHC.Plugins
, GHC.Types.Unique.DFM
, GHC.Types.Unique.FM
, GHC.Types.Unique.Set
, GHC.Types.Unique.DSet
, GHC.Utils.Outputable

if impl(ghc >= 9.3.0)
Expand Down
42 changes: 32 additions & 10 deletions src/GHC/TcPlugin/API.hs
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ module GHC.TcPlugin.API
, classifyPredType, ctPred

-- | == Handling type variables
, TyVar, CoVar
, TyVar, CoVar, DCoVarSet
, MetaDetails, MetaInfo
, isSkolemTyVar
, isMetaTyVar, isFilledMetaTyVar_maybe
Expand Down Expand Up @@ -649,6 +649,13 @@ import GHC.Types.Name.Occurrence
( OccName(..)
, mkVarOcc, mkDataOcc, mkTyVarOcc, mkTcOcc, mkClsOcc
)
#if MIN_VERSION_ghc(9,11,0)
import GHC.Types.Var.Set
( DCoVarSet )
#else
import GHC.Types.Var.Set
( DVarSet )
#endif
#if MIN_VERSION_ghc(9,3,0)
import GHC
( HscEnv )
Expand Down Expand Up @@ -1009,10 +1016,18 @@ setEvBind ev_bind = do
mkPluginUnivCo
:: String -- ^ Name of equality (for the plugin's internal use, or for debugging)
-> Role
-> DCoVarSet -- ^ Coercions that this proof term depends on
-> TcType -- ^ LHS
-> TcType -- ^ RHS
-> Coercion
mkPluginUnivCo str role lhs rhs = mkUnivCo ( PluginProv str ) role lhs rhs
mkPluginUnivCo str role _depCos lhs rhs =
let prov =
PluginProv
str
#if MIN_VERSION_ghc(9,11,0)
_depCos
#endif
in mkUnivCo prov role lhs rhs

-- | Conjure up an evidence term for an equality between two types
-- at the given 'Role' ('Nominal' or 'Representational').
Expand All @@ -1024,25 +1039,28 @@ mkPluginUnivCo str role lhs rhs = mkUnivCo ( PluginProv str ) role lhs rhs
mkPluginUnivEvTerm
:: String -- ^ Name of equality (for the plugin's internal use, or for debugging)
-> Role
-> DCoVarSet -- ^ Coercions that this proof term depends on
-> TcType -- ^ LHS
-> TcType -- ^ RHS
-> EvTerm
mkPluginUnivEvTerm str role lhs rhs = evCoercion $ mkPluginUnivCo str role lhs rhs
mkPluginUnivEvTerm str role depCos lhs rhs =
evCoercion $ mkPluginUnivCo str role depCos lhs rhs

-- | Provide a rewriting of a saturated type family application
-- at the given 'Role' ('Nominal' or 'Representational').
--
-- The result can be passed to 'TcPluginRewriteTo' to specify the outcome
-- of rewriting a type family application.
mkTyFamAppReduction
:: String -- ^ Name of reduction (for debugging)
-> Role -- ^ Role of reduction ('Nominal' or 'Representational')
-> TyCon -- ^ Type family 'TyCon'
-> [TcType] -- ^ Type family arguments
-> TcType -- ^ The type that the type family application reduces to
:: String -- ^ Name of reduction (for debugging)
-> Role -- ^ Role of reduction ('Nominal' or 'Representational')
-> DCoVarSet -- ^ Coercions that this reductiondepends on
-> TyCon -- ^ Type family 'TyCon'
-> [TcType] -- ^ Type family arguments
-> TcType -- ^ The type that the type family application reduces to
-> Reduction
mkTyFamAppReduction str role tc args ty =
Reduction ( mkPluginUnivCo str role ( mkTyConApp tc args ) ty ) ty
mkTyFamAppReduction str role depCos tc args ty =
Reduction ( mkPluginUnivCo str role depCos ( mkTyConApp tc args ) ty ) ty

--------------------------------------------------------------------------------

Expand Down Expand Up @@ -1089,6 +1107,10 @@ mkPrimEqPredRole Phantom = panic "mkPrimEqPredRole phantom"

--------------------------------------------------------------------------------

#if !MIN_VERSION_ghc(9,11,0)
type DCoVarSet = DVarSet
#endif

#if MIN_VERSION_ghc(9,8,0)
setInertSet :: InertSet -> TcS ()
setInertSet inerts = updInertSet ( const inerts )
Expand Down

0 comments on commit 520be16

Please sign in to comment.