effectful-core 1.0.0.0 → 1.1.0.0
raw patch · 5 files changed
+38/−11 lines, 5 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Effectful.Reader.Dynamic: withReader :: (r1 -> r2) -> Eff (Reader r2 : es) a -> Eff (Reader r1 : es) a
+ Effectful.Reader.Static: withReader :: (r1 -> r2) -> Eff (Reader r2 : es) a -> Eff (Reader r1 : es) a
Files
- CHANGELOG.md +5/−0
- effectful-core.cabal +8/−7
- src/Effectful/Internal/Monad.hs +1/−4
- src/Effectful/Reader/Dynamic.hs +12/−0
- src/Effectful/Reader/Static.hs +12/−0
CHANGELOG.md view
@@ -1,2 +1,7 @@+# effectful-core-1.1.0.0 (2022-07-19)+* Don't reset the `UnliftStrategy` to `SeqUnlift` inside the continuation of+ `withEffToIO`.+* Add `withReader`.+ # effectful-core-1.0.0.0 (2022-07-13) * Initial release.
effectful-core.cabal view
@@ -1,7 +1,7 @@ cabal-version: 2.4 build-type: Simple name: effectful-core-version: 1.0.0.0+version: 1.1.0.0 license: BSD-3-Clause license-file: LICENSE category: Control@@ -9,12 +9,13 @@ author: Andrzej Rybczak synopsis: An easy to use, performant extensible effects library. -description: An easy to use, performant extensible effects library with seamless- integration with the existing Haskell ecosystem.- .- This library provides core definitions with a minimal dependency- footprint. See the @<https://hackage.haskell.org/package/effectful effectful>@- package for the "batteries-included" variant.+description:+ An easy to use, performant extensible effects library with seamless+ integration with the existing Haskell ecosystem.+ .+ This library provides core definitions with a minimal dependency+ footprint. See the @<https://hackage.haskell.org/package/effectful effectful>@+ package for the "batteries-included" variant. extra-source-files: CHANGELOG.md
src/Effectful/Internal/Monad.hs view
@@ -170,13 +170,10 @@ :: (HasCallStack, IOE :> es) => ((forall r. Eff es r -> IO r) -> IO a) -- ^ Continuation with the unlifting function in scope.- --- -- /Note:/ the strategy is reset to 'SeqUnlift' inside the continuation. -> Eff es a withEffToIO f = unliftStrategy >>= \case SeqUnlift -> unsafeEff $ \es -> seqUnliftIO es f- ConcUnlift p b -> withUnliftStrategy SeqUnlift $ do- unsafeEff $ \es -> concUnliftIO es p b f+ ConcUnlift p b -> unsafeEff $ \es -> concUnliftIO es p b f -- | Create an unlifting function with the 'SeqUnlift' strategy. seqUnliftIO
src/Effectful/Reader/Dynamic.hs view
@@ -9,6 +9,7 @@ -- ** Handlers , runReader+ , withReader -- ** Operations , ask@@ -35,6 +36,17 @@ runReader r = reinterpret (R.runReader r) $ \env -> \case Ask -> R.ask Local f m -> localSeqUnlift env $ \unlift -> R.local f (unlift m)++-- | Execute a computation in a modified environment.+withReader+ :: (r1 -> r2)+ -- ^ The function to modify the environment.+ -> Eff (Reader r2 : es) a+ -- ^ Computation to run in the modified environment.+ -> Eff (Reader r1 : es) a+withReader f m = do+ r <- ask+ raise $ runReader (f r) m ---------------------------------------- -- Operations
src/Effectful/Reader/Static.hs view
@@ -5,6 +5,7 @@ -- ** Handlers , runReader+ , withReader -- ** Operations , ask@@ -28,6 +29,17 @@ -> Eff (Reader r : es) a -> Eff es a runReader r = evalStaticRep (Reader r)++-- | Execute a computation in a modified environment.+withReader+ :: (r1 -> r2)+ -- ^ The function to modify the environment.+ -> Eff (Reader r2 : es) a+ -- ^ Computation to run in the modified environment.+ -> Eff (Reader r1 : es) a+withReader f m = do+ r <- ask+ raise $ runReader (f r) m -- | Fetch the value of the environment. ask :: Reader r :> es => Eff es r