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
fA 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
fA 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) -> BParameters
bInitial value for the folding process.
fFolding function.
Return Value
Summary value resulting from the folding process.
-
Lazily folds this array to a summary value from right to left.
Declaration
Parameters
bInitial value for the folding process.
fFolding function.
Return Value
Summary value resulting from the folding process.
-
Transforms the elements of this array to a type with a
Monoidinstance and folds them using the empty and combine methods of suchMonoidinstance.Declaration
Swift
func foldMap<B: Monoid>(_ f: @escaping (Element) -> B) -> BParameters
fTransforming 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
bInitial value for the fold.
fFolding 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
Monoidinstance to combine them.Declaration
Parameters
fTrasnforming 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
fA 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 : ApplicativeReturn 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
fA 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() -> ElementReturn 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>
Install in Dash
Array Extension Reference