fx 0.11.1 → 0.11.1.1
raw patch · 2 files changed
+12/−4 lines, 2 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- fx.cabal +1/−1
- library/Fx/Scope.hs +11/−3
fx.cabal view
@@ -1,6 +1,6 @@ cabal-version: 3.4 name: fx-version: 0.11.1+version: 0.11.1.1 synopsis: Modular effectful computations with explicit environments and errors description: A lightweight library for writing effectful computations with explicit
library/Fx/Scope.hs view
@@ -14,7 +14,7 @@ import Fx.Prelude -- |--- Instructions of how to acquire and release a resource of type `env` and which may fail with `err`.+-- Instructions of how to acquire and release a resource of type `env` which may fail with `err`. newtype Scope err env = Scope (Fx () err (env, Fx () err ())) instance Functor (Scope err) where@@ -50,9 +50,17 @@ in m2 -- |--- Create a resource provider from an acquiring effect.+-- Create a scope from an acquiring effect. ----- To add a release action, use 'releasing'.+-- To add a release action, use 'registerRelease'.+--+-- Example:+--+-- > fileInWriteMode :: FilePath -> Scope IOError Handle+-- > fileInWriteMode path = do+-- > handle <- acquire (openFile path WriteMode)+-- > registerRelease (hClose handle)+-- > return handle acquire :: Fx () err env -> Scope err env acquire acquireFx = Scope do env <- acquireFx