-
Focuses on a specific index of this prism.
Declaration
Swift
func at(_ i: A.AtIndex) -> AffineTraversal<S, A.AtFoci>
Parameters
i
Index to focus.
Return Value
An optional from this structure to the focused index.
-
Provides a traversal over all elements of the focus of this prism.
Declaration
Swift
var every: Traversal<S, A.EachFoci> { get }
-
Provides an AffineTraversal focused on an index of the focus of this prism.
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 prism.
-
Provides an AffineTraversal focused on an index of the focus of this prism.
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 prism.
-
Provides an identity Prism.
Declaration
Swift
static var identity: Prism<S, S> { get }
-
Creates a prism based on functions to extract and embed a value into a sum type.
Declaration
Swift
convenience init(extract: @escaping (S) -> A?, embed: @escaping (A) -> S)
Parameters
extract
Function to extract a value from the source.
embed
Function to embed a value into the source.
-
Extract a value from the source.
Declaration
Swift
var extract: (S) -> A? { get }
-
Embed a value into the source
This is equivalent to
reverseGet
Declaration
Swift
var embed: (A) -> S { get }
-
Provides a prism that checks equality with a value.
Declaration
Swift
static func only(_ a: A) -> Prism<A, ()>
Parameters
a
Value to check equality with.
Return Value
A Prism that only matches with the provided value.