You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The design of Resource closely reflects the nature of bracket in CE2, in particular a Resource.make node translates to bracket. This is fine in a lot of cases, but it does force the acquire function to be uncancelable, which isn't great when using Resource with certain types of concurrent , e.g. Resource.make(semaphore.acquire)(_ => semaphore.release).
This can be solved with ad-hoc techniques (see Semaphore.withPermit for an idea of how), but we can look for a more general solution that allows make to translate to both uninterruptible and interruptible bracket, by having it take a Poll[F].
There is one significant caveat to this idea though: Resource is currently interpreted outside of cats-effect to integrate with other resource safety frameworks, which would now have to support both interruptible and uninterruptible acquires. A typical example would be fs2, and the work required to support the enhanced this is likely to be highly nontrivial.
The text was updated successfully, but these errors were encountered:
Just to add a little fuel to the fire, I would consider this to be something that we absolutely need for 3.0.0, particularly since the algebra is open and we can't easily do it later. It doesn't block M1, but it should be considered a blocker for any RCs.
The design of
Resource
closely reflects the nature ofbracket
in CE2, in particular aResource.make
node translates tobracket
. This is fine in a lot of cases, but it does force theacquire
function to be uncancelable, which isn't great when usingResource
with certain types of concurrent , e.g.Resource.make(semaphore.acquire)(_ => semaphore.release)
.This can be solved with ad-hoc techniques (see
Semaphore.withPermit
for an idea of how), but we can look for a more general solution that allowsmake
to translate to both uninterruptible and interruptiblebracket
, by having it take aPoll[F]
.There is one significant caveat to this idea though:
Resource
is currently interpreted outside of cats-effect to integrate with other resource safety frameworks, which would now have to support both interruptible and uninterruptible acquires. A typical example would befs2
, and the work required to support the enhanced this is likely to be highly nontrivial.The text was updated successfully, but these errors were encountered: