Hoogle Search

Within LTS Haskell 19.25 (ghc-9.0.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

    base Control.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:

    (openFile "filename" ReadMode)
    (\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

Page 1 of many | Next