Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Updates Monix to Cats-Effect 1.0.0-RC.
I managed to produce another gigantic PR, not sure how I do it 🙂 but many changes are superficial...
Platform.composeErrors
for those cases in which, given multiple exceptions, we need to combine and signal multiple errors somehow — the logic is platform independent, as on top of the JVM we're usingThrowable#addSuppressed
, but on top of JavaScript we're simply returning aCompositeException
StackFrame
to no longer take anUncaughtExceptionHandler
on error; this is a change to the internals of bothTask
andCoeval
, as instead of reporting the error using a provided logger, we're now composing errors usingPlatform.composeErrors
bracket
andbracketCase
forCoeval
,Task
andIterant
Task
now also implements the newAsync#never
; this posed difficulty in testing the new law, due to having to test for non-termination, which doesn't work well when we are testingTask#unsafeRunSync
, so for those particular tests we're disabling the laws that test for non-terminationCoeval
I added parens to.runTry()
and.run()
to signal side effects, which is a generally agreed upon convention in Scala; this doesn't have an impact on binary or source compatibility, other than warnings; many of the files enumerated as changed are due to thisredeem
andredeemWith
forTask
andCoeval
, as optimizations forattempt.map
andattempt.flatMap
respectively; see related issues: Add error-handling methods toEitherT
typelevel/cats#2237 and Add IO#redeem and IO#redeemWith typelevel/cats-effect#191Iterant
deprecated the oldIterant.bracket
, replacing it withIterant.resource
Iterant.resource
relying onflatMap
foruse
highlighted problems inIterant#flatMap
that were fixedIterant#bracket
andIterant.resource
are now implemented in terms of a newdoOnExitCase
operator; and the now deprecatedIterant.bracket
is implemented in terms ofIterant.resource
andflatMap
Iterant.empty
now returns the same reference, optimizing memory usageIterant#dump
was made more useful by printing the type of the node at each step ... this happened due to me debuggingIterant.resource(acquire)(release).flatMap(use)
, which was pretty hardIterant#doOnFinish
is now gone, now being derived fromdoOnExitCase
So the new
doOnExitCase
forIterant
looks like this:And then we can describe
Iterant.resource
:The deprecated
Iterant.bracket
:And the new
Bracket
implementation:Things left to do, but not addressed in this PR:
Observable#doOnExitCase
Observable.resource
Iterant#cancelable
as a way to address cancelation inF[_]
, see Cancelation laws presuppose no interruption typelevel/cats-effect#192 (comment)Task
violates theConcurrent
andConcurrentEffect
laws when it is executed with the auto-cancelable run loop active and that's a big problemTask#bracket
is broken in the presence of auto-cancelable run loops