Skip to content

Added doctests for map, collectFirst, foldLeft, and foldRight for NonEmptyList#4844

Merged
satorg merged 8 commits intotypelevel:mainfrom
loladenney:main
Apr 19, 2026
Merged

Added doctests for map, collectFirst, foldLeft, and foldRight for NonEmptyList#4844
satorg merged 8 commits intotypelevel:mainfrom
loladenney:main

Conversation

@loladenney
Copy link
Copy Markdown
Contributor

No description provided.

* scala> val nel = NonEmptyList.of(2, 4, 6, 8, 10)
* scala> nel.collectFirst { case v if v > 5 => v }
* res0: Option[Int] = Some(6)
* scala> nel.collectFirst { case v if v % 2 == 1 => "even" }
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should this say "odd"?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good catch! I'll fix that right now.

LukaJCB
LukaJCB previously approved these changes Mar 16, 2026
@loladenney loladenney changed the title Added doctests for map and collectFirst for NonEmptyList Added doctests for map, collectFirst, foldLeft, and foldRight for NonEmptyList Apr 13, 2026
Copy link
Copy Markdown
Contributor

@satorg satorg left a comment

Choose a reason for hiding this comment

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

Thanks

@satorg satorg merged commit be4a99d into typelevel:main Apr 19, 2026
31 of 32 checks 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.

3 participants