Hoogle Search
Within LTS Haskell 24.4 (ghc-9.10.2)
Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.
bracket :: forall (es :: Effects) a b . Eff es a -> (a -> Eff es ()) -> (a -> Eff es b) -> Eff es bbluefin Bluefin.Eff 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.bracket, whose documentation you can inspect for further details. bracket has a very general type that does not require es to contain an exception or IO effect. The reason that this is safe is:
- While bracket does catch exceptions, this is unobservable, since the exception is re-thrown; the cleanup action happens unconditionally; and no part of it gets access to the thrown exception.
- Eff itself is able to guarantee that any exceptions thrown in the body will be actually thrown before bracket exits. This is inherited from the fact that Eff is a wrapper around IO.
bracket :: MonadUnliftIO m => m a -> (a -> m b) -> (a -> m c) -> m cclassy-prelude-yesod ClassyPrelude.Yesod Allocate and clean up a resource safely. For more information on motivation and usage of this function, see base's bracket. This function has two differences from the one in base. The first, and more obvious, is that it works on any MonadUnliftIO instance, not just IO. The more subtle difference is that this function will use uninterruptible masking for its cleanup handler. This is a subtle distinction, but at a high level, means that resource cleanup has more guarantees to complete. This comes at the cost that an incorrectly written cleanup function cannot be interrupted. For more information, please see https://github.com/fpco/safe-exceptions/issues/3.
-
incipit-core IncipitCore Allocate a resource, use it, and clean it up afterwards.
bracket :: (HasCallStack, MonadMask m) => m a -> (a -> m c) -> (a -> m b) -> m bjsaddle-dom JSDOM Generalized abstracted pattern of safe resource acquisition and release in the face of errors. The first action "acquires" some value, which is "released" by the second action at the end. The third action "uses" the value and its result is the result of the bracket. If an error is thrown during the use, the release still happens before the error is rethrown. Note that this is essentially a type-specialized version of generalBracket. This function has a more common signature (matching the signature from Control.Exception), and is often more convenient to use. By contrast, generalBracket is more expressive, allowing us to implement other functions like bracketOnError.
bracket :: Unexceptional m => UIO a -> (a -> UIO ()) -> (a -> UIO c) -> m cunexceptionalio-trans UnexceptionalIO.Trans When you're doing resource handling, PseudoException matters. You still need to use the bracket pattern to handle cleanup.
-
haskell-src-exts Language.Haskell.Exts.Syntax A template haskell bracket expression.
Bracket :: forall (m :: Type -> Type) a1 c a . m a1 -> (a1 -> m c) -> (a1 -> m a) -> Resource m apolysemy Polysemy.Resource Allocate a resource, use it, and clean it up afterwards.
-
haskell-src-exts-simple Language.Haskell.Exts.Simple.Syntax No documentation available.
Bracket :: Expr -> Expr -> Exprlanguage-glsl Language.GLSL.Syntax No documentation available.
bracketOnError :: IO a -> (a -> IO b) -> (a -> IO c) -> IO cbase Control.Exception Like bracket, but only performs the final action if there was an exception raised by the in-between computation.