UnorderedFoldable

trait UnorderedFoldable[t: Type -> Type]Source

A trait for unordered data structures that can be folded.

Signatures

def foldMap(f: a -> b \ ef, t: t[a]): b \ ef 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 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 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 with UnorderedFoldable[t], CommutativeMonoid[a] Source
def forAll(f: a -> Bool \ ef, t: t[a]): Bool \ ef 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 with UnorderedFoldable[t] Source

Returns true if and only if t is empty.

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

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

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

Returns the number of elements in t.