Deprecate arrow.fx.coroutines.Duration #338
Conversation
# Conflicts: # arrow-fx-coroutines/src/test/kotlin/arrow/fx/coroutines/BracketCaseTest.kt # arrow-fx-coroutines/src/test/kotlin/arrow/fx/coroutines/TimerTest.kt
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.
The added function for kotlin.time.Duration
in timer.kt
should be removed. We don't want to add new code there since KotlinX already covers all of these APIs. Does this remove all references to sleep
/timeOutOrNull
from the documentation and code?
I don't understand the diff from arrow-fx-coroutines/src/test/kotlin/arrow/fx/coroutines/TimerTest.kt
. Is it re-added as an empty file?
Thanks for taking the time to do some clean-up!
arrow-fx-coroutines/src/main/kotlin/arrow/fx/coroutines/timer.kt
Outdated
Show resolved
Hide resolved
* } | ||
* ``` | ||
**/ | ||
suspend fun <A> timeOutOrNull(duration: kotlin.time.Duration, fa: suspend () -> A): A? = |
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.
Users should migrate to KotlinX withTimeoutOrNull
.
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.
I will remove that :D
@@ -36,7 +37,7 @@ class EvalOnTests : ArrowFxSpec(spec = { | |||
|
|||
"evalOn on the same context doesn't dispatch" { | |||
suspend fun onSameContext(): String = | |||
evalOn(ComputationPool) { | |||
withContext(ComputationPool) { |
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.
This is just testing code from another library now.
If we want to make such a change we instead just remove EvalOnTests
from Arrow Fx Coroutines
since evalOn
now only delegates to withContext
.
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.
Ok I will do that
package arrow.fx.coroutines | ||
|
||
import java.util.concurrent.TimeUnit | ||
|
||
// TODO replace with kotlin.time | ||
@Deprecated( | ||
"Redundant since 0.12.0 will provide automatic integration with KotlinX", |
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.
I think we need to provide a clearer message here. Duration
is Deprecated
in favor of kotlin.time.Duration
, and KotlinX offers all APIs we offer in timer.kt
for both kotlin.time.Duration
and milliseconds: Long
so APIs are available to the user with and without optining in for kotlin.time
.
But that's a bit too long for a deprecated message I guess 😅
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.
Yes, I was also unsure, what message would make sense in this case.
But I will go for yours, regardless 😄
Co-authored-by: Simon Vergauwen <nomisRev@users.noreply.github.com>
arrow-fx-coroutines/src/main/kotlin/arrow/fx/coroutines/evalOn.kt
Outdated
Show resolved
Hide resolved
@@ -0,0 +1,190 @@ | |||
#!/bin/bash |
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.
What is this file doing? Is this change needed? cc\ @rachelcarmena
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.
No it is not needed, I wanted to execute the buildArrowDoc
gradle task and it couldn't find that file from my local instance. I will remove that.
Still I couldn't execute the gradle task.
Do you know how I can perform the Ank checks?
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.
There is a buildArrowDoc
task available for me when checking out Arrow Fx 🤔 I think it relies on the other project being available locally, so ./gradlew gitPullAll
. Not 100% sure how that works. It's mostly easier to just run Ank on CI and fix all the issues that it raises 😅
That's why I made Ank work with Validated
so long ago 😂
Co-authored-by: Simon Vergauwen <nomisRev@users.noreply.github.com>
This PR's is getting too big, so I am breaking it into multiple sub PR's to show some of the Error's I am running into |
Status
On HOLD
Description
Deprecate and remove usages of arrow's Duration from all API's besides
arrow.fx.Timer
and other usages withinarrow.fx
, as it will be deprecated and removed soon.kotlin.time.Duration
is used.In addition, this PR's centralizes some common build settings in
Todos