Cons
public protocol Cons
Cons provides a Prism between this structure and a pair containing its first element and its tail. It provides a convenient way to attach or detach elements to the left side of a structure.
-
Undocumented
Declaration
Swift
associatedtype First -
Provides a
Prismbetween this structure and its first element and tail.Declaration
Swift
static var cons: Prism<Self, (First, Self)> { get }
-
firstOptionExtension methodProvides an
AffineTraversalbetween this structure and its first element.Declaration
Swift
static var firstOption: AffineTraversal<Self, First> { get } -
tailOptionExtension methodProvides an
AffineTraversalbetween this structure and its tail.Declaration
Swift
static var tailOption: AffineTraversal<Self, Self> { get } -
cons(_:)Extension methodPre-composes the cons
Prismwith a given isomorphism.Parameters
isoAn isomorphism.
Return Value
A prism that provides the first element and tail in another structure resulting from transforming this structure with the provided isomorphism.
-
cons(_:)Extension methodPost-composes the cons `Prismp with a given isomorphism.
Parameters
isoAn isomorphism.
Return Value
A prism that provides the first element and tail of this structure, where the element has been transformed with the provided isomorphism.
-
prepend(_:)Extension methodPrepends an element at the left of this structure.
Declaration
Swift
func prepend(_ a: First) -> SelfParameters
aElement to prepend.
Return Value
A new structure where the provided element is at the initial position.
-
unconsExtension method
Install in Dash
Cons Protocol Reference