bracket package:lifted-base

Generalized version of bracket. Note:
  • When the "acquire" or "release" computations throw exceptions any monadic side effects in m will be discarded.
  • When the "in-between" computation throws an exception any monadic side effects in m produced by that computation will be discarded but the side effects of the "acquire" or "release" computations will be retained.
  • Also, any monadic side effects in m of the "release" computation will be discarded; it is run only for its side effects in IO.
Note that when your acquire and release computations are of type IO it will be more efficient to write:
liftBaseOp (bracket acquire release)
Generalized version of bracketOnError. Note:
  • When the "acquire" or "release" computations throw exceptions any monadic side effects in m will be discarded.
  • When the "in-between" computation throws an exception any monadic side effects in m produced by that computation will be discarded but the side effects of the "acquire" computation will be retained.
  • Also, any monadic side effects in m of the "release" computation will be discarded; it is run only for its side effects in IO.
Note that when your acquire and release computations are of type IO it will be more efficient to write:
liftBaseOp (bracketOnError acquire release)
Generalized version of bracket_. Note any monadic side effects in m of both the "acquire" and "release" computations will be discarded. To keep the monadic side effects of the "acquire" computation, use bracket with constant functions instead. Note that when your acquire and release computations are of type IO it will be more efficient to write:
liftBaseOp_ (bracket_ acquire release)