Skip to content

Conversation

@FintanH
Copy link
Collaborator

@FintanH FintanH commented Nov 14, 2024

Fixes #601.

As pointed out in #60, splitting a NonEmpty that contains a single element can be ambiguous to a NonEmpty equivalent to (x, [x]). A better representation for this return type is (&T, &[T], Option<&T>).

Footnotes

  1. https://github.com/cloudhead/nonempty/issues/60

Copy link

@mx00s mx00s left a comment

Choose a reason for hiding this comment

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

This doc comment is now stale:

/// If there is only one element then first == last.

Potential alternative:

/// If there is only one element then last is `None`.

Fixes #60[^issue-60].

As pointed out in #60, splitting a `NonEmpty` that contains a single
element can be ambiguous to a `NonEmpty` equivalent to `(x, [x])`. A
better representation for this return type is `(&T, &[T],
Option<&T>)`.

[^issue-60]: #60
Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
@FintanH FintanH merged commit ce74c21 into master Dec 17, 2024
5 checks passed
@FintanH FintanH deleted the improve-split branch December 17, 2024 12:44
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.

split method is ambiguous on its own

3 participants