Skip to content

Deprecate foreach in API #2193

Open
Open
@matthughes

Description

@matthughes

On principle, Cats has not provided foreach methods for most of its datatypes as this method implies side-effects. To be consistent, the following methods should be marked deprecated, documenting the suggested workarounds of either:

  • using IO.traverse or
  • using alleycats foreach additions to Foldable
core/src/main/scala/cats/data/Ior.scala
84:  final def foreach(f: B => Unit): Unit = {

core/src/main/scala/cats/data/Validated.scala
31:  def foreach(f: A => Unit): Unit = this match {

core/src/main/scala/cats/syntax/either.scala
38:  def foreach(f: B => Unit): Unit = eab match {

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions