flix

0.79.0

UnorderedFoldable

trait UnorderedFoldable[t: Type -> Type]Source

Trait for types that can be folded without regard to order.

Associated Types

type Aef: Eff = {}Source

The associated effect of the UnorderedFoldable which represents the effect of accessing its elements.

Instances

Primitives
Vector
Non-primitives
Chain, DelayList, Identity, List, Map[k], MultiMap[k], Nec, Nel, Option, RedBlackTree[k], Set

Signatures

def foldMap(f: a -> b \ ef, t: t[a]): b \ ef + Aef[t] with UnorderedFoldable[t], CommutativeMonoid[b]§ Source

Unordered fold of t.

Applies f to all elements in t and combines the results i.e. CommutativeMonoid.combine(f(a)) for all a in t.

Trait Definitions

def count(f: a -> Bool \ ef, t: t[a]): Int32 \ ef + Aef[t] with UnorderedFoldable[t]§ Source

Returns the number of elements in t that satisfy the predicate f.

def exists(f: a -> Bool \ ef, t: t[a]): Bool \ ef + Aef[t] with UnorderedFoldable[t]§ Source

Returns true if and only if at least one element in t satisfies the predicate f.

Returns false if t is empty.

def fold(t: t[a]): a \ Aef[t] with UnorderedFoldable[t], CommutativeMonoid[a]§ Source

Returns the result of applying CommutativeMonoid.combine to all the elements in t.

def forAll(f: a -> Bool \ ef, t: t[a]): Bool \ ef + Aef[t] with UnorderedFoldable[t]§ Source

Returns true if and only if all elements in t satisfy the predicate f.

Returns true if t is empty.

def isEmpty(t: t[a]): Bool \ Aef[t] with UnorderedFoldable[t]§ Source

Returns true if and only if t is empty.

def memberOf(x: a, t: t[a]): Bool \ Aef[t] with UnorderedFoldable[t], Eq[a]§ Source

Returns true if and only if the element x is in t.

def nonEmpty(t: t[a]): Bool \ Aef[t] with UnorderedFoldable[t]§ Source

Returns true if and only if t is non-empty.

def size(t: t[a]): Int32 \ Aef[t] with UnorderedFoldable[t]§ Source

Returns the number of elements in t.