flix

0.79.0

ForEach

Trait for types that support iterating over their elements with forEach, and its functions.

trait ForEach[t: Type]Source

Trait for types that support iterating over their elements with forEach.

Associated Types

type Aef: Eff = {}Source

The effect of forEach.

type Elm: TypeSource

The type of elements in the data structure.

Instances

Primitives
Array[a, r], Vector[a]
Non-primitives
BPlusTree[k, v, r], Chain[a], DelayList[a], DelayMap[k, v], List[a], Map[k, v], MutDeque[a, r], MutHashMap[k, v, r], MutHashSet[a, r], MutList[a, r], MutMap[k, v, r], MutPriorityQueue[a, r], MutSet[a, r], Nec[a], Nel[a], Option[a], Range[t], RedBlackTree[k, v], Set[a], WithFilter[t, a], WithIndex[t], WithMap[t, a, b], WithZip[s, t]

Signatures

def forEach(f: Elm[t] -> Unit \ ef, t: t): Unit \ ef + Aef[t] with ForEach[t]§ Source

Applies f to each element in the data structure.

Module Definitions

def withFilter(p: a -> Bool, m: t): WithFilter[t, a] with ForEach[t] where ForEach.Elm[t] ~ a§ Source

Returns a view for m that filters out elements that don't match p.

def withIndex(m: t): WithIndex[t] with ForEach[t]§ Source

Returns a view for m that wraps each element with its index.

def withMap(f: a -> b, m: t): WithMap[t, a, b] with ForEach[t]§ Source

Returns a view for m that applies f to each element.

def withZip(left: s, right: t): WithZip[s, t] with Iterable[s], Iterable[t]§ Source

Returns a view that zips left and right together.