flix

0.55.0

UnorderedFoldable

trait UnorderedFoldable[t: Type -> Type]Source

A trait for unordered data structures that can be folded.

Associated Types

type Aef: EffSource

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

Instances

instance UnorderedFoldable[Chain]Source
instance UnorderedFoldable[DelayList]Source
instance UnorderedFoldable[Identity]Source
instance UnorderedFoldable[Map[k]]Source
instance UnorderedFoldable[MultiMap[k]]Source
instance UnorderedFoldable[Option]Source
instance UnorderedFoldable[RedBlackTree[k]]Source
instance UnorderedFoldable[Vector]Source

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.