g      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~                                  ! " # $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @ ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~    ! Rank2Types provisionalEdward Kmett <ekmett@gmail.com> Safe-Infered "Used to find the nth element of a  Traversal. 2The result of trying to find the nth element of a  Traversal.  Used for  maximumOf  Used for  minimumOf Used internally by  and the like. Used internally by  traverseOf_,  and the like. Applicative composition of  State Int with a , used  by  elementOf,  elementsOf, traverseElement, traverseElementsOf 0The indexed store can be used to characterize a  LensFamily  and is used by clone Used by Focus Obtain the minimum Obtain the maximum )         Rank2Types provisionalEdward Kmett <ekmett@gmail.com> Safe-Infered' is just a renamed  functor to give better error = messages when someone attempts to use a getter as a setter. ">Anything Settable must be isomorphic to the Identity Functor. $ ( 'SimpleSetting' m = 'Simple' 'Setting' % $ 'SimpleSetter' = 'Simple' 'Setter' &5Running a Setter instantiates it to a concrete type. (When consuming a setter, use this type. ' The only !-like law that can apply to a ' l is that  ! set l c (set l b a) = set l c a You can't view a '3 in general, so the other two laws are irrelevant. %However, two functor laws apply to a '   adjust l id = id , adjust l f . adjust l g = adjust l (f . g) "These an be stated more directly:   l pure = pure # l f . run . l g = l (f . run . g) You can compose a ' with a ! or a " using (.) from the Prelude ! and the result is always only a ' and nothing more. (;This setter can be used to map over all of the values in a .  fmap = adjust mapped  fmapDefault = adjust traverse  (<$) = set mapped ))Build a Setter from a map-like function. Your supplied function f is required to satisfy:   f id = id  f g . f h = f (g . h) Equational reasoning:   sets . adjust = id  adjust . sets = id Another way to view ) is that it takes a 'semantic editor combinator'  and transforms it into a '. *Modify the target of a ! or all the targets of a ' or "  with a function.   fmap = adjust mapped  fmapDefault = adjust traverse   sets . adjust = id  adjust . sets = id  0 adjust :: Setter a b c d -> (c -> d) -> a -> b Another way to view *" is to say that it transformers a ' into a  "semantic editor combinator". +Modify the target of a ! or all the targets of a ' or " P with a function. This is an alias for adjust that is provided for consistency.   mapOf = adjust   fmap = mapOf mapped  fmapDefault = mapOf traverse   sets . mapOf = id  mapOf . sets = id 4 mapOf :: Setter a b c d -> (c -> d) -> a -> b 4 mapOf :: Iso a b c d -> (c -> d) -> a -> b 4 mapOf :: Lens a b c d -> (c -> d) -> a -> b 4 mapOf :: Traversal a b c d -> (c -> d) -> a -> b ,Replace the target of a ! or all of the targets of a '  or " with a constant value.   (<$) = set mapped ) set :: Setter a b c d -> d -> a -> b ) set :: Iso a b c d -> d -> a -> b ) set :: Lens a b c d -> d -> a -> b ) set :: Traversal a b c d -> d -> a -> b -Modifies the target of a ! or all of the targets of a ' or  " with a user supplied function. This is an infix version of *   fmap f = mapped %~ f  fmapDefault f = traverse %~ f  " ghci> _2 %~ length $ (1,"hello")  (1,5) 1 (%~) :: Setter a b c d -> (c -> d) -> a -> b 1 (%~) :: Iso a b c d -> (c -> d) -> a -> b 1 (%~) :: Lens a b c d -> (c -> d) -> a -> b 1 (%~) :: Traversal a b c d -> (c -> d) -> a -> b .Replace the target of a ! or all of the targets of a '  or " with a constant value. This is an infix version of ,!, provided for consistency with (:)   f <$ a = mapped .~ f $ a   ghci> bitAt 0 .~ True $ 0  1 * (.~) :: Setter a b c d -> d -> a -> b * (.~) :: Iso a b c d -> d -> a -> b * (.~) :: Lens a b c d -> d -> a -> b * (.~) :: Traversal a b c d -> d -> a -> b /Set with pass-through WThis is mostly present for consistency, but may be useful for for chaining assignments AIf you do not need a copy of the intermediate result, then using l .~ d directly is a good idea. 00Increment the target(s) of a numerically valued !, ' or "  ghci> _1 +~ 1 $ (1,2)  (2,2) 1/Multiply the target(s) of a numerically valued !,  #, ' or " _2 *~ 4 $ (1,2)(1,8)20Decrement the target(s) of a numerically valued !,  #, ' or " _1 -~ 2 $ (1,2)(-1,2)3-Divide the target(s) of a numerically valued !,  #, ' or " 4,Raise the target(s) of a numerically valued !, ' or "" to a non-negative integral power _2 ^~ 2 $ (1,3)(1,9)5-Raise the target(s) of a fractionally valued !, ' or " to an integral power _2 ^^~ (-1) $ (1,2)(1,0.5)6/Raise the target(s) of a floating-point valued !, ' or " to an arbitrary power. _2 **~ pi $ (1,3)(1,31.54428070019754)7 Logically  the target(s) of a -valued ! or ' 8 Logically  the target(s) of a -valued ! or ' 9,Modify the target of a monoidally valued by ing another value. :Replace the target of a ! or all of the targets of a ' or " in our monadic 2 state with a new value, irrespective of the old.  @ (.=) :: MonadState a m => Iso a a c d -> d -> m () @ (.=) :: MonadState a m => Lens a a c d -> d -> m () @ (.=) :: MonadState a m => Traversal a a c d -> d -> m () @ (.=) :: MonadState a m => Setter a a c d -> d -> m () 9It puts the state in the monad or it gets the hose again. ;Map over the target of a ! or all of the targets of a ' or ' Traversal in our monadic state. G (%=) :: MonadState a m => Iso a a c d -> (c -> d) -> m () G (%=) :: MonadState a m => Lens a a c d -> (c -> d) -> m () G (%=) :: MonadState a m => Traversal a a c d -> (c -> d) -> m () G (%=) :: MonadState a m => Setter a a c d -> (c -> d) -> m () <Modify the target(s) of a Simple !,  #, ' or " by adding a value  Example:  fresh = do  id += 1  access id =Modify the target(s) of a Simple !,  #, ' or " by subtracting a value >Modify the target(s) of a Simple !,  #, ' or " by multiplying by value ?Modify the target(s) of a Simple !,  #, ' or " by dividing by a value @,Raise the target(s) of a numerically valued !, ' or "" to a non-negative integral power A,Raise the target(s) of a numerically valued !, ' or " to an integral power B,Raise the target(s) of a numerically valued !, ' or " to an arbitrary power CModify the target(s) of a Simple !,  #, ' or " by taking their logical  with a value DModify the target(s) of a Simple !, 'Iso, ' or " by taking their logical  with a value EModify the target(s) of a Simple !,  #, ' or " by  ing a value. F6Run a monadic action, and set all of the targets of a !, ' or " to its result.  < (<~) :: MonadState a m => Iso a a c d -> m d -> m () < (<~) :: MonadState a m => Lens a a c d -> m d -> m () < (<~) :: MonadState a m => Traversal a a c d -> m d -> m () < (<~) :: MonadState a m => Setter a a c d -> m d -> m () cAs a reasonable mnemonic, this lets you store the result of a monadic action in a lens rather than  in a local variable.   do foo <- bar  ... +will store the result in a variable, while   do foo <~ bar  ... will store the result in a lenssetter traversal. GSet with pass-through 'This is useful for chaining assignment  * do x <- _2 <.= (an expensive expression) AIf you do not need a copy of the intermediate result, then using l .= d$ will avoid unused binding warnings HTell a part of a value to a , filling in the rest from  % whisper l d = tell (set l d mempty) 0 !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGH* !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGH*'"#& !)(*+,.-0213456789/:;<=>?@ABDCEGFH%$- !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGH Rank2Types provisionalEdward Kmett <ekmett@gmail.com> Safe-Infered*I = type SimpleOverloaded k f a b = Simple (Overloaded k f) a b J 5 type LensLike f a b c d = Overloaded (->) f a b c d KThis class allows us to use L. on a number of different monad transformers. LIRun a monadic action in a larger context than it was defined in, using a R S or R  Traversal. lThis is commonly used to lift actions in a simpler state monad into a state monad with a larger state type. When applied to a 'Simple  TraversalM over multiple values, the actions for each target are executed sequentially + and the results are aggregated monoidally  and a monoidal summary  of the result is given. N focus :: Monad m => Simple Iso a b -> st b m c -> st a m c N focus :: Monad m => Simple Lens a b -> st b m c -> st a m c N focus :: (Monad m, Monoid c) => Simple Traversal a b -> st b m c -> st a m c MLike L4, but discarding any accumulated results as you go. P focus_ :: Monad m => Simple Iso a b -> st b m c -> st a m () P focus_ :: Monad m => Simple Lens a b -> st b m c -> st a m () P focus_ :: (Monad m, Monoid c) => Simple Traversal a b -> st b m c -> st a m () NA much more limited version of L that can work with a '. OMany combinators that accept a S can also accept a  Traversal in limited situations. 'They do so by specializing the type of " that they require of the caller. If a function accepts a O f a b c d for some  f, then they may be passed a S.  Further, if f is an , they may also be passed a  Traversal. P - type SimpleLensLike f = Simple (LensLike f) Q  type SimpleLens = Simple Lens RA R S, R  Traversal, ... can be used instead of a S, Traversal, ...  whenever the type variables don't change upon setting a value.  ( imaginary :: Simple Lens (Complex a) a ( traverseHead :: Simple Traversal [a] a .Note: To use this alias in your own code with O f or Setter, you may have to turn on  LiberalTypeSynonyms. SA S+ is actually a lens family as described in  /http://comonad.com/reader/2012/mirrored-lenses/. 2With great power comes great responsibility and a S1 is subject to the three common sense lens laws: !1) You get back what you put in:   view l (set l b a) = b "2) Putting back what you got doesn't change anything:   set l (view l a) a = a .3) Setting twice is the same as setting once:  ! set l c (set l b a) = set l c a =These laws are strong enough that the 4 type parameters of a S. cannot vary fully independently. For more on  how they interact, read the Why is it a Lens Family? section of  /http://comonad.com/reader/2012/mirrored-lenses/. Every S can be used directly as a ' or  Traversal. You can also use a S for Getting as if it were a Fold or Getter. Since every lens is a valid  TraversalA, the traversal laws should also apply to any lenses you create.  ) Idiomatic naturality:   l pure = pure  ) Sequential composition:  : fmap (l f) . l g = getCompose . l (Compose . fmap f . g) 7 type Lens = forall f. Functor f => LensLike f a b c d TBuild a S from a getter and a setter. J lens :: Functor f => (a -> c) -> (a -> d -> b) -> (c -> f d) -> a -> f b U(U') can be used in one of two scenarios: When applied to a S , it can edit the target of the S in a structure, extracting a  functorial result. When applied to a  Traversal!, it can edit the targets of the  Traversals, extracting an % applicative summary of its actions. 8For all that the definition of this combinator is just:   (%%~) = id  G (%%~) :: Functor f => Iso a b c d -> (c -> f d) -> a -> f b G (%%~) :: Functor f => Lens a b c d -> (c -> f d) -> a -> f b G (%%~) :: Applicative f => Traversal a b c d -> (c -> f d) -> a -> f b `It may be beneficial to think about it as if it had these even more restrictive types, however: When applied to a  Traversal!, it can edit the targets of the  Traversals, extracting a G supplemental monoidal summary of its actions, by choosing f = ((,) m) H (%%~) :: Iso a b c d -> (c -> (e, d)) -> a -> (e, b) H (%%~) :: Lens a b c d -> (c -> (e, d)) -> a -> (e, b) H (%%~) :: Monoid m => Traversal a b c d -> (c -> (m, d)) -> a -> (m, b) VModify the target of a S: in the current state returning some extra information of c or  modify all targets of a  Traversal< in the current state, extracting extra information of type c / and return a monoidal summary of the changes.   (%%=) = (state.) It may be useful to think of (V>), instead, as having either of the following more restricted  type signatures: Q (%%=) :: MonadState a m => Iso a a c d -> (c -> (e, d) -> m e Q (%%=) :: MonadState a m => Lens a a c d -> (c -> (e, d) -> m e Q (%%=) :: (MonadState a m, Monoid e) => Traversal a a c d -> (c -> (e, d) -> m e WJThis is a lens that can change the value (and type) of the first field of  a pair.   ghci> (1,2)^._1  1   ghci> _1 +~ "hello" $ (1,2)  ("hello",2) 3 _1 :: Functor f => (a -> f b) -> (a,c) -> f (a,c) XAs W&, but for the second field of a pair.  + anyOf _2 :: (c -> Bool) -> (a, c) -> Bool Y traverse._2 :: (Applicative f, Traversable t) => (a -> f b) -> t (c, a) -> f (t (c, b)) S foldMapOf (traverse._2) :: (Traversable t, Monoid m) => (c -> m) -> t (b, c) -> m 3 _2 :: Functor f => (a -> f b) -> (c,a) -> f (c,b) YHThis lens can be used to change the result of a function but only where $ the arguments match the key given. Z9Merge two lenses, getters, setters, folds or traversals. [[6 makes a lens from two other lenses (or isomorphisms) \ Cloning a S) is one way to make sure you arent given  something weaker, such as a  Traversal and can be used ? as a way to pass around lenses that have to be monomorphic in f. !Note: This only accepts a proper S , because  lacks its $ (admissable) Applicative instance. ]Modify the target of a S and return the result 2When you do not need the result of the addition, (0) is more flexible. ^-Increment the target of a numerically valued S and return the result 2When you do not need the result of the addition, (0) is more flexible. _-Decrement the target of a numerically valued S and return the result 5When you do not need the result of the subtraction, (2) is more flexible. `-Decrement the target of a numerically valued S and return the result 5When you do not need the result of the subtraction, (1) is more flexible. a+Divide the target of a fractionally valued S and return the result. 2When you do not need the result of the division, (3) is more flexible. b)Raise the target of a numerically valued S to a non-negative  power and return the result 2When you do not need the result of the division, (4) is more flexible. c*Raise the target of a fractionally valued S to an  power and return the result 2When you do not need the result of the division, (5) is more flexible. d,Raise the target of a floating-point valued S- to an arbitrary power and return the result 2When you do not need the result of the division, (6) is more flexible. e Logically  a Boolean valued S and return the result 3When you do not need the result of the operation, (7) is more flexible. f Logically  a Boolean valued S and return the result 3When you do not need the result of the operation, (8) is more flexible. g2 a monoidal value onto the end of the target of a S and return the result 3When you do not need the result of the operation, (9) is more flexible. hModify the target of a ' into your monad';s state by a user supplied function and return the result. 3When you do not need the result of the operation, (;) is more flexible. i*Add to the target of a numerically valued S into your monad's state and return the result. 8When you do not need the result of the multiplication, (<) is more flexible. j1Subtract from the target of a numerically valued S into your monad's state and return the result. 8When you do not need the result of the multiplication, (=) is more flexible. k,Multiply the target of a numerically valued S into your monad's state and return the result. 8When you do not need the result of the multiplication, (>) is more flexible. l+Divide the target of a fractionally valued S into your monad's state and return the result. 2When you do not need the result of the division, (?) is more flexible. m)Raise the target of a numerically valued S into your monad's state to a non-negative  power and return the result 3When you do not need the result of the operation, (B) is more flexible. n*Raise the target of a fractionally valued S into your monad's state to an  power and return the result 3When you do not need the result of the operation, (A) is more flexible. o,Raise the target of a floating-point valued S into your monad'4s state to an arbitrary power and return the result 3When you do not need the result of the operation, (B) is more flexible. p Logically  a Boolean valued S into your monad's state and return the result 3When you do not need the result of the operation, (D) is more flexible. q Logically  a Boolean valued S into your monad's state and return the result 3When you do not need the result of the operation, (C) is more flexible. r2 a monoidal value onto the end of the target of a S into your monad's state and return the result 3When you do not need the result of the operation, (E) is more flexible. -IJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqr*IJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqr*SRTUVWXYKLMN\Z[]^_`abcdefghijklmnopqrOJQPI*IJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqr Rank2Types provisionalEdward Kmett <ekmett@gmail.com> Safe-Infered s Used instead of Const to report '"no instance of (Settable Accessor)' when  attempting to misuse a Setter as a y. vLGeneralizing Const so we can apply simple Applicative transformations to it ( and so we can get nicer error messages xMost y- combinators are able to be used with both a y or a Fold in S limited situations, to do so, they need to be monomorphic in what we are going to  extract with . To be compatible with S,  Traversal and Iso we also : restricted choices of the irrelevant b and d parameters. If a function accepts a Getting m r a b c d , then when r is a Monoid, and m is a   you can pass a Fold (or  Traversal&), otherwise you can only pass this a  y or S. yA yM describes how to retrieve a single value in a way that can be composed with  other lens-like constructions.  Unlike a S a y is read-only. Since a y cannot be used to write back 3 there are no lens laws that can be applied to it.  Moreover, a y can be used directly as a Fold, since it just ignores the . zBuild a y% from an arbitrary Haskell function.   to f . to g = to (g . f)  a^.to f = f a (0, -5)^._2.to abs5{View the value pointed to by a y, Iso or S or the result of folding over  all the results of a Fold or  Traversal# that points at a monoidal values. It may be useful to think of {. as having these more restrictive signatures:   view . to = id view _2 (1,"hello")"hello" 3 view :: Getter a c -> a -> c 3 view :: Monoid m => Fold a m -> a -> m 3 view :: Iso a b c d -> a -> c 3 view :: Lens a b c d -> a -> c 3 view :: Monoid m => Traversal a b m d -> a -> m |View the value of a y, Iso, S# or the result of folding over the $ result of mapping the targets of a Fold or  Traversal. It may be useful to think of |. as having these more restrictive signatures: views _2 length (1,"hello")5 @ views :: Getter a c -> (c -> d) -> a -> d @ views :: Monoid m => Fold a c -> (c -> m) -> a -> m @ views :: Iso a b c d -> (c -> d) -> a -> d @ views :: Lens a b c d -> (c -> d) -> a -> d @ views :: Monoid m => Traversal a b c d -> (c -> m) -> a -> m }View the value pointed to by a y, Iso or S or the result of folding over  all the results of a Fold or  Traversal# that points at a monoidal values. This is the same operation as {, only infix. _2 ^$ (1, "hello")"hello" 3 (^$) :: Getter a c -> a -> c 3 (^$) :: Monoid m => Fold a m -> a -> m 3 (^$) :: Iso a b c d -> a -> c 3 (^$) :: Lens a b c d -> a -> c 3 (^$) :: Monoid m => Traversal a b m d -> a -> m ~View the value pointed to by a y or S or the result of folding over  all the results of a Fold or  Traversal# that points at a monoidal values. This is the same operation as { with the arguments flipped. HThe fixity and semantics are such that subsequent field accesses can be  performed with (Prelude..) $((0, 1 :+ 2), 3)^._1._2.to magnitude2.23606797749979 3 (^.) :: a -> Getter a c -> c 3 (^.) :: Monoid m => a -> Fold a m -> m 3 (^.) :: a -> Iso a b c d -> c 3 (^.) :: a -> Lens a b c d -> c 3 (^.) :: Monoid m => a -> Traversal a b m d -> m Query the target of a S, Iso or y in the current state, or use a  summary of a Fold or  Traversal" that points to a monoidal value.  B query :: MonadReader a m => Getter a c -> m c B query :: (MonadReader a m, Monoid c) => Fold a c -> m c B query :: MonadReader a m => Iso a b c d -> m c B query :: MonadReader a m => Lens a b c d -> m c B query :: (MonadReader a m, Monoid c) => Traversal a b c d -> m c I query :: MonadReader a m => ((c -> Const c d) -> a -> Const c b) -> m c Use the target of a S, Iso or y in the current state, or use a  summary of a Fold or  Traversal" that points to a monoidal value.  P queries :: MonadReader a m => Getter a c -> (c -> e) -> m e P queries :: (MonadReader a m, Monoid c) => Fold a c -> (c -> e) -> m e P queries :: MonadReader a m => Iso a b c d -> (c -> e) -> m e P queries :: MonadReader a m => Lens a b c d -> (c -> e) -> m e P queries :: (MonadReader a m, Monoid c) => Traversal a b c d -> (c -> e) -> m e W queries :: MonadReader a m => ((c -> Const e d) -> a -> Const e b) -> (c -> e) -> m e Use the target of a S, Iso, or y in the current state, or use a  summary of a Fold or  Traversal" that points to a monoidal value. ? use :: MonadState a m => Action m a b -> m b ? use :: MonadState a m => Getter a c -> m c ? use :: (MonadState a m, Monoid r) => Fold a r -> m r ? use :: MonadState a m => Iso a b c d -> m c ? use :: MonadState a m => Lens a b c d -> m c ? use :: (MonadState a m, Monoid r) => Traversal a b r d -> m r Use the target of a S, Iso or y in the current state, or use a  summary of a Fold or  Traversal" that points to a monoidal value. L uses :: MonadState a m => Action m a c -> (c -> e) -> m e L uses :: MonadState a m => Getter a c -> (c -> e) -> m e L uses :: (MonadState a m, Monoid r) => Fold a c -> (c -> r) -> m r L uses :: MonadState a m => Lens a b c d -> (c -> e) -> m e L uses :: MonadState a m => Iso a b c d -> (c -> e) -> m e L uses :: (MonadState a m, Monoid r) => Traversal a b c d -> (c -> r) -> m r stuvwxyz{|}~stuvwxyz{|}~yxvwstuz~}{|stuvwxyz{|}~ Rank2Types provisionalEdward Kmett <ekmett@gmail.com> Safe-Infered4Something we can fold. A I describes how to retrieve multiple values in a way that can be composed % with other lens-like constructions. A  a cC provides a structure with operations very similar to those of the   typeclass, see  and the other  combinators. !By convention, if there exists a foo method that expects a  (f c), then there should be a  fooOf method that takes a  a c and a value of type a. A y is a legal  that just ignores the supplied   Unlike a  Traversal a  is read-only. Since a  cannot be used to write back $ there are no lens laws that apply. Build a y or  from a -like function. H folds :: ((c -> r) -> a -> r) -> (c -> Accessor m d) -> a -> Const m b  Obtain a 9 by lifting an operation that returns a foldable result. +This can be useful to lift operations from  Data.List and elsewhere into a .  Obtain a  from any .  folded = folds foldMap %Fold by repeating the input forever.  repeat = toListOf repeated !A fold that replicates its input n times. ' replicate n = toListOf (replicated n) ITransform a fold into a fold that loops over its elements over and over. * ghci> toListOf (cycled traverse) [1,2,3]  [1,2,3,1,2,3,..] 2Build a fold that unfolds its values from a seed. % ghci> unfoldr = toListOf . unfolded x ^.  f5 Return an infinite fold of repeated applications of f to x. ' toListOf (iterated f) a = iterate f a  Obtain a  by filtering a S, Iso, y,  or  Traversal. .This allows you to traverse the elements of a  Traversal or  in the opposite order. Note:  should have no impact on a y Setter, S or Iso. To change the direction of an Iso, use from.  Obtain a ! by taking elements from another , S, Iso, y or  Traversal while a predicate holds.  / takeWhile p = toListOf (takingWhile p folded) / ghci> toList (takingWhile (<=3) folded) [1..]  [1,2,3]  Obtain a # by dropping elements from another , S, Iso, y or  Traversal while a predicate holds.  1 dropWhile p = toListOf (droppingWhile p folded) . ghci> toList (dropWhile (<=3) folded) [1..6]  [4,5,6]   foldMap = foldMapOf folded   foldMapOf = views B foldMapOf :: Getter a c -> (c -> r) -> a -> r B foldMapOf :: Monoid r => Fold a c -> (c -> r) -> a -> r B foldMapOf :: Lens a b c d -> (c -> r) -> a -> r B foldMapOf :: Iso a b c d -> (c -> r) -> a -> r B foldMapOf :: Monoid r => Traversal a b c d -> (c -> r) -> a -> r   fold = foldOf folded   foldOf = view 3 foldOf :: Getter a m -> a -> m 3 foldOf :: Monoid m => Fold a m -> a -> m 3 foldOf :: Lens a b m d -> a -> m 3 foldOf :: Iso a b m d -> a -> m 3 foldOf :: Monoid m => Traversal a b m d -> a -> m IRight-associative fold of parts of a structure that are viewed through a S, y,  or  Traversal.   foldr = foldrOf folded > foldrOf :: Getter a c -> (c -> e -> e) -> e -> a -> e > foldrOf :: Fold a c -> (c -> e -> e) -> e -> a -> e > foldrOf :: Lens a b c d -> (c -> e -> e) -> e -> a -> e > foldrOf :: Iso a b c d -> (c -> e -> e) -> e -> a -> e > foldrOf :: Traversal a b c d -> (c -> e -> e) -> e -> a -> e LLeft-associative fold of the parts of a structure that are viewed through a S, y,  or  Traversal.   foldl = foldlOf folded > foldlOf :: Getter a c -> (e -> c -> e) -> e -> a -> e > foldlOf :: Fold a c -> (e -> c -> e) -> e -> a -> e > foldlOf :: Lens a b c d -> (e -> c -> e) -> e -> a -> e > foldlOf :: Iso a b c d -> (e -> c -> e) -> e -> a -> e > foldlOf :: Traversal a b c d -> (e -> c -> e) -> e -> a -> e   toList = toListOf folded + toListOf :: Getter a c -> a -> [c] + toListOf :: Fold a c -> a -> [c] + toListOf :: Lens a b c d -> a -> [c] + toListOf :: Iso a b c d -> a -> [c] + toListOf :: Traversal a b c d -> a -> [c]   and = andOf folded + andOf :: Getter a Bool -> a -> Bool + andOf :: Fold a Bool -> a -> Bool + andOf :: Lens a b Bool d -> a -> Bool + andOf :: Iso a b Bool d -> a -> Bool + andOf :: Traversl a b Bool d -> a -> Bool   or = orOf folded + orOf :: Getter a Bool -> a -> Bool + orOf :: Fold a Bool -> a -> Bool + orOf :: Lens a b Bool d -> a -> Bool + orOf :: Iso a b Bool d -> a -> Bool + orOf :: Traversal a b Bool d -> a -> Bool   any = anyOf folded 8 anyOf :: Getter a c -> (c -> Bool) -> a -> Bool 8 anyOf :: Fold a c -> (c -> Bool) -> a -> Bool 8 anyOf :: Lens a b c d -> (c -> Bool) -> a -> Bool 8 anyOf :: Iso a b c d -> (c -> Bool) -> a -> Bool 8 anyOf :: Traversal a b c d -> (c -> Bool) -> a -> Bool   all = allOf folded 8 allOf :: Getter a c -> (c -> Bool) -> a -> Bool 8 allOf :: Fold a c -> (c -> Bool) -> a -> Bool 8 allOf :: Lens a b c d -> (c -> Bool) -> a -> Bool 8 allOf :: Iso a b c d -> (c -> Bool) -> a -> Bool 8 allOf :: Traversal a b c d -> (c -> Bool) -> a -> Bool   product = productOf folded 3 productOf :: Getter a c -> a -> c 3 productOf :: Num c => Fold a c -> a -> c 3 productOf :: Lens a b c d -> a -> c 3 productOf :: Iso a b c d -> a -> c 3 productOf :: Num c => Traversal a b c d -> a -> c   sum = sumOf folded   sumOf _1 :: (a, b) -> a ; sumOf (folded._1) :: (Foldable f, Num a) => f (a, b) -> a / sumOf :: Getter a c -> a -> c / sumOf :: Num c => Fold a c -> a -> c / sumOf :: Lens a b c d -> a -> c / sumOf :: Iso a b c d -> a -> c / sumOf :: Num c => Traversal a b c d -> a -> c When passed a y,  can work over a . When passed a ,  requires an .   traverse_ = traverseOf_ folded  > traverseOf_ _2 :: Functor f => (c -> f e) -> (c1, c) -> f () O traverseOf_ traverseLeft :: Applicative f => (a -> f b) -> Either a c -> f () bThe rather specific signature of traverseOf_ allows it to be used as if the signature was either: N traverseOf_ :: Functor f => Getter a c -> (c -> f e) -> a -> f () N traverseOf_ :: Applicative f => Fold a c -> (c -> f e) -> a -> f () N traverseOf_ :: Functor f => Lens a b c d -> (c -> f e) -> a -> f () N traverseOf_ :: Functor f => Iso a b c d -> (c -> f e) -> a -> f () N traverseOf_ :: Applicative f => Traversal a b c d -> (c -> f e) -> a -> f ()   for_ = forOf_ folded I forOf_ :: Functor f => Getter a c -> a -> (c -> f e) -> f () I forOf_ :: Applicative f => Fold a c -> a -> (c -> f e) -> f () I forOf_ :: Functor f => Lens a b c d -> a -> (c -> f e) -> f () I forOf_ :: Functor f => Iso a b c d -> a -> (c -> f e) -> f () I forOf_ :: Applicative f => Traversal a b c d -> a -> (c -> f e) -> f ()  " sequenceA_ = sequenceAOf_ folded F sequenceAOf_ :: Functor f => Getter a (f ()) -> a -> f () F sequenceAOf_ :: Applicative f => Fold a (f ()) -> a -> f () F sequenceAOf_ :: Functor f => Lens a b (f ()) d -> a -> f () F sequenceAOf_ :: Functor f => Iso a b (f ()) d -> a -> f () F sequenceAOf_ :: Applicative f => Traversal a b (f ()) d -> a -> f ()   mapM_ = mapMOf_ folded D mapMOf_ :: Monad m => Getter a c -> (c -> m e) -> a -> m () D mapMOf_ :: Monad m => Fold a c -> (c -> m e) -> a -> m () D mapMOf_ :: Monad m => Lens a b c d -> (c -> m e) -> a -> m () D mapMOf_ :: Monad m => Iso a b c d -> (c -> m e) -> a -> m () D mapMOf_ :: Monad m => Traversal a b c d -> (c -> m e) -> a -> m ()   forM_ = forMOf_ folded D forMOf_ :: Monad m => Getter a c -> a -> (c -> m e) -> m () D forMOf_ :: Monad m => Fold a c -> a -> (c -> m e) -> m () D forMOf_ :: Monad m => Lens a b c d -> a -> (c -> m e) -> m () D forMOf_ :: Monad m => Iso a b c d -> a -> (c -> m e) -> m () D forMOf_ :: Monad m => Traversal a b c d -> a -> (c -> m e) -> m ()   sequence_ = sequenceOf_ folded > sequenceOf_ :: Monad m => Getter a (m b) -> a -> m () > sequenceOf_ :: Monad m => Fold a (m b) -> a -> m () > sequenceOf_ :: Monad m => Lens a b (m b) d -> a -> m () > sequenceOf_ :: Monad m => Iso a b (m b) d -> a -> m () > sequenceOf_ :: Monad m => Traversal a b (m b) d -> a -> m () 1The sum of a collection of actions, generalizing .   asum = asumOf folded : asumOf :: Alternative f => Getter a c -> a -> f c : asumOf :: Alternative f => Fold a c -> a -> f c : asumOf :: Alternative f => Lens a b c d -> a -> f c : asumOf :: Alternative f => Iso a b c d -> a -> f c : asumOf :: Alternative f => Traversal a b c d -> a -> f c 1The sum of a collection of actions, generalizing .   msum = msumOf folded 8 msumOf :: MonadPlus m => Getter a c -> a -> m c 8 msumOf :: MonadPlus m => Fold a c -> a -> m c 8 msumOf :: MonadPlus m => Lens a b c d -> a -> m c 8 msumOf :: MonadPlus m => Iso a b c d -> a -> m c 8 msumOf :: MonadPlus m => Traversal a b c d -> a -> m c   elem = elemOf folded 7 elemOf :: Eq c => Getter a c -> c -> a -> Bool 7 elemOf :: Eq c => Fold a c -> c -> a -> Bool 7 elemOf :: Eq c => Lens a b c d -> c -> a -> Bool 7 elemOf :: Eq c => Iso a b c d -> c -> a -> Bool 7 elemOf :: Eq c => Traversal a b c d -> c -> a -> Bool   notElem = notElemOf folded : notElemOf :: Eq c => Getter a c -> c -> a -> Bool : notElemOf :: Eq c => Fold a c -> c -> a -> Bool : notElemOf :: Eq c => Iso a b c d -> c -> a -> Bool : notElemOf :: Eq c => Lens a b c d -> c -> a -> Bool : notElemOf :: Eq c => Traversal a b c d -> c -> a -> Bool   concatMap = concatMapOf folded < concatMapOf :: Getter a c -> (c -> [e]) -> a -> [e] < concatMapOf :: Fold a c -> (c -> [e]) -> a -> [e] < concatMapOf :: Lens a b c d -> (c -> [e]) -> a -> [e] < concatMapOf :: Iso a b c d -> (c -> [e]) -> a -> [e] < concatMapOf :: Traversal a b c d -> (c -> [e]) -> a -> [e]   concat = concatOf folded - concatOf :: Getter a [e] -> a -> [e] - concatOf :: Fold a [e] -> a -> [e] - concatOf :: Iso a b [e] d -> a -> [e] - concatOf :: Lens a b [e] d -> a -> [e] - concatOf :: Traversal a b [e] d -> a -> [e] ;Note: this can be rather inefficient for large containers.   length = lengthOf folded   lengthOf _1 :: (a, b) -> Int  lengthOf _1 = 1 : lengthOf (folded.folded) :: Foldable f => f (g a) -> Int + lengthOf :: Getter a c -> a -> Int + lengthOf :: Fold a c -> a -> Int + lengthOf :: Lens a b c d -> a -> Int + lengthOf :: Iso a b c d -> a -> Int + lengthOf :: Traversal a b c d -> a -> Int Perform a safe  of a  or  Traversal or retrieve  the result  from a y or S.  & listToMaybe . toList = headOf folded - headOf :: Getter a c -> a -> Maybe c - headOf :: Fold a c -> a -> Maybe c - headOf :: Lens a b c d -> a -> Maybe c - headOf :: Iso a b c d -> a -> Maybe c - headOf :: Traversal a b c d -> a -> Maybe c Perform a safe  of a  or  Traversal or retrieve  the result  from a y or S. - lastOf :: Getter a c -> a -> Maybe c - lastOf :: Fold a c -> a -> Maybe c - lastOf :: Lens a b c d -> a -> Maybe c - lastOf :: Iso a b c d -> a -> Maybe c - lastOf :: Traversal a b c d -> a -> Maybe c Returns  if this  or  Traversal( has no targets in the given container. Note: nullOf on a valid Iso, S or y should always return    null = nullOf folded /This may be rather inefficient compared to the  check of many containers.   nullOf _1 :: (a, b) -> Int  nullOf _1 = False ? nullOf (folded._1.folded) :: Foldable f => f (g a, b) -> Bool * nullOf :: Getter a c -> a -> Bool * nullOf :: Fold a c -> a -> Bool * nullOf :: Iso a b c d -> a -> Bool * nullOf :: Lens a b c d -> a -> Bool * nullOf :: Traversal a b c d -> a -> Bool 2Obtain the maximum element (if any) targeted by a  or  Traversal Note: maximumOf on a valid Iso, S or y will always return  a value.  8 maximum = fromMaybe (error "empty") . maximumOf folded 9 maximumOf :: Getter a c -> a -> Maybe c 9 maximumOf :: Ord c => Fold a c -> a -> Maybe c 9 maximumOf :: Iso a b c d -> a -> Maybe c 9 maximumOf :: Lens a b c d -> a -> Maybe c 9 maximumOf :: Ord c => Traversal a b c d -> a -> Maybe c 2Obtain the minimum element (if any) targeted by a  or  Traversal Note: minimumOf on a valid Iso, S or y will always return  a value.  8 minimum = fromMaybe (error "empty") . minimumOf folded 9 minimumOf :: Getter a c -> a -> Maybe c 9 minimumOf :: Ord c => Fold a c -> a -> Maybe c 9 minimumOf :: Iso a b c d -> a -> Maybe c 9 minimumOf :: Lens a b c d -> a -> Maybe c 9 minimumOf :: Ord c => Traversal a b c d -> a -> Maybe c 2Obtain the maximum element (if any) targeted by a ,  Traversal, S, Iso,  or y( according to a user supplied ordering.  D maximumBy cmp = fromMaybe (error "empty") . maximumByOf folded cmp J maximumByOf :: Getter a c -> (c -> c -> Ordering) -> a -> Maybe c J maximumByOf :: Fold a c -> (c -> c -> Ordering) -> a -> Maybe c J maximumByOf :: Iso a b c d -> (c -> c -> Ordering) -> a -> Maybe c J maximumByOf :: Lens a b c d -> (c -> c -> Ordering) -> a -> Maybe c J maximumByOf :: Traversal a b c d -> (c -> c -> Ordering) -> a -> Maybe c 2Obtain the minimum element (if any) targeted by a ,  Traversal, S, Iso  or y( according to a user supplied ordering.  D minimumBy cmp = fromMaybe (error "empty") . minimumByOf folded cmp J minimumByOf :: Getter a c -> (c -> c -> Ordering) -> a -> Maybe c J minimumByOf :: Fold a c -> (c -> c -> Ordering) -> a -> Maybe c J minimumByOf :: Iso a b c d -> (c -> c -> Ordering) -> a -> Maybe c J minimumByOf :: Lens a b c d -> (c -> c -> Ordering) -> a -> Maybe c J minimumByOf :: Traversal a b c d -> (c -> c -> Ordering) -> a -> Maybe c The ? function takes a lens (or , getter, iso, fold, or traversal), O a predicate and a structure and returns the leftmost element of the structure  matching the predicate, or  if there is no such element. < findOf :: Getter a c -> (c -> Bool) -> a -> Maybe c < findOf :: Fold a c -> (c -> Bool) -> a -> Maybe c < findOf :: Iso a b c d -> (c -> Bool) -> a -> Maybe c < findOf :: Lens a b c d -> (c -> Bool) -> a -> Maybe c < findOf :: Traversal a b c d -> (c -> Bool) -> a -> Maybe c  A variant of 4 that has no base case and thus may only be applied K to lenses and structures such that the lens views at least one element of  the structure.  . foldr1Of l f = Prelude.foldr1 f . toListOf l   foldr1 = foldr1Of folded : foldr1Of :: Getter a c -> (c -> c -> c) -> a -> c : foldr1Of :: Fold a c -> (c -> c -> c) -> a -> c : foldr1Of :: Iso a b c d -> (c -> c -> c) -> a -> c : foldr1Of :: Lens a b c d -> (c -> c -> c) -> a -> c : foldr1Of :: Traversal a b c d -> (c -> c -> c) -> a -> c  A variant of Q that has no base case and thus may only be applied to lenses and strutures such < that the lens views at least one element of the structure.  . foldl1Of l f = Prelude.foldl1Of l f . toList   foldl1 = foldl1Of folded : foldl1Of :: Getter a c -> (c -> c -> c) -> a -> c : foldl1Of :: Fold a c -> (c -> c -> c) -> a -> c : foldl1Of :: Iso a b c d -> (c -> c -> c) -> a -> c : foldl1Of :: Lens a b c d -> (c -> c -> c) -> a -> c : foldl1Of :: Traversal a b c d -> (c -> c -> c) -> a -> c 6Strictly fold right over the elements of a structure.   foldr' = foldrOf' folded ? foldrOf' :: Getter a c -> (c -> e -> e) -> e -> a -> e ? foldrOf' :: Fold a c -> (c -> e -> e) -> e -> a -> e ? foldrOf' :: Iso a b c d -> (c -> e -> e) -> e -> a -> e ? foldrOf' :: Lens a b c d -> (c -> e -> e) -> e -> a -> e ? foldrOf' :: Traversal a b c d -> (c -> e -> e) -> e -> a -> e NFold over the elements of a structure, associating to the left, but strictly.   foldl' = foldlOf' folded A foldlOf' :: Getter a c -> (e -> c -> e) -> e -> a -> e A foldlOf' :: Fold a c -> (e -> c -> e) -> e -> a -> e A foldlOf' :: Iso a b c d -> (e -> c -> e) -> e -> a -> e A foldlOf' :: Lens a b c d -> (e -> c -> e) -> e -> a -> e A foldlOf' :: Traversal a b c d -> (e -> c -> e) -> e -> a -> e IMonadic fold over the elements of a structure, associating to the right,  i.e. from right to left.   foldrM = foldrMOf folded N foldrMOf :: Monad m => Getter a c -> (c -> e -> m e) -> e -> a -> m e N foldrMOf :: Monad m => Fold a c -> (c -> e -> m e) -> e -> a -> m e N foldrMOf :: Monad m => Iso a b c d -> (c -> e -> m e) -> e -> a -> m e N foldrMOf :: Monad m => Lens a b c d -> (c -> e -> m e) -> e -> a -> m e N foldrMOf :: Monad m => Traversal a b c d -> (c -> e -> m e) -> e -> a -> m e HMonadic fold over the elements of a structure, associating to the left,  i.e. from left to right.   foldlM = foldlMOf folded N foldlMOf :: Monad m => Getter a c -> (e -> c -> m e) -> e -> a -> m e N foldlMOf :: Monad m => Fold a c -> (e -> c -> m e) -> e -> a -> m e N foldlMOf :: Monad m => Iso a b c d -> (e -> c -> m e) -> e -> a -> m e N foldlMOf :: Monad m => Lens a b c d -> (e -> c -> m e) -> e -> a -> m e N foldlMOf :: Monad m => Traversal a b c d -> (e -> c -> m e) -> e -> a -> m e 8666"rank 2 types, MPTCs, TFs, flexible provisionalEdward Kmett <ekmett@gmail.com> Safe-Infered# type 'SimpleIdexedTraversal i = R ( i)Every  is a valid ' The '" laws are still required to hold. type SimpleIdexedTraversal i = R ( i)>Every indexed traversal is a valid Traversal or indexed fold. /The Traversal laws are still required to hold. Every  is a valid Fold. YA function with access to a index. This constructor may be useful when you need to store  a HasIndex. =Type alias for passing around polymorphic indexed functions. bPermit overloading of function application for things that also admit a notion of a key or index. ,Provides overloading for indexed functions. *Build a function from an indexed function Remap the index. !Composition of indexed functions TComposition of indexed functions with a user supplied function for combining indexs Q ifoldMapOf :: Monoid m => IndexedFold i a c -> (i -> c -> m) -> a -> m Q ifoldMapOf :: Monoid m => IndexedTraversal i a b c d -> (i -> c -> m) -> a -> m IRight-associative fold of parts of a structure that are viewed through a S, y, Fold or  Traversal. M ifoldrOf :: IndexedFold i a c -> (i -> c -> e -> e) -> e -> a -> e M ifoldrOf :: IndexedTraversal i a b c d -> (i -> c -> e -> e) -> e -> a -> e LLeft-associative fold of the parts of a structure that are viewed through a S, y, Fold or  Traversal.   foldl = foldlOf folded M ifoldlOf :: IndexedFold i a c -> (i -> e -> c -> e) -> e -> a -> e M ifoldlOf :: IndexedTraversal i a b c d -> (i -> e -> c -> e) -> e -> a -> e G ianyOf :: IndexedFold i a c -> (i -> c -> Bool) -> a -> Bool G ianyOf :: IndexedTraversal i a b c d -> (i -> c -> Bool) -> a -> Bool G iallOf :: IndexedFold i a c -> (i -> c -> Bool) -> a -> Bool G iallOf :: IndexedTraversal i a b c d -> (i -> c -> Bool) -> a -> Bool ] itraverseOf_ :: Applicative f => IndexedFold i a c -> (i -> c -> f e) -> a -> f () ] itraverseOf_ :: Applicative f => IndexedTraversal i a b c d -> (i -> c -> f e) -> a -> f () X iforOf_ :: Applicative f => IndexedFold i a c -> a -> (i -> c -> f e) -> f () X iforOf_ :: Applicative f => IndexedTraversal i a b c d -> a -> (i -> c -> f e) -> f () S imapMOf_ :: Monad m => IndexedFold i a c -> (i -> c -> m e) -> a -> m () S imapMOf_ :: Monad m => IndexedTraversal i a b c d -> (i -> c -> m e) -> a -> m () S iforMOf_ :: Monad m => IndexedFold i a c -> a -> (i -> c -> m e) -> m () S iforMOf_ :: Monad m => IndexedTraversal i a b c d -> a -> (i -> c -> m e) -> m () K iconcatMapOf :: IndexedFold i a c -> (i -> c -> [e]) -> a -> [e] K iconcatMapOf :: IndexedTraversal i a b c d -> (i -> c -> [e]) -> a -> [e] DStrictly fold right over the elements of a structure with an index. N ifoldrOf' :: IndexedFold i a c -> (i -> c -> e -> e) -> e -> a -> e N ifoldrOf' :: IndexedTraversal i a b c d -> (i -> c -> e -> e) -> e -> a -> e \Fold over the elements of a structure with an index, associating to the left, but strictly. P ifoldlOf' :: IndexedFold i a c -> (i -> e -> c -> e) -> e -> a -> e P ifoldlOf' :: IndexedTraversal i a b c d -> (i -> e -> c -> e) -> e -> a -> e CMonadic fold right over the elements of a structure with an index. [ ifoldrMOf :: Monad m => IndexedFold i a c -> (i -> c -> e -> m e) -> e -> a -> e [ ifoldrMOf :: Monad m => IndexedTraversal i a b c d -> (i -> c -> e -> m e) -> e -> a -> e VMonadic fold over the elements of a structure with an index, associating to the left. ] ifoldlOf' :: Monad m => IndexedFold i a c -> (i -> e -> c -> m e) -> e -> a -> e ] ifoldlOf' :: Monad m => IndexedTraversal i a b c d -> (i -> e -> c -> m e) -> e -> a -> e Traversal with an index.   itraverseOf = withIndex J itraverseOf :: IndexedTraversal i a b c d -> (i -> c -> f d) -> a -> f b  iforOf = flip . itraverseOf HMap each element of a structure targeted by a lens to a monadic action, Q evaluate these actions from left to right, and collect the results, with access  its position. O imapMOf :: Monad m => IndexedTraversal a b c d -> (i -> c -> m d) -> a -> m b  iforMOf = flip . imapMOf  Generalizes $% to an arbitrary . ' accumulates state from right to left.  Generalized $& to an arbitrary . ' accumulates state from left to right. Map with index A imapOf :: IndexedTraversal i a b c d -> (i -> c -> d) -> a -> b > imapOf :: IndexedSetter i a b c d -> (i -> c -> d) -> a -> b  (%@) = imapOf CUsing an equality witness to avoid potential overlapping instances  and aid dispatch. '%%$portable provisionalEdward Kmett <ekmett@gmail.com> Safe-InferedThis S4 can be used to read, write or delete a member of a  ,contains 3 .~ False $ Set.fromList [1,2,3,4]fromList [1,2,4] B contains :: Ord k => k -> (Bool -> f Bool) -> Set k -> f (Set k) This '% can be used to change the type of a  by mapping  the elements to new values. Sadly, you can't create a valid  Traversal for a , but you can  manipulate it by reading using  and reindexing it via setmap. *adjust setmapped (+1) (fromList [1,2,3,4])fromList [2,3,4,5]Construct a set from a y, ,  Traversal, S or Iso. 5setOf (folded._2) [("hello",1),("world",2),("!!!",3)]fromList [1,2,3] 3 setOf :: Getter a c -> a -> Set c 3 setOf :: Ord c => Fold a c -> a -> Set c 3 setOf :: Iso a b c d -> a -> Set c 3 setOf :: Lens a b c d -> a -> Set c 3 setOf :: Ord c => Traversal a b c d -> a -> Set c  Rank2Types provisionalEdward Kmett <ekmett@gmail.com> Safe-Infered ) type SimpleTraversal = Simple Traversal A  can be used directly as a Setter or a  (but not as a S) and provides V the ability to both read and update multiple fields, subject to some relatively weak  laws. UThese have also been known as multilenses, but they have the signature and spirit of  8 traverse :: Traversable f => Traversal (f a) (f b) a b 8and the more evocative name suggests their application. Most of the time the  you will want to use is just , but you can also pass any  S or Iso& as a Traversal, and composition of a  (or S or Iso ) with a  (or S or Iso)  using (.) forms a valid . The laws for a Traversal t3 follow from the laws for Traversable as stated in "#The Essence of the Iterator Pattern". 1) Idiomatic naturality:   t pure = pure 2) Sequential composition:  : fmap (t f) . t g = getCompose . t (Compose . fmap f . g) wOne consequence of this requirement is that a traversal needs to leave the same number of elements as a candidate for * subsequent traversal as it started with. -3) No duplication of elements (as defined in "#The Essence of the Iterator Pattern" section 5.5), which states ] that you should incur no effect caused by visiting the same element of the container twice. AMap each element of a structure targeted by a Lens or Traversal, E evaluate these actions from left to right, and collect the results.   traverseOf = id   traverse = traverseOf traverse ; traverseOf :: Iso a b c d -> (c -> f d) -> a -> f b ; traverseOf :: Lens a b c d -> (c -> f d) -> a -> f b ; traverseOf :: Traversal a b c d -> (c -> f d) -> a -> f b   forOf l = flip (traverseOf l)   for = forOf traverse  forOf = morphism flip flip 1 forOf :: Lens a b c d -> a -> (c -> f d) -> f b FEvaluate each action in the structure from left to right, and collect  the results.  " sequenceA = sequenceAOf traverse ! sequenceAOf l = traverseOf l id  sequenceAOf l = l id C sequenceAOf :: Iso a b (f c) c -> a -> f b C sequenceAOf :: Lens a b (f c) c -> a -> f b C sequenceAOf :: Applicative f => Traversal a b (f c) c -> a -> f b HMap each element of a structure targeted by a lens to a monadic action, E evaluate these actions from left to right, and collect the results.   mapM = mapMOf traverse B mapMOf :: Iso a b c d -> (c -> m d) -> a -> m b B mapMOf :: Lens a b c d -> (c -> m d) -> a -> m b B mapMOf :: Monad m => Traversal a b c d -> (c -> m d) -> a -> m b   forM = forMOf traverse  forMOf l = flip (mapMOf l) B forMOf :: Iso a b c d -> a -> (c -> m d) -> m b B forMOf :: Lens a b c d -> a -> (c -> m d) -> m b B forMOf :: Monad m => Traversal a b c d -> a -> (c -> m d) -> m b   sequence = sequenceOf traverse  sequenceOf l = mapMOf l id * sequenceOf l = unwrapMonad . l WrapMonad < sequenceOf :: Iso a b (m c) c -> a -> m b < sequenceOf :: Lens a b (m c) c -> a -> m b < sequenceOf :: Monad m => Traversal a b (m c) c -> a -> m b This generalizes '( to an arbitrary .  " transpose = transposeOf traverse  . ghci> transposeOf traverse [[1,2,3],[4,5,6]]  [[1,4],[2,5],[3,6]]  Since every S. is a Traversal, we can use this as a form of  monadic strength. ( transposeOf _2 :: (b, [a]) -> [(b, a)]  Generalizes  to an arbitrary .  " mapAccumR = mapAccumROf traverse ' accumulates state from right to left. L mapAccumROf :: Iso a b c d -> (s -> c -> (s, d)) -> s -> a -> (s, b) L mapAccumROf :: Lens a b c d -> (s -> c -> (s, d)) -> s -> a -> (s, b) L mapAccumROf :: Traversal a b c d -> (s -> c -> (s, d)) -> s -> a -> (s, b)  Generalized  to an arbitrary .  " mapAccumL = mapAccumLOf traverse ' accumulates state from left to right. L mapAccumLOf :: Iso a b c d -> (s -> c -> (s, d)) -> s -> a -> (s, b) L mapAccumLOf :: Lens a b c d -> (s -> c -> (s, d)) -> s -> a -> (s, b) L mapAccumLOf :: Traversal a b c d -> (s -> c -> (s, d)) -> s -> a -> (s, b) Permit the use of  over an arbitrary  or S.   scanr1 = scanr1Of traverse : scanr1Of :: Iso a b c c -> (c -> c -> c) -> a -> b : scanr1Of :: Lens a b c c -> (c -> c -> c) -> a -> b : scanr1Of :: Traversal a b c c -> (c -> c -> c) -> a -> b Permit the use of  over an arbitrary  or S.   scanl1 = scanl1Of traverse : scanr1Of :: Iso a b c c -> (c -> c -> c) -> a -> b : scanr1Of :: Lens a b c c -> (c -> c -> c) -> a -> b : scanr1Of :: Traversal a b c c -> (c -> c -> c) -> a -> b A S to view/edit the nth element  a , S or Iso. +Attempts to access beyond the range of the  will cause an error. 4 ghci> [[1],[3,4]]^.elementOf (traverse.traverse) 1  3 Access the nth element of a  container. +Attempts to access beyond the range of the  will cause an error.  element = elementOf traverse %This is the traversal that just doesn't return anything < traverseNothing :: Applicative f => (c -> f d) -> a -> f a   Rank2Types provisionalEdward Kmett <ekmett@gmail.com> Safe-InferedThis SK can be used to read, write or delete the value associated with a key in a . (Map.fromList [("hello",12)] ^.at "hello"Just 12!at 10 .~ Just "hello" $ Map.emptyfromList [(10,"hello")] H at :: Ord k => k -> (Maybe v -> f (Maybe v)) -> Map k v -> f (Map k v) Traversal of a  indexed by the key. +Traverse the value at a given key in a Map S traverseAt :: (Applicative f, Ord k) => k -> (v -> f v) -> Map k v -> f (Map k v) % traverseAt k = valueAt k . traverse 0Traverse the value at the minimum key in a Map. KThe key of the minimum element is available as the index of the traversal. 0Traverse the value at the maximum key in a Map. KThe key of the maximum element is available as the index of the traversal.  TemplateHaskell experimentalEdward Kmett <ekmett@gmail.com>None Provides substitution for types Perform substitution for types HProvides for the extraction of free type variables, and alpha renaming. 4When performing substitution into this traversal you're not allowed 8 to substitute in a name that is bound internally or you' ll violate  the . laws, when in doubt generate your names with . Has a  Extract (or modify) the  of something  Traverse free type variables 'Substitute using a map of names in for free type variables   Rank2Types provisionalEdward Kmett <ekmett@gmail.com> Safe-Infered type SimpleIso = ) DIsomorphim families can be composed with other lenses using either () and  I from the Prelude or from Control.Category. However, if you compose them  with each other using (2) from the Prelude, they will be dumbed down to a  mere Lens.   import Control.Category  import Prelude hiding ((.),id)  type Iso a b c d = forall k f. ( k,  f) =>  Overloaded k f a b c d'A concrete data type for isomorphisms. DThis lets you place an isomorphism inside a container without using ImpredicativeTypes. 7Used to provide overloading of isomorphism application  This is a ) with a canonical mapping to it from the . category of isomorphisms over Haskell types. *Build this morphism out of an isomorphism The intention is that by using #, you can supply both halves of an + isomorphism, but k can be instantiated to (->), so you can freely use * the resulting isomorphism as a function. MMap a morphism in the target category using an isomorphism between morphisms  in Hask. Invert an isomorphism. ENote to compose an isomorphism and receive an isomorphism in turn you'll need to use     from (from l) = l If you imported  from Control.Category, then:  from l . from r = from (r . l) Convert from an  back to any  value. WThis is useful when you need to store an isomoprhism as a data type inside a container 6 and later reconstitute it as an overloaded function. @Build an isomorphism family from two pairs of inverse functions 8isos :: (a -> c) -> (c -> a) -> (b -> d) -> (d -> b) ->  a b c d<Build a simple isomorphism from a pair of inverse functions iso :: (a -> b) -> (b -> a) -> )  a b :This isomorphism can be used to wrap or unwrap a value in .  x^.identity =  x  x^.from identity = x :This isomorphism can be used to wrap or unwrap a value in    x^._const =  x  x^.from _const = x           RankNTypes provisionalEdward Kmett <ekmett@gmail.com> Safe-Infered GSometimes you need to store a path lens into a container, but at least F at this time, impredicative polymorphism in GHC is somewhat lacking. FThis type provides a way to, say, store a list of polymorphic lenses. Representable Functors. A  f is  if it is isomorphic to (x -> a) > for some x. All such functors can be represented by choosing x to be ? the set of lenses that are polymorphic in the contents of the ,  that is to say  x = Rep f is a valid choice of x for every   . @Note: Some sources refer to covariant representable functors as ) corepresentable functors, and leave the " representable" name to 1 contravariant functors (those are isomorphic to (a -> x) for some x). LAs the covariant case is vastly more common, and both are often referred to = as representable functors, we choose to call these functors   here. The representation of a   as Lenses # is a valid default definition for  for a representable  functor.  $ fmapRep f m = rep $ \i -> f (m^.i) "Usage for a representable functor Foo:  instance Functor Foo where  fmap = fmapRep # is a valid default definition for  and  for a  representable functor.   pureRep = rep . const "Usage for a representable functor Foo:   instance Applicative Foo where  pure = pureRep  (<*>) = apRep  instance Monad Foo where  return = pureRep  (>>=) = bindRep # is a valid default definition for '( *)' for a representable  functor.  ) apRep mf ma = rep $ \i -> mf^.i $ ma^.i "Usage for a representable functor Foo:  instance Applicative Foo where  pure = pureRep  (<*>) = apRep + is a valid default default definition for '(>>=)' for a  representable functor.  & bindRep m f = rep $ \i -> f(m^.i)^.i "Usage for a representable functor Foo:  instance Monad ... where  return = pureRep  (>>=) = bindRep A default definition for *+ for a    . distributeRep wf = rep $ \i -> fmap (^.i) wf Typical Usage: ! instance Distributive ... where  distribute = distributeRep A  - has a fixed shape. This fills each position  in it with a    A version of 5 that is an isomorphism. Predicativity requires that  we wrap the  as a Key , however.  Map over a  " with access to the lens for the  current position ) mapWithKey f m = rep $ \i -> f i (m^.i)  Traverse a  ! with access to the current path  Traverse a  ! with access to the current path " as a lens, discarding the result  Traverse a  ! with access to the current path ( and a lens (and the arguments flipped)  over a  ! with access to the current path  as a lens  over a  ! with access to the current path " as a lens, discarding the result  over a  ! with access to the current path ( as a lens (with the arguments flipped)  Fold over a  ! with access to the current path  as a lens, yielding a    Fold over a  ! with access to the current path  as a lens. CNB: The Eq requirement on this instance is a consequence of a lens  rather than e as the representation.                  TemplateHaskell experimentalEdward Kmett <ekmett@gmail.com> Trustworthy!+This configuration describes the options we'+ll be using to make isomorphisms or lenses #Flags for lens construction ,Only Generate valid R S lenses -(Handle singleton constructors specially .#Use Iso for singleton constructors /@Expect a single constructor, single field newtype or data type. 06Create the class if the constructor is simple and the 5 rule matches 19Create the instance if the constructor is simple and the 5 rule matches 2 Die if the 5 fails to match 3RLens to access the convention for naming top level isomorphisms in our lens rules =Defaults to lowercasing the first letter of the constructor. 4BLens to access the convention for naming fields in our lens rules ODefaults to stripping the _ off of the field name and lowercasing the name and  rejecting the field if it doesn't start with an '_'. 5wRetrieve options such as the name of the class and method to put in it to build a class around monomorphic data types. 6wRetrieve options such as the name of the class and method to put in it to build a class around monomorphic data types. 7Default lens rules 8)Build lenses with a custom configuration 93Build lenses with a sensible default configuration ' makeLenses = makeLensesWith lensRules :7Make a top level isomorphism injecting _into_ the type dThe supplied name is required to be for a type with a single constructor that has a single argument # makeIso = makeLensesWith isoRules ;1Rules for making an isomorphism from a data type <Make ' classy lenses' for a type ) makeClassy = makeLensesWith classyRules =6Rules for making lenses that precompose another lens. >/Derive lenses, specifying explicit pairings of (fieldName, lensName). Example usage: < makeLensesFor [("_foo", "fooLens"), ("bar", "lbar")] ''Foo ?pRules for making fairly simple lenses, ignoring the special cases for isomorphisms, and not making any classes. @/Derive lenses, specifying explicit pairings of (fieldName, lensName)  using a wrapper class. Example usage: K makeClassyFor "HasFoo" "foo" [("_foo", "fooLens"), ("bar", "lbar")] ''Foo !"#$%&'()*+,-./0123456789:;<=>?@ !"#$%&'()*+,-./0123456789:;<=>?@ !"3456#+*)('&%$,-./012<@:9>8?=;7!"#+*)('&%$,-./0123456789:;<=>?@, Rank2Types provisionalEdward Kmett <ekmett@gmail.com> Safe-Infered !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@portable provisionalEdward Kmett <ekmett@gmail.com> Safe-InferedATraverse the strongly typed  contained in ) where the type of your function matches  the desired . @ traverseException :: (Applicative f, Exception a, Exception b) E => (a -> f b) -> SomeException -> f SomeException AAAALiberalTypeSynonyms provisionalEdward Kmett <ekmett@gmail.com> Safe-InferedBBitwise  the target(s) of a -valued S or ' _2 |~ 6 $ ("hello",3) ("hello",7)CBitwise  the target(s) of a -valued S or ' _2 &~ 7 $ ("hello",254) ("hello",6)DModify the target(s) of a R S, ' or  by computing its bitwise  with another value. EModify the target(s) of a R S, ' or  by computing its bitwise  with another value. FFThis lens can be used to access the value of the nth bit in a number. bitAt n is only a legal S into b if 0 <= n < bitSize (undefined :: b)  16^.bitAt 4True 15^.bitAt 4FalseG*Traverse over all bits in a numeric type. ,The bit position is available as the index. "toListOf traverseBits (5 :: Word8)/[True,False,True,False,False,False,False,False]%If you supply this an Integer, it won't crash, but the result will = be an infinite traversal that can be productively consumed. BCDEFGBCDEFGBCEDFGBCDEFG Haskell2010 provisionalEdward Kmett <ekmett@gmail.com> Safe-InferedH)Access the real part of a complex number ? real :: Functor f => (a -> f a) -> Complex a -> f (Complex a) I.Access the imaginary part of a complex number D imaginary :: Functor f => (a -> f a) -> Complex a -> f (Complex a) JThis isn't quite a legal lens. Notably the view l (set l b a) = b law L is violated when you set a polar value with 0 magnitude and non-zero phase ) as the phase information is lost. So don' t do that! Otherwise, this is a  perfectly cromulent lens. K@Traverse both the real and imaginary parts of a complex number. N traverseComplex :: Applicative f => (a -> f b) -> Complex a -> f (Complex b) HIJKHIJKHIJKHIJKportable provisionalEdward Kmett <ekmett@gmail.com> Safe-InferedL(Traverse the typed value contained in a 7 where the type required by your function matches that  of the contents of the . b traverseDynamic :: (Applicative f, Typeable a, Typeable b) => (a -> f b) -> Dynamic -> f Dynamic LLLLportable provisionalEdward Kmett <ekmett@gmail.com> Safe-InferedM;A traversal for tweaking the left-hand value in an Either: M traverseLeft :: Applicative f => (a -> f b) -> Either a c -> f (Either b c) N,traverse the right-hand value in an Either:   traverseRight = traverse Unfortunately the instance for 'Traversable (Either c)' is still missing  from base, so this can' t just be  N traverseRight :: Applicative f => (a -> f b) -> Either c a -> f (Either c a) MNMNMNMNportable provisionalEdward Kmett <ekmett@gmail.com> Safe-Infered O,A lens reading and writing to the head of a  non-empty list [1,2,3]^._head1P,A lens reading and writing to the tail of a  non-empty list _tail .~ [3,4,5] $ [1,2] [1,3,4,5]Q4A lens reading and writing to the last element of a  non-empty list  [1,2]^._last2R=A lens reading and replacing all but the a last element of a  non-empty list [1,2,3,4]^._init[1,2,3]SCObtain a version of the list with the supplied value interspersed. "abcde"^.interspersed ',' "a,b,c,d,e" ' xs^.interspersed a = intersperse a xs TBObtain a version of the list with the supplied value intercalated UQIndexed traversal of a list. The position in the list is available as the index. V<The traversal for reading and writing to the head of a list MThe position of the head in the original list (0) is available as the index. traverseHead +~ 1 $ [1,2,3][2,2,3] = traverseHead :: Applicative f => (a -> f a) -> [a] -> f [a] W*Traversal for editing the tail of a list. The position of each element in the original list is available as the index. traverseTail +~ 1 $ [1,2,3][1,3,4] = traverseTail :: Applicative f => (a -> f a) -> [a] -> f [a] X%Traverse the last element in a list. QThe position of the last element in the original list is available as the index. traverseLast +~ 1 $ [1,2,3][1,2,4] = traverseLast :: Applicative f => (a -> f a) -> [a] -> f [a] Y,Traverse all but the last element of a list 8The position of each element is available as the index. traverseInit +~ 1 $ [1,2,3][2,3,3] = traverseInit :: Applicative f => (a -> f a) -> [a] -> f [a] OPQRSTUVWXY OPQRSTUVWXY OPQRSTUVWYX OPQRSTUVWXYportable provisionalEdward Kmett <ekmett@gmail.com> Safe-InferedZ4Traverse both parts of a tuple with matching types. [This provides a ) that checks a predicate on a key before ( allowing you to traverse into a value. Z[Z[Z[Z[ Rank2Types provisionalEdward Kmett <ekmett@gmail.com> Safe-Infered\This SL can be used to read, write or delete the value associated with a key in an . fromList [(1,"hello")] ^.at 1 Just "hello"#at 1 .~ Just "hello" $ IntMap.emptyfromList [(1,"hello")] C at :: Int -> (Maybe v -> f (Maybe v)) -> IntMap v -> f (IntMap v) ]Traversal of an  indexed by the key. ^/Traverse the value at a given key in an IntMap N traverseAt :: Applicative f => Int -> (v -> f v) -> IntMap v -> f (IntMap v)  traverseAt k = at k . traverse _/Traverse the value at the minimum key in a Map :The key of the minimum element is available as the index. `/Traverse the value at the maximum key in a Map \]^_`\]^_`\]^_`\]^_`portable provisionalEdward Kmett <ekmett@gmail.com> Safe-InferedaThis S5 can be used to read, write or delete a member of an   0 ghci> contains 3 +~ False $ fromList [1,2,3,4]  fromList [1,2,4] ; contains :: Int -> (Bool -> f Bool) -> IntSet -> f IntSet b IntSet isn't Foldable, but this ) can be used to access the members of an . &sumOf members $ setOf folded [1,2,3,4]10cThis '* can be used to change the contents of an  by mapping  the elements to new values. Sadly, you can't create a valid  for a Set, because the number of B elements might change but you can manipulate it by reading using  and  reindexing it via setmap. *adjust setmapped (+1) (fromList [1,2,3,4])fromList [2,3,4,5]d Construct an  from a y, , , S or . - setOf :: Getter a Int -> a -> IntSet - setOf :: Fold a Int -> a -> IntSet - setOf :: Iso a b Int d -> a -> IntSet - setOf :: Lens a b Int d -> a -> IntSet - setOf :: Traversal a b Int d -> a -> IntSet abcdabcdabcdabcdportable provisionalEdward Kmett <ekmett@gmail.com> Safe-Infered eA S that can access the nth element of a . =Note: This is only a legal lens if there is such an element! fA  is isomorphic to a   viewl m = m^.viewL gA  is isomorphic to a   viewr m = m^.viewR hTraverse the head of a  iTraverse the tail of a  jTraverse the last element of a  k'Traverse all but the last element of a  lTraverse the first n elements of a  mTraverse all but the first n elements of a  n'Travere all the elements numbered from i to j of a  efghijklmn efghijklmn efghijklmn efghijklmnMTPCs provisionalEdward Kmett <ekmett@gmail.com> Safe-InferedoA S that focuses on the root of a . pA , of the direct descendants of the root of a  1 indexed by its position in the list of children opopopop&MPTCs, Rank2Types, LiberalTypeSynonyms provisionalEdward Kmett <ekmett@gmail.com> Safe-InferedqAccess an element of an array. CNote: The indexed element is assumed to exist in the target array.   arr ! i = arr^.ix i " arr // [(i,e)] = ix i ^= e $ arr 'ix 2 ^= 9 $ listArray (1,5) [4,5,6,7,8]array (1,5) [4,9,6,7,8]rCThis setter can be used to derive a new array from an old array by - applying a function to each of the indices.  This is a  contravariant '.   ixmap = adjust . ixmapped  ixmapped = sets . ixmap + adjust (ixmapped b) f arr ! i = arr ! f i ( bounds (adjust (ixmapped b) f arr) = b sGeneric 7 of the elements of an array, using the index into the & array as the index of the traversal.  amap = adjust traverseArray qrsqrsqrsqrsportable provisionalEdward Kmett <ekmett@gmail.com> Safe-Inferedt(Pack (or unpack) a list of bytes into a   pack x = x^.packedBytes  unpack x = x^.from packedBytes u#Traverse the individual bytes in a   % bytes = from packedBytes . traverse , anyOf bytes (==0x80) :: ByteString -> Bool v-Pack (or unpack) a list of characters into a  FWhen writing back to the byteString it is assumed that all characters  lie between '\x00' and '\xff'.  pack x = x^.packedChars  unpack x = x^.from packedChars w#Traverse the individual bytes in a  as characters. FWhen writing back to the byteString it is assumed that all characters  lie between '\x00' and '\xff'.   chars = from packed . traverse + anyOf chars (=='c') :: ByteString -> Bool tuvwtuvwtuvwtuvwportable provisionalEdward Kmett <ekmett@gmail.com> Safe-Inferedx(Pack (or unpack) a list of bytes into a   pack x = x^.packedBytes  unpack x = x^.from packedBytes y#Traverse the individual bytes in a   % bytes = from packedBytes . traverse , anyOf bytes (==0x80) :: ByteString -> Bool z-Pack (or unpack) a list of characters into a  FWhen writing back to the byteString it is assumed that all characters  lie between '\x00' and '\xff'.  pack x = x^.packedChars  unpack x = x^.from packedChars {#Traverse the individual bytes in a  as characters. FWhen writing back to the byteString it is assumed that all characters  lie between '\x00' and '\xff'.   chars = from packed . traverse + anyOf chars (=='c') :: ByteString -> Bool xyz{xyz{xyz{xyz{portable provisionalEdward Kmett <ekmett@gmail.com> Safe-Infered|Pack (or unpack) .  pack x = x^.packed  unpack x = x^.from packed }>Traverse the individual characters in a either strict or lazy . $ anyOf text (=='c') :: Text -> Bool |}|}|}|}portable provisionalEdward Kmett <ekmett@gmail.com> Safe-Infered~Pack (or unpack) .  pack x = x^.packed  unpack x = x^.from packed (Traverse the individual characters in a . $ anyOf text (=='c') :: Text -> Bool ~~~~portable provisionalEdward Kmett <ekmett@gmail.com> Safe-InferedEvaluate the targets of a S or  into a data structure " according to the given strategy.  * evalTraversable = evalTraversal traverse   evalTraversal = id  > evalTraversal :: Simple Lens a b -> Strategy b -> Strategy a C evalTraversal :: Simple Traversal a b -> Strategy b -> Strategy a L evalTraversal :: (b -> Eval b) -> a -> Eval a) -> Strategy b -> Strategy a Evaluate the targets of a S or  according into a % data structure according to a given  in parallel.  ( parTraversable = parTraversal traverse  = parTraversal :: Simple Lens a b -> Strategy b -> Strategy a B parTraversal :: Simple Traversal a b -> Strategy b -> Strategy a L parTraversal :: ((b -> Eval b) -> a -> Eval a) -> Strategy b -> Strategy a  Transform a S, , y, ' or  to P first evaluates its argument according to a given strategy, before proceeding.  after rdeepseq traverse  Transform a S, , y, ' or  to R evaluate its argument according to a given strategy in parallel with evaluating.  meanwhile rdeepseq traverse portable provisionalEdward Kmett <ekmett@gmail.com> Safe-Infered$Evaluate the elements targeted by a S, , ,  y or " according to the given strategy.  seqFoldable = seqOf folded  GHC experimentalEdward Kmett <ekmett@gmail.com> Safe-Infered(Traversable generic data types. Used by . ;Convert from the data type to its representation (or back) "hello"^.generic.from generic"hello";Convert from the data type to its representation (or back) Traverse using GHC.Generics. ?allOf every (=="Hello") (1::Int,2::Double,(),"Hello",["Hello"])True7mapMOf_ every putStrLn ("hello",[(2 :: Int, "world!")])helloworld!  -$.-$/0012345667889::;<<=>>?@@AABCDEEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuv)!wxyz{|}~"                    #    ! " # $ % & ' ( ) ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > > ? @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z [ \]^_`abcdefghijklmnopqrstuvwxyz{rstu|}~    -----------------$%-$&--           ---   ----$  -----           lens-1.6Control.Lens.TraversalControl.Lens.InternalControl.Lens.SetterControl.Lens.TypeControl.Lens.GetterControl.Lens.FoldControl.Lens.Indexed Data.Set.Lens Data.Map.LensLanguage.Haskell.TH.LensControl.Lens.IsoControl.Lens.RepresentableControl.Lens.THControl.Exception.LensData.Bits.LensData.Complex.LensData.Dynamic.LensData.Either.LensData.List.LensData.Pair.LensData.IntMap.LensData.IntSet.LensData.Sequence.LensData.Tree.LensData.Array.LensData.ByteString.LensData.ByteString.Lazy.LensData.Text.LensData.Text.Lazy.Lens Control.Parallel.Strategies.LensControl.Seq.LensGHC.Generics.LensLens TraversalIsoData.Traversable mapAccumR mapAccumL Data.List transposeSimpleData.Distributive distribute Control.Lensbase Traversabletraverse ElementOf getElementOfElementOfResultNotFoundFound SearchingMaxNoMaxMinNoMin Sequenced getSequenced Traversed getTraversed AppliedStaterunAppliedState IndexedStoreFocusing unfocusinggetMingetMaxMutator runMutatorSettablerun SimpleSetting SimpleSetterSettingSettermappedsetsadjustmapOfset%~.~<.~+~*~-~//~^~^^~**~||~&&~<>~.=%=+=-=*=//=^=^^=**=&&=||=<>=<~<.=whisperSimpleOverloaded OverloadedFocusfocusfocus_setFocusLensLikeSimpleLensLike SimpleLenslens%%~%%=_1_2resultAtmerged bothLensesclone<%~<+~<-~<*~~<%=<+=<-=<*==Accessor runAccessorGettablecoerceGettingGettertoviewviews^$^.queryqueriesuseusesFurledfurledunfurledFoldfoldsfoldingfoldedrepeated replicatedcycledunfoldediteratedfiltered backwards takingWhile droppingWhile foldMapOffoldOffoldrOffoldlOftoListOfandOforOfanyOfallOf productOfsumOf traverseOf_forOf_ sequenceAOf_mapMOf_forMOf_ sequenceOf_asumOfmsumOfelemOf notElemOf concatMapOfconcatOflengthOfheadOflastOfnullOf maximumOf minimumOf maximumByOf minimumByOffindOffoldr1Offoldl1OffoldrOf'foldlOf'foldrMOffoldlMOfSimpleIndexedSetter IndexedSetterSimpleIndexedTraversalIndexedTraversalIndexedFolding IndexedFoldIndex withIndex IndexableIndexedindexreindex.@icompose ifoldMapOfifoldrOfifoldlOfianyOfiallOf itraverseOf_iforOf_imapMOf_iforMOf_ iconcatMapOf ifoldrOf' ifoldlOf' ifoldrMOf ifoldlMOf itraverseOfiforOfimapMOfiforMOf imapAccumROf imapAccumLOfimapOf%@contains setmappedsetOfSimpleTraversal traverseOfforOf sequenceAOfmapMOfforMOf sequenceOf transposeOf mapAccumROf mapAccumLOfscanr1Ofscanl1Of elementOfelementtraverseNothingat traverseMap traverseAt traverseAtMin traverseAtMax SubstType substType HasTypeVars typeVarsExHasNamenametypeVars substTypeVars SimpleIso Isomorphism Isomorphic isomorphicisomapfromviaisosisoidentity_constPathwalk RepresentablerepRepfmapReppureRepapRepbindRep distributeReppaths tabulated mapWithReptraverseWithReptraverseWithRep_ forWithRep mapMWithRep mapMWithRep_ forMWithRepfoldMapWithRep foldrWithRep LensRulesLensFlag ClassRequiredCreateInstance CreateClassSingletonRequiredHandleSingletons SingletonIsoSingletonAndField SimpleLenses simpleLenseshandleSingletons singletonIsosingletonRequired createClasscreateInstance classRequiredlensIso lensField lensClass lensFlags defaultRulesmakeLensesWith makeLensesmakeIsoisoRules makeClassy classyRules makeLensesFor lensRules makeClassyFortraverseException|~&~&=|=bitAt traverseBitsreal imaginarypolarizetraverseComplextraverseDynamic traverseLeft traverseRight_head_tail_last_init interspersed intercalated traverseList traverseHead traverseTail traverseLast traverseInitbothvaluetraverseIntMapmembersviewLviewR traverseTo traverseFrom traverseSlicerootchildrenixixmapped traverseArray packedBytesbytes packedCharscharspackedtextevalOfparOfafter meanwhileseqOf GTraversalgenericgeneric1every Control.MonadmapM_GHC.BaseFunctor$fApplicativeElementOf$fFunctorElementOf$fFunctorElementOfResult $fMonoidMax $fMonoidMin$fMonoidSequenced$fMonoidTraversed$fApplicativeAppliedState$fFunctorAppliedState$fFunctorIndexedStore$fApplicativeFocusing$fFunctorFocusingtransformers-0.3.0.0Data.Functor.IdentityIdentityghc-prim GHC.Classes|| GHC.TypesBool&& Data.Monoidmappend mtl-2.1.2Control.Monad.Writer.Class MonadWritermempty$fSettableMutator$fApplicativeMutator$fFunctorMutator$fSettableCompose$fSettableBackwards$fSettableIdentityControl.Applicative ApplicativeGHC.RealIntegral$fFocusReaderT $fFocusStateT$fFocusStateT0ConstMonadMonoid$fApplicativeAccessor$fGettableAccessor$fFunctorAccessor$fGettableElementOf$fGettableCompose$fGettableBackwards$fGettableConst Data.FoldableFoldablefoldMapGHC.Listhead Data.MaybeJustlastTrueFalsenullNothing$fFurledDualBackwards$fFurledrAccessor$fIndexediIndex$fIndexedi(->)containers-0.4.2.1Data.SetSetscanr1scanl1Data.MapMaptemplate-haskellLanguage.Haskell.TH.SyntaxnewNameName$fSubstTypePred $fSubstType[]$fSubstTypeType$fHasTypeVars[]$fHasTypeVarsPred$fHasTypeVarsType$fHasTypeVarsName$fHasTypeVarsTyVarBndr $fHasNameCon $fHasNameName$fHasNameTyVarBndrControl.Category.idCategory$fIsomorphicIsomorphism$fCategoryIsomorphism$fIsomorphic(->)fmappurereturnmapM$fRepresentable(->)$fRepresentableIdentity GHC.Exception Exception SomeException Data.Bits.|..&. Data.DynamicDynamic Data.IntMapIntMap Data.IntSetIntSet Data.SequenceSeqViewLViewR Data.TreeTreebytestring-0.9.2.1Data.ByteString.Internal ByteStringData.ByteString.Lazy.Internal text-0.11.2.2Data.Text.InternalTextData.Text.Lazy.Internalparallel-3.2.0.3Control.Parallel.StrategiesStrategy$fGTraversal:.:$fGTraversalM1$fGTraversal:+:$fGTraversal:*:$fGTraversalU1$fGTraversalK1