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
Prism
between this structure and its first element and tail.Declaration
Swift
static var cons: Prism<Self, (First, Self)> { get }
-
firstOption
Extension methodProvides an
AffineTraversal
between this structure and its first element.Declaration
Swift
static var firstOption: AffineTraversal<Self, First> { get }
-
tailOption
Extension methodProvides an
AffineTraversal
between this structure and its tail.Declaration
Swift
static var tailOption: AffineTraversal<Self, Self> { get }
-
cons(_:)
Extension methodPre-composes the cons
Prism
with a given isomorphism.Parameters
iso
An 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
iso
An 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) -> Self
Parameters
a
Element to prepend.
Return Value
A new structure where the provided element is at the initial position.
-
uncons
Extension method