cats

Reducible

trait Reducible[F[_]] extends Foldable[F]

Data structures that can be reduced to a summary value.

Reducible is like a non-empty Foldable. In addition to the fold methods it provides reduce methods which do not require an initial value.

In addition to the methods needed by Foldable, Reducible is implemented in terms of two methods:

Self Type
Reducible[F]
Linear Supertypes
Foldable[F], Serializable, Serializable, AnyRef, Any
Known Subclasses
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. Reducible
  2. Foldable
  3. Serializable
  4. Serializable
  5. AnyRef
  6. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Abstract Value Members

  1. abstract def foldLeft[A, B](fa: F[A], b: B)(f: (B, A) ⇒ B): B

    Left associative fold on 'F' using the function 'f'.

    Left associative fold on 'F' using the function 'f'.

    Definition Classes
    Foldable
  2. abstract def partialFold[A, B](fa: F[A])(f: (A) ⇒ Fold[B]): Fold[B]

    Low-level method that powers foldRight.

    Low-level method that powers foldRight.

    Definition Classes
    Foldable
  3. abstract def reduceLeftTo[A, B](fa: F[A])(f: (A) ⇒ B)(g: (B, A) ⇒ B): B

    Apply f to the "initial element" of fa and combine it with every other value using the given function g.

  4. abstract def reduceRightTo[A, B](fa: F[A])(f: (A) ⇒ B)(g: (A) ⇒ Fold[B]): Lazy[B]

    Apply f to the "initial element" of fa and lazily combine it with every other value using the given function g.

