packages feed

polysemy-plugin 0.4.5.3 → 0.4.6.0

raw patch · 4 files changed

+69/−9 lines, 4 filesdep ~containersdep ~doctestPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: containers, doctest

API changes (from Hackage documentation)

Files

polysemy-plugin.cabal view
@@ -1,11 +1,11 @@ cabal-version: 2.0 --- This file has been generated from package.yaml by hpack version 0.36.1.+-- This file has been generated from package.yaml by hpack version 0.38.3. -- -- see: https://github.com/sol/hpack  name:           polysemy-plugin-version:        0.4.5.3+version:        0.4.6.0 synopsis:       Disambiguate obvious uses of effects. description:    Please see the README on GitHub at <https://github.com/polysemy-research/polysemy/tree/master/polysemy-plugin#readme> category:       Polysemy@@ -27,7 +27,7 @@  custom-setup   setup-depends:-      Cabal <3.13+      Cabal <3.15     , base >=4.9 && <5     , cabal-doctest >=1.0.6 && <1.1 @@ -65,13 +65,15 @@       UnicodeSyntax   build-depends:       base >=4.9 && <5-    , containers >=0.5 && <0.8+    , containers >=0.5 && <0.9     , ghc >=8.6.5 && <10-    , ghc-tcplugins-extra >=0.3 && <0.6     , polysemy >=1.7     , syb ==0.7.*     , transformers >=0.5.2.0 && <0.7   default-language: Haskell2010+  if impl(ghc < 9.14)+    build-depends:+        ghc-tcplugins-extra >=0.3 && <0.6  test-suite polysemy-plugin-test   type: exitcode-stdio-1.0@@ -110,10 +112,9 @@   ghc-options: -threaded -rtsopts -with-rtsopts=-N -fplugin=Polysemy.Plugin   build-depends:       base >=4.9 && <5-    , containers >=0.5 && <0.8-    , doctest >=0.16.0.1 && <0.25+    , containers >=0.5 && <0.9+    , doctest >=0.16.0.1 && <0.26     , ghc >=8.6.5 && <10-    , ghc-tcplugins-extra >=0.3 && <0.6     , hspec >=2.6.0 && <3     , hspec-discover     , inspection-testing >=0.4.2 && <0.7
src/Polysemy/Plugin/Fundep.hs view
@@ -100,6 +100,10 @@ import           TysPrim (alphaTys) #endif +#if __GLASGOW_HASKELL__ >= 914+import           GHC.Core.Predicate (tyCoVarsOfTypeWellScoped)+#endif+ fundepPlugin :: TcPlugin fundepPlugin = TcPlugin   { tcPluginInit =@@ -249,7 +253,11 @@            $ newWantedEq (fcLoc fc) Nominal wanted given #endif   pure ( Unification (OrdType wanted) (OrdType given)+#if __GLASGOW_HASKELL__ >= 914+       , CNonCanonical (CtWanted ev)+#else        , CNonCanonical ev+#endif        )   where     wanted = fcEffect fc
src/Polysemy/Plugin/Fundep/Stuff.hs view
@@ -8,7 +8,6 @@  import Data.Kind (Type) import GHC (Name, Class, TyCon, mkModuleName)-import GHC.TcPluginM.Extra (lookupModule, lookupName) #if __GLASGOW_HASKELL__ >= 900 import GHC.Data.FastString (fsLit) import GHC.Types.Name.Occurrence (mkTcOcc)@@ -36,6 +35,39 @@ import Outputable (pprPanic, text, (<+>), ($$)) #endif +#if __GLASGOW_HASKELL__ >= 914+import GHC (Module, ModuleName)+import GHC.Data.FastString (FastString)+import GHC.Driver.Env (hsc_home_unit_maybe)+import GHC.Tc.Plugin (findImportedModule, lookupOrig, tcPluginIO)+import GHC.Types.Name (OccName)+import GHC.Types.PkgQual (PkgQual (ThisPkg))+import GHC.Unit.Finder (FindResult (Found), findPluginModule)+import GHC.Unit.Home (homeUnitId)+import GHC.Utils.Outputable (ppr)+import GHC.Utils.Panic (panicDoc)+#else+import GHC.TcPluginM.Extra (lookupModule, lookupName)+#endif++#if __GLASGOW_HASKELL__ >= 914++-- | Port of @lookupModule@ from the abandoned @ghc-tcplugins-extra@.+lookupModule :: ModuleName -> FastString -> TcPluginM Module+lookupModule mod_nm _pkg = do+  hsc_env <- getTopEnv+  tcPluginIO (findPluginModule hsc_env mod_nm) >>= \case+    Found _ m -> pure m+    _ -> do+      let pkg_qual = maybe NoPkgQual (ThisPkg . homeUnitId) (hsc_home_unit_maybe hsc_env)+      findImportedModule mod_nm pkg_qual >>= \case+        Found _ m -> pure m+        _ -> panicDoc "Couldn't find module" (ppr mod_nm)++lookupName :: Module -> OccName -> TcPluginM Name+lookupName = lookupOrig++#endif   ------------------------------------------------------------------------------
src/Polysemy/Plugin/Fundep/Unification.hs view
@@ -81,22 +81,41 @@         InterpreterUse _ s -> s         FunctionDef s      -> s +#if __GLASGOW_HASKELL__ < 914+ #if __GLASGOW_HASKELL__ >= 902+ #define BINDME (const BindMe) #define APART (const Apart)+ #else+ #define BINDME BindMe #define APART Skolem+ #endif +#endif+ tryUnifyUnivarsButNotSkolems :: Set TyVar -> Type -> Type -> Maybe SUBST tryUnifyUnivarsButNotSkolems skolems goal inst =+#if __GLASGOW_HASKELL__ >= 914+  -- the tyfam case only distinguishes MaybeApart from SurelyApart anyway, so it doesn't matter what we do..   case tcUnifyTysFG+         alwaysBindFam+         (\ tv _ -> bool BindMe DontBindMe (S.member tv skolems))+         [inst]+         [goal] of+    Unifiable subst -> pure subst+    _               -> Nothing+#else+  case tcUnifyTysFG          (bool BINDME APART . flip S.member skolems)          [inst]          [goal] of     Unifiable subst -> pure subst     _               -> Nothing+#endif  ------------------------------------------------------------------------------ -- | A wrapper for two types that we want to say have been unified.