polysemy-plugin 0.2.0.0 → 0.2.0.1
raw patch · 4 files changed
+40/−6 lines, 4 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- ChangeLog.md +8/−1
- polysemy-plugin.cabal +3/−2
- src/Polysemy/Plugin/Fundep.hs +4/−3
- test/LegitimateTypeErrorSpec.hs +25/−0
ChangeLog.md view
@@ -1,5 +1,10 @@ # Changelog for polysemy-plugin +## 0.2.0.1 (2019-05-28)++- Fixed a bug where the plugin would get confused in the context of legitimate+ type errors+ ## 0.2.0.0 (2019-05-23) - Fixed a serious bug where the changes from 0.1.0.1 broke most real-world@@ -16,5 +21,7 @@ - Initial release - ## Unreleased changes++- Added `runErrorAsAnother`+
polysemy-plugin.cabal view
@@ -4,10 +4,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: 85478fdf6818cbb2b849d4dd68a9f8dbee303d4a7ac2005945ac34ac5eb9dd33+-- hash: 140d529a7cdddca38bcea9f27672cebd7742b7668b1be602c699a624cbb253aa name: polysemy-plugin-version: 0.2.0.0+version: 0.2.0.1 synopsis: Disambiguate obvious uses of effects. description: Please see the README on GitHub at <https://github.com/isovector/polysemy/tree/master/polysemy-plugin#readme> category: Polysemy@@ -54,6 +54,7 @@ BadSpec ExampleSpec InlineRecursiveCallsSpec+ LegitimateTypeErrorSpec PluginSpec Paths_polysemy_plugin hs-source-dirs:
src/Polysemy/Plugin/Fundep.hs view
@@ -88,9 +88,10 @@ let (w, ws) = splitAppTys wanted (g, gs) = splitAppTys given in (&& eqType w g) . flip all (zip ws gs) $ \(wt, gt) ->- if isTyVarTy gt- then isTyVarTy wt- else True+ or [ isTyVarTy wt+ , eqType gt wt+ ]+ mkWanted :: Bool -> CtLoc -> Type -> Type -> TcPluginM (Maybe Ct)
+ test/LegitimateTypeErrorSpec.hs view
@@ -0,0 +1,25 @@+{-# OPTIONS_GHC -fdefer-type-errors -fno-warn-deferred-type-errors #-}++module LegitimateTypeErrorSpec where++import Polysemy+import Test.Hspec+import Test.ShouldNotTypecheck++wrongLift :: Member (Lift IO) r => Sem r ()+wrongLift = sendM putStrLn++wrongReturn :: Sem (e ': r) () -> Sem r ()+wrongReturn = reinterpret undefined++++spec :: Spec+spec = do+ describe "Legitimate type errors" $ do+ it "should be caused by `sendM`ing an unsaturated function" $+ shouldNotTypecheck wrongLift++ it "should be caused by giving a bad type to reinterpret" $+ shouldNotTypecheck wrongReturn+