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