ghc-tcplugin-api 0.20.1.1 → 0.20.2.0
raw patch · 3 files changed
+45/−2 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ GHC.TcPlugin.API: mkStringExpr :: MonadTcPlugin m => String -> m CoreExpr
+ GHC.TcPlugin.API: mkStringExprFS :: MonadTcPlugin m => FastString -> m CoreExpr
Files
- changelog.md +11/−0
- ghc-tcplugin-api.cabal +1/−1
- src/GHC/TcPlugin/API.hs +33/−1
changelog.md view
@@ -1,3 +1,14 @@+# Version 0.20.2.0 (2026-11-13)++- Add `mkStringExpr :: MonadTcPlugin m => String -> m CoreExpr` and+ `mkStringExprFS :: MonadTcPlugin m => FastString -> m CoreExpr` to+ `GHC.TcPlugin.API`.++ These replace the functions of the same name from `GHC.Core.Make`. Those+ functions were deleted in GHC 10.2 (alongside the `MonadThings` class they+ used for their contexts). Adapt to this change by importing `mkStringExpr`+ from `GHC.TcPlugin.API`, and not through `GHC.Core.Make` nor `GHC.Plugins`.+ # Version 0.20.1.1 (2026-11-03) - Adapt to GHC HEAD `ModuleName` change (GHC commit 575c4bc6cb).
ghc-tcplugin-api.cabal view
@@ -1,6 +1,6 @@ cabal-version: 3.0 name: ghc-tcplugin-api-version: 0.20.1.1+version: 0.20.2.0 synopsis: An API for type-checker plugins. license: BSD-3-Clause build-type: Simple
src/GHC/TcPlugin/API.hs view
@@ -333,6 +333,7 @@ -- before the actual evidence term (the class dictionary expression). , classDataCon+ , mkStringExpr, mkStringExprFS #if !MIN_VERSION_ghc(9,0,0) , mkUncheckedIntExpr #endif@@ -587,6 +588,13 @@ import GHC.Core.Make ( mkCoreConApps ) #endif+import qualified GHC.Core.Make+ as GHC+ ( mkStringExprFSWith+#if MIN_VERSION_ghc(9,4,0)+ , getMkStringIds+#endif+ ) import GHC.Core.Predicate ( EqRel(..) #if MIN_VERSION_ghc(9,13,0)@@ -662,7 +670,7 @@ #endif ) import GHC.Data.FastString- ( FastString, fsLit, unpackFS )+ ( FastString, fsLit, mkFastString, unpackFS ) #if MIN_VERSION_ghc(9,5,0) import GHC.Plugins ( thNameToGhcNameIO )@@ -687,6 +695,11 @@ #endif import qualified GHC.Tc.Plugin as GHC+#if MIN_VERSION_ghc(10,1,0)+import qualified GHC.Tc.Utils.Env+ as GHC+ ( tcLookupKnownKeyId )+#endif #if MIN_VERSION_ghc(9,4,0) import GHC.Tc.Solver.InertSet ( InertSet )@@ -1014,6 +1027,25 @@ -- | Lookup an identifier, such as a type variable. tcLookupId :: MonadTcPlugin m => Name -> m Id tcLookupId = liftTcPluginM . GHC.tcLookupId++-- | Build a Core expression of type 'String' that evaluates to the given string.+mkStringExpr :: MonadTcPlugin m => String -> m CoreExpr+mkStringExpr = mkStringExprFS . mkFastString++-- | Build a Core expression of type 'String' that evaluates to the given+-- 'FastString', decoded as a 'String'.+mkStringExprFS :: MonadTcPlugin m => FastString -> m CoreExpr+#if MIN_VERSION_ghc(10,1,0)+mkStringExprFS fs = do+ ids <- unsafeLiftTcM $ GHC.getMkStringIds GHC.tcLookupKnownKeyId+ pure $ GHC.mkStringExprFSWith ids fs+#elif MIN_VERSION_ghc(9,4,0)+mkStringExprFS fs = do+ ids <- GHC.getMkStringIds tcLookupId+ pure $ GHC.mkStringExprFSWith ids fs+#else+mkStringExprFS = GHC.mkStringExprFSWith tcLookupId+#endif --------------------------------------------------------------------------------