Hoogle Search
Within LTS Haskell 24.46 (ghc-9.10.3)
Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.
bracketSnap :: IO a -> (a -> IO b) -> (a -> Snap c) -> Snap csnap-core Snap.Internal.Core This function brackets a Snap action in resource acquisition and release. This is provided because MonadCatchIO's bracket function doesn't work properly in the case of a short-circuit return from the action being bracketed. In order to prevent confusion regarding the effects of the aquisition and release actions on the Snap state, this function doesn't accept Snap actions for the acquire or release actions. This function will run the release action in all cases where the acquire action succeeded. This includes the following behaviors from the bracketed Snap action.
- Normal completion
- Short-circuit completion, either from calling fail or finishWith
- An exception being thrown.
ghci> :set -XOverloadedStrings ghci> import qualified Data.Map as M ghci> import qualified Snap.Test as T ghci> let br = bracketSnap (putStrLn "before") (const $ putStrLn "after") ghci> T.runHandler (T.get "/" M.empty) (br $ const $ writeBS "OK") before after HTTP/1.1 200 OK server: Snap/test date: Thu, 07 Aug 2014 18:41:50 GMT OK
-
polysemy Polysemy.Resource Allocate a resource, use it, and clean it up afterwards if an error occurred.
-
polysemy Polysemy.Resource A variant of bracket where the return value from the first computation is not required. cf. bracket and bracket_
bracketOnError :: IO a -> (a -> IO b) -> (a -> IO c) -> IO cghc-internal GHC.Internal.Control.Exception Like bracket, but only performs the final action if there was an exception raised by the in-between computation.
bracket_ :: IO a -> IO b -> IO c -> IO cghc-internal GHC.Internal.Control.Exception A variant of bracket where the return value from the first computation is not required.
bracketOnError :: IO a -> (a -> IO b) -> (a -> IO c) -> IO cghc-internal GHC.Internal.Control.Exception.Base Like bracket, but only performs the final action if there was an exception raised by the in-between computation.
bracket_ :: IO a -> IO b -> IO c -> IO cghc-internal GHC.Internal.Control.Exception.Base A variant of bracket where the return value from the first computation is not required.
bracketOnError :: IO a -> (a -> IO b) -> (a -> IO c) -> IO cprotolude Protolude Like bracket, but only performs the final action if there was an exception raised by the in-between computation.
bracket_ :: IO a -> IO b -> IO c -> IO cprotolude Protolude A variant of bracket where the return value from the first computation is not required.
-
HTF Test.Framework.Pretty No documentation available.