FilterIndex

public protocol FilterIndex

FilterIndex provides a Traversal for this structure with all its foci FilterIndexFoci whose index FilterIndexType satisfies a predicate.

  • Undocumented

    Declaration

    Swift

    associatedtype FilterIndexType
  • Undocumented

    Declaration

    Swift

    associatedtype FilterIndexFoci
  • Filters the foci of a Traversal with a predicate.

    Declaration

    Swift

    static func filter(_ predicate: @escaping (FilterIndexType) -> Bool) -> Traversal<Self, FilterIndexFoci>

    Parameters

    predicate

    A predicate to filter the indices of this structure.

    Return Value

    A Traversal between this structure and its foci whose indices match the provided predicate.

  • filter(_:iso:) Extension method

    Pre-composes the Traversal provided by this FilterIndex with an isomorphism.

    Declaration

    Swift

    static func filter<B>(_ predicate: @escaping (FilterIndexType) -> Bool, iso: Iso<B, Self>) -> Traversal<B, FilterIndexFoci>

    Parameters

    predicate

    A predicate to filter the indices of this structure.

    iso

    An isomorphism.

    Return Value

    A Traversal over a structure that is isomorphic to this one, and has the same foci.

  • filter(_:iso:) Extension method

    Post-composes the Traversal provided by the FilterIndex with an isomorphism.

    Declaration

    Swift

    static func filter<B>(_ predicate: @escaping (FilterIndexType) -> Bool, iso: Iso<FilterIndexFoci, B>) -> Traversal<Self, B>

    Parameters

    predicate

    A predicate to filter the indices of this structure.

    iso

    An isomorphism.

    Return Value

    A Traversal between this structure and new foci that is isomorphic to the original ones.

  • filter(_:zipWithIndex:) Extension method

    Provides a Traversal when this structure has an instance of Traverse.

    Declaration

    Swift

    static func filter<F: Traverse, A>(_ predicate: @escaping (FilterIndexType) -> Bool, zipWithIndex: @escaping (Kind<F, A>) -> Kind<F, (A, FilterIndexType)>) -> Traversal<Kind<F, A>, A> where Self: Kind<F, A>, A == FilterIndexFoci

    Parameters

    predicate

    A predicate to filter the indices of this structure.

    zipWithIndex

    A function that associates an index to each value inside this structure.`

    Return Value

    A Traversal over the elements of this Traverse structure whose indices match the predicate.