From f42c55de0a214bcd6e604be55a8be1e84dd877cb Mon Sep 17 00:00:00 2001 From: Daniel Firth Date: Fri, 13 Oct 2023 11:44:46 +0000 Subject: [PATCH] polysemy-plugin: compatibility with ghc 9.8 --- polysemy-plugin/src/Polysemy/Plugin/Fundep.hs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/polysemy-plugin/src/Polysemy/Plugin/Fundep.hs b/polysemy-plugin/src/Polysemy/Plugin/Fundep.hs index 691fcda6..06d48860 100644 --- a/polysemy-plugin/src/Polysemy/Plugin/Fundep.hs +++ b/polysemy-plugin/src/Polysemy/Plugin/Fundep.hs @@ -143,7 +143,11 @@ instance Outputable FindConstraint where -- | Given a list of constraints, filter out the 'FindConstraint's. getFindConstraints :: PolysemyStuff 'Things -> [Ct] -> [FindConstraint] getFindConstraints (findClass -> cls) cts = do +#if MIN_VERSION_GLASGOW_HASKELL(9,8,0,0) + cd@(CDictCan(DictCt{di_cls = cls', di_tys = [eff, r]})) <- cts +#else cd@CDictCan{cc_class = cls', cc_tyargs = [eff, r]} <- cts +#endif guard $ cls == cls' pure $ FindConstraint { fcLoc = ctLoc cd @@ -157,7 +161,11 @@ getFindConstraints (findClass -> cls) cts = do -- | Get evidence in scope that aren't the 'FindConstraint's. getExtraEvidence :: PolysemyStuff 'Things -> [Ct] -> [PredType] getExtraEvidence things cts = do +#if MIN_VERSION_GLASGOW_HASKELL(9,8,0,0) + CDictCan(DictCt{di_cls = cls, di_tys = as}) <- cts +#else CDictCan{cc_class = cls, cc_tyargs = as} <- cts +#endif guard $ cls /= findClass things pure $ mkAppTys (mkTyConTy $ classTyCon cls) as