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

Document cancelation boundaries #1921

Merged

Conversation

TimWSpence
Copy link
Member

No description provided.

@TimWSpence
Copy link
Member Author

I was trying to justify 3 (boundary after poll is not a cancelation boundary) from the laws but failed to do so. What have I missed?

Also, I wasn't sure if this belonged in scaladoc or mdoc docs or both?

@vasilmkd
Copy link
Member

I like it a lot.

@vasilmkd
Copy link
Member

I think we'll definitely need some more on the website but this is a great start.

@TimWSpence
Copy link
Member Author

I think we'll definitely need some more on the website but this is a great start.

Yeah, do you think I should directly copy this stuff to the website? Or is it too much detail for that? Still find that balance hard to judge

@djspiewak
Copy link
Member

I quite like this, though one downside to it is the text in question is somewhat IO-specific. Other implementations of the typeclasses (notably, Monix) are likely to have different semantics. Would it be better to push this to the website or the IO scaladoc rather than putting it in MonadCancel? Otherwise looks very good!

@TimWSpence
Copy link
Member Author

I quite like this, though one downside to it is the text in question is somewhat IO-specific. Other implementations of the typeclasses (notably, Monix) are likely to have different semantics. Would it be better to push this to the website or the IO scaladoc rather than putting it in MonadCancel? Otherwise looks very good!

Yeah I was worried about this as well. I'll see if I can find a place to move it to. The uncancelable boundary at the end of uncancelable is guaranteed by the laws though, right? Is the uncancelable boudnary at the end of poll(foo (assuming cancelation isn't observed during foo) also guaranteed by law? I didn't manage to prove it

@djspiewak
Copy link
Member

The uncancelable boundary at the end of uncancelable is guaranteed by the laws though, right?

Meaning that uncancelable is guaranteed to not check cancelation at the termination? That is in fact guaranteed by laws:

  def onCancelAssociatesOverUncancelableBoundary[A](fa: F[A], fin: F[Unit]) =
    F.uncancelable(_ => F.onCancel(fa, fin)) <-> F.onCancel(F.uncancelable(_ => fa), fin)

Is the uncancelable boudnary at the end of poll(foo (assuming cancelation isn't observed during foo) also guaranteed by law?

This one is a bit trickier. I think this is guaranteed by the above law composed with the following:

  def uncancelablePollIsIdentity[A](fa: F[A]) =
    F.uncancelable(_(fa)) <-> fa

It's tricky though. Both are definitely pervasively assumed properties in polymorphic code.

@djspiewak djspiewak merged commit 04e259a into typelevel:series/3.x May 9, 2021
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.

3 participants