polysemy-plugin 0.4.3.0 → 0.4.3.1
raw patch · 3 files changed
+26/−20 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- ChangeLog.md +4/−0
- polysemy-plugin.cabal +1/−1
- src/Polysemy/Plugin/Fundep.hs +21/−19
ChangeLog.md view
@@ -2,6 +2,10 @@ ## Unreleased +## 0.4.3.1 (2022-07-11)++* Add a missing pattern match that was hit by a user.+ ## 0.4.3.0 (2021-11-23) * Support GHC 9.2.1
polysemy-plugin.cabal view
@@ -5,7 +5,7 @@ -- see: https://github.com/sol/hpack name: polysemy-plugin-version: 0.4.3.0+version: 0.4.3.1 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
src/Polysemy/Plugin/Fundep.hs view
@@ -280,26 +280,28 @@ givens <- get case S.member (PredType' predty) givens of True -> pure True- False -> do+ False -> let (con, apps) = tcSplitTyConApp predty- Just cls = tyConClass_maybe con- env <- lift tcGetInstEnvs- let (mres, _, _) = lookupInstEnv False env cls apps- case mres of- ((inst, mapps) : _) -> do- -- Get the instantiated type of the dictionary- let df = piResultTys (idType $ is_dfun inst)- $ zipWith fromMaybe alphaTys mapps- -- pull off its resulting arguments- let (theta, _) = tcSplitPhiTy df- allM getInstance theta >>= \case- True -> do- -- Record that we can solve this instance, in case it's used- -- elsewhere- modify $ S.insert $ coerce predty- pure True- False -> pure False- _ -> pure False+ in case tyConClass_maybe con of+ Nothing -> pure False+ Just cls -> do+ env <- lift tcGetInstEnvs+ let (mres, _, _) = lookupInstEnv False env cls apps+ case mres of+ ((inst, mapps) : _) -> do+ -- Get the instantiated type of the dictionary+ let df = piResultTys (idType $ is_dfun inst)+ $ zipWith fromMaybe alphaTys mapps+ -- pull off its resulting arguments+ let (theta, _) = tcSplitPhiTy df+ allM getInstance theta >>= \case+ True -> do+ -- Record that we can solve this instance, in case it's used+ -- elsewhere+ modify $ S.insert $ coerce predty+ pure True+ False -> pure False+ _ -> pure False solveFundep