Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
Ixed
Provides a simple Traversal
lets you traverse
the value at a given
key in a Map
or element at an ordinal position in a list or Seq
.
ix :: Index m -> Traversal' m (IxValue m) #
NB: Setting the value of this Traversal
will only set the value in
at
if it is already present.
If you want to be able to insert missing values, you want at
.
>>>
Seq.fromList [a,b,c,d] & ix 2 %~ f
fromList [a,b,f c,d]
>>>
Seq.fromList [a,b,c,d] & ix 2 .~ e
fromList [a,b,e,d]
>>>
Seq.fromList [a,b,c,d] ^? ix 2
Just c
>>>
Seq.fromList [] ^? ix 2
Nothing
Instances
Ixed ByteString | |
Defined in Control.Lens.At ix :: Index ByteString -> Traversal' ByteString (IxValue ByteString) # | |
Ixed ByteString | |
Defined in Control.Lens.At ix :: Index ByteString -> Traversal' ByteString (IxValue ByteString) # | |
Ixed Text | |
Defined in Control.Lens.At | |
Ixed Text | |
Defined in Control.Lens.At | |
Ixed IntSet | |
Defined in Control.Lens.At | |
Ixed [a] | |
Defined in Control.Lens.At ix :: Index [a] -> Traversal' [a] (IxValue [a]) # | |
Ixed (Maybe a) | |
Defined in Control.Lens.At | |
Ixed (Identity a) | |
Defined in Control.Lens.At | |
Ixed (NonEmpty a) | |
Defined in Control.Lens.At | |
Ixed (IntMap a) | |
Defined in Control.Lens.At | |
Ixed (Tree a) | |
Defined in Control.Lens.At | |
Ixed (Seq a) | |
Defined in Control.Lens.At | |
Ord k => Ixed (Set k) | |
Defined in Control.Lens.At | |
Prim a => Ixed (Vector a) | |
Defined in Control.Lens.At | |
Storable a => Ixed (Vector a) | |
Defined in Control.Lens.At | |
Unbox a => Ixed (Vector a) | |
Defined in Control.Lens.At | |
(Eq k, Hashable k) => Ixed (HashSet k) | |
Defined in Control.Lens.At | |
Ixed (Vector a) | |
Defined in Control.Lens.At | |
Eq e => Ixed (e -> a) | |
Defined in Control.Lens.At ix :: Index (e -> a) -> Traversal' (e -> a) (IxValue (e -> a)) # | |
a ~ a2 => Ixed (a, a2) | |
Defined in Control.Lens.At ix :: Index (a, a2) -> Traversal' (a, a2) (IxValue (a, a2)) # | |
(Eq k, Hashable k) => Ixed (HashMap k a) | |
Defined in Control.Lens.At | |
Ord k => Ixed (Map k a) | |
Defined in Control.Lens.At | |
(IArray UArray e, Ix i) => Ixed (UArray i e) | arr |
Defined in Control.Lens.At | |
Ix i => Ixed (Array i e) | arr |
Defined in Control.Lens.At | |
(a ~ a2, a ~ a3) => Ixed (a, a2, a3) | |
Defined in Control.Lens.At ix :: Index (a, a2, a3) -> Traversal' (a, a2, a3) (IxValue (a, a2, a3)) # | |
(a ~ a2, a ~ a3, a ~ a4) => Ixed (a, a2, a3, a4) | |
Defined in Control.Lens.At ix :: Index (a, a2, a3, a4) -> Traversal' (a, a2, a3, a4) (IxValue (a, a2, a3, a4)) # | |
(a ~ a2, a ~ a3, a ~ a4, a ~ a5) => Ixed (a, a2, a3, a4, a5) | |
Defined in Control.Lens.At ix :: Index (a, a2, a3, a4, a5) -> Traversal' (a, a2, a3, a4, a5) (IxValue (a, a2, a3, a4, a5)) # | |
(a ~ a2, a ~ a3, a ~ a4, a ~ a5, a ~ a6) => Ixed (a, a2, a3, a4, a5, a6) | |
Defined in Control.Lens.At ix :: Index (a, a2, a3, a4, a5, a6) -> Traversal' (a, a2, a3, a4, a5, a6) (IxValue (a, a2, a3, a4, a5, a6)) # | |
(a ~ a2, a ~ a3, a ~ a4, a ~ a5, a ~ a6, a ~ a7) => Ixed (a, a2, a3, a4, a5, a6, a7) | |
Defined in Control.Lens.At ix :: Index (a, a2, a3, a4, a5, a6, a7) -> Traversal' (a, a2, a3, a4, a5, a6, a7) (IxValue (a, a2, a3, a4, a5, a6, a7)) # | |
(a ~ a2, a ~ a3, a ~ a4, a ~ a5, a ~ a6, a ~ a7, a ~ a8) => Ixed (a, a2, a3, a4, a5, a6, a7, a8) | |
Defined in Control.Lens.At ix :: Index (a, a2, a3, a4, a5, a6, a7, a8) -> Traversal' (a, a2, a3, a4, a5, a6, a7, a8) (IxValue (a, a2, a3, a4, a5, a6, a7, a8)) # | |
(a ~ a2, a ~ a3, a ~ a4, a ~ a5, a ~ a6, a ~ a7, a ~ a8, a ~ a9) => Ixed (a, a2, a3, a4, a5, a6, a7, a8, a9) | |
Defined in Control.Lens.At ix :: Index (a, a2, a3, a4, a5, a6, a7, a8, a9) -> Traversal' (a, a2, a3, a4, a5, a6, a7, a8, a9) (IxValue (a, a2, a3, a4, a5, a6, a7, a8, a9)) # |
Instances
type Index ByteString | |
Defined in Control.Lens.At | |
type Index ByteString | |
Defined in Control.Lens.At | |
type Index Text | |
Defined in Control.Lens.At | |
type Index Value | |
Defined in Data.Aeson.Lens | |
type Index Text | |
Defined in Control.Lens.At | |
type Index IntSet | |
Defined in Control.Lens.At | |
type Index [a] | |
Defined in Control.Lens.At | |
type Index (Maybe a) | |
Defined in Control.Lens.At | |
type Index (Complex a) | |
Defined in Control.Lens.At | |
type Index (Identity a) | |
Defined in Control.Lens.At | |
type Index (NonEmpty a) | |
Defined in Control.Lens.At | |
type Index (IntMap a) | |
Defined in Control.Lens.At | |
type Index (Tree a) | |
Defined in Control.Lens.At | |
type Index (Seq a) | |
Defined in Control.Lens.At | |
type Index (Set a) | |
Defined in Control.Lens.At | |
type Index (Vector a) | |
Defined in Control.Lens.At | |
type Index (Vector a) | |
Defined in Control.Lens.At | |
type Index (Vector a) | |
Defined in Control.Lens.At | |
type Index (HashSet a) | |
Defined in Control.Lens.At | |
type Index (Vector a) | |
Defined in Control.Lens.At | |
type Index (e -> a) | |
Defined in Control.Lens.At type Index (e -> a) = e | |
type Index (a, b) | |
Defined in Control.Lens.At | |
type Index (HashMap k a) | |
Defined in Control.Lens.At | |
type Index (Map k a) | |
Defined in Control.Lens.At | |
type Index (UArray i e) | |
Defined in Control.Lens.At | |
type Index (Array i e) | |
Defined in Control.Lens.At | |
type Index (a, b, c) | |
Defined in Control.Lens.At | |
type Index (a, b, c, d) | |
Defined in Control.Lens.At | |
type Index (a, b, c, d, e) | |
Defined in Control.Lens.At | |
type Index (a, b, c, d, e, f) | |
Defined in Control.Lens.At | |
type Index (a, b, c, d, e, f, g) | |
Defined in Control.Lens.At | |
type Index (a, b, c, d, e, f, g, h) | |
Defined in Control.Lens.At | |
type Index (a, b, c, d, e, f, g, h, i) | |
Defined in Control.Lens.At |
Instances
type IxValue ByteString | |
Defined in Control.Lens.At | |
type IxValue ByteString | |
Defined in Control.Lens.At | |
type IxValue Text | |
Defined in Control.Lens.At | |
type IxValue Value | |
Defined in Data.Aeson.Lens | |
type IxValue Text | |
Defined in Control.Lens.At | |
type IxValue IntSet | |
Defined in Control.Lens.At | |
type IxValue [a] | |
Defined in Control.Lens.At type IxValue [a] = a | |
type IxValue (Maybe a) | |
Defined in Control.Lens.At | |
type IxValue (Identity a) | |
Defined in Control.Lens.At | |
type IxValue (NonEmpty a) | |
Defined in Control.Lens.At | |
type IxValue (IntMap a) | |
Defined in Control.Lens.At | |
type IxValue (Tree a) | |
Defined in Control.Lens.At | |
type IxValue (Seq a) | |
Defined in Control.Lens.At | |
type IxValue (Set k) | |
Defined in Control.Lens.At | |
type IxValue (Vector a) | |
Defined in Control.Lens.At | |
type IxValue (Vector a) | |
Defined in Control.Lens.At | |
type IxValue (Vector a) | |
Defined in Control.Lens.At | |
type IxValue (HashSet k) | |
Defined in Control.Lens.At | |
type IxValue (Vector a) | |
Defined in Control.Lens.At | |
type IxValue (e -> a) | |
Defined in Control.Lens.At type IxValue (e -> a) = a | |
type IxValue (a, a2) | |
Defined in Control.Lens.At type IxValue (a, a2) = a | |
type IxValue (HashMap k a) | |
Defined in Control.Lens.At | |
type IxValue (Map k a) | |
Defined in Control.Lens.At | |
type IxValue (UArray i e) | |
Defined in Control.Lens.At | |
type IxValue (Array i e) | |
Defined in Control.Lens.At | |
type IxValue (a, a2, a3) | |
Defined in Control.Lens.At type IxValue (a, a2, a3) = a | |
type IxValue (a, a2, a3, a4) | |
Defined in Control.Lens.At type IxValue (a, a2, a3, a4) = a | |
type IxValue (a, a2, a3, a4, a5) | |
Defined in Control.Lens.At type IxValue (a, a2, a3, a4, a5) = a | |
type IxValue (a, a2, a3, a4, a5, a6) | |
Defined in Control.Lens.At type IxValue (a, a2, a3, a4, a5, a6) = a | |
type IxValue (a, a2, a3, a4, a5, a6, a7) | |
Defined in Control.Lens.At type IxValue (a, a2, a3, a4, a5, a6, a7) = a | |
type IxValue (a, a2, a3, a4, a5, a6, a7, a8) | |
Defined in Control.Lens.At type IxValue (a, a2, a3, a4, a5, a6, a7, a8) = a | |
type IxValue (a, a2, a3, a4, a5, a6, a7, a8, a9) | |
Defined in Control.Lens.At type IxValue (a, a2, a3, a4, a5, a6, a7, a8, a9) = a |