Make `Relude.List.permutations` return a `NonEmpty`.
- Dominant language
- Haskell
- Stars
- 742
- Forks
- 80
- PR merge metrics
- No merged PRs in 30d
Description
You may observe that any list has at least one permutation. The empty list's only permutation is the empty list itself, so:
```
λ Relude.List.permutations [ ]
[[]]
```
This behaviour is also theoretically sound since permutations of a list are a model of a symmetric group and a group always has at least one element.
It is nicer to have to drop from a `NonEmpty` to a list than to lift from a list to `NonEmpty`, since the latter requires the handling of the spurious case of the list being empty.
Contributor guide
Research direction
Search the Relude.List.permutations definition and its existing tests or usage sites. Confirm the empty-list example remains valid while changing the result type to NonEmpty, then run the relevant test suite and check that callers can still obtain a list when needed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- haskell
- Domain
- developer-experience
- Issue type
- Feature
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100