Improve Foldable doc traverse_ and sequence_
Open
Nobody has claimed this yet.
ready
- Dominant language
- Scala
- Stars
- 5.5k
- Forks
- 1.2k
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 5
Description
I have added some examples for Foldable.traverse_ and Foldable.sequence_ in https://github.com/non/cats/pull/506 but I think they are not really good:
scala> def parseInt(s: String): Option[Int] = scala.util.Try(Integer.parseInt(s)).toOption
parseInt: (s: String)Option[Int]
scala> Foldable[List].traverse_(List("1", "2"))(parseInt)
res11: Option[Unit] = Some(())
scala> Foldable[List].traverse_(List("1", "A"))(parseInt)
res12: Option[Unit] = None
scala> Foldable[List].sequence_(List(Option(1), Option(2)))
res13: Option[Unit] = Some(())
Does someone have an idea to improve these examples, so that it is still really simple but more useful?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the existing examples in pull request #506 and the documentation for Foldable.traverse_ and sequence_. Propose or update examples that remain simple while demonstrating useful success and failure behavior; done when the documentation clearly explains both operations.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- scala
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100