CanFold

dev.constructive.eo.CanFold
See theCanFold companion object
trait CanFold[S, A]

Capability: the foci A visible in an S can be folded through a Monoid — the carrier-free surface of any optic whose carrier admits forgetful.ForgetfulFold (every readable family; the primary surface of Fold and Traversal).

foldMap is the kernel; headOption / length / exists / foci ride on it. foci is the carrier-free counterpart of the raw-optic all extension (which returns foci still inside their carrier, List[F[X, A]]). Prefer this trait in consuming signatures; see CanGet for the doctrine and the coherence rule.

Attributes

Companion
object
Source
CanFold.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes
class BijectionIso[S, T, A, B]
class ForgetFold[S, F, A]
class GetReplaceLens[S, T, A, B]
class Getter[S, A]
class MendTearPrism[S, T, A, B]
class Optional[S, T, A, B]
class PickFold[S, A]
class PickMendPrism[S, A, B]
class SplitCombineLens[S, T, A, B, XA]
class SimpleLens[S, A, XA]
Show all

Members list

Value members

Abstract methods

def foldMap[M](f: A => M)(s: S)(using Monoid[M]): M

Attributes

Source
CanFold.scala

Concrete methods

def exists(p: A => Boolean)(s: S): Boolean

Attributes

Source
CanFold.scala
def foci(s: S): List[A]

Attributes

Source
CanFold.scala
def headOption(s: S): Option[A]

Attributes

Source
CanFold.scala
def length(s: S): Int

Attributes

Source
CanFold.scala