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.
You may observe that any list has at least one permutation. The empty list's only permutation is the empty list itself, so:
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
NonEmptyto a list than to lift from a list toNonEmpty, since the latter requires the handling of the spurious case of the list being empty.