mirror of
https://github.com/tomjaguarpaw/bluefin.git
synced 2024-10-04 01:17:52 +03:00
parent
65a9af3949
commit
34b28d19e8
@ -390,6 +390,19 @@ catch ::
|
|||||||
Eff es a
|
Eff es a
|
||||||
catch f h = handle h f
|
catch f h = handle h f
|
||||||
|
|
||||||
|
-- | @bracket acquire release body@: @acquire@ a resource, perform the
|
||||||
|
-- @body@ with it, and @release@ the resource even if @body@ threw an
|
||||||
|
-- exception. This is essentially the same as
|
||||||
|
-- @Control.Exception.'Control.Exception.bracket'@, whose
|
||||||
|
-- documentation you can inspect for further details.
|
||||||
|
bracket ::
|
||||||
|
Eff es a ->
|
||||||
|
(a -> Eff es ()) ->
|
||||||
|
(a -> Eff es b) ->
|
||||||
|
Eff es b
|
||||||
|
bracket before after body = UnsafeMkEff $ Control.Exception.bracket
|
||||||
|
(unsafeUnEff before) (unsafeUnEff . after) (unsafeUnEff . body)
|
||||||
|
|
||||||
-- |
|
-- |
|
||||||
-- @
|
-- @
|
||||||
-- >>> runPureEff $ runState 10 $ \\st -> do
|
-- >>> runPureEff $ runState 10 $ \\st -> do
|
||||||
|
@ -4,6 +4,8 @@ module Bluefin.Eff
|
|||||||
-- * Run an 'Eff'
|
-- * Run an 'Eff'
|
||||||
runPureEff,
|
runPureEff,
|
||||||
runEff,
|
runEff,
|
||||||
|
-- * Resource management
|
||||||
|
bracket,
|
||||||
-- * Type classes
|
-- * Type classes
|
||||||
|
|
||||||
-- | See "Bluefin.Eff.IO" for the most direct way of doing I/O in
|
-- | See "Bluefin.Eff.IO" for the most direct way of doing I/O in
|
||||||
|
Loading…
Reference in New Issue
Block a user