Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Lens.Micro.Each
Documentation
class Each s t a b | s -> a, t -> b, s b -> t, t a -> s where Source
A class to support each
. If you're writing a library, don't write instances
of this class which would be exported – other users won't be able to use them
if they use lens.
Minimal complete definition
Nothing
Methods
each :: Traversal s t a b Source
each
tries to be a universal Traversal
– it behaves like traverse
in
most situations, but also adds support for e.g. tuples with same-typed
values:
>>>
(1,2) & each %~ succ
(2,3)
>>>
["x", "y", "z"] ^. each
"xyz"
However, note that each
doesn't work on every instance of Traversable
–
the full list of instances can be found below.
Instances
Each [a] [b] a b |
|
Each (Complex a) (Complex b) a b |
|
Each (Maybe a) (Maybe b) a b |
|
((~) * a a', (~) * b b') => Each (a, a') (b, b') a b |
|
((~) * a a2, (~) * a a3, (~) * b b2, (~) * b b3) => Each (a, a2, a3) (b, b2, b3) a b |
|
((~) * a a2, (~) * a a3, (~) * a a4, (~) * b b2, (~) * b b3, (~) * b b4) => Each (a, a2, a3, a4) (b, b2, b3, b4) a b |
|
((~) * a a2, (~) * a a3, (~) * a a4, (~) * a a5, (~) * b b2, (~) * b b3, (~) * b b4, (~) * b b5) => Each (a, a2, a3, a4, a5) (b, b2, b3, b4, b5) a b |
|
((~) * a a2, (~) * a a3, (~) * a a4, (~) * a a5, (~) * a a6, (~) * b b2, (~) * b b3, (~) * b b4, (~) * b b5, (~) * b b6) => Each (a, a2, a3, a4, a5, a6) (b, b2, b3, b4, b5, b6) a b |
|