Packages

c

cats.syntax

FoldableOps0

final class FoldableOps0[F[_], A] extends AnyVal

Source
foldable.scala
Linear Supertypes
Type Hierarchy
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. FoldableOps0
  2. AnyVal
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new FoldableOps0(fa: F[A])

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    Any
  2. final def ##(): Int
    Definition Classes
    Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    Any
  4. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. def foldMapK[G[_], B](f: (A) ⇒ G[B])(implicit F: Foldable[F], G: MonoidK[G]): G[B]

    Fold implemented by mapping A values into B in a context G and then combining them using the MonoidK[G] instance.

    Fold implemented by mapping A values into B in a context G and then combining them using the MonoidK[G] instance.

    scala> import cats._, cats.implicits._
    scala> val f: Int => Endo[String] = i => (s => s + i)
    scala> val x: Endo[String] = List(1, 2, 3).foldMapK(f)
    scala> val a = x("foo")
    a: String = "foo321"
  6. def getClass(): Class[_ <: AnyVal]
    Definition Classes
    AnyVal → Any
  7. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  8. def mkString_(delim: String)(implicit A: Show[A], F: Foldable[F]): String

    Make a string using Show and delimiter.

    Make a string using Show and delimiter.

    Named as mkString_ to avoid conflict.

    Example:

    scala> import cats.implicits._
    
    scala> val l: List[Int] = List(1, 2, 3)
    scala> l.mkString_(",")
    res0: String = 1,2,3
    scala> val el: List[Int] = List()
    scala> el.mkString_(",")
    res1: String =
  9. def partitionBifold[H[_, _], B, C](f: (A) ⇒ H[B, C])(implicit A: Alternative[F], F: Foldable[F], H: Bifoldable[H]): (F[B], F[C])

    Separate this Foldable into a Tuple by an effectful separating function A => H[B, C] for some Bifoldable[H] Equivalent to Functor#map over Alternative#separate

    Separate this Foldable into a Tuple by an effectful separating function A => H[B, C] for some Bifoldable[H] Equivalent to Functor#map over Alternative#separate

    scala> import cats.implicits._, cats.data.Const
    scala> val list = List(1,2,3,4)
    scala> list.partitionBifold(a => (a, "value " + a.toString))
    res0: (List[Int], List[String]) = (List(1, 2, 3, 4),List(value 1, value 2, value 3, value 4))
    `Const`'s second parameter is never instantiated, so we can use an impossible type:
    scala> list.partitionBifold(a => Const[Int, Nothing with Any](a))
    res1: (List[Int], List[Nothing with Any]) = (List(1, 2, 3, 4),List())
  10. def partitionBifoldM[G[_], H[_, _], B, C](f: (A) ⇒ G[H[B, C]])(implicit A: Alternative[F], F: Foldable[F], M: Monad[G], H: Bifoldable[H]): G[(F[B], F[C])]

    Separate this Foldable into a Tuple by an effectful separating function A => G[H[B, C]] for some Bifoldable[H] Equivalent to Traverse#traverse over Alternative#separate

    Separate this Foldable into a Tuple by an effectful separating function A => G[H[B, C]] for some Bifoldable[H] Equivalent to Traverse#traverse over Alternative#separate

    scala> import cats.implicits._, cats.data.Const
    scala> val list = List(1,2,3,4)
    `Const`'s second parameter is never instantiated, so we can use an impossible type:
    scala> list.partitionBifoldM(a => Option(Const[Int, Nothing with Any](a)))
    res0: Option[(List[Int], List[Nothing with Any])] = Some((List(1, 2, 3, 4),List()))
  11. def partitionEitherM[G[_], B, C](f: (A) ⇒ G[Either[B, C]])(implicit A: Alternative[F], F: Foldable[F], M: Monad[G]): G[(F[B], F[C])]

    Separate this Foldable into a Tuple by an effectful separating function A => G[Either[B, C]] Equivalent to Traverse#traverse over Alternative#separate

    Separate this Foldable into a Tuple by an effectful separating function A => G[Either[B, C]] Equivalent to Traverse#traverse over Alternative#separate

    scala> import cats.implicits._, cats.Eval
    scala> val list = List(1,2,3,4)
    scala> val partitioned1 = list.partitionEitherM(a => if (a % 2 == 0) Eval.now(Either.left[String, Int](a.toString)) else Eval.now(Either.right[String, Int](a)))
    Since `Eval.now` yields a lazy computation, we need to force it to inspect the result:
    scala> partitioned1.value
    res0: (List[String], List[Int]) = (List(2, 4),List(1, 3))
    scala> val partitioned2 = list.partitionEitherM(a => Eval.later(Either.right(a * 4)))
    scala> partitioned2.value
    res1: (List[Nothing], List[Int]) = (List(),List(4, 8, 12, 16))
  12. def sliding10(implicit F: Foldable[F]): List[(A, A, A, A, A, A, A, A, A, A)]
  13. def sliding11(implicit F: Foldable[F]): List[(A, A, A, A, A, A, A, A, A, A, A)]
  14. def sliding12(implicit F: Foldable[F]): List[(A, A, A, A, A, A, A, A, A, A, A, A)]
  15. def sliding13(implicit F: Foldable[F]): List[(A, A, A, A, A, A, A, A, A, A, A, A, A)]
  16. def sliding14(implicit F: Foldable[F]): List[(A, A, A, A, A, A, A, A, A, A, A, A, A, A)]
  17. def sliding15(implicit F: Foldable[F]): List[(A, A, A, A, A, A, A, A, A, A, A, A, A, A, A)]
  18. def sliding16(implicit F: Foldable[F]): List[(A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A)]
  19. def sliding17(implicit F: Foldable[F]): List[(A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A)]
  20. def sliding18(implicit F: Foldable[F]): List[(A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A)]
  21. def sliding19(implicit F: Foldable[F]): List[(A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A)]
  22. def sliding2(implicit F: Foldable[F]): List[(A, A)]
  23. def sliding20(implicit F: Foldable[F]): List[(A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A)]
  24. def sliding21(implicit F: Foldable[F]): List[(A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A)]
  25. def sliding22(implicit F: Foldable[F]): List[(A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A)]
  26. def sliding3(implicit F: Foldable[F]): List[(A, A, A)]
  27. def sliding4(implicit F: Foldable[F]): List[(A, A, A, A)]
  28. def sliding5(implicit F: Foldable[F]): List[(A, A, A, A, A)]
  29. def sliding6(implicit F: Foldable[F]): List[(A, A, A, A, A, A)]
  30. def sliding7(implicit F: Foldable[F]): List[(A, A, A, A, A, A, A)]
  31. def sliding8(implicit F: Foldable[F]): List[(A, A, A, A, A, A, A, A)]
  32. def sliding9(implicit F: Foldable[F]): List[(A, A, A, A, A, A, A, A, A)]
  33. def toString(): String
    Definition Classes
    Any

Inherited from AnyVal

Inherited from Any

Ungrouped