ReducerOps

final
class ReducerOps[A](self: A) extends AnyVal
Companion
object
class AnyVal
trait Matchable
class Any

Value members

Concrete methods

def cons[M](m: M)(implicit r: Reducer[A, M]): M

Prepend the value to a monoid for use in right-to-left reduction

Prepend the value to a monoid for use in right-to-left reduction

def snoc[C](c: C)(implicit r: Reducer[C, A]): A

Append the value to a monoid for use in left-to-right reduction

Append the value to a monoid for use in left-to-right reduction

def unfoldl[C](f: A => Maybe[(A, C)]): UnfoldTo[C]

Unfold to the left using this value as initial seed.

Unfold to the left using this value as initial seed.

Example:

0.unfoldl(i => if (i < 5) just((i+1, i.toString)) else empty[(Int, String)]).to[List]
= List(4, 3, 2, 1, 0)
def unfoldr[C](f: A => Maybe[(C, A)]): UnfoldTo[C]

Unfold to the right using this value as initial seed Example:

Unfold to the right using this value as initial seed Example:

0.unfoldr(i => if (i < 5) just((i.toString, i+1)) else empty[(String, Int)]).to[List]
= List(0, 1, 2, 3, 4)
def unit[M](implicit r: Reducer[A, M]): M

Convert the value into a monoid

Convert the value into a monoid