Skip to content

add non-empty collection variants #274

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

Open
scarf005 opened this issue Feb 21, 2025 · 1 comment
Open

add non-empty collection variants #274

scarf005 opened this issue Feb 21, 2025 · 1 comment

Comments

@scarf005
Copy link

motivation:

it'd be nice to centralize nonempty collections into de-facto stdlib.

example usage:

scala> List().head
java.util.NoSuchElementException: head of empty list
  at scala.collection.immutable.Nil$.head(List.scala:663)
  at scala.collection.immutable.Nil$.head(List.scala:662)
  ... 30 elided
                                                                                                                                                                                                                                        scala> List().headOption
val res1: Option[Nothing] = None

scala> NonEmptyList(1).head
1
@SethTisue
Copy link
Member

one old discussion is at scala/collection-strawman#40 (probably there have been others)

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

No branches or pull requests

2 participants