Documentation Index
Fetch the complete documentation index at: https://docs.canton.network/llms.txt
Use this file to discover all available pages before exploring further.
DA.Foldable
Class of data structures that can be folded to a summary value. It’s a good idea to import this module qualified to avoid clashes with functions defined inPrelude. Ie.:
Module Snapshot
Lifecycle
Stable.
Notices
Status:
active
Introduced in: 3.4.9
Removed in: -
Warnings: 0
Deprecations: 0
Deprecated since: -Typeclasses
class Foldable t
Class of data structures that can be folded to a summary value.
Methods:
fold : Monoid m => t m -> mCombine the elements of a structure using a monoid.foldMap : Monoid m => (a -> m) -> t a -> mCombine the elements of a structure using a monoid.foldr : (a -> b -> b) -> b -> t a -> bRight-associative fold of a structure.foldl : (b -> a -> b) -> b -> t a -> bLeft-associative fold of a structure.foldr1 : (a -> a -> a) -> t a -> aA variant of foldr that has no base case, and thus should only be applied to non-empty structures.foldl1 : (a -> a -> a) -> t a -> aA variant of foldl that has no base case, and thus should only be applied to non-empty structures.toList : t a -> [a]List of elements of a structure, from left to right.null : t a -> BoolTest whether the structure is empty. The default implementation is optimized for structures that are similar to cons-lists, because there is no general way to do better.length : t a -> IntReturns the size/length of a finite structure as anInt. The default implementation is optimized for structures that are similar to cons-lists, because there is no general way to do better.elem : Eq a => a -> t a -> BoolDoes the element occur in the structure?sum : Additive a => t a -> aThe sum function computes the sum of the numbers of a structure.product : Multiplicative a => t a -> aThe product function computes the product of the numbers of a structure.minimum : Ord a => t a -> aThe least element of a non-empty structure.maximum : Ord a => t a -> aThe largest element of a non-empty structure.
instance Ord k => Foldable (Map k)instance Foldable TextMapinstance Foldable Optionalinstance Foldable NonEmptyinstance Foldable Setinstance Foldable (Validation err)instance Foldable (Either a)instance Foldable []instance Foldable a
Functions
mapA_
forA_
forM_
sequence_
concat
and
and returns the conjunction of a container of Bools. For the result to be True, the container must be finite; False, however, results from a False value finitely far from the left end.
or
or returns the disjunction of a container of Bools. For the result to be False, the container must be finite; True, however, results from a True value finitely far from the left end.