Class

cats.syntax

FoldableOps1

Related Doc: package syntax

Permalink

final class FoldableOps1[F[_]] extends AnyVal

Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. FoldableOps1
  2. AnyVal
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new FoldableOps1(F: Foldable[F])

    Permalink

Value Members

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

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

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

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

    Permalink
    Definition Classes
    Any
  5. def getClass(): Class[_ <: AnyVal]

    Permalink
    Definition Classes
    AnyVal → Any
  6. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  7. def partitionBifold[H[_, _], A, B, C](fa: F[A])(f: (A) ⇒ H[B, C])(implicit A: Alternative[F], H: Bifoldable[H]): (F[B], F[C])

    Permalink

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

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

    scala> import cats.implicits._, cats.Foldable, cats.data.Const
    scala> val list = List(1,2,3,4)
    scala> Foldable[List].partitionBifold(list)(a => ("value " + a.toString(), if (a % 2 == 0) -a else a))
    res0: (List[String], List[Int]) = (List(value 1, value 2, value 3, value 4),List(1, -2, 3, -4))
    scala> Foldable[List].partitionBifold(list)(a => Const[Int, Nothing with Any](a))
    res1: (List[Int], List[Nothing with Any]) = (List(1, 2, 3, 4),List())
  8. def partitionBifoldM[G[_], H[_, _], A, B, C](fa: F[A])(f: (A) ⇒ G[H[B, C]])(implicit A: Alternative[F], M: Monad[G], H: Bifoldable[H]): G[(F[B], F[C])]

    Permalink

    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.Foldable, 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> Foldable[List].partitionBifoldM(list)(a => Option(Const[Int, Nothing with Any](a)))
    res0: Option[(List[Int], List[Nothing with Any])] = Some((List(1, 2, 3, 4),List()))
  9. def partitionEitherM[G[_], A, B, C](fa: F[A])(f: (A) ⇒ G[Either[B, C]])(implicit A: Alternative[F], M: Monad[G]): G[(F[B], F[C])]

    Permalink

    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.Foldable, cats.Eval
    scala> val list = List(1,2,3,4)
    scala> val partitioned1 = Foldable[List].partitionEitherM(list)(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 = Foldable[List].partitionEitherM(list)(a => Eval.later(Either.right(a * 4)))
    scala> partitioned2.value
    res1: (List[Nothing], List[Int]) = (List(),List(4, 8, 12, 16))
  10. def toString(): String

    Permalink
    Definition Classes
    Any

Inherited from AnyVal

Inherited from Any

Ungrouped