Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

polysemy-plugin: compatibility with ghc 9.8 #483

Merged
merged 1 commit into from
Oct 13, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions polysemy-plugin/src/Polysemy/Plugin/Fundep.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down
Loading