Array
@frozen
struct Array<Element> : _DestructorSafeContainer
-
Provides a Fold based on the Foldable instance of this type.
Declaration
Swift
static var fold: Fold<Array<Element>, Element> { get }
-
Provides a Traversal based on the Traverse instance of this type.
Declaration
Swift
static var traversal: Traversal<Array<Element>, Element> { get }
-
Undocumented
Declaration
Swift
public typealias EachFoci = Element
-
Declaration
Swift
public static var each: Traversal<Array<Element>, Element> { get }
-
Undocumented
Declaration
Swift
public typealias IndexType = Int
-
Undocumented
Declaration
Swift
public typealias IndexFoci = Element
-
Declaration
Swift
public static func index(_ i: Int) -> AffineTraversal<Array<Element>, Element>
-
Undocumented
Declaration
Swift
public typealias FilterIndexType = Int
-
Undocumented
Declaration
Swift
public typealias FilterIndexFoci = Element
-
Declaration
Swift
public static func filter(_ predicate: @escaping (Int) -> Bool) -> Traversal<Array<Element>, Element>
-
Undocumented
Declaration
Swift
public typealias First = Element
-
Declaration
Swift
public static var cons: Prism<Array<Element>, (Element, Array<Element>)> { get }
-
Undocumented
Declaration
Swift
public typealias Last = Element
-
Declaration
Swift
public static var snoc: Prism<Array<Element>, (Array<Element>, Element)> { get }
-
Provides an Iso between Array and ArrayK
Declaration
Swift
static var toArrayK: Iso<Array<Element>, ArrayK<Element>> { get }
-
Provides an AffineTraversal to retrieve the first element of an Array
Declaration
Swift
static var head: AffineTraversal<Array<Element>, Element> { get }
-
Provides an AffineTraversal to retrieve the tail of an Array.
Declaration
Swift
static var tail: AffineTraversal<Array<Element>, Array<Element>> { get }
-
Maps each element of this array to an effect, evaluates them in parallel and collects the results.
Declaration
Swift
func parTraverse<G: Concurrent, B>(_ f: @escaping (Element) -> Kind<G, B>) -> Kind<G, [B]>
Parameters
f
A function producing an effect.
Return Value
Results collected under the context of the effect provided by the function.
-
Evaluate each effect in this array in parallel of values and collects the results.
Declaration
Swift
func parSequence<G: Concurrent, A>() -> Kind<G, [A]> where Element == Kind<G, A>
Return Value
Results collected under the context of the effects.
-
A parallel traverse followed by flattening the inner result.
Declaration
Swift
func parFlatTraverse<G: Concurrent, B>(_ f: @escaping (Element) -> Kind<G, [B]>) -> Kind<G, [B]>
Parameters
f
A transforming function yielding nested effects.
Return Value
Results collected and flattened under the context of the effects.
-
Eagerly folds this array to a summary value from left to right.
Declaration
Swift
func foldLeft<B>(_ b: B, _ f: @escaping (B, Element) -> B) -> B
Parameters
b
Initial value for the folding process.
f
Folding function.
Return Value
Summary value resulting from the folding process.
-
Lazily folds this array to a summary value from right to left.
Declaration
Parameters
b
Initial value for the folding process.
f
Folding function.
Return Value
Summary value resulting from the folding process.
-
Transforms the elements of this array to a type with a
Monoid
instance and folds them using the empty and combine methods of suchMonoid
instance.Declaration
Swift
func foldMap<B: Monoid>(_ f: @escaping (Element) -> B) -> B
Parameters
f
Transforming function.
Return Value
Summary value resulting from the transformation and folding process.
-
Performs a monadic left fold from this array to the target monad.
Declaration
Parameters
b
Initial value for the fold.
f
Folding function.
Return Value
Summary value resulting from the folding process in the context of the target monad.
-
Performs a monadic left fold by mapping the values in this array to ones in the target monad context and using the
Monoid
instance to combine them.Declaration
Parameters
f
Trasnforming function.
Return Value
Summary value resulting from the transformation and folding process in the context of the target monad.
-
Maps each element of this array to an effect, evaluates them from left to right and collects the results.
Declaration
Swift
func traverse<G: Applicative, B>(_ f: @escaping (Element) -> Kind<G, B>) -> Kind<G, [B]>
Parameters
f
A function producing an effect.
Return Value
Results collected under the context of the effect provided by the function.
-
Evaluate each effect in this array of values and collects the results.
Declaration
Swift
func sequence<G, A>() -> Kind<G, [A]> where Element : Kind<G, A>, G : Applicative
Return Value
Results collected under the context of the effects.
-
A traverse followed by flattening the inner result.
Declaration
Swift
func flatTraverse<G: Applicative, B>(_ f: @escaping (Element) -> Kind<G, [B]>) -> Kind<G, [B]>
Parameters
f
A transforming function yielding nested effects.
Return Value
Results collected and flattened under the context of the effects.
-
Folds this array provided that its element type has an instance of
Monoid
.It uses the monoid empty value as initial value and the combination method for the fold.
Declaration
Swift
func combineAll() -> Element
Return Value
Summary value resulting from the folding process.
-
Declaration
Swift
public func combine(_ other: Array<Element>) -> Array<Element>
-
Declaration
Swift
public static func empty() -> Array<Element>