Fold

org.specs2.control.origami.Fold
See theFold companion trait
object Fold

Attributes

Companion
trait
Graph
Supertypes
class Object
trait Matchable
class Any
Self type
Fold.type

Members list

Givens

Givens

given A[M[_], T](using m: Monad[M]): A[M, T]

Applicative instance

Applicative instance

This means that we can write:

val mean: Fold[Int, Int] = (sum |@| count)(_ / _)

An Applicative instance is also a Functor instance so we can write:

val meanTimes2 = mean.map(_ * 2)

Attributes

given given_Monoid_Fold[M[_], A](using m: Monad[M]): given_Monoid_Fold[M, A]