Portability | non-portable |
---|---|
Stability | experimental |
Maintainer | Edward Kmett <ekmett@gmail.com> |
Safe Haskell | None |
Indices
Each
class (Functor f, Index s ~ Index t) => Each f s t a b | s -> a, t -> b, s b -> t, t a -> s whereSource
Extract each
element of a (potentially monomorphic) container.
Notably, when applied to a tuple, this generalizes both
to arbitrary homogeneous tuples.
>>>
(1,2,3) & each *~ 10
(10,20,30)
It can also be used on monomorphic containers like Text
or ByteString
.
>>>
over each Char.toUpper ("hello"^.Text.packed)
"HELLO"
each
is an IndexedTraversal
, so it can be used to access keys in many containers:
>>>
itoListOf each $ Map.fromList [("hello",2),("world",4)]
[("hello",2),("world",4)]
>>>
("hello","world") & each.each %~ Char.toUpper
("HELLO","WORLD")
each :: IndexedLensLike (Index s) f s t a bSource
Applicative f => Each f ByteString ByteString Word8 Word8 |
|
Applicative f => Each f ByteString ByteString Word8 Word8 |
|
Applicative f => Each f Text Text Char Char |
|
Applicative f => Each f Text Text Char Char |
|
(Applicative f, Unbox a, Unbox b) => Each f (Vector a) (Vector b) a b |
|
(Applicative f, Storable a, Storable b) => Each f (Vector a) (Vector b) a b |
|
(Applicative f, Prim a, Prim b) => Each f (Vector a) (Vector b) a b |
|
Applicative f => Each f (Vector a) (Vector b) a b |
|
Applicative f => Each f (Tree a) (Tree b) a b |
|
Applicative f => Each f (Seq a) (Seq b) a b |
|
Applicative f => Each f (Maybe a) (Maybe b) a b |
|
Functor f => Each f (Identity a) (Identity b) a b |
|
Applicative f => Each f [a] [b] a b |
|
Applicative f => Each f (IntMap a) (IntMap b) a b |
|
Applicative f => Each f (Complex a) (Complex b) a b |
|
Settable f => Each f (i -> a) (i -> b) a b |
|
(Applicative f, Ix i, IArray UArray a, IArray UArray b) => Each f (UArray i a) (UArray i b) a b |
|
(Applicative f, Ix i) => Each f (Array i a) (Array i b) a b |
|
Applicative f => Each f (HashMap c a) (HashMap c b) a b |
|
Applicative f => Each f (Map c a) (Map c b) a b |
|
(Applicative f, ~ * a a', ~ * b b') => Each f (a, a') (b, b') a b |
|
(Applicative f, ~ * a a2, ~ * a a3, ~ * b b2, ~ * b b3) => Each f (a, a2, a3) (b, b2, b3) a b |
|
(Applicative f, ~ * a a2, ~ * a a3, ~ * a a4, ~ * b b2, ~ * b b3, ~ * b b4) => Each f (a, a2, a3, a4) (b, b2, b3, b4) a b |
|
(Applicative f, ~ * a a2, ~ * a a3, ~ * a a4, ~ * a a5, ~ * b b2, ~ * b b3, ~ * b b4, ~ * b b5) => Each f (a, a2, a3, a4, a5) (b, b2, b3, b4, b5) a b |
|
(Applicative f, ~ * a a2, ~ * a a3, ~ * a a4, ~ * a a5, ~ * a a6, ~ * b b2, ~ * b b3, ~ * b b4, ~ * b b5, ~ * b b6) => Each f (a, a2, a3, a4, a5, a6) (b, b2, b3, b4, b5, b6) a b |
|
(Applicative f, ~ * a a2, ~ * a a3, ~ * a a4, ~ * a a5, ~ * a a6, ~ * a a7, ~ * b b2, ~ * b b3, ~ * b b4, ~ * b b5, ~ * b b6, ~ * b b7) => Each f (a, a2, a3, a4, a5, a6, a7) (b, b2, b3, b4, b5, b6, b7) a b |
|
(Applicative f, ~ * a a2, ~ * a a3, ~ * a a4, ~ * a a5, ~ * a a6, ~ * a a7, ~ * a a8, ~ * b b2, ~ * b b3, ~ * b b4, ~ * b b5, ~ * b b6, ~ * b b7, ~ * b b8) => Each f (a, a2, a3, a4, a5, a6, a7, a8) (b, b2, b3, b4, b5, b6, b7, b8) a b |
|
(Applicative f, ~ * a a2, ~ * a a3, ~ * a a4, ~ * a a5, ~ * a a6, ~ * a a7, ~ * a a8, ~ * a a9, ~ * b b2, ~ * b b3, ~ * b b4, ~ * b b5, ~ * b b6, ~ * b b7, ~ * b b8, ~ * b b9) => Each f (a, a2, a3, a4, a5, a6, a7, a8, a9) (b, b2, b3, b4, b5, b6, b7, b8, b9) a b |
|