Trait/Object

zio.prelude

ForEach

Related Docs: object ForEach | package prelude

Permalink

trait ForEach[F[+_]] extends Covariant[F]

ForEach is an abstraction that describes the ability to iterate over a collection, performing an effect for each element in the collection and returning a collection with the same shape in the context of the effect.

By choosing the appropriate effect type to traverse with a wide range of operations on collections can be described. In particular, by traversing with state we can describe folds which allow implementing a wide variety of collection operations that produce summaries from a collection of values.

Self Type
ForEach[F]
Linear Supertypes
Known Subclasses
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. ForEach
  2. Covariant
  3. Invariant
  4. CovariantSubset
  5. AnyRef
  6. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Abstract Value Members

  1. abstract def forEach[G[+_], A, B](fa: F[A])(f: (A) ⇒ G[B])(implicit arg0: IdentityBoth[G], arg1: Covariant[G]): G[F[B]]

    Permalink

    Traverse each element in the collection using the specified effectual function f, returning a new collection with the results in the context of the effect.

Concrete Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  5. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  6. final def compose[G[+_]](implicit arg0: ForEach[G]): ForEach[[+A]F[G[A]]]

    Permalink
  7. final def compose[G[-_]](implicit g: Contravariant[G]): Contravariant[[-A]F[G[A]]]

    Permalink

    Compose covariant and contravariant functors.

    Compose covariant and contravariant functors.

    Definition Classes
    Covariant
  8. final def compose[G[+_]](implicit g: Covariant[G]): Covariant[[+A]F[G[A]]]

    Permalink

    Compose two covariant functors.

    Compose two covariant functors.

    Definition Classes
    Covariant
  9. final def compose[G[_]](implicit g: Invariant[G]): Invariant[[A]F[G[A]]]

    Permalink

    Compose two invariant functors.

    Compose two invariant functors.

    Definition Classes
    Invariant
  10. def compositionLaw[A, B, C](fa: F[A], f: <=>[A, B], g: <=>[B, C])(implicit equal: Equal[F[C]]): Boolean

    Permalink
    Definition Classes
    Invariant
  11. def contains[A, A1 >: A](fa: F[A])(a: A1)(implicit A: Equal[A1]): Boolean

    Permalink

    Returns whether the collection contains the specified element.

  12. def count[A](fa: F[A])(f: (A) ⇒ Boolean): Int

    Permalink

    Returns the number of elements in the collection that satisfy the specified predicate.

  13. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  14. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  15. def exists[A](fa: F[A])(f: (A) ⇒ Boolean): Boolean

    Permalink

    Returns whether any element of the collection satisfies the specified predicate.

  16. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  17. def find[A](fa: F[A])(f: (A) ⇒ Boolean): Option[A]

    Permalink

    Returns the first element in the collection satisfying the specified predicate if one exists or None otherwise.

  18. def flip[G[+_], A](fa: F[G[A]])(implicit arg0: IdentityBoth[G], arg1: Covariant[G]): G[F[A]]

    Permalink

    Converts a collection with elements that are in the context of effects to a collection of elements in the context of an effect.

  19. def fold[A](fa: F[A])(implicit arg0: Identity[A]): A

    Permalink

    Folds over the elements of this collection using an associative operation and an identity.

    Folds over the elements of this collection using an associative operation and an identity. Alias for reduceIdentity.

  20. def foldLeft[S, A](fa: F[A])(s: S)(f: (S, A) ⇒ S): S

    Permalink

    Folds over the elements of this collection from left to right to produce a summary value, maintaining some internal state along the way.

  21. def foldLeftM[G[+_], S, A](fa: F[A])(s: S)(f: (S, A) ⇒ G[S])(implicit arg0: IdentityFlatten[G], arg1: Covariant[G]): G[S]

    Permalink

    Effectually fold over the elements of this collection from left to right to produce a summary value, maintaining some internal state along the way.

  22. def foldMap[A, B](fa: F[A])(f: (A) ⇒ B)(implicit arg0: Identity[B]): B

    Permalink

    Maps each element of the collection to a type B for which an Identity is defined using the function f, then reduces those values to a single summary using the combine operation of Identity, or the identity element if the collection is empty.

  23. def foldMapM[G[+_], A, B](fa: F[A])(f: (A) ⇒ G[B])(implicit arg0: Covariant[G], arg1: IdentityFlatten[G], arg2: Identity[B]): G[B]

    Permalink

    Effectfully maps each element of the collection to a type B for which an Identity is defined using the function f, then reduces those values to a single summary using the combine operation of Identity, or the identity element if the collection is empty.

  24. def foldRight[S, A](fa: F[A])(s: S)(f: (A, S) ⇒ S): S

    Permalink

    Folds over the elements of this collection from right to left to produce a summary value, maintaining some internal state along the way.

  25. def foldRightM[G[+_], S, A](fa: F[A])(s: S)(f: (A, S) ⇒ G[S])(implicit arg0: IdentityFlatten[G], arg1: Covariant[G]): G[S]

    Permalink

    Effectually fold over the elements of this collection from right to left to produce a summary value, maintaining some internal state along the way.

  26. def forEach_[G[+_], A](fa: F[A])(f: (A) ⇒ G[Any])(implicit arg0: IdentityBoth[G], arg1: Covariant[G]): G[Unit]

    Permalink

    Traverses each element in the collection with the specified effectual function f purely for its effects.

  27. def forall[A](fa: F[A])(f: (A) ⇒ Boolean): Boolean

    Permalink

    Returns whether any element of the collection satisfies the specified predicate.

  28. def fproduct[A, B](f: (A) ⇒ B): (F[A]) ⇒ F[(A, B)]

    Permalink
    Definition Classes
    Covariant
  29. def fproductLeft[A, B](f: (A) ⇒ B): (F[A]) ⇒ F[(B, A)]

    Permalink
    Definition Classes
    Covariant
  30. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  31. def groupByNonEmpty[V, K](fa: F[V])(f: (V) ⇒ K): Map[K, NonEmptyChunk[V]]

    Permalink
  32. def groupByNonEmptyM[G[+_], V, K](fa: F[V])(f: (V) ⇒ G[K])(implicit arg0: IdentityBoth[G], arg1: Covariant[G]): G[Map[K, NonEmptyChunk[V]]]

    Permalink
  33. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  34. def identityLaw1[A](fa: F[A])(implicit equal: Equal[F[A]]): Boolean

    Permalink
    Definition Classes
    Invariant
  35. def intersperse[A](fa: F[A], middle: A)(implicit I: Identity[A]): A

    Permalink

    Folds over the elements of this collection using an associative operation with the middle element interspersed between every element.

  36. final def invmap[A, B](f: <=>[A, B]): <=>[F[A], F[B]]

    Permalink
    Definition Classes
    CovariantInvariant
  37. def isEmpty[A](fa: F[A]): Boolean

    Permalink

    Returns whether the collection is empty.

  38. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  39. def map[A, B](f: (A) ⇒ B): (F[A]) ⇒ F[B]

    Permalink

    Lifts a function operating on values to a function that operates on each element of a collection.

    Lifts a function operating on values to a function that operates on each element of a collection.

    Definition Classes
    ForEachCovariant
  40. def mapAccum[S, A, B](fa: F[A])(s: S)(f: (S, A) ⇒ (S, B)): (S, F[B])

    Permalink

    Statefully maps over the elements of the collection, maintaining some state along the way and returning the final state along with the new collection.

  41. final def mapSubset[A, B](f: (A) ⇒ B)(implicit arg0: AnyType[B]): (F[A]) ⇒ F[B]

    Permalink
    Definition Classes
    CovariantCovariantSubset
  42. def maxByOption[A, B](fa: F[A])(f: (A) ⇒ B)(implicit arg0: Ord[B]): Option[A]

    Permalink

    Returns the largest element in the collection if one exists, using the function f to map each element to a type for which an Ord is defined, or None otherwise.

  43. def maxOption[A](fa: F[A])(implicit arg0: Ord[A]): Option[A]

    Permalink

    Returns the largest value in the collection if one exists or None otherwise.

  44. def minByOption[A, B](fa: F[A])(f: (A) ⇒ B)(implicit arg0: Ord[B]): Option[A]

    Permalink

    Returns the smallest element in the collection if one exists, using the function f to map each element to a type for which an Ord is defined, or None otherwise.

  45. def minOption[A](fa: F[A])(implicit arg0: Ord[A]): Option[A]

    Permalink

    Returns the smallest value in the collection if one exists or None otherwise.

  46. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  47. def nonEmpty[A](fa: F[A]): Boolean

    Permalink

    Returns whether the collection contains at least one element

  48. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  49. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  50. def partitionMap[A, B, C](fa: F[A])(f: (A) ⇒ Either[B, C])(implicit both: IdentityBoth[F], either: IdentityEither[F]): (F[B], F[C])

    Permalink

    Partitions the collection based on the specified function.

  51. def partitionMapM[G[+_], A, B, C](fa: F[A])(f: (A) ⇒ G[Either[B, C]])(implicit arg0: IdentityFlatten[G], arg1: Covariant[G], both: IdentityBoth[F], either: IdentityEither[F]): G[(F[B], F[C])]

    Permalink

    Partitions the collection based on the specified effectual function.

  52. def partitionMapV[W, E, A, B](fa: F[A])(f: (A) ⇒ ZValidation[W, E, B])(implicit both: IdentityBoth[F], either: IdentityEither[F]): (F[E], F[B])

    Permalink

    Partitions the collection based on the specified validation function.

  53. def product[A](fa: F[A])(implicit ev: Identity[Prod[A]]): A

    Permalink

    Returns the product of all elements in the collection.

  54. def reduceAssociative[A](fa: F[A])(implicit arg0: Associative[A]): Option[A]

    Permalink

    Reduces the collection to a summary value using the associative operation, returning None if the collection is empty.

  55. def reduceIdempotent[A](fa: F[A])(implicit arg0: Idempotent[A], arg1: Equal[A]): Option[A]

    Permalink

    Reduces the collection to a summary value using the idempotent operation, returning None if the collection is empty.

  56. def reduceIdentity[A](fa: F[A])(implicit arg0: Identity[A]): A

    Permalink

    Reduces the collection to a summary value using the associative operation.

    Reduces the collection to a summary value using the associative operation. Alias for fold.

  57. def reduceMapOption[A, B](fa: F[A])(f: (A) ⇒ B)(implicit arg0: Associative[B]): Option[B]

    Permalink

    Maps each element of the collection to a type B for which an associative operation exists and then reduces the values using the associative operation, returning None if the collection is empty.

  58. def reduceOption[A](fa: F[A])(f: (A, A) ⇒ A): Option[A]

    Permalink

    Reduces the collection to a summary value using the binary function f, returning None if the collection is empty.

  59. def reverse[A](fa: F[A]): F[A]

    Permalink

    Reverses the order of elements in the collection.

  60. def size[A](fa: F[A]): Int

    Permalink

    Returns the number of elements in the collection.

  61. def sum[A](fa: F[A])(implicit ev: Identity[Sum[A]]): A

    Permalink

    Returns the sum of all elements in the collection.

  62. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  63. def toChunk[A](fa: F[A]): Chunk[A]

    Permalink

    Converts the collection to a Chunk.

  64. def toList[A](fa: F[A]): List[A]

    Permalink

    Converts the collection to a List.

  65. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  66. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  67. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  68. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  69. def zipAll[A, B, C](fa: F[A], fb: F[B])(implicit both: IdentityBoth[F], either: IdentityEither[F]): F[These[A, B]]

    Permalink

    Zips the left collection and right collection together, using None to handle the case where one collection is larger than the other.

  70. def zipAllWith[A, B, C](fa: F[A], fb: F[B])(f: (These[A, B]) ⇒ C)(implicit both: IdentityBoth[F], either: IdentityEither[F]): F[C]

    Permalink

    Zips the left collection and right collection together, using the specified function to handle the cases where one collection is larger than the other.

  71. def zipWithIndex[A](fa: F[A]): F[(A, Int)]

    Permalink

    Zips each element of the collection with its index.

Inherited from Covariant[F]

Inherited from Invariant[F]

Inherited from CovariantSubset[F, AnyType]

Inherited from AnyRef

Inherited from Any

Ungrouped