ghc-tcplugin-api 0.4.1.0 → 0.5.0.0
raw patch · 3 files changed
+34/−12 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
- GHC.TcPlugin.API: pattern Coercion :: () => Coercion -> Expr b
- GHC.TcPlugin.API: pattern Type :: () => Type -> Expr b
+ GHC.TcPlugin.API: Coercion :: Coercion -> Expr b
+ GHC.TcPlugin.API: CoercionHole :: CoVar -> IORef (Maybe Coercion) -> CoercionHole
+ GHC.TcPlugin.API: EvExpr :: EvExpr -> EvTerm
+ GHC.TcPlugin.API: EvVarDest :: EvVar -> TcEvDest
+ GHC.TcPlugin.API: HoleDest :: CoercionHole -> TcEvDest
+ GHC.TcPlugin.API: Type :: Type -> Expr b
+ GHC.TcPlugin.API: Var :: Id -> Expr b
+ GHC.TcPlugin.API: [ch_co_var] :: CoercionHole -> CoVar
+ GHC.TcPlugin.API: [ch_ref] :: CoercionHole -> IORef (Maybe Coercion)
+ GHC.TcPlugin.API: askEvBinds :: TcPluginM Solve EvBindsVar
+ GHC.TcPlugin.API: ctev_dest :: CtEvidence -> TcEvDest
+ GHC.TcPlugin.API: ctev_evar :: CtEvidence -> EvVar
+ GHC.TcPlugin.API: ctev_loc :: CtEvidence -> CtLoc
+ GHC.TcPlugin.API: ctev_pred :: CtEvidence -> TcPredType
+ GHC.TcPlugin.API: data () => Expr b
+ GHC.TcPlugin.API: data () => TcEvDest
+ GHC.TcPlugin.API: eb_lhs :: EvBind -> EvVar
+ GHC.TcPlugin.API: eb_rhs :: EvBind -> EvTerm
+ GHC.TcPlugin.API: lookupEvBind :: EvBindMap -> EvVar -> Maybe EvBind
+ GHC.TcPlugin.API: mkLocalId :: HasDebugCallStack => Name -> Mult -> Type -> Id
+ GHC.TcPlugin.API: mkTyVar :: Name -> Kind -> TyVar
+ GHC.TcPlugin.API: newName :: OccName -> TcM Name
+ GHC.TcPlugin.API: pattern Many :: Mult
+ GHC.TcPlugin.API: pattern One :: Mult
+ GHC.TcPlugin.API: type CoreBndr = Var
Files
- changelog.md +6/−0
- ghc-tcplugin-api.cabal +2/−1
- src/GHC/TcPlugin/API.hs +26/−11
changelog.md view
@@ -1,4 +1,10 @@ + +# Version 0.5.0.0 (2021-08-30) + +- Re-export some additional types and functions that are useful for inspecting + and constructing evidence terms, such as `mkTyVar`, `newName`, `mkLocalId`, `lookupEvBind`... + # Version 0.4.1.0 (2021-08-24) - Re-export a few GHC modules, such as GHC.Core.Make and GHC.Plugins.
ghc-tcplugin-api.cabal view
@@ -1,6 +1,6 @@ cabal-version: 3.0 name: ghc-tcplugin-api -version: 0.4.1.0 +version: 0.5.0.0 synopsis: An API for type-checker plugins. license: BSD-3-Clause build-type: Simple @@ -113,6 +113,7 @@ , TcRnMonad as GHC.Tc.Utils.Monad , TcType as GHC.Tc.Utils.TcType + , Id as GHC.Types.Id , Name as GHC.Types.Name , OccName as GHC.Types.Name.Occurrence , Unique as GHC.Types.Unique
src/GHC/TcPlugin/API.hs view
@@ -241,7 +241,6 @@ , newCoercionHole , mkReflCo, mkSymCo, mkTransCo, mkUnivCo , mkCoercionTy, isCoercionTy, isCoercionTy_maybe - , pattern Coercion -- *** Evidence terms @@ -255,8 +254,9 @@ , newEvVar, setEvBind , evCoercion, evCast , ctEvExpr - , pattern Type ---, askEvBinds + , askEvBinds, lookupEvBind, eb_lhs, eb_rhs + , newName, mkLocalId, mkTyVar + , ctev_pred, ctev_evar, ctev_loc, ctev_dest -- *** Class dictionaries @@ -266,7 +266,11 @@ -- -- The class dictionary constructor can be obtained using 'classDataCon'. -- Functions from "GHC.Core.Make", re-exported here, will be useful for - -- constructing the necessary terms, e.g. 'mkCoreApp' for an application. + -- constructing the necessary terms. + -- + -- For instance, we can apply the class data constructor using 'mkCoreConApps'. + -- Remember that the type-level arguments (the typeclass variables) come first, + -- before the actual evidence term (the class dictionary expression). , classDataCon , module GHC.Core.Make @@ -366,7 +370,7 @@ , mkPiTy, mkPiTys #if MIN_VERSION_ghc(9,0,0) - , Mult + , Mult, pattern One, pattern Many , mkFunTyMany , mkScaledFunTy , mkVisFunTyMany, mkVisFunTysMany @@ -423,8 +427,10 @@ -- | === Coercions and evidence , Coercion, Role(..), UnivCoProvenance - , CoercionHole - , EvBind, EvTerm, EvVar, EvExpr, EvBindsVar + , CoercionHole(..) + , EvBind, EvTerm(EvExpr), EvVar, EvExpr, EvBindsVar + , Expr(Var, Type, Coercion), CoreBndr + , TcEvDest(..) -- | == The type-checking environment , TcGblEnv, TcLclEnv @@ -440,7 +446,7 @@ ( TyThing(..) ) import GHC.Builtin.Types import GHC.Core - ( Expr(Type, Coercion) ) + ( CoreBndr, Expr(..) ) import GHC.Core.Class ( Class(..), FunDep ) import GHC.Core.Coercion @@ -489,6 +495,9 @@ ( eqType, mkTyConTy, mkTyConApp, splitTyConApp_maybe , mkAppTy, mkAppTys, isTyVarTy, getTyVar_maybe , mkCoercionTy, isCoercionTy, isCoercionTy_maybe +#if MIN_VERSION_ghc(9,0,0) + , pattern One, pattern Many +#endif ) import GHC.Data.FastString ( FastString, fsLit ) @@ -503,7 +512,7 @@ ) import GHC.Tc.Types.Constraint ( Ct(..), CtLoc(..), CtEvidence(..), CtFlavour(..) - , QCInst(..) + , QCInst(..), TcEvDest(..) , ctPred, ctLoc, ctEvidence, ctEvExpr , ctFlavour, ctEqRel, ctOrigin , bumpCtLocDepth @@ -511,15 +520,19 @@ ) import GHC.Tc.Types.Evidence ( EvBind(..), EvTerm(..), EvExpr, EvBindsVar(..) - , evCoercion, evCast + , evCoercion, evCast, lookupEvBind ) import GHC.Tc.Types.Origin ( CtOrigin(..) ) +import GHC.Tc.Utils.Monad + ( newName ) import qualified GHC.Tc.Utils.Monad as GHC ( traceTc, setCtLocM ) import GHC.Tc.Utils.TcType ( TcType, TcLevel ) +import GHC.Types.Id + ( Id, mkLocalId ) import GHC.Types.Name ( Name ) import GHC.Types.Name.Occurrence @@ -540,7 +553,9 @@ import GHC.Types.Unique.DFM ( UniqDFM, lookupUDFM, lookupUDFM_Directly, elemUDFM ) import GHC.Types.Var - ( Id, TcTyVar, EvVar ) + ( TcTyVar, EvVar + , mkTyVar + ) import GHC.Utils.Outputable ( Outputable(..), SDoc ) #if MIN_VERSION_ghc(9,2,0)