-
Notifications
You must be signed in to change notification settings - Fork 529
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
Translate SyncIO
to F[_]: Sync
#1953
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aside from my one note, I quite like this!
Looks like the translation can work for any Another thing is that we might want to make it uncancelable. If we consider code like this valid: def thing[F[_]](implicit F: MonadCancelThrow[F]) = F.rootCancelScope match {
case Uncancelable =>
// We aren't gonna be cancelled, so no need for special handling
F.delay(...).flatMap(...).attempt.flatMap(...).rethrow
case Cancelable => F.raiseError(new Exception("Operation not supported for cancelable monads"))
} then doing |
Oof, you're so right about this being uncancelable. I don't know if we want to code it against cc @djspiewak |
Made the resulting |
@djspiewak I rebased this branch and addressed the comments. I need your resolution on @oleg-py's comment about If that is the case, this PR is ready for merging. |
"Tying to typeclass hierarchy" sounds odd as a justification. Sync is an "interface" both SyncIO and IO know about (yes, you "implement" it in the companion object, but it's already tied there), whereas there's no reason they, as concrete implementations, should know about each other. Isn't the point of typeclasses to allow reasonable abstraction over implementations?
It's the other way around, I suppose. You can't translate all of IO features (*looks at I guess the question is whether |
I agree with these points. Do you think it would be strange to have a |
I think Also users will be asking about conversions of |
Great! Thanks for the discussion @oleg-py. I'll push out the changes later. |
SyncIO
and IO
SyncIO
to F[_]: Sync
This is ready for merging. |
Resolves #1790.