Traversal

public typealias Traversal<S, A> = PTraversal<S, S, A, A>
  • Focuses on a specific index of this traversal.

    Declaration

    Swift

    func at(_ i: A.AtIndex) -> Traversal<S, A.AtFoci>

    Parameters

    i

    Index to focus.

    Return Value

    A traversal from this structure to the focused index.

  • Provides a traversal over all elements of the foci of this traversal.

    Declaration

    Swift

    var every: Traversal<S, A.EachFoci> { get }
  • Provides a traversal focused on an index of the focus of this traversal.

    Declaration

    Swift

    func index(_ i: A.IndexType) -> Traversal<S, A.IndexFoci>

    Parameters

    i

    Index to focus.

    Return Value

    A traversal focused on an index of the focus of this traversal.

  • Provides a traversal focused on an index of the focus of this traversal.

    Declaration

    Swift

    subscript(i: A.IndexType) -> Traversal<S, A.IndexFoci> { get }

    Parameters

    i

    Index to focus.

    Return Value

    A traversal focused on an index of the focus of this traversal.

  • Updates the focus viewed through the Traversal and returns its new value.

    Declaration

    Swift

    func update(_ f: @escaping (A) -> A) -> State<S, ArrayK<A>>

    Parameters

    f

    Updating function.

    Return Value

    A State with the new value.

  • Updates the focus viewed through the Traversal and returns its old value.

    Declaration

    Swift

    func updateOld(_ f: @escaping (A) -> A) -> State<S, ArrayK<A>>

    Parameters

    f

    Updating function.

    Return Value

    A State with the old value.

  • Updates the focus viewed through the Traversal, ignoring the result.

    Declaration

    Swift

    func update_(_ f: @escaping (A) -> A) -> State<S, ()>

    Parameters

    f

    Updating function.

    Return Value

    A State ignoring the result.

  • Assigns the focus viewed through the Traversal and returns its new value.

    Declaration

    Swift

    func assign(_ a: A) -> State<S, ArrayK<A>>

    Parameters

    a

    Value to assign the focus.

    Return Value

    A State with the new value.

  • Assigns the focus viewed through the Traversal and returns its old value.

    Declaration

    Swift

    func assignOld(_ a: A) -> State<S, ArrayK<A>>

    Parameters

    a

    Value to assign the focus.

    Return Value

    A State with the old value.

  • Assigns the focus viewed through the Traversal, ignoring the result.

    Declaration

    Swift

    func assign_(_ a: A) -> State<S, ()>

    Parameters

    a

    Value to assign the focus.

    Return Value

    A State ignoring the result.

  • Provides an identity Traversal

    Declaration

    Swift

    static var identity: Traversal<S, S> { get }
  • Provides a Traversal that takes an S or an S and strips the choice of S.

    Declaration

    Swift

    static var codiagonal: Traversal<Either<S, S>, S> { get }