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

NonEmptyList: Add bindAll and more unit tests #2995

Merged
merged 6 commits into from
Mar 27, 2023
Merged

Conversation

franciscodr
Copy link
Collaborator

This pull request adds the bindAll function to NonEmptyList for both Raise and RaiseAccumulate implementations. Additionally, it adds missing unit tests for the NonEmptyList API.

@@ -84,6 +85,11 @@ public class ResultRaise(private val raise: Raise<Throwable>) : Raise<Throwable>
@JvmName("bindAllResult")
public fun <A> Iterable<Result<A>>.bindAll(): List<A> =
map { it.bind() }

@RaiseDSL
@JvmName("bindAllResult")
Copy link
Member

Choose a reason for hiding this comment

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

We may have a problem with this name clashing in the Arrow 2.0 branch, where NonEmptyList is defined as a value class.

Copy link
Member

Choose a reason for hiding this comment

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

Not sure how it would differ when it being a value class 🤔 From Kotlin AST point-of-view it's a different type, and from JVM binary it has a different name.

@@ -249,6 +250,10 @@ public interface Raise<in Error> {
@RaiseDSL
public fun <A> Iterable<Either<Error, A>>.bindAll(): List<A> =
map { it.bind() }

@RaiseDSL
public fun <A> NonEmptyList<Either<Error, A>>.bindAll(): NonEmptyList<A> =
Copy link
Member

Choose a reason for hiding this comment

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

If we are including NonEmptyList, should we also include Set and other types of collections?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, I thought about adding NonEmptySet too today

@github-actions
Copy link
Contributor

github-actions bot commented Mar 24, 2023

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.

Looks great 🙌 Thank you @franciscodr.

@nomisRev nomisRev merged commit 92656b1 into main Mar 27, 2023
@nomisRev nomisRev deleted the fd-nel-additional-changes branch March 27, 2023 06:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants