effectful 2.2.1.0 → 2.2.2.0
raw patch · 5 files changed
+58/−15 lines, 5 filesdep ~effectful-coredep ~polysemyPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: effectful-core, polysemy
API changes (from Hackage documentation)
Files
- CHANGELOG.md +5/−0
- README.md +10/−2
- bench/FileSizes.hs +0/−1
- effectful.cabal +4/−4
- tests/EnvTests.hs +39/−8
CHANGELOG.md view
@@ -1,3 +1,8 @@+# effectful-2.2.2.0 (2023-01-11)+* Add `withSeqEffToIO` and `withConcEffToIO` to `Effectful`.+* Use strict `IORef` and `MVar` variants where appropriate.+* Make `inject` work with effect stacks sharing a polymorphic suffix.+ # effectful-2.2.1.0 (2022-11-09) * Add `localSeqLift` and `localLift` to `Effectful.Dispatch.Dynamic`.
README.md view
@@ -156,14 +156,22 @@ features of the [`unliftio`](https://hackage.haskell.org/package/unliftio) package divided into appropriate effects. -## Example+## Examples For the examples see the *Introduction* sections of [`Effectful.Dispatch.Dynamic`](https://hackage.haskell.org/package/effectful-core/docs/Effectful-Dispatch-Dynamic.html) and [`Effectful.Dispatch.Static`](https://hackage.haskell.org/package/effectful-core/docs/Effectful-Dispatch-Static.html). -## Resources+## Acknowledgements++To all contributors of existing effect libraries - thank you for putting the+time and effort to explore the space. In particular, conversations in issue+trackers of `cleff`, `eff`, `freer-simple`, `fused-effects` and `polysemy`+repositories were invaluable in helping me discover and understand challenges in+the space.++### Resources Resources that inspired the rise of this library and had a lot of impact on its design.
bench/FileSizes.hs view
@@ -54,7 +54,6 @@ import qualified Polysemy as P import qualified Polysemy.Reader as P import qualified Polysemy.State as P-import qualified Polysemy.Internal as P #endif tryGetFileSize :: FilePath -> IO (Maybe Int)
effectful.cabal view
@@ -1,7 +1,7 @@ cabal-version: 2.4 build-type: Simple name: effectful-version: 2.2.1.0+version: 2.2.2.0 license: BSD-3-Clause license-file: LICENSE category: Control@@ -22,7 +22,7 @@ CHANGELOG.md README.md -tested-with: GHC ==8.8.4 || ==8.10.7 || ==9.0.2 || ==9.2.4 || ==9.4.2+tested-with: GHC ==8.8.4 || ==8.10.7 || ==9.0.2 || ==9.2.5 || ==9.4.4 bug-reports: https://github.com/haskell-effectful/effectful/issues source-repository head@@ -67,7 +67,7 @@ , async >= 2.2.2 , bytestring >= 0.10 , directory >= 1.3.2- , effectful-core >= 2.2.1.0 && < 2.2.2.0+ , effectful-core >= 2.2.2.0 && < 2.2.3.0 , process >= 1.6.9 , time >= 1.9.2@@ -164,7 +164,7 @@ build-depends: fused-effects >= 1.1.2.0 if impl(ghc < 9.5)- build-depends: polysemy >= 1.7.1.0+ build-depends: polysemy >= 1.9.0.0 build-depends: base , async
tests/EnvTests.hs view
@@ -42,21 +42,52 @@ U.assertEqual "exepcted result" 3 s test_injectEnv :: Assertion-test_injectEnv = runEff $ runReader () $ do+test_injectEnv = runEff . runReader () $ do+ assertEnvSize "runEff" 2 s <- execState @Int 0 $ inject action- U.assertEqual "expected result" 15 s+ U.assertEqual "expected result" 63 s where action :: Eff [State Int, IOE, Reader (), State Int] () action = do- modify @Int (+1)- raise $ do- modify @Int (+2)- inject innerAction+ assertEnvSize "action" 4+ injectId $ do+ assertEnvSize "injectId" 4+ modify @Int (+1)+ raise $ do+ assertEnvSize "action.raise" 3+ modify @Int (+2)+ inject innerAction+ injectPure $+ assertEnvSize "injectPure" 0 - innerAction :: Eff [State Int, State Int, IOE] ()+ innerAction :: Eff [State Int, Reader (), State Int] () innerAction = do+ assertEnvSize "innerAction" 3 modify @Int (+4)- raise $ modify @Int (+8)+ raise $ do+ assertEnvSize "innerAction.raise" 2+ modify @Int (+8)+ hideReader $ do+ assertEnvSize "hideReader" 2+ modify @Int (+16)+ onlyState $ do+ assertEnvSize "onlyState" 1+ modify @Int (+32)++ hideReader :: Eff (State s : es) r -> Eff (State s : Reader r : es) r+ hideReader = inject++ onlyState :: Eff '[State s] a -> Eff (State s : es) a+ onlyState = inject++ injectId :: Eff es a -> Eff es a+ injectId = inject++ injectPure :: Eff '[] a -> Eff es a+ injectPure = inject++ assertEnvSize label n = unsafeEff $ \es -> do+ assertEqual ("expected Env size (" ++ label ++ ")") n =<< sizeEnv es ----------------------------------------