Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resource.makeMask #1255

Closed
SystemFw opened this issue Oct 3, 2020 · 1 comment · Fixed by #1493
Closed

Resource.makeMask #1255

SystemFw opened this issue Oct 3, 2020 · 1 comment · Fixed by #1493
Assignees

Comments

@SystemFw
Copy link
Contributor

SystemFw commented Oct 3, 2020

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.

@SystemFw SystemFw added the CE 3 label Oct 3, 2020
@djspiewak
Copy link
Member

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.

@SystemFw SystemFw self-assigned this Dec 8, 2020
@SystemFw SystemFw linked a pull request Dec 10, 2020 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants