effectful 2.5.1.0 → 2.6.1.0
raw patch · 9 files changed
Files
- CHANGELOG.md +18/−0
- README.md +2/−2
- bench/FileSizes.hs +0/−1
- effectful.cabal +9/−8
- src/Effectful/Concurrent.hs +1/−0
- src/Effectful/Concurrent/Async.hs +8/−2
- src/Effectful/Concurrent/STM.hs +1/−0
- src/Effectful/FileSystem/IO/ByteString.hs +4/−1
- tests/ReaderTests.hs +14/−18
CHANGELOG.md view
@@ -1,3 +1,21 @@+# effectful-2.6.1.0 (2025-08-30)+* Add `MonadError`, `MonadReader`, `MonadState` and `MonadWriter` instances for+ `Eff` for compatibility with existing code.+* Re-export `writeTMVar` from `stm-2.5.1.0` in `Effectful.Concurrent.STM`.+* Add `cancelMany` to `Effectful.Concurrent.Async`.++# effectful-core-2.6.0.0 (2025-06-13)+* Adjust `generalBracket` with `base >= 4.21` to make use of the new exception+ annotation mechanism.+* Add `withException` to `Effectful.Exception`.+* Deprecate `Effectful.Reader.Dynamic.withReader` as it doesn't work correctly+ for all potential interpreters.+* Re-export `ThreadId` from `Effectful.Concurrent` for convenience.+* **Breaking changes**:+ - Change the order of type parameters in `raise` for better usability.+ - `Effectful.Error.Static.ErrorWrapper` is no longer caught by `catchSync`.+ - Remove deprecated function `Effectful.withConcEffToIO`.+ # effectful-2.5.1.0 (2024-11-27) * Add `passthrough` to `Effectful.Dispatch.Dynamic` for passing operations to the upstream handler within `interpose` and `impose` without having to fully
README.md view
@@ -1,12 +1,12 @@ # effectful -[](https://github.com/haskell-effectful/effectful/actions?query=branch%3Amaster)+[](https://github.com/haskell-effectful/effectful/actions/workflows/haskell-ci.yml) [](https://hackage.haskell.org/package/effectful) [](https://www.stackage.org/lts/package/effectful) [](https://www.stackage.org/nightly/package/effectful) -<img src="https://user-images.githubusercontent.com/387658/127747903-f728437f-2ee4-47b8-9f0c-5102fd44c8e4.png" width="128">+<img src="https://raw.githubusercontent.com/haskell-effectful/effectful/master/logo.svg" width="150"> An easy to use, fast extensible effects library with seamless integration with the existing Haskell ecosystem.
bench/FileSizes.hs view
@@ -1,6 +1,5 @@ {-# LANGUAGE BlockArguments #-} {-# LANGUAGE CPP #-}-{-# LANGUAGE UndecidableInstances #-} module FileSizes where import Control.Exception
effectful.cabal view
@@ -1,7 +1,7 @@ cabal-version: 3.0 build-type: Simple name: effectful-version: 2.5.1.0+version: 2.6.1.0 license: BSD-3-Clause license-file: LICENSE category: Control@@ -22,7 +22,7 @@ CHANGELOG.md README.md -tested-with: GHC == { 8.10.7, 9.0.2, 9.2.8, 9.4.8, 9.6.5, 9.8.3, 9.10.1, 9.12.1 }+tested-with: GHC == { 8.10.7, 9.0.2, 9.2.8, 9.4.8, 9.6.7, 9.8.4, 9.10.2, 9.12.2, 9.14.1 } bug-reports: https://github.com/haskell-effectful/effectful/issues source-repository head@@ -66,19 +66,20 @@ TypeApplications TypeFamilies TypeOperators+ UndecidableInstances library import: language build-depends: base >= 4.14 && < 5- , async >= 2.2.2+ , async >= 2.2.5 , bytestring >= 0.10 , directory >= 1.3.2- , effectful-core >= 2.5.1.0 && < 2.5.2.0+ , effectful-core >= 2.6.1.0 && < 2.6.2.0 , process >= 1.6.9 , strict-mutable-base >= 1.1.0.0 , time >= 1.9.2- , stm >= 2.5.0.0+ , stm >= 2.5.1.0 , unliftio >= 0.2.20 hs-source-dirs: src@@ -188,10 +189,10 @@ if impl(ghc < 9.9) build-depends: freer-simple >= 1.2.1.2 - if impl(ghc < 9.11)- build-depends: fused-effects >= 1.1.2.2+ if impl(ghc < 9.15)+ build-depends: fused-effects >= 1.1.2.3 - if impl(ghc < 9.11)+ if impl(ghc < 9.15) build-depends: polysemy >= 1.9.2.0 build-depends: base
src/Effectful/Concurrent.hs view
@@ -20,6 +20,7 @@ , runConcurrent -- * Basic concurrency operations+ , C.ThreadId , myThreadId , forkIO , forkFinally
src/Effectful/Concurrent/Async.hs view
@@ -1,4 +1,3 @@-{-# LANGUAGE UndecidableInstances #-} -- | Lifted "Control.Concurrent.Async". module Effectful.Concurrent.Async ( -- * Effect@@ -18,7 +17,8 @@ -- ** Querying 'Async's , wait, poll, waitCatch, A.asyncThreadId- , cancel, uninterruptibleCancel, cancelWith, A.AsyncCancelled(..)+ , cancel, cancelMany, uninterruptibleCancel, cancelWith+ , A.AsyncCancelled(..) , A.compareAsyncs -- ** High-level utilities@@ -173,6 +173,12 @@ -- | Lifted 'A.cancel'. cancel :: Concurrent :> es => Async a -> Eff es () cancel = unsafeEff_ . A.cancel++-- | Lifted 'A.cancelMany'.+--+-- @since 2.6.1.0+cancelMany :: Concurrent :> es => [Async a] -> Eff es ()+cancelMany = unsafeEff_ . A.cancelMany -- | Lifted 'A.cancelWith'. cancelWith :: (Exception e, Concurrent :> es) => Async a -> e -> Eff es ()
src/Effectful/Concurrent/STM.hs view
@@ -37,6 +37,7 @@ , STM.takeTMVar , STM.putTMVar , STM.readTMVar+ , STM.writeTMVar , STM.tryReadTMVar , STM.swapTMVar , STM.tryTakeTMVar
src/Effectful/FileSystem/IO/ByteString.hs view
@@ -36,7 +36,6 @@ ) where import Data.ByteString (ByteString)-import Data.ByteString qualified as BS import Data.ByteString.Char8 qualified as BS8 import Prelude hiding (appendFile, readFile, writeFile) import System.IO (Handle)@@ -44,6 +43,10 @@ import Effectful import Effectful.Dispatch.Static import Effectful.FileSystem++#if MIN_VERSION_bytestring(0,11,2)+import Data.ByteString qualified as BS+#endif ---------------------------------------- -- Introducing and eliminating ByteStrings
tests/ReaderTests.hs view
@@ -5,13 +5,14 @@ import Effectful import Effectful.Dispatch.Dynamic-import Effectful.Reader.Dynamic+import Effectful.Reader.Dynamic qualified as D+import Effectful.Reader.Static qualified as S import Utils qualified as U readerTests :: TestTree readerTests = testGroup "Reader"- [ testCase "local works in handlers (dynamic/static)" $ test_localInHandler runReader- , testCase "local works in handlers (dynamic/pure)" $ test_localInHandler runPureReader+ [ testCase "local works in handlers (static)" test_localInHandlerStatic+ , testCase "local works in handlers (dynamic)" test_localInHandlerDynamic ] data SomeEff :: Effect where@@ -19,21 +20,16 @@ type instance DispatchOf SomeEff = Dynamic -test_localInHandler- :: (forall r es a. r -> Eff (Reader r : es) a -> Eff es a)- -> Assertion-test_localInHandler runR = runEff . runR "global" . interpret f $ do- local (const "local") $ send SomeAction+test_localInHandlerStatic :: Assertion+test_localInHandlerStatic = runEff . S.runReader "global" . interpret f $ do+ S.local (const "local") $ send SomeAction where- f :: (IOE :> es, Reader String :> es) => EffectHandler SomeEff es- f _ SomeAction = U.assertEqual "expected result" "local" =<< ask+ f :: (IOE :> es, S.Reader String :> es) => EffectHandler SomeEff es+ f _ SomeAction = U.assertEqual "expected result" "local" =<< S.ask --- | Purely dynamic Reader for testing purposes.-runPureReader :: r -> Eff (Reader r : es) a -> Eff es a-runPureReader r0 = interpret (handler r0)+test_localInHandlerDynamic :: Assertion+test_localInHandlerDynamic = runEff . D.runReader "global" . interpret f $ do+ D.local (const "local") $ send SomeAction where- handler :: r -> EffectHandler (Reader r) handlerEs- handler r env = \case- Ask -> pure r- Local f m -> localSeqUnlift env $ \unlift -> do- unlift $ interpose (handler $ f r) m+ f :: (IOE :> es, D.Reader String :> es) => EffectHandler SomeEff es+ f _ SomeAction = U.assertEqual "expected result" "local" =<< D.ask