Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
Indexing
ix :: forall n a. SNatI n => Fin n -> Lens' (Vec n a) a Source #
Index lens.
>>>
view (ix (FS FZ)) ('a' ::: 'b' ::: 'c' ::: VNil)
'b'
>>>
set (ix (FS FZ)) 'x' ('a' ::: 'b' ::: 'c' ::: VNil)
'a' ::: 'x' ::: 'c' ::: VNil
_head :: Lens' (Vec ('S n) a) a Source #
Head lens. Note: lens
_head
is a Traversal'
.
>>>
view _head ('a' ::: 'b' ::: 'c' ::: VNil)
'a'
>>>
set _head 'x' ('a' ::: 'b' ::: 'c' ::: VNil)
'x' ::: 'b' ::: 'c' ::: VNil