#4810: Versions of bracket without masking acquire action
---------------------------------+------------------------------------------
Reporter: mitar | Owner:
Type: proposal | Status: new
Priority: normal | Milestone:
Component: libraries/base | Version: 7.0.1
Keywords: | Testcase:
Blockedby: | Difficulty:
Os: Unknown/Multiple | Blocking:
Architecture: Unknown/Multiple | Failure: None/Unknown
---------------------------------+------------------------------------------
Comment(by simonmar):
Replying to [comment:4 mitar]:
> Replying to [comment:3 simonmar]:
> > but can't you just transform that to
>
> I do not see a way. This is an example from a library where user can use
bracket to wrap my library calls but then I am "unable" to use bracket
inside my library (and I want to use bracket because I want that my
function to be interruptible).
Ok, so to be clear you want to provide a library that exposes `acquire`
and `release` operations, which you expect the user to be able to use in
`bracket`. Furthermore, within `acquire`, you want to use `bracket`
yourself to acquire and release some other resource.
Remember that `acquire` will still be interruptible, since it is within
`mask`, not `uninterruptibleMask`. Is there really a problem here?
> But I still argue that we need also:
>
> {{{
> bracketWithUnmask :: ((forall a. IO a -> IO a) -> IO a) -> (a -> IO b)
-> (a -> IO c) -> IO c
> }}}
But that breaks the abstraction - you shouldn't be able to unmask
unconditionally. That's why we moved to `mask` instead of
`block`/`unblock`. The exception to the rule is for `forkIO`, where it is
harmless to unmask (and necessary, in some cases).
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/4810#comment:5>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs