Packages

trait Fold[R, 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[R, A, B]
Linear Supertypes
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): Eff[R, B]
  2. abstract def fold: (S, A) ⇒ S
  3. abstract def start: Eff[R, 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[R, A, C]): Fold[R, A, (B, C)] { type S = (Fold.this.S, f.S) }

    fanout = zip in the Arrow terminology

  4. def ***[V, W](f: Fold[R, V, W]): Fold[R, (A, V), (B, W)] { type S = (Fold.this.S, f.S) }

    parallel composition

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

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

  6. def <*[C](f: Fold[R, A, C]): Fold[R, A, B] { type S = (Fold.this.S, f.S) }

    zip with another fold only for its side effects

  7. def <*>[C](f: Fold[R, A, C]): Fold[R, A, (B, C)] { type S = (Fold.this.S, f.S) }

    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[R, S]): Fold[R, A, B] { type S = (Fold.this.S, sink.S) }

    alias for observeNextState

  9. def <-*(sink: Sink[R, S]): Fold[R, A, B] { type S = (Fold.this.S, sink.S) }

    alias for observeState

  10. def <<+*(sink: Sink[R, (A, S)]): Fold[R, A, B] { type S = (Fold.this.S, sink.S) }

    alias for observeWithNextState

  11. def <<-*(sink: Sink[R, (A, S)]): Fold[R, A, B] { type S = (Fold.this.S, sink.S) }

    alias for observeWithState

  12. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  13. def as[C](c: ⇒ C): Fold[R, A, C] { type S = Fold.this.S }

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

  14. def asFoldable[F[_]](implicit monoid: Monoid[B], foldable: Foldable[F]): Fold[R, F[A], B] { type S = org.specs2.control.eff.Eff[R,B] }

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

  15. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  16. def clone(): AnyRef
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  17. def compose[C](f2: Fold[R, B, C]): Fold[R, A, C] { type S = org.specs2.control.eff.Eff[R,(Fold.this.S, f2.S)] }

    pipe the output of this fold into another fold

  18. def contramap[C](f: (C) ⇒ A): Fold[R, C, B] { type S = Fold.this.S }

    contramap the input values

  19. def endWith(action: Eff[R, Unit]): Fold[R, 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
  24. def hashCode(): Int
    Definition Classes
    AnyRef → Any
  25. def into[U](implicit intoPoly: IntoPoly[R, U]): Fold[U, A, B] { type S = Fold.this.S }

    use a transformation to go from effect stack to another

  26. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  27. def map[C](f: (B) ⇒ C): Fold[R, A, C] { type S = Fold.this.S }

    map the output value

  28. def mapFlatten[C](f: (B) ⇒ Eff[R, C]): Fold[R, A, C] { type S = Fold.this.S }

    flatMap the output value

  29. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  30. def nest[F[_], C](f: (C) ⇒ F[A])(implicit monoid: Monoid[B], foldable: Foldable[F]): Fold[R, C, B] { type S = org.specs2.control.eff.Eff[R,B] }

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

  31. final def notify(): Unit
    Definition Classes
    AnyRef
  32. final def notifyAll(): Unit
    Definition Classes
    AnyRef
  33. def observe[C](f: Fold[R, A, C]): Fold[R, A, B] { type S = (Fold.this.S, f.S) }

    alias for <*

  34. def observeNextState(sink: Sink[R, S]): Fold[R, A, B] { type S = (Fold.this.S, sink.S) }

    observe the next state

  35. def observeState(sink: Sink[R, S]): Fold[R, A, B] { type S = (Fold.this.S, sink.S) }

    observe the current state

  36. def observeWithNextState(sink: Sink[R, (A, S)]): Fold[R, A, B] { type S = (Fold.this.S, sink.S) }

    observe both the input value and the next state

  37. def observeWithState(sink: Sink[R, (A, S)]): Fold[R, A, B] { type S = (Fold.this.S, sink.S) }

    observe both the input value and the current state

  38. def observedBy[C](f: Fold[R, A, C]): Fold[R, A, C]

    alias for *>

  39. def pipe[C](f: Fold[R, B, C]): Fold[R, A, C] { type S = Fold.this.S }

    run another fold on the end result

  40. def run[F[_]](foldable: F[A])(implicit arg0: Foldable[F]): Eff[R, B]

    run a Fold with a Foldable instance

  41. def run1(a: A): Eff[R, B]

    run over one element

  42. def startWith(action: Eff[R, Unit]): Fold[R, A, B] { type S = Fold.this.S }
  43. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  44. def toString(): String
    Definition Classes
    AnyRef → Any
  45. def void: Fold[R, A, Unit] { type S = Fold.this.S }

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

  46. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  47. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  48. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  49. def zip[C](f: Fold[R, A, C]): Fold[R, A, (B, C)] { type S = (Fold.this.S, f.S) }

    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