-
Notifications
You must be signed in to change notification settings - Fork 448
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
CU-ev2g8f Fix Sequence#travserse, Option#apEval & Either#apEval #2260
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
211fea8
Fix Sequence.traverse to not put everything into memory first
nomisRev 4ab5726
Fix Either.apEval
nomisRev 9378ab2
Fix Option.apEval
nomisRev 255a9dc
Merge branch 'master' into cu-ev2g8f-fix-sequence-travserse
nomisRev 60213b1
Merge branch 'master' into cu-ev2g8f-fix-sequence-travserse
nomisRev 4a7825a
ktlintFormat
nomisRev File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 5 additions & 7 deletions
12
arrow-libs/core/arrow-core-data/src/test/kotlin/arrow/typeclasses/TraverseTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,15 @@ | ||
package arrow.typeclasses | ||
|
||
import arrow.core.None | ||
import arrow.core.Option | ||
import arrow.core.Some | ||
import arrow.core.extensions.option.applicative.applicative | ||
import arrow.core.extensions.sequence.traverse.sequence | ||
import arrow.core.Left | ||
import arrow.core.Right | ||
import arrow.core.sequenceEither | ||
import io.kotlintest.shouldBe | ||
import io.kotlintest.specs.StringSpec | ||
|
||
class TraverseTest : StringSpec({ | ||
"traverse is stacksafe over very long collections and short circuits properly" { | ||
// This has to traverse 50k elements till it reaches None and terminates | ||
generateSequence(0) { it + 1 }.map { if (it < 50_000) Some(it) else None } | ||
.sequence(Option.applicative()) shouldBe None | ||
generateSequence(0) { it + 1 }.map { if (it < 50_000) Right(it) else Left(Unit) } | ||
.sequenceEither() shouldBe Left(Unit) | ||
} | ||
}) |
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.
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.
is there or should be a specific test for this change?
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.
We should add many tests.. 😭😅 This code was taken from the
EitherApply.kt
code, and is verified inTraverseTest
. By reverting this change it makesTraverseTest
fail.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.
That's what I meant, perfect then! 👌