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 makeFull #1493

Merged
merged 90 commits into from
Dec 18, 2020
Merged

Resource makeFull #1493

merged 90 commits into from
Dec 18, 2020

Conversation

SystemFw
Copy link
Contributor

@SystemFw SystemFw commented Dec 10, 2020

Although there are a few open questions, I think this is ready for an initial review.
The most relevant files are Resource, Semaphore, and the relative tests.

Summary of the changes:

  • Resource is invariant in F
  • No more preinterpretation, and different nodes: Allocate, Eval, Pure, Bind
  • Resource can now express interruptible acquires
  • Fixed a bug in bracketFull which allowed interruptible releases
  • liftF is deprecated in favour of eval
  • Semaphore has a new implementation. Hopefully it's clearer, although the underlying idea remains complex (necessarily so)
  • Resource.mapK requires a MonadCancel constraint on both source and destination effect, and it cannot be avoided.
  • Various cleanups, simplifications, scaladoc, etc.

Open questions:

  • Resource.mapK requires a MonadCancel[F, Throwable] on both source and destination effects, which is problematic for Semaphore, which currently only takes a GenConcurrent[F, _]. I've tried quite a few things, one thing still left to try though is having mapK take MonadCancel[F, _] and MonadCancel[G, _], and see how that goes (skeptical, but we'll see). This appears to work.
  • I think that as constructed, allowFull can be engineered to build a Resource with interruptible release (makeFull cannot). Not quite sure if we want to tackle that, or just say "don't do that". Fixed in bracketFull.
  • I've left liftK with the current name, rather than evalK, since consistency with cats for that sort of operation seems more important (whereas for liftF/eval, consistency with fs2 is). Let me know if you have a different view, and evalK should be introduced instead.

@SystemFw SystemFw changed the title Resource.makefull Resource makeFull Dec 10, 2020
@SystemFw SystemFw marked this pull request as ready for review December 12, 2020 02:21
@djspiewak djspiewak merged commit 60a295d into typelevel:series/3.x Dec 18, 2020
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 this pull request may close these issues.

Consider removing possibility to widen effect in Resource#useForever Resource.makeMask
3 participants