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

Fix semantics of untilOutput and untilInput #2896

Merged
merged 1 commit into from
Jan 20, 2023
Merged

Fix semantics of untilOutput and untilInput #2896

merged 1 commit into from
Jan 20, 2023

Conversation

serras
Copy link
Member

@serras serras commented Jan 19, 2023

Fixes #2846

It seems that this was a semantic problem. Here's the diff between the previous and the proposed version:

public fun untilOutput(f: suspend (Output) -> Boolean): Schedule<Input, Output> =
-    !whileOutput(f)
+    whileOutput { !f(it) }

The former version applies whileOutput(f) and then negates, which applies to the entire Schedule. However, this is not right if you have several conditions, the right thing to do is to negate only the given f.

@serras serras requested a review from a team January 19, 2023 22:15
@github-actions
Copy link
Contributor

Kover Report

File Coverage [54.97%]
arrow-libs/fx/arrow-fx-resilience/src/commonMain/kotlin/arrow/fx/resilience/Schedule.kt 54.97%
Total Project Coverage 41.87%

Copy link
Member

@nomisRev nomisRev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome! Thank you @serras

@serras serras merged commit 013c8cd into main Jan 20, 2023
@serras serras deleted the schedule-while branch January 20, 2023 10:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants