AffineTraversal

public typealias AffineTraversal<S, A> = PAffineTraversal<S, S, A, A>
  • Updates the focus viewed through the AffineTraversal and returns its new value.

    Declaration

    Swift

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

    Parameters

    f

    Updating function.

    Return Value

    A State with the new value.

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

    Declaration

    Swift

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

    Parameters

    f

    Updating function.

    Return Value

    A State with the old value.

  • Updates the focus viewed through the AffineTraversal, 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 AffineTraversal and returns its new value.

    Declaration

    Swift

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

    Parameters

    a

    Value to assign the focus.

    Return Value

    A State with the new value.

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

    Declaration

    Swift

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

    Parameters

    a

    Value to assign the focus.

    Return Value

    A State with the old value.

  • Assigns the focus viewed through the AffineTraversal, 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.

  • Obtains an identity AffineTraversal.

    Declaration

    Swift

    static var identity: AffineTraversal<S, S> { get }
  • Obtains an AffineTraversal that takes either an S or an S and strips the choice of S.

    Declaration

    Swift

    static var codiagonal: AffineTraversal<Either<S, S>, S> { get }
  • Focuses on a specific index of this AffineTraversal.

    Declaration

    Swift

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

    Parameters

    i

    Index to focus.

    Return Value

    An AffineTraversal from this structure to the focused index.

  • Provides a traversal over all elements of the focus of this AffineTraversal.

    Declaration

    Swift

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

    Declaration

    Swift

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

    Parameters

    i

    Index to focus.

    Return Value

    An AffineTraversal focused on an index of the focus of this AffineTraversal.

  • Provides an AffineTraversal focused on an index of the focus of this AffineTraversal.

    Declaration

    Swift

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

    Parameters

    i

    Index to focus.

    Return Value

    An AffineTraversal focused on an index of the focus of this AffineTraversal.