Concrete Value Members

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

    Definition Classes
    AnyRef
  2. final def !=(arg0: Any): Boolean

    Definition Classes
    Any
  3. final def ##(): Int

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

    Definition Classes
    AnyRef
  5. final def ==(arg0: Any): Boolean

    Definition Classes
    Any
  6. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  7. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  8. def compose[G[_]](implicit GG: Reducible[G]): Reducible[[α]F[G[α]]]

    Compose two Reducible instances into a new one.

  9. def compose[G[_]](implicit G0: Foldable[G]): Foldable[[α]F[G[α]]]

    Compose this Foldable[F] with a Foldable[G] to create a Foldable[F[G]] instance.

    Compose this Foldable[F] with a Foldable[G] to create a Foldable[F[G]] instance.

    Definition Classes
    Foldable
  10. def dropWhile_[A](fa: F[A])(p: (A) ⇒ Boolean): List[A]

    Convert F[A] to a List[A], dropping all initial elements which match p.

    Convert F[A] to a List[A], dropping all initial elements which match p.

    Definition Classes
    Foldable
  11. def empty[A](fa: F[A]): Boolean

    Returns true if there are no elements.

    Returns true if there are no elements. Otherwise false.

    Definition Classes
    Foldable
  12. final def eq(arg0: AnyRef): Boolean

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

    Definition Classes
    AnyRef → Any
  14. def exists[A](fa: F[A])(p: (A) ⇒ Boolean): Boolean

    Check whether at least one element satisfies the predicate.

    Check whether at least one element satisfies the predicate.

    If there are no elements, the result is false.

    Definition Classes
    Foldable
  15. def filter_[A](fa: F[A])(p: (A) ⇒ Boolean): List[A]

    Convert F[A] to a List[A], only including elements which match p.

    Convert F[A] to a List[A], only including elements which match p.

    Definition Classes
    Foldable
  16. def finalize(): Unit

    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]

    Find the first element matching the predicate, if one exists.

    Find the first element matching the predicate, if one exists.

    Definition Classes
    Foldable
  18. def fold[A](fa: F[A])(implicit A: Monoid[A]): A

    Fold implemented using the given Monoid[A] instance.

    Fold implemented using the given Monoid[A] instance.

    Definition Classes
    Foldable
  19. def foldK[G[_], A](fga: F[G[A]])(implicit G: MonoidK[G]): G[A]

    Fold implemented using the given MonoidK[G] instance.

    Fold implemented using the given MonoidK[G] instance.

    This method is identical to fold, except that we use the universal monoid (MonoidK[G]) to get a Monoid[G[A]] instance.

    For example:

    val F = Foldable[List]
    F.foldK(List(1 :: 2 :: Nil, 3 :: 4 :: 5 :: Nil))
    // List(1, 2, 3, 4, 5)
    Definition Classes
    Foldable
  20. def foldMap[A, B](fa: F[A])(f: (A) ⇒ B)(implicit B: Monoid[B]): B

    Fold implemented by mapping A values into B and then combining them using the given Monoid[B] instance.

    Fold implemented by mapping A values into B and then combining them using the given Monoid[B] instance.

    Definition Classes
    Foldable
  21. def foldRight[A, B](fa: F[A], lb: Lazy[B])(f: (A) ⇒ Fold[B]): Lazy[B]

    Right associative lazy fold on F using the folding function 'f'.

    Right associative lazy fold on F using the folding function 'f'.

    This method evaluates b lazily (in some cases it will not be needed), and returns a lazy value. We are using A => Fold[B] to support laziness in a stack-safe way.

    For more detailed information about how this method works see the documentation for Fold[_].

    Definition Classes
    Foldable
  22. def forall[A](fa: F[A])(p: (A) ⇒ Boolean): Boolean

    Check whether all elements satisfy the predicate.

    Check whether all elements satisfy the predicate.

    If there are no elements, the result is true.

    Definition Classes
    Foldable
  23. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  24. def hashCode(): Int

    Definition Classes
    AnyRef → Any
  25. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  26. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  27. final def notify(): Unit

    Definition Classes
    AnyRef
  28. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  29. def reduce[A](fa: F[A])(implicit A: Semigroup[A]): A

    Reduce a F[A] value using the given Semigroup[A].

  30. def reduceK[G[_], A](fga: F[G[A]])(implicit G: SemigroupK[G]): G[A]

    Reduce a F[G[A]] value using SemigroupK[G], a universal semigroup for G[_].

    Reduce a F[G[A]] value using SemigroupK[G], a universal semigroup for G[_].

    This method is a generalization of reduce.

  31. def reduceLeft[A](fa: F[A])(f: (A, A) ⇒ A): A

    Left-associative reduction on F using the function f.

    Left-associative reduction on F using the function f.

    Implementations should override this method when possible.

  32. def reduceLeftToOption[A, B](fa: F[A])(f: (A) ⇒ B)(g: (B, A) ⇒ B): Option[B]

    Overriden from Foldable[_] for efficiency.

    Overriden from Foldable[_] for efficiency.

    Definition Classes
    ReducibleFoldable
  33. def reduceMap[A, B](fa: F[A])(f: (A) ⇒ B)(implicit B: Semigroup[B]): B

    Apply f to each element of fa and combine them using the given Semigroup[B].

  34. def reduceRight[A](fa: F[A])(f: (A) ⇒ Fold[A]): Lazy[A]

    Right-associative reduction on F using the function f.

  35. def reduceRightToOption[A, B](fa: F[A])(f: (A) ⇒ B)(g: (A) ⇒ Fold[B]): Lazy[Option[B]]

    Overriden from Foldable[_] for efficiency.

    Overriden from Foldable[_] for efficiency.

    Definition Classes
    ReducibleFoldable
  36. def sequence1_[G[_], A, B](fga: F[G[A]])(implicit G: Apply[G]): G[Unit]

    Sequence F[G[A]] using Apply[G].

    Sequence F[G[A]] using Apply[G].

    This method is similar to Foldable#sequence_. The difference is that we only need Apply[G] here, since we don't need to call Applicative#pure for a starting value.

  37. def sequence_[G[_], A, B](fga: F[G[A]])(implicit arg0: Applicative[G]): G[Unit]

    Sequence F[G[A]] using Applicative[G].

    Sequence F[G[A]] using Applicative[G].

    This is similar to traverse_ except it operates on F[G[A]] values, so no additional functions are needed.

    For example:

    val F = Foldable[List]
    F.sequence_(List(Option(1), Option(2), Option(3))) // Some(())
    F.sequence_(List(Option(1), None, Option(3)))      // None
    Definition Classes
    Foldable
  38. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  39. def toList[A](fa: F[A]): List[A]

    Convert F[A] to a List[A].

    Convert F[A] to a List[A].

    Definition Classes
    Foldable
  40. def toString(): String

    Definition Classes
    AnyRef → Any
  41. def traverse1_[G[_], A, B](fa: F[A])(f: (A) ⇒ G[B])(implicit G: Apply[G]): G[Unit]

    Traverse F[A] using Apply[G].

    Traverse F[A] using Apply[G].

    A values will be mapped into G[B] and combined using Applicative#map2.

    This method does the same thing as Foldable#traverse_. The difference is that we only need Apply[G] here, since we don't need to call Applicative#pure for a starting value.

  42. def traverse_[G[_], A, B](fa: F[A])(f: (A) ⇒ G[B])(implicit G: Applicative[G]): G[Unit]

    Traverse F[A] using Applicative[G].

    Traverse F[A] using Applicative[G].

    A values will be mapped into G[B] and combined using Applicative#map2.

    For example:

    def parseInt(s: String): Option[Int] = ...
    val F = Foldable[List]
    F.traverse_(List("333", "444"))(parseInt) // Some(())
    F.traverse_(List("333", "zzz"))(parseInt) // None

    This method is primarily useful when G[_] represents an action or effect, and the specific A aspect of G[A] is not otherwise needed.

    Definition Classes
    Foldable
  43. final def wait(): Unit

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

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

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from Foldable[F]

Inherited from Serializable

Inherited from Serializable

Inherited from AnyRef

Inherited from Any

Ungrouped