Reducible
Trait for types that can be reduced to a summary value, and its functions.
trait Reducible[t: Type -> Type]SourceTrait for types that can be reduced to a summary value.
Reducible is like a non-empty Foldable and may only be implemented on non-empty data structures.
Associated Types
type Aef: Eff = {}SourceThe associated effect of the Reducible instance.
The effect describes the effect of traversing the underlying data structure.
It is pure (i.e. {}) for immutable data structures.
Instances
Signatures
def reduceLeftTo(f: b -> (a -> b \ ef1), g: a -> b \ ef2, t: t[a]): b \ ef1 + ef2 + Reducible.Aef[t] with Reducible[t]§ SourceLeft-associative reduction of a structure.
Applies g to the initial element of t and combines it
with the remainder of t using f going from left to right.
def reduceRightTo(f: a -> (b -> b \ ef1), g: a -> b \ ef2, t: t[a]): b \ ef1 + ef2 + Reducible.Aef[t] with Reducible[t]§ SourceRight-associative reduction of a structure.
Applies g to the initial element of t and combines it
with the remainder of t using f going from right to left.
Trait Definitions
Returns the number of elements in t that satisfy the predicate f.
def dropWhile(f: a -> Bool \ ef, t: t[a]): List[a] \ ef + Reducible.Aef[t] with Reducible[t]§ SourceReturns t as a list without the longest prefix that satisfies the predicate f.
Returns true if and only if at least one element in t satisfies the predicate f.
Alias for findLeft.
Optionally returns the first element of t that satisfies the predicate f when searching from left to right.
def findLeft(f: a -> Bool \ ef, t: t[a]): Option[a] \ ef + Reducible.Aef[t] with Reducible[t]§ SourceOptionally returns the first element of t that satisfies the predicate f when searching from left to right.
def findRight(f: a -> Bool \ ef, t: t[a]): Option[a] \ ef + Reducible.Aef[t] with Reducible[t]§ SourceOptionally returns the first element of t that satisfies the predicate f when searching from right to left.
def fold(t: t[a]): a \ Reducible.Aef[t] with Reducible[t], SemiGroup[a]§ SourceAlias for reduce.
Reduce t using the derived SemiGroup instance.
def foldLeft(f: b -> (a -> b \ ef), s: b, t: t[a]): b \ ef + Reducible.Aef[t] with Reducible[t]§ SourceLeft-associative fold of a structure.
Applies f to a start value s and all elements in t going from left to right.
def foldRight(f: a -> (b -> b \ ef), s: b, t: t[a]): b \ ef + Reducible.Aef[t] with Reducible[t]§ SourceRight-associative fold of a structure.
Applies f to a start value s and all elements in t going from right to left.
Returns true if and only if all elements in t satisfy the predicate f.
def forEach(f: a -> Unit \ ef, t: t[a]): Unit \ ef + Reducible.Aef[t] with Reducible[t]§ SourceApplies f to each element in t.
def head(t: t[a]): a \ Reducible.Aef[t] with Reducible[t]§ SourceReturns the first element of t.
def init(t: t[a]): List[a] \ Reducible.Aef[t] with Reducible[t]§ SourceReturns t as a list without the last element.
def intersperse(a: a, t: t[a]): List[a] \ Reducible.Aef[t] with Reducible[t]§ SourceReturns t as a list with a inserted between every two adjacent elements.
def last(t: t[a]): a \ Reducible.Aef[t] with Reducible[t]§ SourceReturns the last element of t.
def length(t: t[a]): Int32 \ Reducible.Aef[t] with Reducible[t]§ SourceReturns the number of elements in t.
def maximum(t: t[a]): a \ Reducible.Aef[t] with Reducible[t], Order[a]§ SourceFinds the largest element of t according to the Order on a.
def maximumBy(cmp: a -> (a -> Comparison), t: t[a]): a \ Reducible.Aef[t] with Reducible[t]§ SourceFinds the largest element of t according to the given comparator cmp.
Returns true if and only if the element a is in t.
def minimum(t: t[a]): a \ Reducible.Aef[t] with Reducible[t], Order[a]§ SourceFinds the smallest element of t according to the Order on a.
def minimumBy(cmp: a -> (a -> Comparison), t: t[a]): a \ Reducible.Aef[t] with Reducible[t]§ SourceFinds the smallest element of t according to the given comparator cmp.
def reduce(t: t[a]): a \ Reducible.Aef[t] with Reducible[t], SemiGroup[a]§ SourceReduce t using the derived SemiGroup instance.
def reduceLeft(f: a -> (a -> a \ ef), t: t[a]): a \ ef + Reducible.Aef[t] with Reducible[t]§ SourceLeft-associative reduction on t using f.
def reduceMap(f: a -> b \ ef, t: t[a]): b \ ef + Reducible.Aef[t] with Reducible[t], SemiGroup[b]§ SourceApplies f to each element of t and combines them using the derived SemiGroup instance.
def reduceRight(f: a -> (a -> a \ ef), t: t[a]): a \ ef + Reducible.Aef[t] with Reducible[t]§ SourceRight-associative reduction on t using f.
def reverse(t: t[a]): List[a] \ Reducible.Aef[t] with Reducible[t]§ SourceReturns the reverse of t as a list.
Returns the sum of all elements in t.
Returns the sum of all elements in t according to the function f.
def tail(t: t[a]): List[a] \ Reducible.Aef[t] with Reducible[t]§ SourceReturns the tail of t as a list.
def takeWhile(f: a -> Bool \ ef, t: t[a]): List[a] \ ef + Reducible.Aef[t] with Reducible[t]§ SourceReturns the longest prefix of t as a list that satisfies the predicate f.
def toArray(rc: Region[r], t: t[a]): Array[a, r] \ r + Reducible.Aef[t] with Reducible[t]§ SourceReturns t as an array.
def toList(t: t[a]): List[a] \ Reducible.Aef[t] with Reducible[t]§ SourceReturns t as a list.
Returns t as a map.
def toNel(t: t[a]): Nel[a] \ Reducible.Aef[t] with Reducible[t]§ SourceReturns t as a non-empty list.
Returns t as a set.
def toVector(t: t[a]): Vector[a] \ Reducible.Aef[t] with Reducible[t]§ SourceReturns t as a vector.
Module Definitions
def size(t: t[a]): Int32 \ Reducible.Aef[t] with Reducible[t]§ SourceReturns the number of elements in t.