ghc-tcplugin-api 0.8.2.0 → 0.8.3.0
raw patch · 3 files changed
+24/−18 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- changelog.md +7/−2
- ghc-tcplugin-api.cabal +1/−1
- src/GHC/TcPlugin/API/Internal/Shim.hs +16/−15
changelog.md view
@@ -1,12 +1,17 @@+# Version 0.8.3.0 (2022-10-05)++- Bugfix for the GHC 9.0 rewriter plugin compatibility shim:+ fix coercion orientations in family application cache+ # Version 0.8.2.0 (2022-10-05) - Bugfix for the GHC 9.0 rewriter plugin compatibility shim:- fix coercion orientations.+ fix coercion orientations in family rewriting. # Version 0.8.1.0 (2022-10-05) - Bugfix for the GHC 9.2 rewriter plugin compatibility shim:- fix coercion orientations.+ fix coercion orientations in family rewriting. # Version 0.8.0.0 (2022-07-07)
ghc-tcplugin-api.cabal view
@@ -1,6 +1,6 @@ cabal-version: 3.0 name: ghc-tcplugin-api-version: 0.8.2.0+version: 0.8.3.0 synopsis: An API for type-checker plugins. license: BSD-3-Clause build-type: Simple
src/GHC/TcPlugin/API/Internal/Shim.hs view
@@ -511,7 +511,7 @@ | fr `eqCanRewriteFR` (flavour, eq_rel) , let redn :: Reduction- redn = Reduction (mkSymCo co) xi -- inerts use a different orientation in GHC 9.0 and 9.2+ redn = Reduction (mkSymCoOnGHC92 co) xi -> finish True (homogenise $ downgradeRedn role' inert_role redn) where inert_role = eqRelRole inert_eq_rel@@ -531,13 +531,26 @@ when (use_cache && eq_rel == NomEq && flavour /= Derived) $ liftTcS $ extendFamAppCache tc tys- ( mkSymCo final_co, final_xi ) -- different orientation in GHC 9.0 and 9.2+ ( mkSymCoOnGHC92 final_co, final_xi ) #if !MIN_VERSION_ghc(9,2,0) flavour #endif return final_redn {-# INLINE finish #-} +-- On GHC 9.2, lookupFamAppCache and matchFam+-- use a coercion that goes from right to left.+-- On GHC 9.0 (and GHC 9.4 and above), the coercions+-- always go from left to right.+-- (Recall: this module is only used for GHC 9.2 and below.)+mkSymCoOnGHC92 :: Coercion -> Coercion+mkSymCoOnGHC92 co =+#if MIN_VERSION_ghc(9,2,0)+ mkSymCo co+#else+ co+#endif+ -- Returned coercion is output ~r input, where r is the role in the RewriteM monad -- See Note [How to normalise a family application] try_to_reduce :: TyCon -> [Type] -> Maybe Rewriter@@ -551,19 +564,7 @@ forM result downgrade where mkRed :: Maybe (Coercion, Type) -> Maybe Reduction- mkRed = fmap $ \ (co, ty) ->- Reduction- -- On GHC 9.2, lookupFamAppCache and matchFam- -- use a coercion that goes from right to left.- -- On GHC 9.0 (and GHC 9.4 and above), the coercions- -- always go from left to right.- -- (Recall: this module is only used for GHC 9.2 and below.)-#if MIN_VERSION_ghc(9,2,0)- (mkSymCo co)-#else- co-#endif- ty+ mkRed = fmap $ \ (co, ty) -> Reduction (mkSymCoOnGHC92 co) ty downgrade :: Reduction -> RewriteM Reduction downgrade redn@(Reduction co xi) = do eq_rel <- getEqRel