Hoogle Search

Within LTS Haskell 24.3 (ghc-9.10.2)

Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.

  1. bracket :: IO a -> (a -> IO b) -> (a -> IO c) -> IO c

    ghc-lib-parser GHC.Utils.Exception

    When you want to acquire a resource, do some work with it, and then release the resource, it is a good idea to use bracket, because bracket will install the necessary exception handler to release the resource in the event that an exception is raised during the computation. If an exception is raised, then bracket will re-raise the exception (after performing the release). A common example is opening a file:

    bracket
    (openFile "filename" ReadMode)
    (hClose)
    (\fileHandle -> do { ... })
    
    The arguments to bracket are in this order so that we can partially apply it, e.g.:
    withFile name mode = bracket (openFile name mode) hClose
    
    Bracket wraps the release action with mask, which is sufficient to ensure that the release action executes to completion when it does not invoke any interruptible actions, even in the presence of asynchronous exceptions. For example, hClose is uninterruptible when it is not racing other uses of the handle. Similarly, closing a socket (from "network" package) is also uninterruptible under similar conditions. An example of an interruptible action is killThread. Completion of interruptible release actions can be ensured by wrapping them in uninterruptibleMask_, but this risks making the program non-responsive to Control-C, or timeouts. Another option is to run the release action asynchronously in its own thread:
    void $ uninterruptibleMask_ $ forkIO $ do { ... }
    
    The resource will be released as soon as possible, but the thread that invoked bracket will not block in an uninterruptible state.

  2. bracket :: MonadSafe m => Base m a -> (a -> Base m b) -> (a -> m c) -> m c

    pipes-safe Pipes.Safe

    Analogous to bracket from Control.Monad.Catch, except this also protects against premature termination

  3. bracket :: Gen Char

    checkers Test.QuickCheck.Instances.Char

    Generates one or other of '[' and ']'.

  4. bracket :: forall (es :: [Effect]) a b c . Eff es a -> (a -> Eff es b) -> (a -> Eff es c) -> Eff es c

    effectful-core Effectful.Exception

    Lifted bracket.

  5. bracket :: Parser a -> Parser b -> Parser c -> Parser b

    polyparse Text.ParserCombinators.HuttonMeijer

    No documentation available.

  6. bracket :: (Show p, Show t) => Parser s (p, t) e a -> Parser s (p, t) e b -> Parser s (p, t) e c -> Parser s (p, t) e b

    polyparse Text.ParserCombinators.HuttonMeijerWallace

    No documentation available.

  7. bracket :: PolyParse p => p bra -> p ket -> p a -> p a

    polyparse Text.ParserCombinators.Poly.Base

    Parse a bracketed item, discarding the brackets. If everything matches except the closing bracket, the whole parse fails soft, which can give less-than-satisfying error messages. If you want better error messages, try calling with e.g. bracket open (commit close) item

  8. bracket :: PolyParse p => p bra -> p ket -> p a -> p a

    polyparse Text.ParserCombinators.Poly.StateLazy

    Parse a bracketed item, discarding the brackets. If everything matches except the closing bracket, the whole parse fails soft, which can give less-than-satisfying error messages. If you want better error messages, try calling with e.g. bracket open (commit close) item

  9. bracket :: forall (es :: Effects) a b . Eff es a -> (a -> Eff es ()) -> (a -> Eff es b) -> Eff es b

    bluefin-internal Bluefin.Internal

    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.
    While it is usually the case that the cleanup action will in fact want to use IO effects, this is not universally true, see the polymorphicBracket example for an example.

  10. bracket :: MonadPeelIO m => m a -> (a -> m b) -> (a -> m c) -> m c

    monad-peel Control.Exception.Peel

    Generalized version of bracket. Note, any monadic side effects in m of the "release" computation will be discarded; it is run only for its side effects in IO.

Page 3 of many | Previous | Next