Collectors #
This module provides consumers that collect the values emitted by an iterator in a data structure. Concretely, the following operations are provided:
Iter.toList
, collecting the values in a listIter.toListRev
, collecting the values in a list in reverse order but more efficientlyIter.toArray
, collecting the values in an array
Some operations are implemented using the IteratorCollect
and IteratorCollectPartial
typeclasses.
Traverses the given iterator and stores the emitted values in an array.
This function requires a Finite
instance proving that the iterator will finish after a finite
number of steps. If the iterator is not finite or such an instance is not available, consider using
it.allowNontermination.toArray
instead of it.toArray
. However, it is not possible to formally
verify the behavior of the partial variant.
Instances For
Traverses the given iterator and stores the emitted values in an array.
This is a partial, potentially nonterminating, function. It is not possible to formally verify
its behavior. If the iterator has a Finite
instance, consider using IterM.toArray
instead.
Instances For
Traverses the given iterator and stores the emitted values in reverse order in a list. Because
lists are prepend-only, this toListRev
is usually more efficient that toList
.
This function requires a Finite
instance proving that the iterator will finish after a finite
number of steps. If the iterator is not finite or such an instance is not available, consider using
it.allowNontermination.toListRev
instead of it.toListRev
. However, it is not possible to
formally verify the behavior of the partial variant.
Instances For
Traverses the given iterator and stores the emitted values in reverse order in a list. Because
lists are prepend-only, this toListRev
is usually more efficient that toList
.
This is a partial, potentially nonterminating, function. It is not possible to formally verify
its behavior. If the iterator has a Finite
instance, consider using IterM.toListRev
instead.
Instances For
Traverses the given iterator and stores the emitted values in a list. Because
lists are prepend-only, toListRev
is usually more efficient that toList
.
This function requires a Finite
instance proving that the iterator will finish after a finite
number of steps. If the iterator is not finite or such an instance is not available, consider using
it.allowNontermination.toList
instead of it.toList
. However, it is not possible to
formally verify the behavior of the partial variant.
Instances For
Traverses the given iterator and stores the emitted values in a list. Because
lists are prepend-only, toListRev
is usually more efficient that toList
.
This is a partial, potentially nonterminating, function. It is not possible to formally verify
its behavior. If the iterator has a Finite
instance, consider using IterM.toList
instead.