Reducer

trait Reducer[C, M]

A Reducer[C,M] is a scalaz.Semigroup[M] that maps values of type C through unit to values of type M. A C-Reducer may also supply operations which tack on another C to an existing Semigroup M on the left or right. These specialized reductions may be more efficient in some scenarios and are used when appropriate by a scalaz.Generator. The names cons and snoc work by analogy to the synonymous operations in the list semigroup.

Minimal definition: unit or snoc

Based on the Reducer Haskell library by Edward Kmett (https://hackage.haskell.org/package/reducers).

Companion
object
class Object
trait Matchable
class Any
class UnitReducer[C, M]

Type members

Classlikes

Value members

Abstract methods

def cons(c: C, m: M): M

Faster append(unit(c), m).

Faster append(unit(c), m).

def snoc(m: M, c: C): M

Faster append(m, unit(c)).

Faster append(m, unit(c)).

def unit(c: C): M

Concrete methods

def append(a1: M, a2: => M): M
def compose[N](r: Reducer[C, N]): Reducer[C, (M, N)]

Distribute Cs to M and N.

Distribute Cs to M and N.

def unfoldl[B](seed: B)(f: B => Maybe[(B, C)])(implicit M: Monoid[M]): M
def unfoldlOpt[B](seed: B)(f: B => Maybe[(B, C)]): Maybe[M]
def unfoldr[B](seed: B)(f: B => Maybe[(C, B)])(implicit M: Monoid[M]): M
def unfoldrOpt[B](seed: B)(f: B => Maybe[(C, B)]): Maybe[M]

Implicits

Implicits

implicit