ArrayK

public final class ArrayK<A> : ArrayKOf<A>

ArrayK is a Higher Kinded Type wrapper over Swift arrays.

  • Concatenates two arrays

    Declaration

    Swift

    public static func + (lhs: ArrayK<A>, rhs: ArrayK<A>) -> ArrayK<A>

    Parameters

    lhs

    Left hand side of the concatenation.

    rhs

    Right hand side of the concatenation.

    Return Value

    An array that contains the elements of the two arrays in the order they appear in the original ones.

  • Safe downcast.

    Declaration

    Swift

    public static func fix(_ fa: ArrayKOf<A>) -> ArrayK<A>

    Parameters

    fa

    Value in the higher-kind form.

    Return Value

    Value cast to ArrayK.

  • Initializes an ArrayK.

    Declaration

    Swift

    public init(_ array: [A])

    Parameters

    array

    A Swift array of values.

  • Initializes an ArrayK.

    Declaration

    Swift

    public init(_ values: A...)

    Parameters

    values

    A variable number of values.

  • Obtains the wrapped array.

    Declaration

    Swift

    public var asArray: [A] { get }
  • Obtains the first element of this array, or Option.none if it is empty.

    Declaration

    Swift

    public func firstOrNone() -> Option<A>

    Return Value

    An optional value containing the first element of the array, if present.

  • Obtains the element in the position passed as an argument, if any.

    Declaration

    Swift

    public func getOrNone(_ i: Int) -> Option<A>

    Parameters

    i

    Index of the element to obtain.

    Return Value

    An optional value containing the element of the array at the specified index, if present.

  • Obtains the element in the position passed as an argument, if any.

    Declaration

    Swift

    public subscript(index: Int) -> Option<A> { get }

    Parameters

    index

    Index of the element to obtain.

  • Declaration

    Swift

    public var description: String { get }
  • Declaration

    Swift

    public func combine(_ other: ArrayK<A>) -> ArrayK
  • Declaration

    Swift

    public static func empty() -> ArrayK
  • A lifted version of any. Retains the short-circuiting behavior.

    Declaration

    Swift

    public func anyS<F: Selective>(_ p: @escaping (A) -> Kind<F, Bool>) -> Kind<F, Bool>

    Parameters

    p

    A lifted predicate to find any element of this array that matches it.

    Return Value

    A boolean computation describing if any element of the array matches the predicate.

  • A lifted version of all. Retains the short-circuiting behavior.

    Declaration

    Swift

    public func allS<F: Selective>(_ p: @escaping (A) -> Kind<F, Bool>) -> Kind<F, Bool>

    Parameters

    p

    A lifted predicate to check all elements of this array match it.

    Return Value

    A boolean computation describing if all elements of the array match the predicate.