Skip to content

Conversation

@UnrelatedString
Copy link
Owner

@UnrelatedString UnrelatedString commented Feb 27, 2025

Description of the change

Modified toUnfoldable in Data.List.NonEmpty and Data.List.Lazy.NonEmpty to have the signature toUnfoldable :: forall f. Unfoldable1 f => NonEmptyList ~> f, and reimplemented it accordingly. Additionally added tests covering all four toUnfoldables, since apparently there were no such tests in the existing codebase.

The motivation for this PR is that some users may hypothetically wish to convert known non-empty lists into other structures which cannot be empty. This can be addressed unobtrusively because Unfoldable1 is a superclass of Unfoldable; the old type signature is completely compatible with the new implementation. For lack of a real use case, I was inspired to contribute this change when developing an even more superfluous package of my own which pervasively concerns itself with laziness in unfoldables.

Did not bump the version--although I don't think I could have made any breaking changes, I still changed the types of two functions in the public API (and the only relevant tests are ones I wrote), and either way I assume versioning decisions are best left to package maintainers.


Checklist:

  • Added the change to the changelog's "Unreleased" section with a reference to this PR (e.g. "- Made a change (#0000)")
  • Linked any existing issues or proposals that this pull request should close
  • Updated or added relevant documentation
  • Added a test for the contribution (if applicable)

@UnrelatedString UnrelatedString merged commit 34f77a8 into main Feb 27, 2025
1 check passed
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.

2 participants