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
Conversions
_Vec :: SNatI n => Prism' [a] (Vec n a) Source #
Prism from list.
>>>
preview _Vec "foo" :: Maybe (Vec N.Nat3 Char)
Just ('f' ::: 'o' ::: 'o' ::: VNil)
>>>
preview _Vec "foo" :: Maybe (Vec N.Nat2 Char)
Nothing
>>>
review _Vec (True ::: False ::: VNil)
[True,False]
Orphan instances
SNatI n => Each (Fin n) (Vec n a) (Vec n b) a b Source # | |
SNatI n => Ixed (Vec n a) Source # |
|
Field1 (Vec ('S n) a) (Vec ('S n) a) a a Source # | |
Field2 (Vec ('S ('S n)) a) (Vec ('S ('S n)) a) a a Source # | |
Field3 (Vec ('S ('S ('S n))) a) (Vec ('S ('S ('S n))) a) a a Source # | |
Field4 (Vec ('S ('S ('S ('S n)))) a) (Vec ('S ('S ('S ('S n)))) a) a a Source # | |
Field5 (Vec ('S ('S ('S ('S ('S n))))) a) (Vec ('S ('S ('S ('S ('S n))))) a) a a Source # | |
Field6 (Vec ('S ('S ('S ('S ('S ('S n)))))) a) (Vec ('S ('S ('S ('S ('S ('S n)))))) a) a a Source # | |
Field7 (Vec ('S ('S ('S ('S ('S ('S ('S n))))))) a) (Vec ('S ('S ('S ('S ('S ('S ('S n))))))) a) a a Source # | |
Field8 (Vec ('S ('S ('S ('S ('S ('S ('S ('S n)))))))) a) (Vec ('S ('S ('S ('S ('S ('S ('S ('S n)))))))) a) a a Source # | |
Field9 (Vec ('S ('S ('S ('S ('S ('S ('S ('S ('S n))))))))) a) (Vec ('S ('S ('S ('S ('S ('S ('S ('S ('S n))))))))) a) a a Source # | |