Packages

trait Fold[M[_], A, B] extends AnyRef

A Fold is a "left fold" over a data structure with:

  • a 'start' value
  • a 'fold' method to accumulate state
  • an 'end' method to finalize the result

Both 'start' and 'end' have an effect which allows the whole folding to take place inside a context.

Self Type
Fold[M, A, B]
Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Fold
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Type Members

  1. abstract type S

Abstract Value Members

  1. abstract def end(s: S): M[B]
  2. abstract def fold: (S, A) ⇒ M[S]
  3. implicit abstract def monad: Monad[M]
  4. abstract def start: M[S]

Concrete Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. def &&&[C](f: Fold[M, A, C]): Fold[M, A, (B, C)] { ... /* 2 definitions in type refinement */ }

    fanout = zip in the Arrow terminology

  4. def ***[V, W](f: Fold[M, V, W]): Fold[M, (A, V), (B, W)] { ... /* 2 definitions in type refinement */ }

    parallel composition

  5. def *>[C](f: Fold[M, A, C]): Fold[M, A, C]

    zip with another fold, running this one only for its side effects

  6. def <*[C](f: Fold[M, A, C]): Fold[M, A, B] { ... /* 2 definitions in type refinement */ }

    zip with another fold only for its side effects

  7. def <*>[C](f: Fold[M, A, C]): Fold[M, A, (B, C)] { ... /* 2 definitions in type refinement */ }

    zip 2 folds to return a pair of values.

    zip 2 folds to return a pair of values. alias for zip

  8. def <+*(sink: Sink[M, S]): Fold[M, A, B] { ... /* 2 definitions in type refinement */ }

    alias for observeNextState

  9. def <-*(sink: Sink[M, S]): Fold[M, A, B] { ... /* 2 definitions in type refinement */ }

    alias for observeState

  10. def <<+*(sink: Sink[M, (A, S)]): Fold[M, A, B] { ... /* 2 definitions in type refinement */ }

    alias for observeWithNextState

  11. def <<-*(sink: Sink[M, (A, S)]): Fold[M, A, B] { ... /* 2 definitions in type refinement */ }

    alias for observeWithState

  12. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  13. def as[C](c: ⇒ C): Fold[M, A, C] { ... /* 2 definitions in type refinement */ }

    equivalent of the as method for functors, added here for easier type inference

  14. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  15. def clone(): AnyRef
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @native() @throws( ... )
  16. def compose[C](f2: Fold[M, B, C]): Fold[M, A, C] { ... /* 2 definitions in type refinement */ }

    pipe the output of this fold into another fold

  17. def contraflatMap[C](f: (C) ⇒ M[A]): Fold[M, C, B] { ... /* 2 definitions in type refinement */ }

    contramap the input values with effects

  18. def contramap[C](f: (C) ⇒ A): Fold[M, C, B] { ... /* 2 definitions in type refinement */ }

    contramap the input values

  19. def endWith(action: M[Unit]): Fold[M, A, B] { type S = Fold.this.S }
  20. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  21. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  22. def finalize(): Unit
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  23. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  24. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  25. def into[M1[_]](implicit nat: ~>[M, M1], m: Monad[M1]): Fold[M1, A, B] { ... /* 2 definitions in type refinement */ }
  26. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  27. def map[C](f: (B) ⇒ C): Fold[M, A, C] { ... /* 2 definitions in type refinement */ }

    map the output value

  28. def mapFlatten[C](f: (B) ⇒ M[C]): Fold[M, A, C] { ... /* 2 definitions in type refinement */ }

    flatMap the output value

  29. def monadic[M1[_]](implicit nat: ~>[M, M1], m: Monad[M1]): Fold[M1, A, B] { ... /* 2 definitions in type refinement */ }
  30. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  31. def nest[F[_], C](f: (C) ⇒ F[A])(implicit monoid: Monoid[B], foldable: Foldable[F]): Fold[M, C, B] { ... /* 2 definitions in type refinement */ }

    create a fold that will run this fold repeatedly on input elements and collect all results

  32. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  33. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  34. def observe[C](f: Fold[M, A, C]): Fold[M, A, B] { ... /* 2 definitions in type refinement */ }

    alias for <*

  35. def observeNextState(sink: Sink[M, S]): Fold[M, A, B] { ... /* 2 definitions in type refinement */ }

    observe the next state

  36. def observeState(sink: Sink[M, S]): Fold[M, A, B] { ... /* 2 definitions in type refinement */ }

    observe the current state

  37. def observeWithNextState(sink: Sink[M, (A, S)]): Fold[M, A, B] { ... /* 2 definitions in type refinement */ }

    observe both the input value and the next state

  38. def observeWithState(sink: Sink[M, (A, S)]): Fold[M, A, B] { ... /* 2 definitions in type refinement */ }

    observe both the input value and the current state

  39. def observedBy[C](f: Fold[M, A, C]): Fold[M, A, C]

    alias for *>

  40. def pipe[C](f: Fold[M, B, C]): Fold[M, A, C] { ... /* 2 definitions in type refinement */ }

    run another fold on the end result

  41. def run[F[_]](foldable: F[A])(implicit arg0: Foldable[F]): M[B]

    run a Fold with a Foldable instance

  42. def run1(a: A): M[B]

    run over one element

  43. def startWith(action: M[Unit]): Fold[M, A, B] { type S = Fold.this.S }
  44. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  45. def toString(): String
    Definition Classes
    AnyRef → Any
  46. def void: Fold[M, A, Unit] { ... /* 2 definitions in type refinement */ }

    equivalent of the void method for functors, added here for easier type inference

  47. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  48. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  49. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @throws( ... )
  50. def zip[C](f: Fold[M, A, C]): Fold[M, A, (B, C)] { ... /* 2 definitions in type refinement */ }

    zip 2 folds to return a pair of values.

    zip 2 folds to return a pair of values. alias for <*>

Inherited from AnyRef

Inherited from Any

Ungrouped