trait
FoldM[T, M[_], U] extends AnyRef
Type Members
-
abstract
type
S
Abstract Value Members
-
abstract
def
end(s: S): M[U]
-
abstract
def
fold: (S, T) ⇒ S
-
abstract
def
start: M[S]
Concrete Value Members
-
final
def
!=(arg0: Any): Boolean
-
final
def
##(): Int
-
def
&&&[V](f: FoldM[T, M, V])(implicit ap: Apply[M]): FoldM[T, M, (U, V)] { type S = (FoldM.this.S, f.S) }
-
def
***[V, W](f: FoldM[V, M, W])(implicit m: Bind[M]): FoldM[(T, V), M, (U, W)] { type S = (FoldM.this.S, f.S) }
-
def
*>[V](f: FoldM[T, M, V])(implicit ap: Apply[M], ev: <:<[U, Unit]): FoldM[T, M, V] { type S = (FoldM.this.S, f.S) }
-
def
<*[V](f: SinkM[T, M])(implicit ap: Apply[M]): FoldM[T, M, U] { type S = (FoldM.this.S, f.S) }
-
def
<*>[V](f: FoldM[T, M, V])(implicit ap: Apply[M]): FoldM[T, M, (U, V)] { type S = (FoldM.this.S, f.S) }
-
def
<<*[V](sink: SinkM[(S, T), M])(implicit ap: Apply[M]): FoldM[T, M, U] { type S = (FoldM.this.S, sink.S) }
-
def
<<<*[V](sink: SinkM[(S, T), M])(implicit ap: Apply[M]): FoldM[T, M, U] { type S = (FoldM.this.S, sink.S) }
-
final
def
==(arg0: Any): Boolean
-
def
as[V](v: ⇒ V)(implicit m: Functor[M]): FoldM[T, M, V] { type S = FoldM.this.S }
-
final
def
asInstanceOf[T0]: T0
-
def
clone(): AnyRef
-
def
compose[V](f2: FoldM[U, M, V])(implicit m: Monad[M]): FoldM[T, M, V] { type S = M[(FoldM.this.S, f2.S)] }
-
def
contramap[R](f: (R) ⇒ T)(implicit m: Functor[M]): FoldM[R, M, U] { type S = FoldM.this.S }
-
def
endWith(action: M[Unit])(implicit ap: Apply[M]): FoldM[T, M, U] { type S = FoldM.this.S }
-
final
def
eq(arg0: AnyRef): Boolean
-
def
equals(arg0: Any): Boolean
-
def
finalize(): Unit
-
def
first[V](implicit m: MonadPlus[M]): FoldM[(T, V), M, (U, V)] { type S = (FoldM.this.S, M[V]) }
-
def
firstOption[V](implicit m: Bind[M], nat: ~>[scalaz.Id.Id, M]): FoldM[(T, V), M, (U, Option[V])] { type S = (FoldM.this.S, Option[V]) }
-
final
def
getClass(): Class[_]
-
def
hashCode(): Int
-
def
into[N[_]](implicit nat: ~>[M, N]): FoldM[T, N, U] { type S = FoldM.this.S }
-
final
def
isInstanceOf[T0]: Boolean
-
def
map[V](f: (U) ⇒ V)(implicit m: Functor[M]): FoldM[T, M, V] { type S = FoldM.this.S }
-
def
mapFlatten[V](f: (U) ⇒ M[V])(implicit m: Bind[M]): FoldM[T, M, V] { type S = FoldM.this.S }
-
final
def
ne(arg0: AnyRef): Boolean
-
def
nest[F[_], R](f: (R) ⇒ F[T])(implicit df: FoldableM[F, M], monoid: Monoid[U], monad: Monad[M]): FoldM[R, M, U] { type S = M[U] }
-
final
def
notify(): Unit
-
final
def
notifyAll(): Unit
-
def
observe[V](f: SinkM[T, M])(implicit ap: Apply[M]): FoldM[T, M, U] { type S = (FoldM.this.S, f.S) }
-
def
observeNextState[V](sink: SinkM[(S, T), M])(implicit ap: Apply[M]): FoldM[T, M, U] { type S = (FoldM.this.S, sink.S) }
-
def
observeState[V](sink: SinkM[(S, T), M])(implicit ap: Apply[M]): FoldM[T, M, U] { type S = (FoldM.this.S, sink.S) }
-
def
pipe[V](f: FoldM[U, M, V])(implicit m: Bind[M]): FoldM[T, M, V] { type S = FoldM.this.S }
-
def
run[F[_]](ft: F[T])(implicit foldableM: FoldableM[F, M]): M[U]
-
def
run1(t: T)(implicit m: Bind[M]): M[U]
-
def
runBreak[F[_]](ft: F[T])(implicit foldableM: FoldableM[F, M]): M[U]
-
def
runS[F](f: F)(implicit foldableMS: FoldableMS[T, F, M]): M[U]
-
def
second[V](implicit m: MonadPlus[M]): FoldM[(V, T), M, (V, U)] { type S = (M[V], FoldM.this.S) }
-
def
secondOption[V](implicit m: Bind[M], nat: ~>[scalaz.Id.Id, M]): FoldM[(V, T), M, (Option[V], U)] { type S = (Option[V], FoldM.this.S) }
-
def
startWith(action: M[Unit])(implicit ap: Apply[M]): FoldM[T, M, U] { type S = FoldM.this.S }
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
-
def
toString(): String
-
def
void(implicit m: Functor[M]): FoldM[T, M, Unit] { type S = FoldM.this.S }
-
final
def
wait(): Unit
-
final
def
wait(arg0: Long, arg1: Int): Unit
-
final
def
wait(arg0: Long): Unit
-
def
zip[V](f: FoldM[T, M, V])(implicit ap: Apply[M]): FoldM[T, M, (U, V)] { type S = (FoldM.this.S, f.S) }
Inherited from AnyRef
Inherited from Any
A FoldM is a "left fold" over a data structure with:
Both 'start' and 'end' have an effect which allows the whole folding to take place inside a context M.
If 'M' has an 'Apply' instance then FoldM can be made Applicative to allow the folding of two values U and S at the same time.
If 'M' has a 'Monad' instance then FoldM can be made into a 'Compose' instance which allows to compose 2 folds into one, for example:
A FoldM can be used with a 'FoldableM' which produces the elements to fold over. Examples of FoldableM include
Usage example:
sum.run(List(1, 2, 3)) == 6