h$~      !"#$%&'()*+,-./ 0 1 2 3 4 5 678 9 : ; < = >?@ A B C D E F G H I J K L M N O P QRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~                                                                                                                                                                                                                                                                                                                                                                                                                 ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! " " " " " " " " " " " " " " " " " " " " " " " " " " " " # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # ###############################$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$%%%%%%%%%%%%%%%%%%%%%%%%&&&&&&&&&&&''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''((()**+++++++,,,,,,,----------...........////////////////////////////////////00000000000000000000000000000000000000000000000000000011111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111122222333333333333333333333344444444444444444444444444444444444444445555555555555555666667788999999:::;;;;;;;;;;<<<<<<<<========>>>>>>>>>>>????????????????@ABBBBCCCCCCCCCCCCCCCCDDDEEEEEEEEEEEFGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGHHHHHIIIIIIIIIIIIIJJJJJJKKKKKKKKLLLLLLLLLLLLLLLLMMMMMMMMMMMMMMMMMMMMMMMMM/(C) 2012-2016 Edward Kmett, (C) 2017 Ryan Scott BSD-style (see the file LICENSE)Edward Kmett  experimental non-portable Safe-Inferred7N(C) 2012-2016 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett  experimental non-portable Safe-Inferred7 (C) 2012-2016 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett  experimental non-portable Trustworthy9P@lensThis class provides a generalized notion of list reversal extended to other containers.BlensThis is used internally by the  O code to provide efficient access to the two functions that make up an isomorphism.@ABCBC@A+(C) 2014-2016 Edward Kmett and Eric Mertens BSD-style (see the file LICENSE)Edward Kmett  provisional non-portable Safe-Inferred<QlensReturn the the subset of given ordinals within a given bound and in order of the first occurrence seen.Bound:  0 <= x < lordinalNub 3 [-1,2,1,4,2,3][2,1]Rlens\mathcal{O}(\min(m,n)). The R: function drops the given suffix from a list. It returns 4 if the list did not end with the suffix given, or ' the list after the suffix, if it does.stripSuffix "bar" "foobar" Just "foo"stripSuffix "foo" "foo"Just ""stripSuffix "bar" "barfoo"NothingstripSuffix "foo" "barfoobaz"NothingQlensstrict upper bound lensordinals lens)unique, in-bound ordinals, in order seen QRQRP Trustworthy<  /543210(C) 2012-2016 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett  experimental non-portable Safe-Inferred '(>DnSlensThis is an illegal 7 used to replace the contents of a list of consecutive Y values representing each layer of a structure into the original shape that they were derived from.Attempting to Flow something back into a shape other than the one it was taken from will fail.VlensThis is an illegal  used to construct a single Y.YlensThis data type represents a path-compressed copy of one level of a source data structure. We can safely use path-compression because we know the depth of the tree.+Path compression is performed by viewing a Y as a PATRICIA trie of the paths into the structure to leaves at a given depth, similar in many ways to a QR, but unlike a regular PATRICIA trie we do not need to store the mask bits merely the depth of the fork.5One invariant of this structure is that underneath a Z node you will not find any \ nodes, so \ can only occur at the root.]lensGenerate the leaf of a given V4 based on whether or not we're at the correct depth.dlensThis is an illegal .flensThis is an illegal . STUVWXY[Z\] Y[Z\VWX]STU(C) 2012-2016 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett  experimental non-portable Trustworthy>?QG mlens composition of ST  with a  , used by U.plens composition of ST  with a  , used by V.slensA function with access to a index. This constructor may be useful when you need to store an v in a container to avoid ImpredicativeTypes. %index :: Indexed i a b -> i -> a -> bvlensThis class permits overloading of function application for things that also admit a notion of a key or index.wlensBuild a function from an w function.xlens This is a / that is both  by f and  by g such that f is left adjoint to g. From this you can derive a lot of structure due to the preservation of limits and colimits.ylensx- is strong enough to let us distribute every x / over every Haskell +. This is effectively a generalization of .zlensThis permits us to make a decision at an outermost point about whether or not we use an index.Ideally any use of this function should be done in such a way so that you compute the same answer, but this cannot be enforced at the type level.{lens Transform a W into an X or a  Y into an  Z, etc. { :: W s t a b -> X  s t a b { :: [ s t a b -> X  s t a b { :: \ s t a b -> ]  s t a b { :: O s t a b -> ]  s t a b { :: Y s a -> Z  s a { :: ^ s a -> _  s a { :: v  p => ` (p f) s t a b -> a p f s t a b|lens Transform a W into an X or a  Y into an  Z, etc.This combinator is like {> except that it handles large traversals and folds gracefully. | :: W s t a b -> X  s t a b | :: [ s t a b -> X  s t a b | :: \ s t a b -> ]  s t a b | :: O s t a b -> ]  s t a b | :: Y s a -> Z  s a | :: ^ s a -> _  s a | :: v  p => ` (m f) s t a b -> a p f s t a b}lensFold a container with indices returning both the indices and the values.)The result is only valid to compose in a  Traversal, if you don't edit the index as edits to the index have no effect.$[10, 20, 30] ^.. ifolded . withIndex[(0,10),(1,20),(2,30)][10, 20, 30] ^.. ifolded . withIndex . alongside negated (re _Show)[(0,"10"),(-1,"20"),(-2,"30")]~lensWhen composed with an  IndexedFold or IndexedTraversal this yields an (s) Fold of the indices.lens"cat" ^@.. (folded <> folded)1[(0,'c'),(1,'a'),(2,'t'),(0,'c'),(1,'a'),(2,'t')]&"cat" ^@.. indexing (folded <> folded)1[(0,'c'),(1,'a'),(2,'t'),(3,'c'),(4,'a'),(5,'t')]mnopqrstuvwxyz{|}~stuxyzvwpqr{mno|}~(C) 2012-2016 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett  provisional non-portable Safe-Inferred2>RSlensThe  equivalent for a   . (C) 2012-2016 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett  experimental non-portable Safe-Inferred?Vlens Used for  b.lens Used for  c.lensUsed internally by d and the like. The argument a" of the result should not be used!See 4.16 Changelog entry for the explanation of "why not Apply f =>"?lensUsed internally by  e and the like.lensUsed internally by f and the like. The argument a" of the result should not be used!lensA  for a  .lens Extract the  element. This will fairly eagerly determine that it can return ( the moment it sees any element at all.lens Extract the  element. This will fairly eagerly determine that it can return ( the moment it sees any element at all.=<;:=<;:(C) 2012-2016 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett  experimental non-portable Safe-Inferred>?alens type  p g a s =  p g a a slensThis is a generalized form of  that can be repeatedly cloned with less impact on its performance, and which permits the use of an arbitrary x /.The extra phantom " is used to let us lie and claim ^-compatibility under limited circumstances. This is used internally to permit a number of combinators to gracefully degrade when applied to a  Y or ^.lens type  p a s =  p a a slensThis is a generalized form of  that can be repeatedly cloned with less impact on its performance, and which permits the use of an arbitrary x /lens type  a s =  a a slens0The indexed store can be used to characterize a \ and is used by g. a b t is isomorphic to newtype  a b t =  { runContext :: forall f.  f => (a -> f b) -> f t } , and to exists s. (s, \ s t a b).A  is like a \3 that has already been applied to a some structure.lens'This is used internally to construct a h,  or  from a singleton value.lensThis is an indexed analogue to # for when you are working with an .lensThis is the generalization of  to an indexed comonad store.lensThis is the generalization of  to an indexed comonad store.lensThis is the generalization of  to an indexed comonad store.lensThis is the generalization of  to an indexed comonad store.lensThis is the generalization of  to an indexed comonad store.lensThis is the generalization of  to an indexed comonad store.lens2We can always forget the rest of the structure of w: and obtain a simpler indexed comonad store model called .lens6This is a Bob Atkey -style 2-argument indexed comonad.It exists as a superclass for ( and expresses the functoriality of an  in its third argument.The notion of indexed monads is covered in more depth in Bob Atkey's "Parameterized Notions of Computation"  'http://bentnib.org/paramnotions-jfp.pdf) and that construction is dualized here.lens?extract from an indexed comonadic value when the indices match.lens9duplicate an indexed comonadic value splitting the index.lens;extend a indexed comonadic computation splitting the index.lens6This is a Bob Atkey -style 2-argument indexed functor.It exists as a superclass for ( and expresses the functoriality of an  in its third argument.(C) 2012-2016 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett  experimental non-portable Safe-Inferred>l lensThis alias is helpful when it comes to reducing repetition in type signatures. type  p g a t =  p g a a t lens is like ), except that it provides a questionable  instance To protect this instance it relies on the soundness of another  type, and usage conventions.For example. This lets us write a suitably polymorphic and lazy i", but there must be a better way!lensThis alias is helpful when it comes to reducing repetition in type signatures. type  p a t =  p a a t lensThis is used to characterize a W.a.k.a. indexed Cartesian store comonad, indexed Kleene store comonad, or an indexed FunList. *http://twanvl.nl/blog/haskell/non-regular1A  is like a W1 that has already been applied to some structure.Where a  a b t holds an a and a function from b to t, a  a b t holds N as and a function from N bs to t , (where N might be infinite).Mnemonically, a / holds many stores and you can easily add more.This is a final encoding of .lensThis alias is helpful when it comes to reducing repetition in type signatures. type  p g a t =  p g a a t lens is like ), except that it provides a questionable  instance To protect this instance it relies on the soundness of another  type, and usage conventions.For example. This lets us write a suitably polymorphic and lazy i", but there must be a better way!lensThis alias is helpful when it comes to reducing repetition in type signatures. type  p a t =  p a a t lensThis is used to characterize a W.a.k.a. indexed Cartesian store comonad, indexed Kleene store comonad, or an indexed FunList. *http://twanvl.nl/blog/haskell/non-regular1A  is like a W1 that has already been applied to some structure.Where a  a b t holds an a and a function from b to t, a  a b t holds N as and a function from N bs to t , (where N might be infinite).Mnemonically, a / holds many stores and you can easily add more.This is a final encoding of .lens&This class is used to run the various  variants used in this library.(C) 2012-2016 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett  experimental non-portable Safe-Inferred'(>q\lensThis is used to generate an indexed magma from an unindexed sourceBy constructing it this way we avoid infinite reassociations where possible.In  p g a b t, g has a nominal+ role to avoid exposing an illegal _|_ via 3, while the remaining arguments are degraded to a nominal role by the invariants of lensThis is used to generate an indexed magma from an unindexed sourceBy constructing it this way we avoid infinite reassociations in sums where possible.lens;This is a a non-reassociating initially encoded version of .lens experimental non-portable Safe-Inferredrlens type  a s t =  a a s tlens$This type is used internally by the  [9 code to provide efficient access to the two parts of a Prism. Safe-Inferreds(C) 2012-2016 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett  provisional non-portable Safe-Inferred >?tlensThis class is provided mostly for backwards compatibility with lens 3.8, but it can also shorten type signatures.lens2This is a profunctor used internally to implement Review#It plays a role similar to that of j or Const do for Control.Lens.Getter(C) 2012-2016 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett  provisional non-portable TrustworthyvDlens Anything  must be isomorphic to the   .lens klensSo you can pass our l, into combinators from other lens libraries.(C) 2012-2016 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett  experimental non-portable Trustworthy?y lensWrap a monadic effect with a phantom type argument. Used when magnifying mn.lens3Wrap a monadic effect with a phantom type argument.lensUsed by %o to %p into qrlensMake a  out of  for result collection.lensUsed by %o to %p into st.lensMake a  out of  for error handling.lensUsed by %o to %p into st.lensMake a  out of  for error handling.lensUsed by %o to %p into uv or wx.lensUsed by %o to %p into yz.lensUsed by %o to %p into mn.lensUsed by %o to %p into {|.$$}(C) 2012-16 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett  experimental Rank2Types Safe-Inferred{=<;:@ABCSTUVWXY\[Z]mnopqrstuvwxyz{|}~(C) 2012-16 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett  provisional Rank2Types Trustworthy'(./>?.lensThis is a convenient alias for use when you need to consume either indexed or non-indexed lens-likes based on context. type  p f =  ( p f) lensThis is a convenient alias for use when you need to consume either indexed or non-indexed lens-likes based on context.lensConvenient alias for constructing simple indexed lenses and their ilk.lens?Convenient alias for constructing indexed lenses and their ilk.lens type  f =  ( f) lensMany combinators that accept a  can also accept a  in limited situations.'They do so by specializing the type of " that they require of the caller.If a function accepts a  f s t a b for some  f, then they may be passed a . Further, if f is an , they may also be passed a .lens type  p q f s a =  ( p q f) s a lens type  f s t a b =  (->) (->) f s t a b  type  p f s t a b =  p (->) f s t a b type  p f s t a b =  p p f s t a b lens type  p f s a =  ( p f) s a lensA valid  l should satisfy the laws: l  D  l ( Procompose f g) =  Procompose (l f) (l g)  This gives rise to the laws for , , , , , , , , , and 5 as well along with their index-preserving variants. type  f s t a b =  (->) f s t a b lensA  ,   , ... can be used instead of a ,, ... whenever the type variables don't change upon setting a value. ;~ ::   ( a) a  ::  ( ) [a] a .Note: To use this alias in your own code with  f or , you may have to turn on LiberalTypeSynonyms.2This is commonly abbreviated as a "prime" marker, e.g.  =  .lensA relevant Fold (aka ) has one or more targets.lensAn  can be used as a , but when composed with an , , or  yields an  respectively.lensEvery  is a valid  Y and can be used for .lensA  describes how to retrieve multiple values in a way that can be composed with other  constructions.A  s a 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 a), then there should be a fooOf method that takes a  s a and a value of type s.A  is a legal  that just ignores the supplied . Unlike a W a  is read-only. Since a , cannot be used to write back there are no  laws that apply.lensAn  can be used as a , but when composed with an , , or  yields an ,  or  respectively.lensEvery  is a valid  Z and can be used for  like a .lensA  describes how to retrieve a single value in a way that can be composed with other  constructions. Unlike a  a  is read-only. Since a , cannot be used to write back there are no  laws that can be applied to it. In fact, it is isomorphic to an arbitrary function from (s -> a). Moreover, a  can be used directly as a  Y, since it just ignores the .lens Composable 0. Useful for constraining excess polymorphism, foo . (id :: As Int) . bar.lensA  .lensA witness that (a ~ s, b ~ t).Note: Composition with an  is index-preserving.lensA  .lensA  l is a & that can also be turned around with  to obtain a  in the opposite direction.There are three laws that a  should satisfy: First, if I  or  a value with a  and then   or use ( ), I will get it back:   l ( l b) D  b #Second, if you can extract a value a using a  l from a value s, then the value s is completely described by l and a:   l s D  a O  l a D s Third, if you get non-match t$, you can convert it result back to s:  l s D  t O  l t D  s "The first two laws imply that the  laws hold for every  and that we  at most 1 element:   l x  1 #It may help to think of this as an & that can be partial in one direction.Every  is a valid .Every  is a valid .For example, you might have a   ! allows you to always go from a  to an ,, and provide you with tools to check if an  is a  and/or to edit one if it is. nat ::    nat =     \ i -> if i  0 then  i else  ( i) Now we can ask if an  is a .5^?natJust 5 (-5)^?natNothing We can update the ones that are:(-3,4) & both.nat *~ 2(-3,8)And we can then convert from a  to an .5 ^. re nat -- :: Natural5Similarly we can use a  to  the  half of an :Left "hello" & _Left %~ lengthLeft 5or to construct an : 5^.re _LeftLeft 5#such that if you query it with the (, you will get your original input back.5^.re _Left ^? _LeftJust 5&Another interesting way to think of a ! is as the categorical dual of a  -- a co-8, so to speak. This is what permits the construction of  .Note: Composition with a  is index-preserving.lensIf you see this in a signature for a function, the function is expecting a % (in practice, this usually means a ).lensThis is a limited form of a  that can only be used for re operations. Like with a #, there are no laws to state for a .You can generate a  by using unto. You can also use any  or  directly as a .lens type  =   lens2Isomorphism families can be composed with another  using () and . Since every  is both a valid  and a valid <, the laws for those types imply the following laws for an  f: f    f D    f  f D  Note: Composition with an # is index- and measure- preserving.lens type IndexedPreservingSetter' i =  IndexedPreservingSetter lensAn  can be composed with a ,  or + and leaves the index intact, yielding an .lens type  i =  ( i) lensEvery  is a valid .The ! laws are still required to hold.lensA  is just a  that doesn't change the types.These are particularly common when talking about monomorphic containers. e.g. sets Data.Text.map ::    type  =   lens The only  law that can apply to a  l is that  l y ( l x a) D  l y a  You can't  a 2 in general, so the other two laws are irrelevant. However, two  laws apply to a :  l  D   l f   l g D  l (f  g) "These can be stated more directly: l  D  l f    l g D l (f    g) You can compose a  with a  or a  using ( ) from the Prelude" and the result is always only a  and nothing more.over traverse f [a,b,c,d][f a,f b,f c,f d]over _1 f (a,b)(f a,b)"over (traverse._1) f [(a,b),(c,d)][(f a,b),(f c,d)]over both f (a,b) (f a,f b)$over (traverse.both) f [(a,b),(c,d)][(f a,f b),(f c,f d)]lens type  =   lensAn , leaves any index it is composed with alone.lens type  i =  ( i) lensEvery  is a valid W or  Z.The s constraint is used to allow an  to be used directly as a W.The W! laws are still required to hold.In addition, the index i should satisfy the requirement that it stays unchanged even when modifying the value a, otherwise traversals like indices break the  laws.lensA $ which targets at least one element.Note that since  is not a superclass of , a & cannot always be used in place of a . In such circumstances  will convert a  into a .lens type  =   lensA  can be used directly as a l or a  (but not as a ) and provides the ability to both read and update multiple fields, subject to some relatively weak  laws.These have also been known as multilenses, but they have the signature and spirit of  ::  f =>  (f a) (f b) a b 7and 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  or  as a , and composition of a  (or  or  ) with a  (or  or  ) using () forms a valid .The laws for a  t follow from the laws for 4 as stated in "The Essence of the Iterator Pattern". t  D   (t f)  t g D   t (   f  g) .One consequence of this requirement is that a  needs to leave the same number of elements as a candidate for subsequent  that it started with. Another testament to the strength of these laws is that the caveat expressed in section 5.5 of the "Essence of the Iterator Pattern" about exotic  instances that  the same entry multiple times was actually already ruled out by the second law in that same paper!lens type  =   lensAn , leaves any index it is composed with alone.lens type  i =  ( i) lensEvery  is a valid  and a valid X.lens type  =   lensA , is actually a lens family as described in  /http://comonad.com/reader/2012/mirrored-lenses/.2With great power comes great responsibility and a ' is subject to the three common sense  laws: 1) You get back what you put in:  l ( l v s) D v 52) Putting back what you got doesn't change anything:  l ( l s) s D s -3) Setting twice is the same as setting once:  l v' ( l v s) D  l v' s =These laws are strong enough that the 4 type parameters of a  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/.1There are some emergent properties of these laws:1)  l s must be injective for every s This is a consequence of law #12)  l must be surjective, because of law #2, which indicates that it is possible to obtain any v from some s such that  s v = s3) Given just the first two laws you can prove a weaker form of law #3 where the values v that you are setting match:  l v ( l v s) D  l v s Every  can be used directly as a l or .You can also use a  for  as if it were a  or . Since every  is a valid , the  laws are required of any  you create: l  D   (l f)  l g D   l (   f  g) type  s t a b = forall f.  f =>  f s t a b 55(C) 2012-16 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett  provisional Rank2Types Trustworthy>?"|lensThis is a convenient alias when defining highly polymorphic code that takes both  and  as appropriate. If a function takes this it is expecting one of those two things based on context.lensThis is a convenient alias when defining highly polymorphic code that takes both  and  as appropriate. If a function takes this it is expecting one of those two things based on context.lens type  i =  ( i) lens Running an $ instantiates it to a concrete type.When consuming a setter directly to perform a mapping, you can use this type, but most user code will not need to use this type.lens0This is a useful alias for use when consuming a .0Most user code will never have to use this type. type  =   lens Running a $ instantiates it to a concrete type.When consuming a setter directly to perform a mapping, you can use this type, but most user code will not need to use this type.lensThis 0 can be used to map over all of the values in a .  D    D   () D   over mapped f [a,b,c] [f a,f b,f c]over mapped (+1) [1,2,3][2,3,4]set mapped x [a,b,c][x,x,x] [[a,b],[c]] & mapped.mapped +~ x[[a + x,b + x],[c + x]]=over (mapped._2) length [("hello","world"),("leaders","!!!")][("hello",5),("leaders",3)]  ::  f =>  (f a) (f b) a b If you want an  use  .lensThis setter. can be used to modify all of the values in a .+You sometimes have to use this rather than  -- due to temporary insanity  was not a superclass of  until GHC 7.10.  D   over lifted f [a,b,c] [f a,f b,f c]set lifted b (Just a)Just bIf you want an  use  .lensThis 0 can be used to map over all of the inputs to a .  D   8getPredicate (over contramapped (*2) (Predicate even)) 5True,getOp (over contramapped (*5) (Op show)) 100"500"Prelude.map ($ 1) $ over (mapped . _Unwrapping' Op . contramapped) (*12) [(*2),(+1),(^3)] [24,13,1728]lensThis ( can be used to map over the input of a /.The most common / to use this with is (->).(argument %~ f) g xg (f x)!(argument %~ show) length [1,2,3]7(argument %~ f) h x y h (f x) yMap over the argument of the result of a function -- i.e., its second argument:(mapped.argument %~ f) h x y h x (f y)  ::  (b -> r) (a -> r) a b lensBuild an index-preserving  from a map-like function.Your supplied function f is required to satisfy: f  D  f g  f h D f (g  h) Equational reasoning:    D     D  Another way to view  is that it takes a "semantic editor combinator" and transforms it into a .  :: ((a -> b) -> s -> t) ->  s t a b lensBuild a ,  or  depending on your choice of /.  :: ((a -> b) -> s -> t) ->  s t a b lensRestore  to a full .lens Build an  from any .lens Clone an .lensModify the target of a  or all the targets of a  or  with a function.  D    D      D     D  Given any valid  l, you can also rely on the law:  l f   l g =  l (f  g) e.g.over mapped f (over mapped g [a,b,c]) == over mapped (f . g) [a,b,c]TrueAnother way to view  is to say that it transforms a & into a "semantic editor combinator".over mapped f (Just a) Just (f a)over mapped (*10) [1,2,3] [10,20,30]over _1 f (a,b)(f a,b)over _1 show (10,20) ("10",20)  ::  s t a b -> (a -> b) -> s -> t  ::  s t a b -> (a -> b) -> s -> t lensReplace the target of a  or all of the targets of a  or  with a constant value. () D   set _2 "hello" (1,()) (1,"hello")set mapped () [1,2,3,4] [(),(),(),()]Note: Attempting to  a  or  will fail at compile time with an relatively nice error message.  ::  s t a b -> b -> s -> t  ::  s t a b -> b -> s -> t  ::  s t a b -> b -> s -> t  ::  s t a b -> b -> s -> t lensReplace the target of a  or all of the targets of a  or 2 with a constant value, without changing its type.%This is a type restricted version of ), which retains the type of the original.set' mapped x [a,b,c,d] [x,x,x,x]set' _2 "hello" (1,"world") (1,"hello")set' mapped 0 [1,2,3,4] [0,0,0,0]Note: Attempting to adjust  a  or  will fail at compile time with an relatively nice error message.  ::  s a -> a -> s -> s  ::  s a -> a -> s -> s  ::  s a -> a -> s -> s  ::  s a -> a -> s -> s lensModifies the target of a  or all of the targets of a  or  with a user supplied function.This is an infix version of .  f D   f  f D   f (a,b,c) & _3 %~ f (a,b,f c)(a,b) & both %~ f (f a,f b)_2 %~ length $ (1,"hello")(1,5)traverse %~ f $ [a,b,c] [f a,f b,f c]traverse %~ even $ [1,2,3][False,True,False]9traverse.traverse %~ length $ [["hello","world"],["!!!"]] [[5,5],[3]] () :: # s t a b -> (a -> b) -> s -> t () :: & s t a b -> (a -> b) -> s -> t () :: % s t a b -> (a -> b) -> s -> t () ::  s t a b -> (a -> b) -> s -> t lensReplace 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 D   f  a (a,b,c,d) & _4 .~ e (a,b,c,e)(42,"world") & _1 .~ "hello"("hello","world")(a,b) & both .~ c(c,c) () ::  s t a b -> b -> s -> t () ::  s t a b -> b -> s -> t () ::  s t a b -> b -> s -> t () ::  s t a b -> b -> s -> t lensSet the target of a ,  or  to  a value. l  t D  l ( t) Nothing & id ?~ aJust aMap.empty & at 3 ?~ xfromList [(3,x)] can be used type-changily:"('a', ('b', 'c')) & _2.both ?~ 'x'('a',(Just 'x',Just 'x')) () ::  s t a ( b) -> b -> s -> t () ::  s t a ( b) -> b -> s -> t () ::  s t a ( b) -> b -> s -> t () ::  s t a ( b) -> b -> s -> t lensSet with pass-through.This is mostly present for consistency, but may be useful for chaining assignments.If you do not need a copy of the intermediate result, then using l  t directly is a good idea.(a,b) & _1 <.~ c (c,(c,b))-("good","morning","vietnam") & _3 <.~ "world"$("world",("good","morning","world"))(42,Map.fromList [("goodnight","gracie")]) & _2.at "hello" <.~ Just "world"(Just "world",(42,fromList [("goodnight","gracie"),("hello","world")])) () :: ! s t a b -> b -> s -> (b, t) () :: $ s t a b -> b -> s -> (b, t) () :: # s t a b -> b -> s -> (b, t) () ::  s t a b -> b -> s -> (b, t) lensSet to  a value with pass-through.This is mostly present for consistency, but may be useful for for chaining assignments.If you do not need a copy of the intermediate result, then using l  d directly is a good idea. import qualified Data.Map as Map_2.at "hello" b -> s -> (b, t) () ::  s t a ( b) -> b -> s -> (b, t) () ::  s t a ( b) -> b -> s -> (b, t) () ::  s t a ( b) -> b -> s -> (b, t) lens0Increment the target(s) of a numerically valued ,  or .(a,b) & _1 +~ c (a + c,b)(a,b) & both +~ c (a + c,b + c)(1,2) & _2 +~ 1(1,3)"[(a,b),(c,d)] & traverse.both +~ e[(a + e,b + e),(c + e,d + e)] () ::  a =>  s a -> a -> s -> s () ::  a =>  s a -> a -> s -> s () ::  a =>  s a -> a -> s -> s () ::  a =>  s a -> a -> s -> s lens/Multiply the target(s) of a numerically valued , ,  or .(a,b) & _1 *~ c (a * c,b)(a,b) & both *~ c (a * c,b * c)(1,2) & _2 *~ 4(1,8)Just 24 & mapped *~ 2Just 48 () ::  a =>  s a -> a -> s -> s () ::  a =>  s a -> a -> s -> s () ::  a =>  s a -> a -> s -> s () ::  a =>  s a -> a -> s -> s lens0Decrement the target(s) of a numerically valued , ,  or .(a,b) & _1 -~ c (a - c,b)(a,b) & both -~ c (a - c,b - c)_1 -~ 2 $ (1,2)(-1,2)"mapped.mapped -~ 1 $ [[4,5],[6,7]] [[3,4],[5,6]] () ::  a =>  s a -> a -> s -> s () ::  a =>  s a -> a -> s -> s () ::  a =>  s a -> a -> s -> s () ::  a =>  s a -> a -> s -> s lens-Divide the target(s) of a numerically valued , ,  or .(a,b) & _1 //~ c (a / c,b)(a,b) & both //~ c (a / c,b / c)("Hawaii",10) & _2 //~ 2("Hawaii",5.0) () ::  a =>  s a -> a -> s -> s () ::  a =>  s a -> a -> s -> s () ::  a =>  s a -> a -> s -> s () ::  a =>  s a -> a -> s -> s lens,Raise the target(s) of a numerically valued ,  or " to a non-negative integral power.(1,3) & _2 ^~ 2(1,9) () :: ( a,  e) =>  s a -> e -> s -> s () :: ( a,  e) =>  s a -> e -> s -> s () :: ( a,  e) =>  s a -> e -> s -> s () :: ( a,  e) =>  s a -> e -> s -> s lens-Raise the target(s) of a fractionally valued ,  or  to an integral power.(1,2) & _2 ^^~ (-1)(1,0.5) () :: ( a,  e) =>  s a -> e -> s -> s () :: ( a,  e) =>  s a -> e -> s -> s () :: ( a,  e) =>  s a -> e -> s -> s () :: ( a,  e) =>  s a -> e -> s -> s lens/Raise the target(s) of a floating-point valued ,  or  to an arbitrary power.(a,b) & _1 **~ c(a**c,b)(a,b) & both **~ c (a**c,b**c)_2 **~ 10 $ (3,2) (3,1024.0) () ::  a =>  s a -> a -> s -> s () ::  a =>  s a -> a -> s -> s () ::  a =>  s a -> a -> s -> s () ::  a =>  s a -> a -> s -> s lens Logically  the target(s) of a -valued  or .both ||~ True $ (False,True) (True,True)both ||~ False $ (False,True) (False,True) () ::  s  ->  -> s -> s () ::  s  ->  -> s -> s () ::  s  ->  -> s -> s () ::  s  ->  -> s -> s lens Logically  the target(s) of a -valued  or .both &&~ True $ (False, True) (False,True)both &&~ False $ (False, True) (False,False) () ::  s  ->  -> s -> s () ::  s  ->  -> s -> s () ::  s  ->  -> s -> s () ::  s  ->  -> s -> s lensReplace the target of a  or all of the targets of a  or  in our monadic state with a new value, irrespective of the old.This is an alias for ().-execState (do assign _1 c; assign _2 d) (a,b)(c,d)execState (both .= c) (a,b)(c,c)  ::  s m =>  s a -> a -> m ()  ::  s m =>  s a -> a -> m ()  ::  s m =>  s a -> a -> m ()  ::  s m =>  s a -> a -> m () lensReplace the target of a  or all of the targets of a  or  in our monadic state with a new value, irrespective of the old.This is an infix version of .%execState (do _1 .= c; _2 .= d) (a,b)(c,d)execState (both .= c) (a,b)(c,c) () ::  s m =>  s a -> a -> m () () ::  s m =>  s a -> a -> m () () ::  s m =>  s a -> a -> m () () ::  s m =>  s a -> a -> m () 9It puts the state in the monad or it gets the hose again.lensMap over the target of a  or all of the targets of a  or  in our monadic state.$execState (do _1 %= f;_2 %= g) (a,b) (f a,g b)execState (do both %= f) (a,b) (f a,f b) () ::  s m =>  s a -> (a -> a) -> m () () ::  s m =>  s a -> (a -> a) -> m () () ::  s m =>  s a -> (a -> a) -> m () () ::  s m =>  s a -> (a -> a) -> m () () ::  s m =>  s s a b -> (a -> b) -> m () lensThis is an alias for ().lensReplace the target of a  or all of the targets of a  or  in our monadic state with & a new value, irrespective of the old.-execState (do at 1 ?= a; at 2 ?= b) Map.emptyfromList [(1,a),(2,b)]1execState (do _1 ?= b; _2 ?= c) (Just a, Nothing)(Just b,Just c) () ::  s m =>  s ( a) -> a -> m () () ::  s m =>  s ( a) -> a -> m () () ::  s m =>  s ( a) -> a -> m () () ::  s m =>  s ( a) -> a -> m () lensModify the target(s) of a , ,  or  by adding a value.Example: fresh ::   m => m  fresh = do   1   %execState (do _1 += c; _2 += d) (a,b) (a + c,b + d)execState (do _1.at 1.non 0 += 10) (Map.fromList [(2,100)],"hello")#(fromList [(1,10),(2,100)],"hello") () :: ( s m,  a) =>  s a -> a -> m () () :: ( s m,  a) =>  s a -> a -> m () () :: ( s m,  a) =>  s a -> a -> m () () :: ( s m,  a) =>  s a -> a -> m () lensModify the target(s) of a , ,  or  by subtracting a value.%execState (do _1 -= c; _2 -= d) (a,b) (a - c,b - d) () :: ( s m,  a) =>  s a -> a -> m () () :: ( s m,  a) =>  s a -> a -> m () () :: ( s m,  a) =>  s a -> a -> m () () :: ( s m,  a) =>  s a -> a -> m () lensModify the target(s) of a , ,  or  by multiplying by value.%execState (do _1 *= c; _2 *= d) (a,b) (a * c,b * d) () :: ( s m,  a) =>  s a -> a -> m () () :: ( s m,  a) =>  s a -> a -> m () () :: ( s m,  a) =>  s a -> a -> m () () :: ( s m,  a) =>  s a -> a -> m () lensModify the target(s) of a , ,  or  by dividing by a value.'execState (do _1 //= c; _2 //= d) (a,b) (a / c,b / d) () :: ( s m,  a) =>  s a -> a -> m () () :: ( s m,  a) =>  s a -> a -> m () () :: ( s m,  a) =>  s a -> a -> m () () :: ( s m,  a) =>  s a -> a -> m () lens,Raise the target(s) of a numerically valued ,  or " to a non-negative integral power. () :: ( s m,  a,  e) =>  s a -> e -> m () () :: ( s m,  a,  e) =>  s a -> e -> m () () :: ( s m,  a,  e) =>  s a -> e -> m () () :: ( s m,  a,  e) =>  s a -> e -> m () lens,Raise the target(s) of a numerically valued ,  or  to an integral power. () :: ( s m,  a,  e) =>  s a -> e -> m () () :: ( s m,  a,  e) =>  s a -> e -> m () () :: ( s m,  a,  e) =>  s a -> e -> m () () :: ( s m,  a,  e) =>  s a -> e -> m () lens,Raise the target(s) of a numerically valued ,  or  to an arbitrary power'execState (do _1 **= c; _2 **= d) (a,b) (a**c,b**d) () :: ( s m,  a) =>  s a -> a -> m () () :: ( s m,  a) =>  s a -> a -> m () () :: ( s m,  a) =>  s a -> a -> m () () :: ( s m,  a) =>  s a -> a -> m () lensModify the target(s) of a , ,  or  by taking their logical  with a value.execState (do _1 &&= True; _2 &&= False; _3 &&= True; _4 &&= False) (True,True,False,False)(True,False,False,False) () ::  s m =>  s  ->  -> m () () ::  s m =>  s  ->  -> m () () ::  s m =>  s  ->  -> m () () ::  s m =>  s  ->  -> m () lensModify the target(s) of a , 'Iso,  or  by taking their logical  with a value.execState (do _1 ||= True; _2 ||= False; _3 ||= True; _4 ||= False) (True,True,False,False)(True,True,True,False) () ::  s m =>  s  ->  -> m () () ::  s m =>  s  ->  -> m () () ::  s m =>  s  ->  -> m () () ::  s m =>  s  ->  -> m () lens6Run a monadic action, and set all of the targets of a ,  or  to its result. () ::  s m =>  s s a b -> m b -> m () () ::  s m =>  s s a b -> m b -> m () () ::  s m =>  s s a b -> m b -> m () () ::  s m =>  s s a b -> m b -> m () As a reasonable mnemonic, this lets you store the result of a monadic action in a " 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 , , or .lensSet with pass-throughThis is useful for chaining assignment without round-tripping through your  stack. do x <-  ) ninety_nine_bottles_of_beer_on_the_wall If you do not need a copy of the intermediate result, then using l  d$ will avoid unused binding warnings. () ::  s m =>  s s a b -> b -> m b () ::  s m =>  s s a b -> b -> m b () ::  s m =>  s s a b -> b -> m b () ::  s m =>  s s a b -> b -> m b lensSet  a value with pass-throughThis is useful for chaining assignment without round-tripping through your  stack. do x <- 0 "foo" ) ninety_nine_bottles_of_beer_on_the_wall If you do not need a copy of the intermediate result, then using l  d$ will avoid unused binding warnings. () ::  s m =>  s s a ( b) -> b -> m b () ::  s m =>  s s a ( b) -> b -> m b () ::  s m =>  s s a ( b) -> b -> m b () ::  s m =>  s s a ( b) -> b -> m b lensModify the target of a  value by using ().(Sum a,b) & _1 <>~ Sum c(Sum {getSum = a + c},b)(Sum a,Sum b) & both <>~ Sum c+(Sum {getSum = a + c},Sum {getSum = b + c})"both <>~ "!!!" $ ("hello","world")("hello!!!","world!!!") () ::  a =>  s t a a -> a -> s -> t () ::  a =>  s t a a -> a -> s -> t () ::  a =>  s t a a -> a -> s -> t () ::  a =>  s t a a -> a -> s -> t lensModify the target(s) of a , ,  or  by using ().?execState (do _1 <>= Sum c; _2 <>= Product d) (Sum a,Product b)3(Sum {getSum = a + c},Product {getProduct = b * d}),execState (both <>= "!!!") ("hello","world")("hello!!!","world!!!") () :: ( s m,  a) =>  s a -> a -> m () () :: ( s m,  a) =>  s a -> a -> m () () :: ( s m,  a) =>  s a -> a -> m () () :: ( s m,  a) =>  s a -> a -> m () lens Write to a fragment of a larger Writer format.lensThis is a generalization of < that allows you to modify just a portion of the resulting .lensThis is a generalization of < that allows you to modify just a portion of the resulting ! with access to the index of an .lensThis is a generalization of  that allows you to " just a portion of the resulting .lensThis is a generalization of  that allows you to " just a portion of the resulting ", with access to the index of an .lensModify the value of the Reader. environment associated with the target of a , , or .  l  a D a  l f  locally l g D  l (f  g) %(1,1) & locally _1 (+1) (uncurry (+))3-"," & locally ($) ("Hello" <>) (<> " world!")"Hello, world!" locally :: MonadReader s m =>  s s a b -> (a -> b) -> m r -> m r locally :: MonadReader s m =>  s s a b -> (a -> b) -> m r -> m r locally :: MonadReader s m =>  s s a b -> (a -> b) -> m r -> m r locally :: MonadReader s m => & s s a b -> (a -> b) -> m r -> m r lensThis is a generalization of " that allows one to make indexed  changes to a Reader. environment associated with the target of a , , or .  l f D  l f . const  l f D  l f . s ilocally :: MonadReader s m =>  s s a b -> (i -> a -> b) -> m r -> m r ilocally :: MonadReader s m =>  s s a b -> (i -> a -> b) -> m r -> m r ilocally :: MonadReader s m => + s s a b -> (i -> a -> b) -> m r -> m r lens%Map with index. This is an alias for ./When you do not need access to the index, then ' is more liberal in what it can accept.  l D  l    l D  l  s  :: ) i s t a b -> (i -> a -> b) -> s -> t  :: + i s t a b -> (i -> a -> b) -> s -> t  :: & i s t a b -> (i -> a -> b) -> s -> t lensSet with index. Equivalent to  with the current value ignored./When you do not need access to the index, then ' is more liberal in what it can accept.  l D  l    :: $ i s t a b -> (i -> b) -> s -> t  :: & i s t a b -> (i -> b) -> s -> t  :: ! i s t a b -> (i -> b) -> s -> t lens Build an  from an -like function.Your supplied function f is required to satisfy: f  D  f g  f h D f (g  h) Equational reasoning:    D     D  Another way to view  is that it takes a "semantic editor combinator" which has been modified to carry an index and transforms it into a .lensAdjust every target of an ,  or  with access to the index. () D  /When you do not need access to the index then (() is more liberal in what it can accept. l  f D l   f () :: * i s t a b -> (i -> a -> b) -> s -> t () :: , i s t a b -> (i -> a -> b) -> s -> t () :: & i s t a b -> (i -> a -> b) -> s -> t lensReplace every target of an ,  or  with access to the index. () D  /When you do not need access to the index then (() is more liberal in what it can accept. l  b D l   b () :: % i s t a b -> (i -> b) -> s -> t () :: ' i s t a b -> (i -> b) -> s -> t () :: ! i s t a b -> (i -> b) -> s -> t lens/Adjust every target in the current state of an ,  or  with access to the index./When you do not need access to the index then (() is more liberal in what it can accept. l  f D l   f () ::  s m => ( i s s a b -> (i -> a -> b) -> m () () ::  s m => * i s s a b -> (i -> a -> b) -> m () () ::  s m => $ i s t a b -> (i -> a -> b) -> m () lensThis is an alias for ().lens0Replace every target in the current state of an ,  or  with access to the index./When you do not need access to the index then (() is more liberal in what it can accept. l  b D l   b () ::  s m => # i s s a b -> (i -> b) -> m () () ::  s m => % i s s a b -> (i -> b) -> m () () ::  s m =>  i s t a b -> (i -> b) -> m () lensRun an arrow command and use the output to set all the targets of a ,  or  to the result. can be used very similarly to (), except that the type of the object being modified can change; for example: runKleisli action ((), (), ()) where action = assignA _1 (Kleisli (const getVal1)) >>> assignA _2 (Kleisli (const getVal2)) >>> assignA _3 (Kleisli (const getVal3)) getVal1 :: Either String Int getVal1 = ... getVal2 :: Either String Bool getVal2 = ... getVal3 :: Either String Char getVal3 = ...  has the type   (, , )  ::  p => ! s t a b -> p s b -> p s t  ::  p =>  s t a b -> p s b -> p s t  ::  p =>  s t a b -> p s b -> p s t  ::  p =>  s t a b -> p s b -> p s t lens is a deprecated alias for .lens&Map with index. (Deprecated alias for )./When you do not need access to the index, then ' is more liberal in what it can accept.  l D  l    :: ) i s t a b -> (i -> a -> b) -> s -> t  :: + i s t a b -> (i -> a -> b) -> s -> t  :: & i s t a b -> (i -> a -> b) -> s -> t  #44444444444444444444444444244444444(C) 2012-16 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett  provisional Rank2Types Trustworthy'(./>?lens type  =  ( i) lens>When you see this as an argument to a function, it expects an lens type  =   lens=When you see this as an argument to a function, it expects a .4This type can also be used when you need to store a  in a container, since it is rank-1. You can turn them back into a  with ,, or use it directly with combinators like  and ().lensBuild a  from a getter and a setter.  :: : f => (s -> a) -> (s -> b -> t) -> (a -> f b) -> s -> f t s ^. lens getter settergetter ss & lens getter setter .~ b setter s bs & lens getter setter %~ fsetter s (f (getter s)) ! :: (s -> a) -> (s -> a -> s) ->  s a lens4Obtain a getter and a setter from a lens, reversing .lensBuild an index-preserving  from a ^ and a l.lens Build an  from a ^ and a l.lens0This can be used to chain lens operations using op= syntax rather than op~+ syntax for simple non-type-changing cases.(10,20) & _1 .~ 30 & _2 .~ 40(30,40) (10,20) &~ do _1 .= 30; _2 .= 40(30,40)0This does not support type-changing assignment, e.g.(10,20) & _1 .~ "hello" ("hello",20)lens(&) can be used in one of two scenarios:When applied to a  , it can edit the target of the 1 in a structure, extracting a functorial result.When applied to a , it can edit the targets of the traversals, extracting an applicative summary of its actions.5[66,97,116,109,97,110] & each %%~ \a -> ("na", chr a)("nananananana","Batman")7For all that the definition of this combinator is just: () D  It may be beneficial to think about it as if it had these even more restricted types, however: () ::  f =>  O* s t a b -> (a -> f b) -> s -> f t () ::  f => ) s t a b -> (a -> f b) -> s -> f t () ::  f => W# s t a b -> (a -> f b) -> s -> f t When applied to a , it can edit the targets of the traversals, extracting a supplemental monoidal summary of its actions, by choosing  f = ((,) m) () ::  O0 s t a b -> (a -> (r, b)) -> s -> (r, t) () :: / s t a b -> (a -> (r, b)) -> s -> (r, t) () ::  m => W) s t a b -> (a -> (m, b)) -> s -> (m, t) lensModify the target of a  in the current state returning some extra information of type r or modify all targets of a W= in the current state, extracting extra information of type r. and return a monoidal summary of the changes.(runState (_1 %%= \x -> (f x, g x)) (a,b) (f a,(g a,b)) () D ( ) It may be useful to think of (), instead, as having either of the following more restricted type signatures: () ::  s m =>  O( s s a b -> (a -> (r, b)) -> m r () ::  s m => ' s s a b -> (a -> (r, b)) -> m r () :: ( s m,  r) => W! s s a b -> (a -> (r, b)) -> m r lensThis is convenient to 2 argument order of composite functions defined as: fab ?? a = fmap ($ a) fab For the  instance  f = ((->) r)= you can reason about this function as if the definition was () D : (h ?? x) ah a xexecState ?? [] $ modify (1:)[1]%over _2 ?? ("hello","world") $ length ("hello",5)(over ?? length ?? ("hello","world") $ _2 ("hello",5)lensLift a  so it can run under a function (or other corepresentable profunctor).  ::  s t a b -> % (e -> s) (e -> t) (e -> a) (e -> b) "(\x -> (x-1,x+1)) ^. inside _1 $ 549runState (modify (1:) >> modify (2:)) ^. (inside _2) $ [][2,1]lens8Merge two lenses, getters, setters, folds or traversals.  D     :: ^ s a -> ^ s' a -> ^ ( s s') a  ::  Y s a ->  Y s' a ->  Y ( s s') a  ::  s a ->  s' a ->  ( s s') a  ::  s a ->  s' a ->  ( s s') a  ::  s a ->  s' a ->  ( s s') a lens This is a  that updates either side of an &, where both sides have the same type.  D    Left a^.chosenaRight a^.chosenaRight "hello"^.chosen"hello"Right a & chosen *~ b Right (a * b)  ::  ( a a) ( b b) a b  f ( a) =   f a  f ( a) =   f a lens makes a  from two other lenses or a  from two other getters by executing them on their respective halves of a product.*(Left a, Right b)^.alongside chosen chosen(a,b)4(Left a, Right b) & alongside chosen chosen .~ (c,d)(Left c,Right d)  ::  s t a b ->  s' t' a' b' ->  (s,s') (t,t') (a,a') (b,b')  ::  s a ->  s' a' ->  (s,s') (a,a') lensThis  lets you view the current pos# of any indexed store comonad and seek to a new position. This reduces the API for working these instances to a single .  w D w    s w D w    s  f w D w    f  ::  ( a s) a  :: x p =>  ( p a s) a  :: x p =>  ( p g a s) a lens Cloning a  is one way to make sure you aren't given something weaker, such as a W and can be used as a way to pass around lenses that have to be monomorphic in f.!Note: This only accepts a proper .let example l x = set (cloneLens l) (x^.cloneLens l + 1) x in example _2 ("hello",1,"you")("hello",2,"you")lensClone a  as an IndexedPreservingLens4 that just passes through whatever index is on any , ,  or  it is composed with.lens Clone an  as an  with the same index.lensModify the target of a  and return the result.3When you do not need the result of the operation, () is more flexible. () :: * s t a b -> (a -> b) -> s -> (b, t) () ::  O+ s t a b -> (a -> b) -> s -> (b, t) () ::  b => W$ s t a b -> (a -> b) -> s -> (b, t) lens-Increment the target of a numerically valued  and return the result.2When you do not need the result of the addition, () is more flexible. () ::  a =>  s a -> a -> s -> (a, s) () ::  a =>   s a -> a -> s -> (a, s) lens-Decrement the target of a numerically valued  and return the result.5When you do not need the result of the subtraction, () is more flexible. () ::  a =>  s a -> a -> s -> (a, s) () ::  a =>   s a -> a -> s -> (a, s) lens,Multiply the target of a numerically valued  and return the result.8When you do not need the result of the multiplication, () is more flexible. () ::  a =>  s a -> a -> s -> (a, s) () ::  a =>   s a -> a -> s -> (a, s) lens+Divide the target of a fractionally valued  and return the result.2When you do not need the result of the division, () is more flexible. () ::  a =>  s a -> a -> s -> (a, s) () ::  a =>   s a -> a -> s -> (a, s) lens)Raise the target of a numerically valued  to a non-negative  power and return the result.3When you do not need the result of the operation, () is more flexible. () :: ( a,  e) =>  s a -> e -> s -> (a, s) () :: ( a,  e) =>   s a -> e -> s -> (a, s) lens*Raise the target of a fractionally valued  to an  power and return the result.3When you do not need the result of the operation, () is more flexible. () :: ( a,  e) =>  s a -> e -> s -> (a, s) () :: ( a,  e) =>   s a -> e -> s -> (a, s) lens,Raise the target of a floating-point valued . to an arbitrary power and return the result.3When you do not need the result of the operation, () is more flexible. () ::  a =>  s a -> a -> s -> (a, s) () ::  a =>   s a -> a -> s -> (a, s) lens Logically  a Boolean valued  and return the result.3When you do not need the result of the operation, () is more flexible. () ::  s  ->  -> s -> (, s) () ::   s  ->  -> s -> (, s) lens Logically  a Boolean valued  and return the result.3When you do not need the result of the operation, () is more flexible. () ::  s  ->  -> s -> (, s) () ::   s  ->  -> s -> (, s) lensModify the target of a , but return the old value.%When you do not need the old value, () is more flexible. () :: * s t a b -> (a -> b) -> s -> (a, t) () ::  O+ s t a b -> (a -> b) -> s -> (a, t) () ::  a => W$ s t a b -> (a -> b) -> s -> (a, t) lensReplace the target of a , but return the old value.%When you do not need the old value, () is more flexible. () :: # s t a b -> b -> s -> (a, t) () ::  O$ s t a b -> b -> s -> (a, t) () ::  a => W s t a b -> b -> s -> (a, t) lensReplace the target of a  with a ! value, but return the old value."If you do not need the old value () is more flexible. import qualified Data.Map as Map_2.at "hello" < b -> s -> (a, t) () ::  s t a ( b) -> b -> s -> (a, t) () ::  s t a ( b) -> b -> s -> (a, t) lens-Increment the target of a numerically valued  and return the old value.%When you do not need the old value, () is more flexible.(a,b) & _1 <<+~ c (a,(a + c,b))(a,b) & _2 <<+~ c (b,(a,b + c)) () ::  a =>  s a -> a -> s -> (a, s) () ::  a =>  s a -> a -> s -> (a, s) lens-Decrement the target of a numerically valued  and return the old value.%When you do not need the old value, () is more flexible.(a,b) & _1 <<-~ c (a,(a - c,b))(a,b) & _2 <<-~ c (b,(a,b - c)) () ::  a =>  s a -> a -> s -> (a, s) () ::  a =>  s a -> a -> s -> (a, s) lens,Multiply the target of a numerically valued  and return the old value.%When you do not need the old value, () is more flexible.(a,b) & _1 <<*~ c (a,(a * c,b))(a,b) & _2 <<*~ c (b,(a,b * c)) () ::  a =>  s a -> a -> s -> (a, s) () ::  a =>  s a -> a -> s -> (a, s) lens*Divide the target of a numerically valued  and return the old value.%When you do not need the old value, () is more flexible.(a,b) & _1 <  s a -> a -> s -> (a, s) () :: Fractional a =>  s a -> a -> s -> (a, s) lens)Raise the target of a numerically valued 2 to a non-negative power and return the old value.%When you do not need the old value, () is more flexible. () :: ( a,  e) =>  s a -> e -> s -> (a, s) () :: ( a,  e) =>  s a -> e -> s -> (a, s) lens*Raise the target of a fractionally valued / to an integral power and return the old value.%When you do not need the old value, () is more flexible. () :: ( a,  e) =>  s a -> e -> s -> (a, s) () :: ( a,  e) =>  s a -> e -> S -> (a, s) lens,Raise the target of a floating-point valued 0 to an arbitrary power and return the old value.%When you do not need the old value, () is more flexible.(a,b) & _1 <<**~ c (a,(a**c,b))(a,b) & _2 <<**~ c (b,(a,b**c)) () ::  a =>  s a -> a -> s -> (a, s) () ::  a =>  s a -> a -> s -> (a, s) lens Logically  the target of a -valued  and return the old value.%When you do not need the old value, () is more flexible.(False,6) & _1 <<||~ True(False,(True,6))("hello",True) & _2 <<||~ False(True,("hello",True)) () ::  s  ->  -> s -> (, s) () ::  s  ->  -> s -> (, s) lens Logically  the target of a -valued  and return the old value.%When you do not need the old value, () is more flexible.(False,6) & _1 <<&&~ True(False,(False,6))("hello",True) & _2 <<&&~ False(True,("hello",False)) () :: # s Bool -> Bool -> s -> (Bool, s) () :: " s Bool -> Bool -> s -> (Bool, s) lens)Modify the target of a monoidally valued  by using (') a new value and return the old value.%When you do not need the old value, () is more flexible.(Sum a,b) & _1 <<<>~ Sum c+(Sum {getSum = a},(Sum {getSum = a + c},b))$_2 <<<>~ ", 007" $ ("James", "Bond")("Bond",("James","Bond, 007")) () ::  r =>  s r -> r -> s -> (r, s) () ::  r =>  s r -> r -> s -> (r, s) lensModify the target of a  into your Monad';s state by a user supplied function and return the result.When applied to a W, it this will return a monoidal summary of all of the intermediate results.3When you do not need the result of the operation, () is more flexible. () ::  s m =>  s a -> (a -> a) -> m a () ::  s m =>   s a -> (a -> a) -> m a () :: ( s m,  a) =>  s a -> (a -> a) -> m a lens*Add to the target of a numerically valued  into your Monad's state and return the result.2When you do not need the result of the addition, () is more flexible. () :: ( s m,  a) =>  s a -> a -> m a () :: ( s m,  a) =>   s a -> a -> m a lens1Subtract from the target of a numerically valued  into your Monad's state and return the result.5When you do not need the result of the subtraction, () is more flexible. () :: ( s m,  a) =>  s a -> a -> m a () :: ( s m,  a) =>   s a -> a -> m a lens,Multiply the target of a numerically valued  into your Monad's state and return the result.8When you do not need the result of the multiplication, () is more flexible. () :: ( s m,  a) =>  s a -> a -> m a () :: ( s m,  a) =>   s a -> a -> m a lens+Divide the target of a fractionally valued  into your Monad's state and return the result.2When you do not need the result of the division, () is more flexible. () :: ( s m,  a) =>  s a -> a -> m a () :: ( s m,  a) =>   s a -> a -> m a lens)Raise the target of a numerically valued  into your Monad's state to a non-negative  power and return the result.3When you do not need the result of the operation, () is more flexible. () :: ( s m,  a,  e) =>  s a -> e -> m a () :: ( s m,  a,  e) =>   s a -> e -> m a lens*Raise the target of a fractionally valued  into your Monad's state to an  power and return the result.3When you do not need the result of the operation, () is more flexible. () :: ( s m,  b,  e) =>  s a -> e -> m a () :: ( s m,  b,  e) =>   s a -> e -> m a lens,Raise the target of a floating-point valued  into your Monad'5s state to an arbitrary power and return the result.3When you do not need the result of the operation, () is more flexible. () :: ( s m,  a) =>  s a -> a -> m a () :: ( s m,  a) =>   s a -> a -> m a lens Logically  a Boolean valued  into your Monad's state and return the result.3When you do not need the result of the operation, () is more flexible. () ::  s m =>  s  ->  -> m  () ::  s m =>   s  ->  -> m  lens Logically  a Boolean valued  into your Monad's state and return the result.3When you do not need the result of the operation, () is more flexible. () ::  s m =>  s  ->  -> m  () ::  s m =>   s  ->  -> m  lensModify the target of a  into your Monad'4s state by a user supplied function and return the old value that was replaced.When applied to a W, this will return a monoidal summary of all of the old values present.3When you do not need the result of the operation, () is more flexible. () ::  s m =>  s a -> (a -> a) -> m a () ::  s m =>   s a -> (a -> a) -> m a () :: ( s m,  a) =>  s a -> (a -> a) -> m a () ::  s m => " ((,)a) s s a b -> (a -> b) -> m alensReplace the target of a  into your Monad'3s state with a user supplied value and return the old value that was replaced.When applied to a W, this will return a monoidal summary of all of the old values present.3When you do not need the result of the operation, () is more flexible. () ::  s m =>  s a -> a -> m a () ::  s m =>   s a -> a -> m a () :: ( s m,  a) =>  s a -> a -> m a lensReplace the target of a  into your Monad' s state with ' a user supplied value and return the old value that was replaced.When applied to a W, this will return a monoidal summary of all of the old values present.3When you do not need the result of the operation, () is more flexible. () ::  s m => # s t a (Maybe b) -> b -> m a () ::  s m =>  O$ s t a (Maybe b) -> b -> m a () :: ( s m,  a) => W s t a (Maybe b) -> b -> m a lensModify the target of a  into your Monad'*s state by adding a value and return the old value that was replaced.3When you do not need the result of the operation, () is more flexible. () :: ( s m,  a) =>  s a -> a -> m a () :: ( s m,  a) =>  s a -> a -> m a lensModify the target of a  into your Monad'/s state by subtracting a value and return the old value that was replaced.3When you do not need the result of the operation, () is more flexible. () :: ( s m,  a) =>  s a -> a -> m a () :: ( s m,  a) =>  s a -> a -> m a lensModify the target of a  into your Monad'.s state by multipling a value and return the old value that was replaced.3When you do not need the result of the operation, () is more flexible. () :: ( s m,  a) =>  s a -> a -> m a () :: ( s m,  a) =>  s a -> a -> m a lensModify the target of a  into your /s state by dividing by a value and return the old value that was replaced.3When you do not need the result of the operation, () is more flexible. () :: ( s m,  a) =>  s a -> a -> m a () :: ( s m,  a) =>  s a -> a -> m a lensModify the target of a  into your Monad'>s state by raising it by a non-negative power and return the old value that was replaced.3When you do not need the result of the operation, () is more flexible. () :: ( s m,  a,  e) =>  s a -> e -> m a () :: ( s m,  a,  e) =>  s a -> a -> m a lensModify the target of a  into your Monad';s state by raising it by an integral power and return the old value that was replaced.3When you do not need the result of the operation, () is more flexible. () :: ( s m,  a,  e) =>  s a -> e -> m a () :: ( s m,  a,  e) =>  s a -> e -> m a lensModify the target of a  into your Monad'  s a -> a -> m a () :: ( s m,  a) =>  s a -> a -> m a lensModify the target of a  into your Monad's state by taking its logical  with a value and return the old value that was replaced.3When you do not need the result of the operation, () is more flexible. () ::  s m =>  s  ->  -> m  () ::  s m =>  s  ->  -> m  lensModify the target of a  into your Monad's state by taking its logical  with a value and return the old value that was replaced.3When you do not need the result of the operation, () is more flexible. () ::  s m =>  s  ->  -> m  () ::  s m =>  s  ->  -> m  lensModify the target of a  into your Monad's state by using () and return the old value that was replaced.3When you do not need the result of the operation, () is more flexible. () :: ( s m,  r) =>  s r -> r -> m r () :: ( s m,  r) =>  s r -> r -> m r lens,Run a monadic action, and set the target of  to its result. () ::  s m =>  O s s a b -> m b -> m b () ::  s m =>  s s a b -> m b -> m b (NB: This is limited to taking an actual  than admitting a W= because there are potential loss of state issues otherwise.lens() a ' value onto the end of the target of a  and return the result.3When you do not need the result of the operation, () is more flexible.lens() a ' value onto the end of the target of a  into your Monad's state and return the result.3When you do not need the result of the operation, () is more flexible.lens for Arrows.Unlike ,  can't accept a simple l-, but requires a full lens, or close enough."overA _1 ((+1) *** (+2)) ((1,2),6) ((2,4),6) 6overA :: Arrow ar => Lens s t a b -> ar a b -> ar s t lensAdjust the target of an  returning the intermediate result, or adjust all of the targets of an X6 and return a monoidal summary along with the answer. l  f D l   f /When you do not need access to the index then (() is more liberal in what it can accept.9If you do not need the intermediate result, you can use ( ) or even (). () :: 1 i s t a b -> (i -> a -> b) -> s -> (b, t) () ::  b => X+ i s t a b -> (i -> a -> b) -> s -> (b, t) lensAdjust the target of an > returning the old value, or adjust all of the targets of an X and return a monoidal summary of the old values along with the answer. () :: 1 i s t a b -> (i -> a -> b) -> s -> (a, t) () ::  a => X+ i s t a b -> (i -> a -> b) -> s -> (a, t) lensAdjust the target of an  returning a supplementary result, or adjust all of the targets of an X and return a monoidal summary of the supplementary results and the answer. () D   () ::  f => 0 i s t a b -> (i -> a -> f b) -> s -> f t () ::  f => X* i s t a b -> (i -> a -> f b) -> s -> f t In particular, it is often useful to think of this function as having one of these even more restricted type signatures: () :: 6 i s t a b -> (i -> a -> (r, b)) -> s -> (r, t) () ::  r => X0 i s t a b -> (i -> a -> (r, b)) -> s -> (r, t) lensAdjust the target of an  returning a supplementary result, or adjust all of the targets of an X within the current state, and return a monoidal summary of the supplementary results. l  f D  (l  f) () ::  s m => 3 i s s a b -> (i -> a -> (r, b)) -> s -> m r () :: ( s m,  r) => X- i s s a b -> (i -> a -> (r, b)) -> s -> m r lensAdjust the target of an  returning the intermediate result, or adjust all of the targets of an X within the current state, and return a monoidal summary of the intermediate results. () ::  s m => ) i s s a b -> (i -> a -> b) -> m b () :: ( s m,  b) => X# i s s a b -> (i -> a -> b) -> m b lensAdjust the target of an > returning the old value, or adjust all of the targets of an X within the current state, and return a monoidal summary of the old values. () ::  s m => ) i s s a b -> (i -> a -> b) -> m a () :: ( s m,  b) => X# i s s a b -> (i -> a -> b) -> m a lensA version of () that works on .("hello","world")^#_2"world"lens A version of  that works on .$storing _2 "world" ("hello","there")("hello","world")lensA version of () that works on .!("hello","there") & _2 #~ "world"("hello","world")lensA version of () that works on .!("hello","world") & _2 #%~ length ("hello",5)lensA version of () that works on .6("hello","world") & _2 #%%~ \x -> (length x, x ++ "!")(5,("hello","world!"))lensA version of () that works on .lensA version of () that works on .lensA version of () that works on ."("hello","world") & _2 <#%~ length(5,("hello",5))lensA version of () that works on .lensA version of () that works on .lensA version of () that works on ."("hello","there") & _2 <#~ "world"("world",("hello","world"))lensA version of () that works on .lens'There is a field for every type in the  . Very zen.[] & mapped.devoid +~ 1[]Nothing & mapped.devoid %~ absNothing  ::   a lensWe can always retrieve a () from any type."hello"^.united()"hello" & united .~ ()"hello"lensA $ focusing on the first element of a ? container.2 :| [3, 4] & head1 +~ 10 12 :| [3,4]Identity True ^. head1TruelensA # focusing on the last element of a ? container.2 :| [3, 4] & last1 +~ 10 2 :| [3,14],Node 'a' [Node 'b' [], Node 'c' []] ^. last1'c'lens#Fuse a composition of lenses using  to provide  fusion.#In general, given a pair of lenses foo and bar fusing (foo.bar) = foo.bar  however, foo and bar are either going to  internally or they are trivial. exploits the 2 lemma to merge these separate uses into a single .:This is particularly effective when the choice of functor f) is unknown at compile time or when the  foo.bar in the above description is recursive or complex enough to prevent inlining.  ::  s t a b ->  s t a b 1441444444444444444444444444444444444444444444444424444444484444444444(C) 2012-16 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett  provisional Rank2Types Safe-Inferred.9>?=lens-Provides access to the 19th field of a tuple.lens!Access the 19th field of a tuple.lens-Provides access to the 18th field of a tuple.lens!Access the 18th field of a tuple.lens-Provides access to the 17th field of a tuple.lens!Access the 17th field of a tuple.lens-Provides access to the 16th field of a tuple.lens!Access the 16th field of a tuple.lens-Provides access to the 15th field of a tuple.lens!Access the 15th field of a tuple.lens-Provides access to the 14th field of a tuple.lens!Access the 14th field of a tuple.lens-Provides access to the 13th field of a tuple.lens!Access the 13th field of a tuple.lens-Provides access to the 12th field of a tuple.lens!Access the 12th field of a tuple.lens-Provides access to the 11th field of a tuple.lens!Access the 11th field of a tuple.lens-Provides access to the 10th field of a tuple.lens!Access the 10th field of a tuple.lens,Provides access to the 9th field of a tuple.lens Access the 9th field of a tuple.lens+Provide access to the 8th field of a tuple.lens Access the 8th field of a tuple.lens+Provide access to the 7th field of a tuple.lens Access the 7th field of a tuple.lens.Provides access to the 6th element of a tuple.lens Access the 6th field of a tuple.lens,Provides access to the 5th field of a tuple.lens Access the 5th field of a tuple.lens+Provide access to the 4th field of a tuple.lens Access the 4th field of a tuple.lens,Provides access to the 3rd field of a tuple.lens Access the 3rd field of a tuple.lens,Provides access to the 2nd field of a tuple.lens Access the 2nd field of a tuple._2 .~ "hello" $ (1,(),3,4)(1,"hello",3,4)(1,2,3,4) & _2 *~ 3 (1,6,3,4)_2 print (1,2)2(1,())    :: (s -> ) -> (a, s) ->     :: ( f, . t) => (a -> f b) -> t (s, a) -> f (t (s, b))   (  ) :: ( t, ! m) => (s -> m) -> t (b, s) -> m lens(Provides access to 1st field of a tuple.lens?Access the 1st field of a tuple (and possibly change its type). (1,2)^._11_1 .~ "hello" $ (1,2) ("hello",2)(1,2) & _1 .~ "hello" ("hello",2)_1 putStrLn ("hello","world")hello ((),"world")/This can also be used on larger tuples as well:(1,2,3,4,5) & _1 +~ 41 (42,2,3,4,5)  ::  (a,b) (a',b) a a'  ::  (a,b,c) (a',b,c) a a'  ::  (a,b,c,d) (a',b,c,d) a a' ...  :: / (a,b,c,d,e,f,g,h,i) (a',b,c,d,e,f,g,h,i) a a' lensStrict version of lensStrict version of lensStrict version of lensStrict version of lensStrict version of lensStrict version of lensStrict version of lensStrict version of lensStrict version of lensStrict version of lensStrict version of lensStrict version of lensStrict version of lensStrict version of lensStrict version of lensStrict version of lensStrict version of lensStrict version of lensStrict version of lens  k ~(a,b) = (\a' -> (a',b))  k a lenslens  k ~(a,b) = (\b' -> (a,b'))  k b lens99(C) 2012-16 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett  provisional Rank2Types Trustworthy>lensThis is a convenient alias used when consuming (indexed) getters and (indexed) folds in a highly general fashion.lensUsed to consume an  Z.lensWhen you see this in a type signature it indicates that you can pass the function a , , W,  Y,  [,  O, or one of the indexed variants, and it will just "do the right thing".Most - combinators are able to be used with both a  or a  Y in limited situations, to do so, they need to be monomorphic in what we are going to extract with . To be compatible with , W and  O. we also restricted choices of the irrelevant t and b parameters.If a function accepts a  r s a , then when r is a , then you can pass a  Y (or W'), otherwise you can only pass this a  or .lensBuild an (index-preserving) $ from an arbitrary Haskell function.  f   g D  (g  f)  a   f D f a a ^.to ff a("hello","world")^.to snd"world" 5^.to succ6(0, -5)^._2.to abs5  :: (s -> a) ->  s a lens  :: (s -> (i, a)) ->  i s a lens,Build an constant-valued (index-preserving) ! from an arbitrary Haskell value.  a   b D  b a   b D b a   b D a   ( b) $This can be useful as a second case failing a  e.g. foo failing  0  :: a ->  s a lens  :: i -> a ->  i s a lensView the value pointed to by a ,  O or 5 or the result of folding over all the results of a  Y or W" that points at a monoidal value.    D   view (to f) af aview _2 (1,"hello")"hello"view (to succ) 56&view (_2._1) ("hello",("world","!!!"))"world"As , is commonly used to access the target of a 2 or obtain a monoidal summary of the targets of a , It may be useful to think of it as having one of these more restricted signatures:  ::  s a -> s -> a  ::  m =>  Y s m -> s -> m  ::   s a -> s -> a  ::  s a -> s -> a  ::  m =>  s m -> s -> m 7In a more general setting, such as when working with a  transformer stack you can use:  ::  s m =>  s a -> m a  :: ( s m,  a) =>  Y s a -> m a  ::  s m =>   s a -> m a  ::  s m =>  s a -> m a  :: ( s m,  a) =>  s a -> m a lens-View a function of the value pointed to by a  or  or the result of folding over the result of mapping the targets of a  Y or W.  l f D  (l   f) views (to f) g ag (f a)views _2 length (1,"hello")5As , is commonly used to access the target of a 2 or obtain a monoidal summary of the targets of a , It may be useful to think of it as having one of these more restricted signatures:  ::  s a -> (a -> r) -> s -> r  ::  m =>  Y! s a -> (a -> m) -> s -> m  ::  ! s a -> (a -> r) -> s -> r  ::  s a -> (a -> r) -> s -> r  ::  m =>  s a -> (a -> m) -> s -> m 7In a more general setting, such as when working with a  transformer stack you can use:  ::  s m =>  s a -> (a -> r) -> m r  :: ( s m,  r) =>  Y s a -> (a -> r) -> m r  ::  s m =>   s a -> (a -> r) -> m r  ::  s m =>  s a -> (a -> r) -> m r  :: ( s m,  r) =>  s a -> (a -> r) -> m r  ::  s m =>  r s a -> (a -> r) -> m r lensView the value pointed to by a  or 5 or the result of folding over all the results of a  Y or W" that points at a monoidal values.This is the same operation as  with the arguments flipped.The fixity and semantics are such that subsequent field accesses can be performed with (). (a,b)^._2b("hello","world")^._2"world"import Data.Complex$((0, 1 :+ 2), 3)^._1._2.to magnitude2.23606797749979 () :: s ->  s a -> a () ::  m => s ->  Y s m -> m () :: s ->   s a -> a () :: s ->  s a -> a () ::  m => s ->  s m -> m lensUse the target of a ,  O, or . in the current state, or use a summary of a  Y or W" that points to a monoidal value.evalState (use _1) (a,b)a$evalState (use _1) ("hello","world")"hello"  ::  s m =>  s a -> m a  :: ( s m,  r) =>  Y s r -> m r  ::  s m =>   s a -> m a  ::  s m =>  s a -> m a  :: ( s m,  r) =>  s r -> m r lensUse the target of a ,  O or . in the current state, or use a summary of a  Y or W" that points to a monoidal value.,evalState (uses _1 length) ("hello","world")5  ::  s m =>  s a -> (a -> r) -> m r  :: ( s m,  r) =>  Y s a -> (a -> r) -> m r  ::  s m =>  s a -> (a -> r) -> m r  ::  s m =>   s a -> (a -> r) -> m r  :: ( s m,  r) =>  s a -> (a -> r) -> m r  ::  s m =>  r s t a b -> (a -> r) -> m r lensThis is a generalized form of  that only extracts the portion of the log that is focused on by a  . If given a  or a  then a monoidal summary of the parts of the log that are visited will be returned.  ::  w m =>  w u -> m a -> m (a, u)  ::  w m =>  w u -> m a -> m (a, u)  ::  w m =>  w u -> m a -> m (a, u)  :: ( w m,  u) =>  w u -> m a -> m (a, u)  :: ( w m,  u) =>  w u -> m a -> m (a, u)  :: ( w m,  u) =>  w u -> m a -> m (a, u) lensThis is a generalized form of  that only extracts the portion of the log that is focused on by a  . If given a  or a  then a monoidal summary of the parts of the log that are visited will be returned.  ::  w m => # i w u -> m a -> m (a, (i, u))  ::  w m => $ i w u -> m a -> m (a, (i, u))  :: ( w m,  u) => % i w u -> m a -> m (a, (i, u))  :: ( w m,  u) =>  i w u -> m a -> m (a, (i, u)) lensThis is a generalized form of  that only extracts the portion of the log that is focused on by a  . If given a  or a  then a monoidal summary of the parts of the log that are visited will be returned.  ::  w m => ( w u -> (u -> v) -> m a -> m (a, v)  ::  w m => ) w u -> (u -> v) -> m a -> m (a, v)  ::  w m => * w u -> (u -> v) -> m a -> m (a, v)  :: ( w m,  v) => * w u -> (u -> v) -> m a -> m (a, v)  :: ( w m,  v) => $ w u -> (u -> v) -> m a -> m (a, v)  :: ( w m,  v) => ( w u -> (u -> v) -> m a -> m (a, v) lensThis is a generalized form of  that only extracts the portion of the log that is focused on by a  . If given a  or a  then a monoidal summary of the parts of the log that are visited will be returned.  ::  w m => - w u -> (i -> u -> v) -> m a -> m (a, v)  ::  w m => . w u -> (i -> u -> v) -> m a -> m (a, v)  :: ( w m,  v) => / w u -> (i -> u -> v) -> m a -> m (a, v)  :: ( w m,  v) => ) w u -> (i -> u -> v) -> m a -> m (a, v) lensView the index and value of an ( into the current environment as a pair.When applied to an  the result will most likely be a nonsensical monoidal summary of the indices tupled with a monoidal summary of the values and probably not whatever it is you wanted.lens-View a function of the index and value of an  into the current environment.When applied to an  the result will be a monoidal summary instead of a single answer.  D   lensUse the index and value of an " into the current state as a pair.When applied to an  the result will most likely be a nonsensical monoidal summary of the indices tupled with a monoidal summary of the values and probably not whatever it is you wanted.lens,Use a function of the index and value of an  into the current state.When applied to an  the result will be a monoidal summary instead of a single answer.lensView the index and value of an  or .This is the same operation as  with the arguments flipped.The fixity and semantics are such that subsequent field accesses can be performed with (). ( ) :: s ->  i s a -> (i, a) ( ) :: s ->  i s a -> (i, a) The result probably doesn't have much meaning when applied to an .lens Coerce a  -compatible  to an . This is useful when using a  that is not simple as a  or a .  ::  s t a b ->  s a  ::  s t a b ->  s a  ::  i s t a b ->  i s a  ::  i s t a b ->  i s a   88(C) 2012-16 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett  provisional non-portable Trustworthy lensAn analogue of  for .  :: (b -> t) -> Review' t b  =  .  lensTurn a  around to get a   =  .   =  .  un (to length) # [1,2,3]3lensTurn a  or  O around to build a .If you have an  O,   is a more powerful version of this function that will return an  O instead of a mere . 5 ^.re _LeftLeft 56 ^.re (_Left.unto succ)Left 7  D     D     D     D     ::  s t a b ->  b t  ::  s t a b ->  b t lensThis can be used to turn an  O or  around and ? a value (or the current environment) through it the other way.  D     .  D  review _Left "mustard"Left "mustard"review (unto succ) 56Usually  is used in the (->)  with a  or  O, in which case it may be useful to think of it as having one of these more restricted type signatures:  ::  s a -> a -> s  ::  s a -> a -> s However, when working with a 9 transformer stack, it is sometimes useful to be able to  the current environment, in which case it may be beneficial to think of it as having one of these slightly more liberal type signatures:  ::  a m =>  s a -> m s  ::  a m =>  s a -> m s lensAn infix alias for .  f # x D f x l # x D x   l #This is commonly used when using a  as a smart constructor. _Left # 4Left 4But it can be used for any  base 16 # 123"7b" (#) ::  s a -> a -> s (#) ::  s a -> a -> s (#) ::  s a -> a -> s (#) ::  s a -> a -> s lensThis can be used to turn an  O or  around and  a value (or the current environment) through it the other way, applying a function.  D     ( f) g D g  f reviews _Left isRight "mustard"Falsereviews (unto succ) (*2) 38%Usually this function is used in the (->)  with a  or  O, in which case it may be useful to think of it as having one of these more restricted type signatures:  ::  s a -> (s -> r) -> a -> r  ::  s a -> (s -> r) -> a -> r However, when working with a 9 transformer stack, it is sometimes useful to be able to  the current environment, in which case it may be beneficial to think of it as having one of these slightly more liberal type signatures:  ::  a m =>  s a -> (s -> r) -> m r  ::  a m =>  s a -> (s -> r) -> m r lensThis can be used to turn an  O or  around and ? a value (or the current environment) through it the other way.  D       D  evalState (reuse _Left) 5Left 5evalState (reuse (unto succ)) 56  ::  a m =>  s a -> m s  ::  a m =>  s a -> m s lensThis can be used to turn an  O or  around and  the current state through it the other way, applying a function.  D     ( f) g D  (g  f) *evalState (reuses _Left isLeft) (5 :: Int)True  ::  a m =>  s a -> (s -> r) -> m r  ::  a m =>  s a -> (s -> r) -> m r lensCoerce a polymorphic  to a .  ::  s t a b ->  t b  ::  s t a b ->  t b 8 (C) 2012-16 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett  provisional non-portable TrustworthylensA 3 stripping a suffix from a sequence when used as a /, or appending that suffix when run backwards:"review" ^? suffixed "view" Just "re""review" ^? suffixed "tire"Nothingsuffixed ".o" # "hello" "hello.o"lensA 3 stripping a prefix from a sequence when used as a 0, or prepending that prefix when run backwards:"preview" ^? prefixed "pre" Just "view""review" ^? prefixed "pre"Nothingprefixed "pre" # "amble" "preamble"lens type APrism' =   lensIf you see this in a signature for a function, the function is expecting a .lensConvert / to the pair of functions that characterize it.lensClone a 6 so that you can reuse the same monomorphically typed  for different purposes.See  and / for examples of why you might want to do this.lensBuild a  [. t a is used instead of  a to permit the types of s and t to differ.lens This is usually used to build a *, when you have to use an operation like  which already returns a .lensUse a " as a kind of first-class pattern.  ::  s t a b -> $ (t -> r) (s -> r) (b -> r) (a -> r)lens%Given a pair of prisms, project sums. Viewing a  as a co-,, this combinator can be seen to be dual to .lensUse a " to work over part of a structure.lenslift a  through a  functor, giving a Prism that matches only if all the elements of the container match the .:[Left 1, Right "foo", Left 4, Right "woot"]^..below _Right[][Right "hail hydra!", Right "foo", Right "blah", Right "woot"]^..below _Right%[["hail hydra!","foo","blah","woot"]]lensCheck to see if this  doesn't match.isn't _Left (Right 12)Trueisn't _Left (Left 12)Falseisn't _Empty []False  =  .   = hasn't lens!Retrieve the value targeted by a  or return the original value while allowing the type to change if it does not match.matching _Just (Just 12)Right 12matching _Just (Nothing :: Maybe Int) :: Either (Maybe Bool) Int Left NothinglensLike %, but also works for combinations of  and  s, and also s.'matching' (_2 . _Just) ('x', Just True) Right Truematching' (_2 . _Just) ('x', Nothing :: Maybe Int) :: Either (Char, Maybe Bool) IntLeft ('x',Nothing)*matching' traverse "" :: Either [Int] CharLeft []-matching' traverse "xyz" :: Either [Int] Char Right 'x'lensThis  provides a  for tweaking the  half of an :over _Left (+1) (Left 2)Left 3over _Left (+1) (Right 2)Right 2Right 42 ^._Left :: String""Left "hello" ^._Left"hello">It also can be turned around to obtain the embedding into the  half of an : _Left # 5Left 5 5^.re _LeftLeft 5lensThis  provides a  for tweaking the  half of an :over _Right (+1) (Left 2)Left 2over _Right (+1) (Right 2)Right 3Right "hello" ^._Right"hello"!Left "hello" ^._Right :: [Double][]>It also can be turned around to obtain the embedding into the  half of an : _Right # 5Right 5 5^.re _RightRight 5lensThis  provides a ) for tweaking the target of the value of  in a .over _Just (+1) (Just 2)Just 3Unlike  this is a *, and so you can use it to inject as well: _Just # 5Just 5 5^.re _JustJust 5Interestingly, m ^?  D m Just x ^? _JustJust xNothing ^? _JustNothinglensThis  provides the  of a  in a .Nothing ^? _NothingJust ()Just () ^? _NothingNothing3But you can turn it around and use it to construct  as well: _Nothing # ()Nothinglens& is a logically uninhabited data type. This is a  that will always fail to match.lensThis 0 compares for exact equality with a given value. only 4 # ()4 5 ^? only 4NothinglensThis  compares for approximate equality with a given value and a predicate for testing, an example where the value is the empty list and the predicate checks that a list is empty (same as   with the   list instance):nearly [] null # ()[][1,2,3,4] ^? nearly [] nullNothing  []  ::  [a] ()To comply with the " laws the arguments you supply to  nearly a p are somewhat constrained. We assume p x holds iff x D a-. Under that assumption then this is a valid .This is useful when working with a type where you can test equality for only a subset of its values, and the prism selects such a value.lens7This is an improper prism for text formatting based on  and .This  is "improper" in the sense that it normalizes the text formatting, but round tripping is idempotent given sane / instances. _Show # 2"2""EQ" ^? _Show :: Maybe OrderingJust EQ  D    readMaybe 210210 (C) 2012-16 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett  provisional Rank2Types Trustworthy ->?4lens Obtain a ( by lifting an operation that returns a  result.+This can be useful to lift operations from  Data.List and elsewhere into a .[1,2,3,4]^..folding tail[2,3,4]lens Obtain a  by lifting  like function.[1,2,3,4]^..foldring foldr [1,2,3,4]lensObtain  FoldWithIndex by lifting  like function.lens Obtain a  from any  indexed by ordinal position.Just 3^..folded[3]Nothing^..folded[][(1,2),(3,4)]^..folded.both [1,2,3,4]lens Obtain a  from any  indexed by ordinal position.lensForm a  by repeating the input forever.  D   "timingOut $ 5^..taking 20 repeated)[5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5]  ::  a a lensA  that replicates its input n times.  n D  ( n) 5^..replicated 20)[5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5]lensTransform a non-empty  into a , that loops over its elements over and over.0timingOut $ [1,2,3]^..taking 7 (cycled traverse)[1,2,3,1,2,3,1]  ::  s a ->  s a lensBuild a % that unfolds its values from a seed.  D    ?10^..unfolded (\b -> if b == 0 then Nothing else Just (b, b-1))[10,9,8,7,6,5,4,3,2,1]lensx   f returns an infinite  of repeated applications of f to x.  ( f) a D  f a  :: (a -> a) ->  a a lens Obtain a - that can be composed with to filter another , , ,  (or ).Note: This is not a legal , unless you are very careful not to invalidate the predicate on the target.Note: This is also not a legal , unless you are very careful not to inject a value that fails the predicate.*As a counter example, consider that given evens =   the second  law is violated:  evens    evens    evens (  ) ,So, in order for this to qualify as a legal  you can only use it for actions that preserve the result of the predicate![1..10]^..folded.filtered even [2,4,6,8,10]-This will preserve an index if it is present.lensObtain a potentially empty > by taking the first element from another, potentially empty  and using it as an index.;The resulting optic can be composed with to filter another , , ,  (or ).[(Just 2, 3), (Nothing, 4)] & mapped . filteredBy (_1 . _Just) <. _2 %@~ (*) :: [(Maybe Int, Int)][(Just 2,6),(Nothing,4)]  ::  a i ->  i a a Note: As with  , this is not a legal , unless you are very careful not to invalidate the predicate on the target!lens Obtain a ! by taking elements from another , , ,  or  while a predicate holds.  p D  ( p ) 5timingOut $ toListOf (takingWhile (<=3) folded) [1..][1,2,3]  :: (a -> ) ->  s a ->  s a  :: (a -> ) ->  s a ->  s a  :: (a -> ) ->  s a ->  s a -- * See note below  :: (a -> ) ->  s a ->  s a -- * See note below  :: (a -> ) ->  s a ->  s a -- * See note below  :: (a -> ) ->  s a ->  s a -- * See note below  :: (a -> ) ->  i s a ->  i s a -- * See note below  :: (a -> ) ->  i s a ->  i s a -- * See note below  :: (a -> ) ->  i s a ->  i s a  :: (a -> ) ->  i s a ->  i s a Note: When applied to a , 3 yields something that can be used as if it were a , but which is not a  per the laws, unless you are careful to ensure that you do not invalidate the predicate when writing back through it.lens Obtain a # by dropping elements from another , , ,  or  while a predicate holds.  p D  ( p ) ,toListOf (droppingWhile (<=3) folded) [1..6][4,5,6]-toListOf (droppingWhile (<=3) folded) [1,6,1][6,1]  :: (a -> ) ->  s a ->  s a  :: (a -> ) ->  s a ->  s a  :: (a -> ) ->  s a -> ! s a -- see notes  :: (a -> ) ->  s a -> ! s a -- see notes  :: (a -> ) ->  s a -> ! s a -- see notes  :: (a -> ) ->  s a -> ! s a -- see notes   :: (a -> ) ->  s a ->  s a -- see notes  :: (a -> ) ->  s a ->  s a -- see notes  :: (a -> ) ->  s a ->  s a  :: (a -> ) ->  s a ->  s a   :: (a -> ) ->  i s a ->  i s a -- see notes  :: (a -> ) ->  i s a ->  i s a -- see notes  :: (a -> ) ->  i s a ->  i s a  :: (a -> ) ->  i s a ->  i s a Note: Many uses of this combinator will yield something that meets the types, but not the laws of a valid  or . The  and  laws are only satisfied if the new values you assign to the first target also does not pass the predicate! Otherwise subsequent traversals will visit fewer elements and  fusion is not sound.So for any traversal t and predicate p,  p t may not be lawful, but ( 1 .  p) t is. For example:let l :: Traversal' [Int] Int; l = droppingWhile (<= 1) traverse1let l' :: Traversal' [Int] Int; l' = dropping 1 ll is not a lawful setter because  l f .  l g D  l (f . g):[1,2,3] & l .~ 0 & l .~ 4[1,0,0][1,2,3] & l .~ 4[1,4,4]l'$ on the other hand behaves lawfully:[1,2,3] & l' .~ 0 & l' .~ 4[1,2,4][1,2,3] & l' .~ 4[1,2,4]lensA  over the individual  of a .  ::     ::      ::      ::     %Note: This function type-checks as a  but it doesn't satisfy the laws. It's only valid to use it when you don't insert any whitespace characters while traversing, and if your original  contains only isolated space characters (and no other characters that count as space, such as non-breaking spaces).lensA  over the individual  of a .  ::     ::      ::      ::     %Note: This function type-checks as a  but it doesn't satisfy the laws. It's only valid to use it when you don't insert any newline characters while traversing, and if your original , contains only isolated newline characters.lens.Map each part of a structure viewed through a , ,  or % to a monoid and combine the results.:foldMapOf (folded . both . _Just) Sum [(Just 21, Just 21)]Sum {getSum = 42}  =     D   l =  l  s   ::  s a -> (a -> r) -> s -> r  ::  r => " s a -> (a -> r) -> s -> r  ::  r => ! s a -> (a -> r) -> s -> r  :: ! s a -> (a -> r) -> s -> r  :: " s a -> (a -> r) -> s -> r  ::  r =>  s a -> (a -> r) -> s -> r  ::  r =>  s a -> (a -> r) -> s -> r  ::  r =>  s a -> (a -> r) -> s -> r  ::  r s a -> (a -> r) -> s -> r lens5Combine the elements of a structure viewed through a , ,  or  using a monoid.>foldOf (folded.folded) [[Sum 1,Sum 4],[Sum 8, Sum 8],[Sum 21]]Sum {getSum = 42}  =     D   ::  s m -> s -> m  ::  m =>  s m -> s -> m  ::  s m -> s -> m  ::  s m -> s -> m  ::  m =>  s m -> s -> m  ::  m =>  s m -> s -> m lensRight-associative fold of parts of a structure that are viewed through a , ,  or .  D     :: ) s a -> (a -> r -> r) -> r -> s -> r  :: + s a -> (a -> r -> r) -> r -> s -> r  :: * s a -> (a -> r -> r) -> r -> s -> r  :: + s a -> (a -> r -> r) -> r -> s -> r  :: % s a -> (a -> r -> r) -> r -> s -> r  :: ) s a -> (a -> r -> r) -> r -> s -> r   l D  l  s  ::  (( r) s a -> (a -> r -> r) -> r -> s -> r lensLeft-associative fold of the parts of a structure that are viewed through a , ,  or .  D    :: ) s a -> (r -> a -> r) -> r -> s -> r  :: + s a -> (r -> a -> r) -> r -> s -> r  :: * s a -> (r -> a -> r) -> r -> s -> r  :: + s a -> (r -> a -> r) -> r -> s -> r  :: % s a -> (r -> a -> r) -> r -> s -> r  :: ) s a -> (r -> a -> r) -> r -> s -> r lens#Extract a list of the targets of a  . See also ().  D   () D   lens Extract a  of the targets of .%toNonEmptyOf both1 ("hello", "world")"hello" :| ["world"]  ::  s a -> s -> NonEmpty a  ::  s a -> s -> NonEmpty a  ::  s a -> s -> NonEmpty a  ::  s a -> s -> NonEmpty a  ::  s a -> s -> NonEmpty a  ::  s a -> s -> NonEmpty a lens(A convenient infix (flipped) version of .[[1,2],[3]]^..id [[[1,2],[3]]][[1,2],[3]]^..traverse [[1,2],[3]][[1,2],[3]]^..traverse.traverse[1,2,3] (1,2)^..both[1,2]  xs D xs   () D   ( ) :: s ->  s a ->  '^..'a :: s ->  s a ->  '^..'a :: s ->  s a ->  '^..'a :: s ->  s a ->  '^..'a :: s ->  s a ->  '^..'a :: s ->  s a -> [a] lensReturns  if every target of a  is .andOf both (True,False)FalseandOf both (True,True)True  D    ::  s  -> s ->   ::  s  -> s ->   ::  s  -> s ->   ::  s  -> s ->   ::  s  -> s ->   ::  s  -> s ->  lensReturns  if any target of a  is .orOf both (True,False)TrueorOf both (False,False)False  D    ::  s  -> s ->   ::  s  -> s ->   ::  s  -> s ->   ::  s  -> s ->   ::  s  -> s ->   ::  s  -> s ->  lensReturns  if any target of a  satisfies a predicate.anyOf both (=='x') ('x','y')Trueimport Data.Data.LensanyOf biplate (== "world") (((),2::Int),"hello",("world",11::Int))True  D     l D  l  s  ::  s a -> (a ->  ) -> s ->   ::  s a -> (a ->  ) -> s ->   ::  s a -> (a ->  ) -> s ->   ::  s a -> (a ->  ) -> s ->   ::  s a -> (a ->  ) -> s ->   ::  s a -> (a ->  ) -> s ->  lensReturns  if every target of a  satisfies a predicate.allOf both (>=3) (4,5)TrueallOf folded (>=2) [1..10]False  D     l =  l  s  ::  s a -> (a ->  ) -> s ->   ::  s a -> (a ->  ) -> s ->   ::  s a -> (a ->  ) -> s ->   ::  s a -> (a ->  ) -> s ->   ::  s a -> (a ->  ) -> s ->   ::  s a -> (a ->  ) -> s ->  lensReturns  only if no targets of a  satisfy a predicate.2noneOf each (is _Nothing) (Just 3, Just 4, Just 5)True3noneOf (folded.folded) (<10) [[13,99,20],[3,71,42]]False  l =  l  s  ::  s a -> (a ->  ) -> s ->   ::  s a -> (a ->  ) -> s ->   ::  s a -> (a ->  ) -> s ->   ::  s a -> (a ->  ) -> s ->   ::  s a -> (a ->  ) -> s ->   ::  s a -> (a ->  ) -> s ->  lensCalculate the Product of every number targeted by a .productOf both (4,5)20productOf folded [1,2,3,4,5]120  D   This operation may be more strict than you would expect. If you want a lazier version use ala Product    ::  a =>  s a -> s -> a  ::  a =>  s a -> s -> a  ::  a =>  s a -> s -> a  ::  a =>  s a -> s -> a  ::  a =>  s a -> s -> a  ::  a =>  s a -> s -> a lensCalculate the Sum of every number targeted by a .sumOf both (5,6)11sumOf folded [1,2,3,4]10!sumOf (folded.both) [(1,2),(3,4)]10import Data.Data.Lens8sumOf biplate [(1::Int,[]),(2,[(3::Int,4::Int)])] :: Int10  D   This operation may be more strict than you would expect. If you want a lazier version use ala Sum    _1 ::  a => (a, b) -> a  (  ) :: ( f,  a) => f (a, b) -> a  ::  a =>  s a -> s -> a  ::  a =>  s a -> s -> a  ::  a =>  s a -> s -> a  ::  a =>  s a -> s -> a  ::  a =>  s a -> s -> a  ::  a =>  s a -> s -> a lens&Traverse over all of the targets of a  (or ), computing an  (or )-based answer, but unlike # do not construct a new structure.  generalizes  to work over any .When passed a ,  can work over any , but when passed a ,  requires an .+traverseOf_ both putStrLn ("hello","world")helloworld  D     _2 :: # f => (c -> f r) -> (d, c) -> f ()    ::  f => (a -> f b) ->  a c -> f ()   l D  l  s !The rather specific signature of 5 allows it to be used as if the signature was any of:  ::  f => $ s a -> (a -> f r) -> s -> f ()  ::  f => & s a -> (a -> f r) -> s -> f ()  ::  f => % s a -> (a -> f r) -> s -> f ()  ::  f => & s a -> (a -> f r) -> s -> f ()  ::  f =>  s a -> (a -> f r) -> s -> f ()  ::  f => $ s a -> (a -> f r) -> s -> f () lens&Traverse over all of the targets of a  (or ), computing an  (or )-based answer, but unlike # do not construct a new structure.  generalizes  to work over any .When passed a ,  can work over any , but when passed a ,  requires an . for_ D   &forOf_ both ("hello","world") putStrLnhelloworld!The rather specific signature of 5 allows it to be used as if the signature was any of:  l s D  l s  s  ::  f => $ s a -> s -> (a -> f r) -> f ()  ::  f => & s a -> s -> (a -> f r) -> f ()  ::  f => % s a -> s -> (a -> f r) -> f ()  ::  f => & s a -> s -> (a -> f r) -> f ()  ::  f =>  s a -> s -> (a -> f r) -> f ()  ::  f => $ s a -> s -> (a -> f r) -> f () lens&Evaluate each action in observed by a 9 on a structure from left to right, ignoring the results.  sequenceA_ D   5sequenceAOf_ both (putStrLn "hello",putStrLn "world")helloworld  ::  f =>  s (f a) -> s -> f ()  ::  f =>  s (f a) -> s -> f ()  ::  f =>  s (f a) -> s -> f ()  ::  f =>  s (f a) -> s -> f ()  ::  f =>  s (f a) -> s -> f ()  ::  f =>  s (f a) -> s -> f () lens&Traverse over all of the targets of a , computing an  based answer.As long as you have  or  effect you are better using . The & is useful only when you have genuine  effect.traverse1Of_ both1 (\ks -> Map.fromList [ (k, ()) | k <- ks ]) ("abc", "bcd")fromList [('b',()),('c',())]  ::  f =>  s a -> (a -> f r) -> s -> f () lensSee  and .for1Of_ both1 ("abc", "bcd") (\ks -> Map.fromList [ (k, ()) | k <- ks ])fromList [('b',()),('c',())]  ::  f =>  s a -> s -> (a -> f r) -> f () lensSee  and .  ::  f =>  s (f a) -> s -> f () lensMap each target of a  on a structure to a monadic action, evaluate these actions from left to right, and ignore the results.'mapMOf_ both putStrLn ("hello","world")helloworld d D    ::  m => $ s a -> (a -> m r) -> s -> m ()  ::  m => & s a -> (a -> m r) -> s -> m ()  ::  m => % s a -> (a -> m r) -> s -> m ()  ::  m => & s a -> (a -> m r) -> s -> m ()  ::  m =>  s a -> (a -> m r) -> s -> m ()  ::  m => $ s a -> (a -> m r) -> s -> m () lens is # with two of its arguments flipped.'forMOf_ both ("hello","world") putStrLnhelloworld  D    ::  m => $ s a -> s -> (a -> m r) -> m ()  ::  m => & s a -> s -> (a -> m r) -> m ()  ::  m => % s a -> s -> (a -> m r) -> m ()  ::  m => & s a -> s -> (a -> m r) -> m ()  ::  m =>  s a -> s -> (a -> m r) -> m ()  ::  m => $ s a -> s -> (a -> m r) -> m () lens-Evaluate each monadic action referenced by a = on the structure from left to right, and ignore the results.4sequenceOf_ both (putStrLn "hello",putStrLn "world")helloworld  D    ::  m =>  s (m a) -> s -> m ()  ::  m =>  s (m a) -> s -> m ()  ::  m =>  s (m a) -> s -> m ()  ::  m =>  s (m a) -> s -> m ()  ::  m =>  s (m a) -> s -> m ()  ::  m =>  s (m a) -> s -> m () lens1The sum of a collection of actions, generalizing .asumOf both ("hello","world") "helloworld",asumOf each (Nothing, Just "hello", Nothing) Just "hello" asum D    ::  f =>  s (f a) -> s -> f a  ::  f =>  s (f a) -> s -> f a  ::  f =>  s (f a) -> s -> f a  ::  f =>  s (f a) -> s -> f a  ::  f =>  s (f a) -> s -> f a  ::  f =>  s (f a) -> s -> f a lens1The sum of a collection of actions, generalizing .msumOf both ("hello","world") "helloworld",msumOf each (Nothing, Just "hello", Nothing) Just "hello"  D    ::  m =>  s (m a) -> s -> m a  ::  m =>  s (m a) -> s -> m a  ::  m =>  s (m a) -> s -> m a  ::  m =>  s (m a) -> s -> m a  ::  m =>  s (m a) -> s -> m a  ::  m =>  s (m a) -> s -> m a lens/Does the element occur anywhere within a given  of the structure?%elemOf both "hello" ("hello","world")True  D    ::  a =>  s a -> a -> s ->   ::  a =>  s a -> a -> s ->   ::  a =>  s a -> a -> s ->   ::  a =>  s a -> a -> s ->   ::  a =>  s a -> a -> s ->   ::  a =>  s a -> a -> s ->  lens3Does the element not occur anywhere within a given  of the structure? notElemOf each 'd' ('a','b','c')True notElemOf each 'a' ('a','b','c')False  D    ::  a =>  s a -> a -> s ->   ::  a =>  s a -> a -> s ->   ::  a =>  s a -> a -> s ->   ::  a =>  s a -> a -> s ->   ::  a =>  s a -> a -> s ->   ::  a =>  s a -> a -> s ->  lens)Map a function over all the targets of a 4 of a container and concatenate the resulting lists.)concatMapOf both (\x -> [x, x + 1]) (1,3) [1,2,3,4]  D    :: # s a -> (a -> [r]) -> s -> [r]  :: % s a -> (a -> [r]) -> s -> [r]  :: $ s a -> (a -> [r]) -> s -> [r]  :: % s a -> (a -> [r]) -> s -> [r]  ::  s a -> (a -> [r]) -> s -> [r] lens+Concatenate all of the lists targeted by a  into a longer list.concatOf both ("pan","ama")"panama"  D    D   ::  s [r] -> s -> [r]  ::  s [r] -> s -> [r]  ::  s [r] -> s -> [r]  ::  s [r] -> s -> [r]  ::  s [r] -> s -> [r] lens0Calculate the number of targets there are for a  in a given container.Note: This can be rather inefficient for large containers and just like ., this will not terminate for infinite folds.  D   lengthOf _1 ("hello",())1lengthOf traverse [1..10]100lengthOf (traverse.traverse) [[1,2],[3,4],[5,6]]6  (  ) :: ( f,  g) => f (g a) ->   ::  s a -> s ->   ::  s a -> s ->   ::  s a -> s ->   ::  s a -> s ->   ::  s a -> s ->  lensPerform a safe  of a  or  or retrieve  the result from a  or . When using a  as a partial , or a  as a partial = this can be a convenient way to extract the optional value.Note: if you get stack overflows due to this, you may want to use  instead, which can deal more gracefully with heavily left-biased trees. This is because  works by using the 2 monoid, which can occasionally cause space leaks.Left 4 ^?_LeftJust 4Right 4 ^?_LeftNothing"world" ^? ix 3Just 'l'"world" ^? ix 20Nothing+This operator works as an infix version of . () D   It may be helpful to think of 8 as having one of the following more specialized types: ( ) :: s ->  s a ->  a ( ) :: s ->  s a ->  a ( ) :: s ->  s a ->  a ( ) :: s ->  s a ->  a ( ) :: s ->  s a ->  a lensPerform an *UNSAFE*  of a  or  assuming that it is there.Left 4 ^?! _Left4"world" ^?! ix 3'l' ( ) :: s ->  s a -> a ( ) :: s ->  s a -> a ( ) :: s ->  s a -> a ( ) :: s ->  s a -> a ( ) :: s ->  s a -> a lens Retrieve the  entry of a  or  or retrieve  the result from a  or .>The answer is computed in a manner that leaks space less than  or ^?'- and gives you back access to the outermost  constructor more quickly, but does so in a way that builds an intermediate structure, and thus may have worse constant factors. This also means that it can not be used in any , but must instead have s% passed as its last argument, unlike .Note: this could been named headOf.firstOf traverse [1..10]Just 1firstOf both (1,2)Just 1firstOf ignored ()Nothing  ::  s a -> s ->  a  ::  s a -> s ->  a  ::  s a -> s ->  a  ::  s a -> s ->  a  ::  s a -> s ->  a lens Retrieve the  entry of a  or  or the result from a  or .!first1Of traverse1 (1 :| [2..10])1first1Of both1 (1,2)1Note: this is different from .+first1Of traverse1 ([1,2] :| [[3,4],[5,6]])[1,2]%([1,2] :| [[3,4],[5,6]]) ^. traverse1 [1,2,3,4,5,6]  ::  s a -> s -> a  ::  s a -> s -> a  ::  s a -> s -> a  ::  s a -> s -> a  ::  s a -> s -> a lens Retrieve the Last entry of a  or  or retrieve  the result from a  or .>The answer is computed in a manner that leaks space less than ala Last  - and gives you back access to the outermost  constructor more quickly, but may have worse constant factors.lastOf traverse [1..10]Just 10lastOf both (1,2)Just 2lastOf ignored ()Nothing  ::  s a -> s ->  a  ::  s a -> s ->  a  ::  s a -> s ->  a  ::  s a -> s ->  a  ::  s a -> s ->  a lens Retrieve the  entry of a  or  or retrieve the result from a  or .o last1Of traverse1 (1 :| [2..10])10last1Of both1 (1,2)2  ::  s a -> s ->  a  ::  s a -> s ->  a  ::  s a -> s ->  a  ::  s a -> s ->  a  ::  s a -> s ->  a lensReturns  if this  or ' has no targets in the given container.Note:  on a valid ,  or  should always return .  D   /This may be rather inefficient compared to the  check of many containers.nullOf _1 (1,2)FalsenullOf ignored ()TruenullOf traverse []TruenullOf (element 20) [1..10]True  (  _1  ) :: ( f,  g) => f (g a, b) ->   ::  s a -> s ->   ::  s a -> s ->   ::  s a -> s ->   ::  s a -> s ->   ::  s a -> s ->  lensReturns  if this  or ( has any targets in the given container.5A more "conversational" alias for this combinator is .Note:  on a valid ,  or  should always return .    D   /This may be rather inefficient compared to the    check of many containers.notNullOf _1 (1,2)TruenotNullOf traverse [1..10]TruenotNullOf folded []FalsenotNullOf (element 20) [1..10]False  (  _1  ) :: ( f,  g) => f (g a, b) ->   ::  s a -> s ->   ::  s a -> s ->   ::  s a -> s ->   ::  s a -> s ->   ::  s a -> s ->  lens2Obtain the maximum element (if any) targeted by a  or  safely.Note:  on a valid ,  or  will always return  a value.maximumOf traverse [1..10]Just 10maximumOf traverse []Nothing0maximumOf (folded.filtered even) [1,4,3,6,7,9,2]Just 6 maximum D  ( "empty")    In the interest of efficiency, This operation has semantics more strict than strictly necessary. 3 getMax ( l Max), has lazier semantics but could leak memory.  ::  a =>  s a -> s ->  a  ::  a =>  s a -> s ->  a  ::  a =>  s a -> s ->  a  ::  a =>  s a -> s ->  a  ::  a =>  s a -> s ->  a lens)Obtain the maximum element targeted by a  or .#maximum1Of traverse1 (1 :| [2..10])10  ::  a =>  s a -> s -> a  ::  a =>  s a -> s -> a  ::  a =>  s a -> s -> a  ::  a =>  s a -> s -> a  ::  a =>  s a -> s -> a lens2Obtain the minimum element (if any) targeted by a  or  safely.Note:  on a valid ,  or  will always return  a value.minimumOf traverse [1..10]Just 1minimumOf traverse []Nothing0minimumOf (folded.filtered even) [1,4,3,6,7,9,2]Just 2 minimum D  ( "empty")    In the interest of efficiency, This operation has semantics more strict than strictly necessary. 3 getMin ( l Min), has lazier semantics but could leak memory.  ::  a =>  s a -> s ->  a  ::  a =>  s a -> s ->  a  ::  a =>  s a -> s ->  a  ::  a =>  s a -> s ->  a  ::  a =>  s a -> s ->  a lens)Obtain the minimum element targeted by a  or .#minimum1Of traverse1 (1 :| [2..10])1  ::  a =>  s a -> s -> a  ::  a =>  s a -> s -> a  ::  a =>  s a -> s -> a  ::  a =>  s a -> s -> a  ::  a =>  s a -> s -> a lens2Obtain the maximum element (if any) targeted by a , , , , or  according to a user supplied .maximumByOf traverse (compare `on` length) ["mustard","relish","ham"]Just "mustard"In the interest of efficiency, This operation has semantics more strict than strictly necessary.  cmp D  ( "empty")    cmp  ::  s a -> (a -> a ->  ) -> s ->  a  ::  s a -> (a -> a ->  ) -> s ->  a  ::  s a -> (a -> a ->  ) -> s ->  a  ::  s a -> (a -> a ->  ) -> s ->  a  ::  s a -> (a -> a ->  ) -> s ->  a lens2Obtain the minimum element (if any) targeted by a , , ,  or  according to a user supplied .In the interest of efficiency, This operation has semantics more strict than strictly necessary.minimumByOf traverse (compare `on` length) ["mustard","relish","ham"] Just "ham"  minimumBy cmp D  ( "empty")    cmp  ::  s a -> (a -> a ->  ) -> s ->  a  ::  s a -> (a -> a ->  ) -> s ->  a  ::  s a -> (a -> a ->  ) -> s ->  a  ::  s a -> (a -> a ->  ) -> s ->  a  ::  s a -> (a -> a ->  ) -> s ->  a lensThe  function takes a  (or , , , or ), a predicate and a structure and returns the leftmost element of the structure matching the predicate, or  if there is no such element.findOf each even (1,3,4,6)Just 4findOf folded even [1,3,5,7]Nothing  ::  s a -> (a ->  ) -> s ->  a  ::  s a -> (a ->  ) -> s ->  a  ::  s a -> (a ->  ) -> s ->  a  ::  s a -> (a ->  ) -> s ->  a  ::  s a -> (a ->  ) -> s ->  a   D    l D  l  s 8A simpler version that didn't permit indexing, would be:  ::  ( ( a)) s a -> (a ->  ) -> s ->  a  l p =  l (a y -> if p a then  a else y)  lensThe  function takes a  (or , , , or ), a monadic predicate and a structure and returns in the monad the leftmost element of the structure matching the predicate, or  if there is no such element.findMOf each ( \x -> print ("Checking " ++ show x) >> return (even x)) (1,3,4,6) "Checking 1" "Checking 3" "Checking 4"Just 4findMOf each ( \x -> print ("Checking " ++ show x) >> return (even x)) (1,3,5,7) "Checking 1" "Checking 3" "Checking 5" "Checking 7"Nothing  :: ( m,  s a) -> (a -> m  ) -> s -> m ( a)  :: ( m,  s a) -> (a -> m  ) -> s -> m ( a)  :: ( m,  s a) -> (a -> m  ) -> s -> m ( a)  :: ( m,  s a) -> (a -> m  ) -> s -> m ( a)  :: ( m,  s a) -> (a -> m  ) -> s -> m ( a)    :: (Monad m, Foldable f) => (a -> m Bool) -> f a -> m (Maybe a)  l D  l  s 8A simpler version that didn't permit indexing, would be:  :: Monad m =>  ( (m ( a))) s a -> (a -> m  ) -> s -> m ( a)  l p = * l (a y -> p a >>= x -> if x then return ( a) else y) $ return  lensThe  function takes a  (or , , , , etc.), a key, and a structure containing key/value pairs. It returns the first value corresponding to the given key. This function generalizes  to work on an arbitrary  instead of lists.0lookupOf folded 4 [(2, 'a'), (4, 'b'), (4, 'c')]Just 'b'.lookupOf each 2 [(2, 'a'), (4, 'b'), (4, 'c')]Just 'a'  ::  k =>  s (k,v) -> k -> s ->  v lens A variant of  that has no base case and thus may only be applied to lenses and structures such that the . views at least one element of the structure.foldr1Of each (+) (1,2,3,4)10  l f D  f   l  D    :: $ s a -> (a -> a -> a) -> s -> a  :: & s a -> (a -> a -> a) -> s -> a  :: & s a -> (a -> a -> a) -> s -> a  :: % s a -> (a -> a -> a) -> s -> a  ::  s a -> (a -> a -> a) -> s -> a lens A variant of  that has no base case and thus may only be applied to lenses and structures such that the - views at least one element of the structure.foldl1Of each (+) (1,2,3,4)10  l f D  f   l  D    :: $ s a -> (a -> a -> a) -> s -> a  :: & s a -> (a -> a -> a) -> s -> a  :: & s a -> (a -> a -> a) -> s -> a  :: % s a -> (a -> a -> a) -> s -> a  ::  s a -> (a -> a -> a) -> s -> a lens5Strictly fold right over the elements of a structure.  D    :: ) s a -> (a -> r -> r) -> r -> s -> r  :: + s a -> (a -> r -> r) -> r -> s -> r  :: + s a -> (a -> r -> r) -> r -> s -> r  :: * s a -> (a -> r -> r) -> r -> s -> r  :: % s a -> (a -> r -> r) -> r -> s -> r lensFold over the elements of a structure, associating to the left, but strictly.  D    :: ) s a -> (r -> a -> r) -> r -> s -> r  :: + s a -> (r -> a -> r) -> r -> s -> r  :: + s a -> (r -> a -> r) -> r -> s -> r  :: * s a -> (r -> a -> r) -> r -> s -> r  :: % s a -> (r -> a -> r) -> r -> s -> r lens A variant of  that has no base case and thus may only be applied to folds and structures such that the fold views at least one element of the structure.  l f D  f   l  :: $ s a -> (a -> a -> a) -> s -> a  :: & s a -> (a -> a -> a) -> s -> a  :: & s a -> (a -> a -> a) -> s -> a  :: % s a -> (a -> a -> a) -> s -> a  ::  s a -> (a -> a -> a) -> s -> a lens A variant of  that has no base case and thus may only be applied to folds and structures such that the fold views at least one element of the structure.  l f D  f   l  :: $ s a -> (a -> a -> a) -> s -> a  :: & s a -> (a -> a -> a) -> s -> a  :: & s a -> (a -> a -> a) -> s -> a  :: % s a -> (a -> a -> a) -> s -> a  ::  s a -> (a -> a -> a) -> s -> a lensMonadic fold over the elements of a structure, associating to the right, i.e. from right to left.  D    ::  m => - s a -> (a -> r -> m r) -> r -> s -> m r  ::  m => / s a -> (a -> r -> m r) -> r -> s -> m r  ::  m => / s a -> (a -> r -> m r) -> r -> s -> m r  ::  m => . s a -> (a -> r -> m r) -> r -> s -> m r  ::  m => ) s a -> (a -> r -> m r) -> r -> s -> m r lensMonadic fold over the elements of a structure, associating to the left, i.e. from left to right.  D    ::  m => - s a -> (r -> a -> m r) -> r -> s -> m r  ::  m => / s a -> (r -> a -> m r) -> r -> s -> m r  ::  m => / s a -> (r -> a -> m r) -> r -> s -> m r  ::  m => . s a -> (r -> a -> m r) -> r -> s -> m r  ::  m => ) s a -> (r -> a -> m r) -> r -> s -> m r lensCheck to see if this  or  matches 1 or more entries.has (element 0) []Falsehas _Left (Left 12)Truehas _Right (Left 12)FalseThis will always return  for a  or .has _1 ("hello","world")True  ::  s a -> s ->   ::  s a -> s ->   ::  s a -> s ->   ::  s a -> s ->   ::  s a -> s ->  lensCheck to see if this  or  has no matches.hasn't _Left (Right 12)Truehasn't _Left (Left 12)FalselensThis converts a  to a 5 that returns the first element, if it exists, as a .  ::  s a ->  s ( a)  ::  s a ->  s ( a)  ::  s a ->  s ( a)  ::  s a ->  s ( a)  ::  s a ->  s ( a)  ::  s a ->  s ( a) lensThis converts an  to an  that returns the first index and element, if they exist, as a .  ::  i s a ->  s ( (i, a))  ::  i s a ->  s ( (i, a))  ::  i s a ->  s ( (i, a))  ::  i s a ->  s ( (i, a)) lens'Retrieve the first value targeted by a  or  (or  the result from a  or  ). See also  and , which are similar with some subtle differences (explained below).   toList D     =    Unlike , this function uses a  to read the value to be focused in on. This allows one to pass the value as the last argument by using the  instance for (->) s However, it may also be used as part of some deeply nested transformer stack. uses a monoidal value to obtain the result. This means that it generally has good performance, but can occasionally cause space leaks or even stack overflows on some data types. There is another function, , which avoids these issues at the cost of a slight constant performance cost and a little less flexibility.It may be helpful to think of 8 as having one of the following more specialized types:  ::  s a -> s ->  a  ::  s a -> s ->  a  ::  s a -> s ->  a  ::  s a -> s ->  a  ::  s a -> s ->  a  ::  s m =>  s a -> m ( a)  ::  s m =>  s a -> m ( a)  ::  s m =>  s a -> m ( a)  ::  s m =>  s a -> m ( a)  ::  s m =>  s a -> m ( a) lens1Retrieve the first index and value targeted by a  or  (or  the result from a  or  ). See also ().  =    This is usually applied in the   (->) s.  ::  i s a -> s ->  (i, a)  ::  i s a -> s ->  (i, a)  ::  i s a -> s ->  (i, a)  ::  i s a -> s ->  (i, a) However, it may be useful to think of its full generality when working with a  transformer stack:  ::  s m =>  s a -> m ( (i, a))  ::  s m =>  s a -> m ( (i, a))  ::  s m =>  s a -> m ( (i, a))  ::  s m =>  s a -> m ( (i, a)) lens5Retrieve a function of the first value targeted by a  or  (or  the result from a  or ).This is usually applied in the   (->) s.lensRetrieve a function of the first index and value targeted by an  or  (or  the result from an  or ). See also ().  =    This is usually applied in the   (->) s.  :: $ i s a -> (i -> a -> r) -> s ->  r  :: & i s a -> (i -> a -> r) -> s ->  r  :: % i s a -> (i -> a -> r) -> s ->  r  ::  i s a -> (i -> a -> r) -> s ->  r However, it may be useful to think of its full generality when working with a  transformer stack:  ::  s m => " i s a -> (i -> a -> r) -> m ( r)  ::  s m => $ i s a -> (i -> a -> r) -> m ( r)  ::  s m => # i s a -> (i -> a -> r) -> m ( r)  ::  s m =>  i s a -> (i -> a -> r) -> m ( r) lens'Retrieve the first value targeted by a  or  (or  the result from a  or ) into the current state.  =     ::  s m =>  s a -> m ( a)  ::  s m =>  s a -> m ( a)  ::  s m =>  s a -> m ( a)  ::  s m =>  s a -> m ( a)  ::  s m =>  s a -> m ( a) lens2Retrieve the first index and value targeted by an  or  (or  the index and result from an  or ) into the current state.  =     ::  s m =>  i s a -> m ( (i, a))  ::  s m =>  i s a -> m ( (i, a))  ::  s m =>  i s a -> m ( (i, a))  ::  s m =>  i s a -> m ( (i, a)) lens5Retrieve a function of the first value targeted by a  or  (or  the result from a  or ) into the current state.  =     ::  s m =>  s a -> (a -> r) -> m ( r)  ::  s m =>  s a -> (a -> r) -> m ( r)  ::  s m =>  s a -> (a -> r) -> m ( r)  ::  s m =>  s a -> (a -> r) -> m ( r)  ::  s m =>  s a -> (a -> r) -> m ( r) lensRetrieve a function of the first index and value targeted by an  or  (or a function of  the index and result from an  or ) into the current state.  =     ::  s m => " i s a -> (i -> a -> r) -> m ( r)  ::  s m => $ i s a -> (i -> a -> r) -> m ( r)  ::  s m => # i s a -> (i -> a -> r) -> m ( r)  ::  s m =>  i s a -> (i -> a -> r) -> m ( r) lensThis allows you to # the elements of a pretty much any $ construction in the opposite order.This will preserve indexes on s4 types and will give you the elements of a (finite)  or  in the opposite order."This has no practical impact on a , ,  or .NB: To write back through an , you want to use '. Similarly, to write back through an , you want to use .lensFold an  or / by mapping indices and values to an arbitrary  with access to the i.-When you don't need access to the index then % is more flexible in what it accepts.  l D  l    :: & i s a -> (i -> a -> m) -> s -> m  ::  m => ( i s a -> (i -> a -> m) -> s -> m  :: ' i s a -> (i -> a -> m) -> s -> m  ::  m => " i s a -> (i -> a -> m) -> s -> m lensRight-associative fold of parts of a structure that are viewed through an  or  with access to the i.-When you don't need access to the index then % is more flexible in what it accepts.  l D  l    :: 0 i s a -> (i -> a -> r -> r) -> r -> s -> r  :: 2 i s a -> (i -> a -> r -> r) -> r -> s -> r  :: 1 i s a -> (i -> a -> r -> r) -> r -> s -> r  :: , i s a -> (i -> a -> r -> r) -> r -> s -> r lensLeft-associative fold of the parts of a structure that are viewed through an  or  with access to the i.-When you don't need access to the index then % is more flexible in what it accepts.  l D  l    :: 0 i s a -> (i -> r -> a -> r) -> r -> s -> r  :: 2 i s a -> (i -> r -> a -> r) -> r -> s -> r  :: 1 i s a -> (i -> r -> a -> r) -> r -> s -> r  :: , i s a -> (i -> r -> a -> r) -> r -> s -> r lens4Return whether or not any element viewed through an  or * satisfy a predicate, with access to the i.-When you don't need access to the index then % is more flexible in what it accepts.  l D  l    ::  i s a -> (i -> a ->  ) -> s ->   ::  i s a -> (i -> a ->  ) -> s ->   ::  i s a -> (i -> a ->  ) -> s ->   ::  i s a -> (i -> a ->  ) -> s ->  lens5Return whether or not all elements viewed through an  or * satisfy a predicate, with access to the i.-When you don't need access to the index then % is more flexible in what it accepts.  l D  l    ::  i s a -> (i -> a ->  ) -> s ->   ::  i s a -> (i -> a ->  ) -> s ->   ::  i s a -> (i -> a ->  ) -> s ->   ::  i s a -> (i -> a ->  ) -> s ->  lens=Return whether or not none of the elements viewed through an  or * satisfy a predicate, with access to the i.-When you don't need access to the index then % is more flexible in what it accepts.  l D  l    ::  i s a -> (i -> a ->  ) -> s ->   ::  i s a -> (i -> a ->  ) -> s ->   ::  i s a -> (i -> a ->  ) -> s ->   ::  i s a -> (i -> a ->  ) -> s ->  lensTraverse the targets of an  or  with access to the i, discarding the results.-When you don't need access to the index then % is more flexible in what it accepts.  l D  l    ::  f => + i s a -> (i -> a -> f r) -> s -> f ()  ::  f => - i s a -> (i -> a -> f r) -> s -> f ()  ::  f => , i s a -> (i -> a -> f r) -> s -> f ()  ::  f => ' i s a -> (i -> a -> f r) -> s -> f () lensTraverse the targets of an  or  with access to the index, discarding the results (with the arguments flipped).  D    -When you don't need access to the index then % is more flexible in what it accepts.  l a D  l a    ::  f => + i s a -> s -> (i -> a -> f r) -> f ()  ::  f => - i s a -> s -> (i -> a -> f r) -> f ()  ::  f => , i s a -> s -> (i -> a -> f r) -> f ()  ::  f => ' i s a -> s -> (i -> a -> f r) -> f () lens*Run monadic actions for each target of an  or 3 with access to the index, discarding the results.-When you don't need access to the index then % is more flexible in what it accepts.  l D  l    ::  m => + i s a -> (i -> a -> m r) -> s -> m ()  ::  m => - i s a -> (i -> a -> m r) -> s -> m ()  ::  m => , i s a -> (i -> a -> m r) -> s -> m ()  ::  m => ' i s a -> (i -> a -> m r) -> s -> m () lens*Run monadic actions for each target of an  or  with access to the index, discarding the results (with the arguments flipped).  D    -When you don't need access to the index then % is more flexible in what it accepts.  l a D  l a    ::  m => + i s a -> s -> (i -> a -> m r) -> m ()  ::  m => - i s a -> s -> (i -> a -> m r) -> m ()  ::  m => , i s a -> s -> (i -> a -> m r) -> m ()  ::  m => ' i s a -> s -> (i -> a -> m r) -> m () lens (i -> a -> [r]) -> s -> [r]  :: , i s a -> (i -> a -> [r]) -> s -> [r]  :: + i s a -> (i -> a -> [r]) -> s -> [r]  :: & i s a -> (i -> a -> [r]) -> s -> [r] lensThe  function takes an  or , a predicate that is also supplied the index, a structure and returns the left-most element of the structure matching the predicate, or  if there is no such element.-When you don't need access to the index then % is more flexible in what it accepts.  l D  l    ::  i s a -> (i -> a ->  ) -> s ->  a  ::  i s a -> (i -> a ->  ) -> s ->  a  ::  i s a -> (i -> a ->  ) -> s ->  a  ::  i s a -> (i -> a ->  ) -> s ->  a lensThe  function takes an  or , a monadic predicate that is also supplied the index, a structure and returns in the monad the left-most element of the structure matching the predicate, or  if there is no such element.-When you don't need access to the index then % is more flexible in what it accepts.  l D  l    ::  m =>  i s a -> (i -> a -> m  ) -> s -> m ( a)  ::  m =>  i s a -> (i -> a -> m  ) -> s -> m ( a)  ::  m =>  i s a -> (i -> a -> m  ) -> s -> m ( a)  ::  m =>  i s a -> (i -> a -> m  ) -> s -> m ( a) lensStrictly; fold right over the elements of a structure with an index.-When you don't need access to the index then % is more flexible in what it accepts.  l D  l    :: 0 i s a -> (i -> a -> r -> r) -> r -> s -> r  :: 2 i s a -> (i -> a -> r -> r) -> r -> s -> r  :: 1 i s a -> (i -> a -> r -> r) -> r -> s -> r  :: , i s a -> (i -> a -> r -> r) -> r -> s -> r lensFold over the elements of a structure with an index, associating to the left, but strictly.-When you don't need access to the index then % is more flexible in what it accepts.  l D  l    :: 2 i s a -> (i -> r -> a -> r) -> r -> s -> r  :: 4 i s a -> (i -> r -> a -> r) -> r -> s -> r  :: 3 i s a -> (i -> r -> a -> r) -> r -> s -> r  :: . i s a -> (i -> r -> a -> r) -> r -> s -> r lensMonadic fold right over the elements of a structure with an index.-When you don't need access to the index then % is more flexible in what it accepts.  l D  l    ::  m => 4 i s a -> (i -> a -> r -> m r) -> r -> s -> m r  ::  m => 6 i s a -> (i -> a -> r -> m r) -> r -> s -> m r  ::  m => 5 i s a -> (i -> a -> r -> m r) -> r -> s -> m r  ::  m => 0 i s a -> (i -> a -> r -> m r) -> r -> s -> m r lensMonadic fold over the elements of a structure with an index, associating to the left.-When you don't need access to the index then % is more flexible in what it accepts.  l D  l    ::  m => 4 i s a -> (i -> r -> a -> m r) -> r -> s -> m r  ::  m => 6 i s a -> (i -> r -> a -> m r) -> r -> s -> m r  ::  m => 5 i s a -> (i -> r -> a -> m r) -> r -> s -> m r  ::  m => 0 i s a -> (i -> r -> a -> m r) -> r -> s -> m r lens-Extract the key-value pairs from a structure.>When you don't need access to the indices in the result, then % is more flexible in what it accepts.  l D     l  ::  i s a -> s -> [(i,a)]  ::  i s a -> s -> [(i,a)]  ::  i s a -> s -> [(i,a)]  ::  i s a -> s -> [(i,a)] lensAn infix version of .lensPerform a safe  (with index) of an  or  or retrieve  the index and result from an  or . When using a  as a partial , or an  as a partial = this can be a convenient way to extract the optional value. ( ) :: s ->  i s a ->  (i, a) ( ) :: s ->  i s a ->  (i, a) ( ) :: s ->  i s a ->  (i, a) ( ) :: s ->  i s a ->  (i, a) lensPerform an *UNSAFE*  (with index) of an  or  assuming that it is there. ( ) :: s ->  i s a -> (i, a) ( ) :: s ->  i s a -> (i, a) ( ) :: s ->  i s a -> (i, a) ( ) :: s ->  i s a -> (i, a) lens4Retrieve the index of the first value targeted by a  or ! which is equal to a given value.  D    ::  a =>  i s a -> a -> s ->  i  ::  a =>  i s a -> a -> s ->  i lens1Retrieve the indices of the values targeted by a  or " which are equal to a given value.  D    ::  a =>  i s a -> a -> s -> [i]  ::  a =>  i s a -> a -> s -> [i] lens4Retrieve the index of the first value targeted by a  or  which satisfies a predicate.  D    ::  i s a -> (a ->  ) -> s ->  i  ::  i s a -> (a ->  ) -> s ->  i lens1Retrieve the indices of the values targeted by a  or  which satisfy a predicate.  D    ::  i s a -> (a -> ) -> s -> [i]  ::  i s a -> (a -> ) -> s -> [i] lens Filter an  or , obtaining an .4[0,0,0,5,5,5]^..traversed.ifiltered (\i a -> i <= a) [0,5,5,5] Compose with  to filter another ,  IndexedIso, ,  (or /) with access to both the value and the index.Note: As with  , this is not a legal , unless you are very careful not to invalidate the predicate on the target!lens Obtain an " by taking elements from another , ,  or  while a predicate holds.  :: (i -> a -> ) ->  i s a ->  i s a  :: (i -> a -> ) ->  i s a ->  i s a  :: (i -> a -> ) ->  i s a ->  i s a  :: (i -> a -> ) ->  i s a ->  i s a Note: Applying  to an  or - will still allow you to use it as a pseudo-, but if you change the value of any target to one where the predicate returns , then you will break the  laws and  fusion will no longer be sound.lens Obtain an # by dropping elements from another , ,  or  while a predicate holds.  :: (i -> a -> ) ->  i s a ->  i s a  :: (i -> a -> ) ->  i s a ->  i s a -- see notes  :: (i -> a -> ) ->  i s a ->  i s a -- see notes  :: (i -> a -> ) ->  i s a ->  i s a Note: As with  applying  to an  or - will still allow you to use it as a pseudo-, but if you change the value of the first target to one where the predicate returns , then you will break the  laws and ! fusion will no longer be sound.lensFold a value using a specified  and  operations. This is like 9 where the % instance can be manually specified.   D 9   :: ) s a -> (a -> a -> a) -> a -> s -> a  :: + s a -> (a -> a -> a) -> a -> s -> a  :: * s a -> (a -> a -> a) -> a -> s -> a  :: % s a -> (a -> a -> a) -> a -> s -> a  :: + s a -> (a -> a -> a) -> a -> s -> a 'foldByOf both (++) [] ("hello","world") "helloworld"lensFold a value using a specified  and  operations. This is like 8 where the % instance can be manually specified.   D 8   :: 5 s a -> (r -> r -> r) -> r -> (a -> r) -> s -> r  :: 7 s a -> (r -> r -> r) -> r -> (a -> r) -> s -> r  :: 1 s a -> (r -> r -> r) -> r -> (a -> r) -> s -> r  :: 6 s a -> (r -> r -> r) -> r -> (a -> r) -> s -> r  :: 7 s a -> (r -> r -> r) -> r -> (a -> r) -> s -> r /foldMapByOf both (+) 0 length ("hello","world")108998888888(C) 2012-16 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett  provisional Rank2Types Trustworthy'(->?pzlensAllows # of the value at the largest index.lens% of the element at the largest index.lensAllows ! the value at the smallest index.lens( of the element with the smallest index.lens type  f =  ( f) lens:When you see this as an argument to a function, it expectsto be indexed if p is an instance of s i,to be unindexed if p is (->),a  if f is ,a  if f is only a  and ,a  if f is only a ,a  if f is  and .lens type  =  ( i) lens type  =  ( i) lens>When you see this as an argument to a function, it expects an .lens>When you see this as an argument to a function, it expects an .lens type  =   lens=When you see this as an argument to a function, it expects a .lens type  =   lens=When you see this as an argument to a function, it expects a .lensBuild a  by providing a function which specifies the elements you wish to focus.'The caller provides a function of type: (Applicative f => (a -> f b) -> s -> f t Which is a higher order function which accepts a "focusing function" and applies it to all desired focuses within s, then constructs a t$ using the Applicative instance of f.Only elements which are "focused" using the focusing function will be targeted by the resulting traversal.For example, we can explicitly write a traversal which targets the first and third elements of a tuple like this: firstAndThird :: Traversal (a, x, a) (b, x, b) a b firstAndThird = traversal go where go :: Applicative f => (a -> f b) -> (a, x, a) -> f (b, x, b) go focus (a, x, a') = liftA3 (,,) (focus a) (pure x) (focus a') !(1,"two",3) & firstAndThird *~ 10 (10,"two",30)+over firstAndThird length ("one",2,"three")(3,2,5)We can re-use existing s when writing new ones by passing our focusing function along to them. This example re-uses  to focus all elements in a list which is embedded in a tuple. This traversal could also be written simply as  _2 . traverse. selectNested :: Traversal (x, [a]) (x, [b]) a b selectNested = traversal go where go :: Applicative f => (a -> f b) -> (x, [a]) -> f (x, [b]) go focus (x, as) = liftA2 (,) (pure x) (traverse focus as) 'selectNested .~ "hello" $ (1,[2,3,4,5])%(1,["hello","hello","hello","hello"])!(1,[2,3,4,5]) & selectNested *~ 3(1,[6,9,12,15])Note that the  function actually just returns the same function you pass to it. The function it accepts is in fact a valid traversal all on its own! The use of  does nothing except verify that the function it is passed matches the signature of a valid traversal. One could remove the  traversal combinator from either of the last two examples and use the definition of go& directly with no change in behaviour..This function exists for consistency with the , prism and iso constructors as well as to serve as a touchpoint for beginners who wish to construct their own traversals but are uncertain how to do so.lens.Map each element of a structure targeted by a  or , evaluate these actions from left to right, and collect the results.0This function is only provided for consistency,  is strictly more general.traverseOf each print (1,2,3)123 ((),(),())  D    l D  l  s    itraversed D  itraverse This yields the obvious law:  D    ::  f => * s t a b -> (a -> f b) -> s -> f t  ::  f => ) s t a b -> (a -> f b) -> s -> f t  ::  f => # s t a b -> (a -> f b) -> s -> f t  ::  f => $ s t a b -> (a -> f b) -> s -> f t lens A version of ' with the arguments flipped, such that:forOf each (1,2,3) print123 ((),(),())0This function is only provided for consistency,  is strictly more general.  D   D  .   for D    l s D for l s  s  ::  f => # s t a b -> s -> (a -> f b) -> f t  ::  f => # s t a b -> s -> (a -> f b) -> f t  ::  f => # s t a b -> s -> (a -> f b) -> f t lensEvaluate each action in the structure from left to right, and collect the results.sequenceAOf both ([1,2],[3,4])[(1,3),(1,4),(2,3),(2,4)]  D   D    l D  l  D l   ::  f =>  s t (f b) b -> s -> f t  ::  f =>  s t (f b) b -> s -> f t  ::  f =>  s t (f b) b -> s -> f t lens.Map each element of a structure targeted by a  to a monadic action, evaluate these actions from left to right, and collect the results.$mapMOf both (\x -> [x, x + 1]) (1,3)[(1,3),(1,4),(2,3),(2,4)]  D     l D forM l  s  ::  m => ) s t a b -> (a -> m b) -> s -> m t  ::  m => ( s t a b -> (a -> m b) -> s -> m t  ::  m => # s t a b -> (a -> m b) -> s -> m t lens is a flipped version of $, consistent with the definition of forM.$forMOf both (1,3) $ \x -> [x, x + 1][(1,3),(1,4),(2,3),(2,4)] forM D    l D  ( l)   l s D forM l s  s  ::  m => ) s t a b -> s -> (a -> m b) -> m t  ::  m => ( s t a b -> s -> (a -> m b) -> m t  ::  m => # s t a b -> s -> (a -> m b) -> m t lens-Sequence the (monadic) effects targeted by a # in a container from left to right.#sequenceOf each ([1,2],[3,4],[5,6])[(1,3,5),(1,3,6),(1,4,5),(1,4,6),(2,3,5),(2,3,6),(2,4,5),(2,4,6)]  D    l D  l   l D   l   ::  m =>  s t (m b) b -> s -> m t  ::  m =>  s t (m b) b -> s -> m t  ::  m =>  s t (m b) b -> s -> m t lensThis generalizes  to an arbitrary .Note:  handles ragged inputs more intelligently, but for non-ragged inputs:&transposeOf traverse [[1,2,3],[4,5,6]][[1,4],[2,5],[3,6]]  D    Since every  is a 9, we can use this as a form of monadic strength as well:   :: (b, [a]) -> [(b, a)] lensThis generalizes  to an arbitrary .  mapAccumR D      accumulates  from right to left.   ::  s t a b -> (acc -> a -> (acc, b)) -> acc -> s -> (acc, t)   ::  s t a b -> (acc -> a -> (acc, b)) -> acc -> s -> (acc, t)   :: ; s t a b -> (acc -> a -> (acc, b)) -> acc -> s -> (acc, t)   ::  ( ( acc)) s t a b -> (acc -> a -> (acc, b)) -> acc -> s -> (acc, t) lensThis generalizes  to an arbitrary .  mapAccumL D      accumulates  from left to right.   ::  s t a b -> (acc -> a -> (acc, b)) -> acc -> s -> (acc, t)   ::  s t a b -> (acc -> a -> (acc, b)) -> acc -> s -> (acc, t)   :: ; s t a b -> (acc -> a -> (acc, b)) -> acc -> s -> (acc, t)   ::  ( acc) s t a b -> (acc -> a -> (acc, b)) -> acc -> s -> (acc, t)   l f acc0 s =  ( (l (a ->  (acc ->  (f acc a))) s) acc0) lensThis permits the use of  over an arbitrary  or .  D      :: * s t a a -> (a -> a -> a) -> s -> t   :: ) s t a a -> (a -> a -> a) -> s -> t   :: $ s t a a -> (a -> a -> a) -> s -> t lensThis permits the use of  over an arbitrary  or .  D      :: * s t a a -> (a -> a -> a) -> s -> t   :: ) s t a a -> (a -> a -> a) -> s -> t   :: $ s t a a -> (a -> a -> a) -> s -> t lensThis  allows you to  the individual stores in a . lensThis  allows you to  the individual stores in a  with access to their indices. lens  turns a  into a ( that resembles an early version of the & (or &) type.Note: You should really try to maintain the invariant of the number of children in the list.!(a,b,c) & partsOf each .~ [x,y,z](x,y,z)Any extras will be lost. If you do not supply enough, then the remainder will come from the original structure.#(a,b,c) & partsOf each .~ [w,x,y,z](w,x,y)(a,b,c) & partsOf each .~ [x,y](x,y,c)+('b', 'a', 'd', 'c') & partsOf each %~ sort('a','b','c','d')So technically, this is only a 7 if you do not change the number of results it returns.When applied to a  the result is merely a .   ::  s a ->  s [a]   ::  s a ->  s [a]   ::  s a ->  s [a]   ::  s a ->  s [a]   ::  s a ->  s [a] lensAn indexed version of  7 that receives the entire list of indices as its index. lensA type-restricted version of   that can only be used with a . lensA type-restricted version of   that can only be used with an . lens  turns a  into a & (or & ) family. If you do not need the types of s and t2 to be different, it is recommended that you use  .+It is generally safer to traverse with the  rather than use this combinator. However, it is sometimes convenient.  s t [a] [b]   ::  s t a b ->  s t [a] [b]   ::  s t a b ->  s t [a] [b]   ::  s a ->  s [a]   ::  s a ->  s [a] lensAn indexed version of  7 that receives the entire list of indices as its index. lensThis converts a 7 that you "know" will target one or more elements to a 0. It can also be used to transform a non-empty  into a .The resulting  or ! will be partial if the supplied  returns no results.[1,2,3] ^. singular _head1Left (ErrorCall "singular: empty traversal") <- try (evaluate ([] ^. singular _head)) :: IO (Either ErrorCall ())Left 4 ^. singular _Left4[1..10] ^. singular (ix 7)8[] & singular traverse .~ 0[]   ::  s t a a ->  s t a a   ::  s a ->  s a   ::  i s t a a ->  i s t a a   ::  i s a ->  i s a lensThis converts a 3 that you "know" will target only one element to a &. It can also be used to transform a  into a .The resulting  or  will be partial if the + targets nothing or more than one element.Left (ErrorCall "unsafeSingular: empty traversal") <- try (evaluate ([] & unsafeSingular traverse .~ 0)) :: IO (Either ErrorCall [Integer])   ::  s t a b ->  s t a b   ::  s a ->  s a   ::  i s t a b ->  i s t a b   ::  i s a ->  i s a lensThe one-level version of '. This extracts a list of the immediate children according to a given  as editable contexts.Given a context you can use  to see the values,  at what the structure would be like with an edited result, or simply  the original structure. propChildren l x =  l x    (  l x) propId l x =  ( x) [ w | w <-   l x]   ::  s a -> s -> [ (->) a s]   ::  s a -> s -> [ (->) a s]   ::  s a -> s -> [ (->) a s]   ::  i s a -> s -> [ (s i) a s]   ::  i s a -> s -> [ (s i) a s] lensThe non-empty version of  . This extract a non-empty list of immediate children according to a given  as editable contexts.let head1 f s = runPretext (NonEmpty.head $ holes1Of traversed1 s) f('a' :| "bc") ^. head1'a' ('a' :| "bc") & head1 %~ toUpper 'A' :| "bc"   ::  s a -> s ->  ( (->) a s)   ::  s a -> s ->  ( (->) a s)   ::  s a -> s ->  ( (->) a s)   ::  i s a -> s ->  ( (s i) a s)   ::  i s a -> s ->  ( (s i) a s) lensTraverse both parts of a  container with matching types.&Usually that type will be a pair. Use /; to traverse the elements of arbitrary homogeneous tuples.(1,2) & both *~ 10(10,20)"over both length ("hello","world")(5,5)("hello","world")^.both "helloworld"   ::  (a, a) (b, b) a b   ::  ( a a) ( b b) a b lensTraverse both parts of a  container with matching types.!Usually that type will be a pair.   ::  (a, a) (b, b) a b   ::  ( a a) ( b b) a b lensApply a different  or  to each side of a  container.   ::  s t a b ->  s' t' a b ->  (r s s') (r t t') a b   ::  i s t a b ->  i s' t' a b ->  i (r s s') (r t t') a b   ::  s t a b ->  s' t' a b ->  (r s s') (r t t') a b    ::  s t a b ->  s' t' a b ->  (s,s') (t,t') a b   ::  s t a b -> " s' t' a b ->  (s,s') (t,t') a b   ::  s a -> " s' a ->  (s,s') a   ::  s a ->  s' a ->  (s,s') a    ::  i s t a b ->  i s' t' a b ->  i (s,s') (t,t') a b   ::  i s t a b ->  i s' t' a b ->  i (s,s') (t,t') a b   ::  i s a ->  i s' a ->  i (s,s') a   ::  i s a ->  i s' a ->  i (s,s') a    ::  s t a b ->  s' t' a b ->  (s,s') (t,t') a b   ::  s t a b ->  s' t' a b ->  (s,s') (t,t') a b   ::  s a ->  s' a ->  (s,s') a   ::  s a ->  s' a ->  (s,s') a .("hello",["world","!!!"])^..beside id traverse["hello","world","!!!"] lensVisit the first n targets of a , ,  or .=[("hello","world"),("!!!","!!!")]^.. taking 2 (traverse.both)["hello","world"]'timingOut $ [1..] ^.. taking 3 traverse[1,2,3]+over (taking 5 traverse) succ "hello world" "ifmmp world"   ::  ->  s a ->  s a   ::  ->  s a ->  s a   ::  ->  s a ->  s a   ::  ->  s a ->  s a   ::  ->  s a ->  s a   ::  ->  s a ->  s a   ::  ->  i s a ->  i s a   ::  ->  i s a ->  i s a   ::  ->  i s a ->  i s a   ::  ->  i s a ->  i s a lensVisit all but the first n targets of a , ,  or .$("hello","world") ^? dropping 1 both Just "world".Dropping works on infinite traversals as well:[1..] ^? dropping 1 foldedJust 2   ::  ->  s a ->  s a   ::  ->  s a ->  s a   ::  ->  s a ->  s a   ::  ->  s a ->  s a   ::  ->  s a ->  s a   ::  ->  s a ->  s a   ::  ->  i s a ->  i s a   ::  ->  i s a ->  i s a   ::  ->  i s a ->  i s a   ::  ->  i s a ->  i s a lensA 2 is completely characterized by its behavior on a . Cloning a  is one way to make sure you aren't given something weaker, such as a  and can be used as a way to pass around traversals that have to be monomorphic in f.!Note: This only accepts a proper  (or ). To clone a  as such, use ."Note: It is usually better to use  and  than to  . The former can execute at full speed, while the latter needs to round trip through the .let foo l a = (view (getting (cloneTraversal l)) a, set (cloneTraversal l) 10 a)foo both ("hello","world")("helloworld",(10,10))   ::  ( (->) a b) s t a b ->  s t a b lensClone a  yielding an 9 that passes through whatever index it is composed with. lens Clone an  yielding an  with the same index. lensA 2 is completely characterized by its behavior on a . lensClone a  yielding an 9 that passes through whatever index it is composed with. lens Clone an  yielding an  with the same index. lensTraversal with an index.NB: When you don't need access to the index then you can just apply your  directly as a function!   D   l =   l   =    ::  f => 0 i s t a b -> (i -> a -> f b) -> s -> f t   ::  f => + i s t a b -> (i -> a -> f b) -> s -> f t   ::  f => * i s t a b -> (i -> a -> f b) -> s -> f t lens3Traverse with an index (and the arguments flipped).  l a D   l a     D       ::  f => 0 i s t a b -> s -> (i -> a -> f b) -> f t   ::  f => + i s t a b -> s -> (i -> a -> f b) -> f t   ::  f => * i s t a b -> s -> (i -> a -> f b) -> f t lens.Map each element of a structure targeted by a  to a monadic action, evaluate these actions from left to right, and collect the results, with access its position.(When you don't need access to the index ' is more liberal in what it can accept.  l D   l     ::  m => 0 i s t a b -> (i -> a -> m b) -> s -> m t   ::  m => + i s t a b -> (i -> a -> m b) -> s -> m t   :: Bind m => * i s t a b -> (i -> a -> m b) -> s -> m t lens.Map each element of a structure targeted by a  to a monadic action, evaluate these actions from left to right, and collect the results, with access its position (and the arguments flipped).  l a D   l a     D       ::  m => / i s t a b -> s -> (i -> a -> m b) -> m t   ::  m => * i s t a b -> s -> (i -> a -> m b) -> m t lens Generalizes  to an arbitrary  with access to the index. & accumulates state from right to left.   l D   l     ::  i s t a b -> (i -> acc -> a -> (acc, b)) -> acc -> s -> (acc, t)   ::  i s t a b -> (i -> acc -> a -> (acc, b)) -> acc -> s -> (acc, t) lens Generalizes  to an arbitrary  with access to the index. & accumulates state from left to right.   l D   l     ::  i s t a b -> (i -> acc -> a -> (acc, b)) -> acc -> s -> (acc, t)   ::  i s t a b -> (i -> acc -> a -> (acc, b)) -> acc -> s -> (acc, t) lens Traverse any  container. This is an % that is indexed by ordinal position. lens Traverse any ? container. This is an % that is indexed by ordinal position. lens Traverse any  container. This is an % that is indexed by ordinal position. lensThis is the trivial empty .   ::  i s s a b    D   6 & ignored %~ absurd6 lens Traverse the nth   a ,  or  if it exists.2[[1],[3,4]] & elementOf (traverse.traverse) 1 .~ 5 [[1],[5,4]]*[[1],[3,4]] ^? elementOf (folded.folded) 1Just 3*timingOut $ ['a'..] ^?! elementOf folded 5'f'8timingOut $ take 10 $ elementOf traverse 3 .~ 16 $ [0..][0,1,2,16,4,5,6,7,8,9]   ::  s a ->  ->   s a   ::  s a ->  ->   s a lens Traverse the nth element of a  container.   D    lens*Traverse (or fold) selected elements of a  (or 2) where their ordinal positions match a predicate.   ::  s a -> ( -> ) ->   s a   ::  s a -> ( -> ) ->   s a lensTraverse elements of a ; container where their ordinal positions match a predicate.   D    lens Try to map a function over this , failing if the  has no targets..failover (element 3) (*2) [1,2] :: Maybe [Int]Nothing7failover _Left (*2) (Right 4) :: Maybe (Either Int Int)Nothing8failover _Right (*2) (Right 4) :: Maybe (Either Int Int)Just (Right 8)  ? :: Alternative m => Traversal s t a b -> (a -> b) -> s -> m t lens5Try to map a function which uses the index over this , failing if the  has no targets.   :: Alternative m => IndexedTraversal i s t a b -> (i -> a -> b) -> s -> m t lensTry the first  (or ), falling back on the second  (or ) if it returns no entries.This is only a valid  if the second  is disjoint from the result of the first or returns exactly the same results. These conditions are trivially met when given a , , , 6 or "affine" Traversal -- one that has 0 or 1 target.Mutatis mutandis for ."[0,1,2,3] ^? failing (ix 1) (ix 2)Just 1#[0,1,2,3] ^? failing (ix 42) (ix 2)Just 2   ::  s t a b ->  s t a b ->  s t a b   ::  s t a b ->  s t a b ->  s t a b   ::  s a ->  s a ->  s a These cases are also supported, trivially, but are boring, because the left hand side always succeeds.   ::  s t a b ->  s t a b ->  s t a b   ::  s t a b ->  s t a b ->  s t a b   ::  s t a b ->  s t a b ->  s t a b   ::  s a ->  s a ->  s a If both of the inputs are indexed, the result is also indexed, so you can apply this to a pair of indexed traversals or indexed folds, obtaining an indexed traversal or indexed fold.   ::  i s t a b ->  i s t a b ->  i s t a b   ::  i s a ->  i s a ->  i s a These cases are also supported, trivially, but are boring, because the left hand side always succeeds.   ::  i s t a b ->  i s t a b ->  i s t a b   ::  i s a ->  i s a ->  i s a lensTry the second traversal. If it returns no entries, try again with all entries from the first traversal, recursively.   ::  s s ->  s a ->  s a   ::  s s ->  s a ->  s a   ::  s t s t ->  s t a b ->  s t a b   ::  s s ->  i s a ->  i s a   ::  s t s t ->  i s t a b ->  i s t a b lensFuse a  by reassociating all of the ()/ operations to the left and fusing all of the  calls into one. This is particularly useful when constructing a  using operations from  GHC.Generics.Given a pair of s foo and bar,   (foo.bar) = foo.bar  However, foo and bar are each going to use the  they are given.  exploits the ' lemma to merge their separate uses of  into a single . and it further exploits an interesting property of the right Kan lift (or () to left associate all of the uses of ()1 to make it possible to fuse together more fmaps.:This is particularly effective when the choice of functor f) is unknown at compile time or when the  foo.bar in the above description is recursive or complex enough to prevent inlining.< is a version of this combinator suitable for fusing lenses.   ::  s t a b ->  s t a b lens'Traverse a container using a specified . This is like 7 where the " instance can be specified by any     D 7 lens'Sequence a container using a specified . This is like 7 where the " instance can be specified by any     D 6 67?>  ?>  7 6   5(C) 2012-16 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett  provisional Rank2Types Trustworthy?| lensThis provides a breadth-first  or  of the individual   of any other  or  via iterative deepening depth-first search. The levels are returned to you in a compressed format."This can permit us to extract the   directly:.["hello","world"]^..levels (traverse.traverse)[Zero,Zero,One () 'h',Two 0 (One () 'e') (One () 'w'),Two 0 (One () 'l') (One () 'o'),Two 0 (One () 'l') (One () 'r'),Two 0 (One () 'o') (One () 'l'),One () 'd']&But we can also traverse them in turn:7["hello","world"]^..levels (traverse.traverse).traverse "hewlolrold"=We can use this to traverse to a fixed depth in the tree of () used in the :["hello","world"] & taking 4 (levels (traverse.traverse)).traverse %~ toUpper["HEllo","World"]'Or we can use it to traverse the first n elements in found in that 3 regardless of the depth at which they were found.["hello","world"] & taking 4 (levels (traverse.traverse).traverse) %~ toUpper["HELlo","World"]The resulting  of the  ' which is indexed by the depth of each Y.7["dog","cat"]^@..levels (traverse.traverse) <. traverse1[(2,'d'),(3,'o'),(3,'c'),(4,'g'),(4,'a'),(5,'t')]   ::  s t a b ->   s t (Y () a) (Y () b)   ::  s a ->   s (Y () a) Note:4 Internally this is implemented by using an illegal <, as it extracts information in an order that violates the  laws. lensThis provides a breadth-first  or ( of the individual levels of any other  or  via iterative deepening depth-first search. The levels are returned to you in a compressed format.This is similar to  (, but retains the index of the original <, so you can access it when traversing the levels later on.;["dog","cat"]^@..ilevels (traversed<.>traversed).itraversed[((0,0),'d'),((0,1),'o'),((1,0),'c'),((0,2),'g'),((1,1),'a'),((1,2),'t')]The resulting 5 of the levels which is indexed by the depth of each Y.=["dog","cat"]^@..ilevels (traversed<.>traversed)<.>itraversed[((2,(0,0)),'d'),((3,(0,1)),'o'),((3,(1,0)),'c'),((4,(0,2)),'g'),((4,(1,1)),'a'),((5,(1,2)),'t')]   ::  i s t a b ->   s t (Y i a) (Y i b)   ::  i s a ->   s (Y i a) Note:4 Internally this is implemented by using an illegal <, as it extracts information in an order that violates the  laws.Y Y (C) 2012-16 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett  provisional Rank2Types Safe-Inferred >  lens type   =    lensReify a  + so it can be stored safely in a container. lens type   =    lens Reify an  + so it can be stored safely in a container. lens type   i =  (  i) lens Reify an  + so it can be stored safely in a container. lens type   =    lensReify a  + so it can be stored safely in a container. lensReify a  + so it can be stored safely in a container.;This can also be useful for creatively combining folds as   s is isomorphic to  ReaderT s []! and provides similar instances.;("hello","world")^..runFold ((,) <$> Fold _2 <*> Fold both)%[("world","hello"),("world","world")] lens Reify an  + so it can be stored safely in a container. lensReify a  + so it can be stored safely in a container.This can also be useful when combining getters in novel ways, as   is isomorphic to (->) and provides similar instances.("hello","world","!!!")^.runGetter ((,) <$> Getter _2 <*> Getter (_1.to length)) ("world",5) lens type   =    lens A form of  3 that can be stored monomorphically in a container. lens type   i =  (  i) lens Reify an  + so it can be stored safely in a container. lens type   i =  (  i) lens Reify an  + so it can be stored safely in a container. lens type   =    lensReify a  + so it can be stored safely in a container., , (C) 2013-2016 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett  experimental non-portable Safe-Inferred-.>?& lens There was an & caused by abusing the internals of a . lensBoth  exceptions and Control.Exception provide a  type.This lets us write combinators to build handlers that are agnostic about the choice of which of these they use. lensThis builds a ! for just the targets of a given [ (or any  , really).  ... [   G (s ->   "Assertion Failed\n"  s) ,   G (s ->   "Error\n"  s) ] This works ith both the  type provided by Control.Exception:   ::   a -> (a ->  r) ->  r   ::   a -> (a ->  r) ->  r   ::    a -> (a ->  r) ->  r   ::   a -> (a ->  r) ->  r   ::   a -> (a ->  r) ->  r  and with the  type provided by Control.Monad.Catch:   ::   a -> (a -> m r) ->  m r   ::   a -> (a -> m r) ->  m r   ::    a -> (a -> m r) ->  m r   ::   a -> (a -> m r) ->  m r   ::   a -> (a -> m r) ->  m r  and with the C type provided by Control.Monad.Error.Lens:   ::  e a -> (a -> m r) -> C e m r   ::  e a -> (a -> m r) -> C e m r   ::   e a -> (a -> m r) -> C e m r   ::  e a -> (a -> m r) -> C e m r   ::  e a -> (a -> m r) -> C e m r lensThis builds a ! for just the targets of a given  [ (or any , really). that ignores its input and just recovers with the stated monadic action.  ... [   G ( "looped") ,   G ( "overflow") ] This works with the  type provided by Control.Exception:   ::   a ->  r ->  r   ::   a ->  r ->  r   ::    a ->  r ->  r   ::   a ->  r ->  r   ::   a ->  r ->  r  and with the  type provided by Control.Monad.Catch:   ::   a -> m r ->  m r   ::   a -> m r ->  m r   ::    a -> m r ->  m r   ::   a -> m r ->  m r   ::   a -> m r ->  m r  and with the C type provided by Control.Monad.Error.Lens:   ::  e a -> m r -> C e m r   ::  e a -> m r -> C e m r   ::   e a -> m r -> C e m r   ::  e a -> m r -> C e m r   ::  e a -> m r -> C e m r   (C) 2012-16 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett  provisional Rank2Types Trustworthy'(? lens Compose an s& function with a non-indexed function.Mnemonically, the <, points to the indexing we want to preserve.let nestedMap = (fmap Map.fromList . Map.fromList) [(1, [(10, "one,ten"), (20, "one,twenty")]), (2, [(30, "two,thirty"), (40,"two,forty")])].nestedMap^..(itraversed<.itraversed).withIndex[(1,"one,ten"),(1,"one,twenty"),(2,"two,thirty"),(2,"two,forty")] lens'Compose a non-indexed function with an s function.Mnemonically, the >, points to the indexing we want to preserve.This is the same as ().f  g (and f   g) gives you the index of g unless g is index-preserving, like a ,  or 0, in which case it'll pass through the index of f.let nestedMap = (fmap Map.fromList . Map.fromList) [(1, [(10, "one,ten"), (20, "one,twenty")]), (2, [(30, "two,thirty"), (40,"two,forty")])].nestedMap^..(itraversed.>itraversed).withIndex[(10,"one,ten"),(20,"one,twenty"),(30,"two,thirty"),(40,"two,forty")] lensUse a value itself as its own index. This is essentially an indexed version of .Note: When used to modify the value, this can break the index requirements assumed by  + and similar, so this is only properly an , but it can be used as more.   :: a a b lensRemap the index. lensComposition of s functions.Mnemonically, the < and >9 points to the fact that we want to preserve the indices.let nestedMap = (fmap Map.fromList . Map.fromList) [(1, [(10, "one,ten"), (20, "one,twenty")]), (2, [(30, "two,thirty"), (40,"two,forty")])]/nestedMap^..(itraversed<.>itraversed).withIndex[((1,10),"one,ten"),((1,20),"one,twenty"),((2,30),"two,thirty"),((2,40),"two,forty")] lensComposition of s? functions with a user supplied function for combining indices. lensThis allows you to filter an , ,  or & based on a predicate on the indices.6["hello","the","world","!!!"]^..traversed.indices even["hello","world"]over (traversed.indices (>0)) Prelude.reverse $ ["He","was","stressed","o_O"]["He","saw","desserts","O_o"] lensThis allows you to filter an , ,  or  based on an index.0["hello","the","world","!!!"]^?traversed.index 2 Just "world" lensThe  for a %.,If you don't need access to the index, then % is more flexible in what it accepts. lensThe  of a , container.   ~ is a fold over the keys of a ,.Data.Map.fromList [(2, "hello"), (1, "world")]^..ifolded.asIndex[1,2] lensThe  of a . container.8 !"#%$,+*)('&.-stuvwxyz{|}~ 8vwxyzstu {|%$ ,+*)('& }~ .- #"!   9  9  9 (C) 2012-2016 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett  experimental non-portable Trustworthy? lensTraverse a strict  in a relatively balanced fashion, as a balanced tree with biased runs of elements at the leaves. lensTraverse a strict  in a relatively balanced fashion, as a balanced tree with biased runs of elements at the leaves, pretending the bytes are chars. lensAn # of the individual bytes in a lazy  lensAn # of the individual bytes in a lazy  pretending the bytes are chars.  (C) 2012-16 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett  provisional Rank2Types Trustworthy '(./ lensA   . lens>When you see this as an argument to a function, it expects an . lensProvides witness that (s ~ a, b ~ t) holds. lensExtract a witness of type . lensSubstituting types with . lens We can use " to do substitution into anything. lens is symmetric. lens8This is an adverb that can be used to modify many other  combinators to make them require simple lenses, simple traversals, simple prisms or simple isos as input. lensComposition with this isomorphism is occasionally useful when your , W or  has a constraint on an unused argument to force that argument to agree with the type of a used argument and avoid ScopedTypeVariables or other ugliness. lens Construct an ! from explicit equality evidence. lensA  version of  lens7Recover a "profunctor lens" form of equality. Reverses  . lensThe opposite of working   is working  . lensConvert a "profunctor lens" form of equality to an equality. Reverses  . The type should be understood as =fromLeibniz :: (forall p. p a b -> p s t) -> Equality s t a b lens/Convert Leibniz equality to equality. Reverses   in  cases. The type should be understood as 7fromLeibniz' :: (forall f. f s -> f a) -> Equality' s a lens A version of   that provides explicit, rather than implicit, equality evidence.   (C) 2012-16 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett  provisional0Rank2Types, TypeFamilies, FunctionalDependencies Trustworthy &./" lensA   . lens>When you see this as an argument to a function, it expects an . lens a and one from b -> t that characterize an . lens Convert from   back to any .This is useful when you need to store an isomorphism as a data type inside a container and later reconstitute it as an overloaded function.See g or 7 for more information on why you might want to do this. lens Based on #& from Conor McBride's work on Epigram.*This version is generalized to accept any  , not just a newtype.$au (_Wrapping Sum) foldMap [1,2,3,4]10You may want to think of this combinator as having the following, simpler type: 6au :: AnIso s t a b -> ((b -> t) -> e -> s) -> e -> a au = xplat . from lens Based on ala'& from Conor McBride's work on Epigram.*This version is generalized to accept any  , not just a newtype.'For a version you pass the name of the newtype constructor to, see #.auf (_Wrapping Sum) (foldMapOf both) Prelude.length ("hello","world")10Mnemonically, the German auf plays a similar role to  la, and the combinator is  ! with an extra function argument:   :: 7 s t a b -> ((r -> t) -> e -> s) -> (r -> b) -> e -> a but the signature is general.Note: The direction of the ' required for this function changed in lens( 4.18 to match up with the behavior of  . For the old behavior use   or for a version that is compatible across both old and new versions of lens you can just use ! lens  =   .   but with a nicer signature. lens  =   .   but with a nicer signature.xplatf (_Unwrapping Sum) (foldMapOf both) Prelude.length ("hello","world")10   :: 7 s t a b -> ((r -> a) -> e -> b) -> (r -> s) -> e -> t lensThe opposite of working  a  is working   an isomorphism.   D       ::  s t a b -> (t -> s) -> b -> a lensThis isomorphism can be used to convert to or from an instance of . LT^.from enum097^.enum :: Char'a'Note: this is only an isomorphism from the numeric range actually used and it is a bit of a pleasant fiction, since there are questionable  instances for , and  that exist solely for  [1.0 .. 4.0]' sugar and the instances for those and ( don't cover all values in their range. lensThis can be used to lift any  into an arbitrary . lensIf v is an element of a type a, and a' is a sans the element v, then   v is an isomorphism from  a' to a.   D     Keep in mind this is only a real isomorphism if you treat the domain as being  (a sans v).9This is practically quite useful when you want to have a 3 where all the entries should have non-zero values.4Map.fromList [("hello",1)] & at "hello" . non 0 +~ 2fromList [("hello",3)]4Map.fromList [("hello",1)] & at "hello" . non 0 -~ 1 fromList []0Map.fromList [("hello",1)] ^. at "hello" . non 01%Map.fromList [] ^. at "hello" . non 00This combinator is also particularly useful when working with nested maps.e.g.$ When you want to create the nested  when it is missing:  s t a b -> * (f a) (f b) (f s) (f t) contramapping ::  f =>  s a ->  (f a) (f s) lens Lift two s into both arguments of a / simultaneously.  dimapping :: / p =>  s t a b ->  s' t' a' b' -> 2 (p a s') (p b t') (p s a') (p t b') dimapping :: / p =>  s a ->  s' a' ->  (p a s') (p s a') lensLift an - contravariantly into the left argument of a /.  lmapping :: / p =>  s t a b -> - (p a x) (p b y) (p s x) (p t y) lmapping :: / p =>  s a ->  (p a x) (p s x) lensLift an * covariantly into the right argument of a /.  rmapping :: / p =>  s t a b -> - (p x s) (p y t) (p x a) (p y b) rmapping :: / p =>  s a ->  (p x s) (p x a) lens Lift two s into both arguments of a .  bimapping ::  p =>  s t a b ->  s' t' a' b' -> 2 (p s s') (p t t') (p a a') (p b b') bimapping ::  p =>  s a ->  s' a' ->  (p s s') (p a a') lensLift an  into the first argument of a .  firsting ::  p =>  s t a b -> - (p s x) (p t y) (p a x) (p b y) firsting ::  p =>  s a ->  (p s x) (p a x) lensLift an  into the second argument of a #. This is essentially the same as  , but it takes a 'Bifunctor p' constraint instead of a 'Functor (p a)' one.  seconding ::  p =>  s t a b -> . (p x s) (p y t) (p x a) (p y b) seconding ::  p =>  s a ->  (p x s) (p x a)  lens provisional non-portable Trustworthy&9w lensisn't _Empty [1,2,3]True  !(C) 2012-16 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett  experimental non-portable Trustworthy&>?= lensThis class provides a way to attach or detach elements on the right side of a structure in a flexible manner. lens   ::  [a] [b] ([a], a) ([b], b)   ::  ( a) ( b) ( a, a) ( b, b)   ::  ( a) ( b) ( a, a) ( b, b)   ::   (, )   ::   (, )   ::   (, ) lensThis class provides a way to attach or detach elements on the left side of a structure in a flexible manner. lens   ::  [a] [b] (a, [a]) (b, [b])   ::  ( a) ( b) (a,  a) (b,  b)   ::  ( a) ( b) (a,  a) (b,  b)   ::   (, )   ::   (, )   ::   (, ) lens  an element onto a container.This is an infix alias for  .a <| [][a] a <| [b, c][a,b,c]a <| Seq.fromList [] fromList [a]a <| Seq.fromList [b, c]fromList [a,b,c] lens  an element onto a container. cons a [][a] cons a [b, c][a,b,c]cons a (Seq.fromList []) fromList [a]cons a (Seq.fromList [b, c])fromList [a,b,c] lensAttempt to extract the left-most element from a container, and a version of the container without that element. uncons []Nothinguncons [a, b, c]Just (a,[b,c]) lensA  reading and writing to the  of a  non-empty container.[a,b,c]^? _headJust a[a,b,c] & _head .~ d[d,b,c][a,b,c] & _head %~ f [f a,b,c][] & _head %~ f[][1,2,3]^?!_head1 []^?_headNothing [1,2]^?_headJust 1[] & _head .~ 1[][0] & _head .~ 2[2][0,1] & _head .~ 2[2,1]This isn't limited to lists.For instance you can also  the head of a :#Seq.fromList [a,b,c,d] & _head %~ ffromList [f a,b,c,d]Seq.fromList [] ^? _headNothingSeq.fromList [a,b,c,d] ^? _headJust a   ::  [a] a   ::  ( a) a   ::  ( a) a lensA  reading and writing to the  of a  non-empty container.[a,b] & _tail .~ [c,d,e] [a,c,d,e][] & _tail .~ [a,b][]![a,b,c,d,e] & _tail.traverse %~ f[a,f b,f c,f d,f e][1,2] & _tail .~ [3,4,5] [1,3,4,5][] & _tail .~ [1,2][][a,b,c]^?_tail Just [b,c] [1,2]^?!_tail[2]"hello"^._tail"ello" ""^._tail""7This isn't limited to lists. For instance you can also  the tail of a .2Seq.fromList [a,b] & _tail .~ Seq.fromList [c,d,e]fromList [a,c,d,e]Seq.fromList [a,b,c] ^? _tailJust (fromList [b,c])Seq.fromList [] ^? _tailNothing   ::  [a] [a]   ::  ( a) ( a)   ::  ( a) ( a) lensA 7 reading and replacing all but the a last element of a  non-empty container.[a,b,c,d]^?_init Just [a,b,c] []^?_initNothing[a,b] & _init .~ [c,d,e] [c,d,e,b][] & _init .~ [a,b][][a,b,c,d] & _init.traverse %~ f[f a,f b,f c,d][1,2,3]^?_init Just [1,2][1,2,3,4]^?!_init[1,2,3]"hello"^._init"hell" ""^._init""   ::  [a] [a]   ::  ( a) ( a)   ::  ( a) ( a) lensA . reading and writing to the last element of a  non-empty container.[a,b,c]^?!_lastc []^?_lastNothing[a,b,c] & _last %~ f [a,b,f c] [1,2]^?_lastJust 2[] & _last .~ 1[][0] & _last .~ 2[2][0,1] & _last .~ 2[0,2]This  is not limited to lists, however. We can also work with other containers, such as a . Vector.fromList "abcde" ^? _lastJust 'e'Vector.empty ^? _lastNothing(Vector.fromList "abcde" & _last .~ 'Q') == Vector.fromList "abcdQ"True   ::  [a] a   ::  ( a) a   ::  ( a) a lens ( an element onto the end of a container.This is an infix alias for  .Seq.fromList [] |> a fromList [a]Seq.fromList [b, c] |> afromList [b,c,a]LazyT.pack "hello" |> '!'"hello!" lens ( an element onto the end of a container.snoc (Seq.fromList []) a fromList [a]snoc (Seq.fromList [b, c]) afromList [b,c,a]snoc (LazyT.pack "hello") '!'"hello!" lensAttempt to extract the right-most element from a container, and a version of the container without that element.unsnoc (LazyT.pack "hello!")Just ("hello",'!')unsnoc (LazyT.pack "")Nothingunsnoc (Seq.fromList [b,c,a])Just (fromList [b,c],a)unsnoc (Seq.fromList [])Nothing   5 5 5 5 5 5"(C) 2012-16 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett  experimental non-portable Safe-Inferred>S lensA Banker's deque based on Chris Okasaki's "Purely Functional Data Structures" lensO(1). Determine if a   is .&Control.Lens.Internal.Deque.null emptyTrue.Control.Lens.Internal.Deque.null (singleton 1)False lensO(1). Generate a singleton   singleton 1 BD 1 [1] 0 [] lensO(1). Calculate the size of a  size (fromList [1,4,6])3 lensO(n) amortized. Construct a   from a list of values.fromList [1,2]BD 1 [1] 1 [2]  #'(C) 2012-16 Edward Kmett, Michael Sloan BSD-style (see the file LICENSE)Edward Kmett  experimentalRank2, MPTCs, fundeps Trustworthy&.9>? lens  provides isomorphisms to wrap and unwrap newtypes or data types with one constructor. lensAn isomorphism between s and a.If your type has a  instance,   will default to  , and you can choose to not override it with your own definition. lensImplement the   operation for a type using its  instance. lensWork under a newtype wrapper.5Const "hello" & _Wrapped %~ Prelude.length & getConst5   D       D     lensGiven the constructor for a  3 type, return a deconstructor that is its inverse. Assuming the  $ instance is legal, these laws hold:   f  f D  f    f D  op Identity (Identity 4)4op Const (Const "hello")"hello" lens This is a convenient version of  ! with an argument that's ignored.The user supplied function is ignored, merely its type is used. lens This is a convenient version of  ! with an argument that's ignored.The user supplied function is ignored, merely its type is used. lens This is a convenient version of  ! with an argument that's ignored.The user supplied function is ignored, merely its types are used. lens This is a convenient version of  ! with an argument that's ignored.The user supplied function is ignored, merely its types are used. lensThis combinator is based on ala& from Conor McBride's work on Epigram.As with  0, the user supplied function for the newtype is ignored.ala Sum foldMap [1,2,3,4]10ala All foldMap [True,True]Trueala All foldMap [True,False]Falseala Any foldMap [False,False]Falseala Any foldMap [True,False]Trueala Product foldMap [1,2,3,4]24You may want to think of this combinator as having the following, simpler, type. ala :: Rewrapping s t => (Unwrapped s -> s) -> ((Unwrapped t -> t) -> e -> s) -> e -> Unwrapped s lensThis combinator is based on ala'& from Conor McBride's work on Epigram.As with  0, the user supplied function for the newtype is ignored. alaf :: Rewrapping s t => (Unwrapped s -> s) -> ((r -> t) -> e -> s) -> (r -> Unwrapped t) -> e -> Unwrapped s 1alaf Sum foldMap Prelude.length ["hello","world"]10 lensUse wrapping . unwrapping returns a sorted list. lensUse wrapping . unwrapping returns a sorted list. lensUse wrapping . unwrapping returns a sorted list. lensUse wrapping . unwrapping returns a sorted list. lensUse wrapping 2. Unwrapping returns some permutation of the list. lensUse wrapping 2. Unwrapping returns some permutation of the list.  $+(C) 2013-2016 Edward Kmett and Eric Mertens BSD-style (see the file LICENSE)Edward Kmett  experimental non-portableSafe lens%Apply arguments to a type constructorlensApply arguments to a functionlens-Construct a tuple type given a list of types.lens4Construct a tuple value given a list of expressions.lens3Construct a tuple pattern given a list of patterns.lens&Apply arguments to a type constructor.lens/Generate many new names from a given base name.lensDecompose an applied type into its individual components. For example, this: Either Int Char would be unfolded to this: ( ''Either, [ ''Int,  ''Char]) This function ignores explicit parentheses and visible kind applications.lensIn an effort to prevent users from having to enable KindSignatures every time that they use lens' TH functionality, we strip off reified kind annotations from when: The kind of a type does not contain any kind variables. If it *does* contain kind variables, we want to preserve them so that we can generate type signatures that preserve the dependency order of kind and type variables. (The data types in test/T917.hs contain examples where this is important.) This will require enabling , but since  implies 4, we can at least accomplish two things at once.The data type is not an instance of a data family. We make an exception for data family instances, since the presence or absence of a kind annotation can be the difference between typechecking or not. (See T917DataFam in tests/T917.hs for an example.) Moreover, the  extension implies .lensTemplate Haskell wants type variables declared in a forall, so we find all free type variables in a given type and declare them.lensThis function works like  except that it takes a list of variables to exclude from quantification.lens Convert a  into its corresponding .lens6Peel off a kind signature from a Type (if it has one).lens base name lenscount ++%(C) 2012-16 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett  provisional Rank2Types Trustworthy>?'lensThis class allows us to use  part of the environment, changing the environment supplied by many different  transformers. Unlike 4 this can change the environment of a deeply nested  transformer. Also, unlike ", this can be used with any valid , but cannot be used with a  or .lensRun a monadic action in a larger environment than it was defined in, using a .This acts like , but can in many cases change the type of the environment as well.3This is commonly used to lift actions in a simpler   into a  with a larger environment type.)This can be used to edit pretty much any - transformer stack with an environment in it:(1,2) & magnify _2 (+1)33flip Reader.runReader (1,2) $ magnify _1 Reader.ask1flip Reader.runReader (1,2,[10..20]) $ magnify (_3._tail) Reader.ask[11,12,13,14,15,16,17,18,19,20]The type can be read as 9 magnify :: LensLike' (Magnified m c) a b -> m c -> n c 8but the higher-rank constraints make it easier to apply magnify to a  in highly-polymorphic code.  ::  s a -> (a -> r) -> s -> r  ::  r =>  s a -> (a -> r) -> s -> r  ::  w =>  s t ->  t w st c ->  s w st c  :: ( w,  c) =>  s a ->  a w st c ->  s w st c ... lensThis class allows us to use  in, changing the  supplied by many different , transformers, potentially quite deep in a  transformer stack.lens!Run a monadic action in a larger " than it was defined in, using a  or .3This is commonly used to lift actions in a simpler   into a   with a larger  type.When applied to a  over multiple values, the actions for each target are executed sequentially and the results are aggregated.)This can be used to edit pretty much any  transformer stack with a  in it!-flip State.evalState (a,b) $ zoom _1 $ use ida.flip State.execState (a,b) $ zoom _1 $ id .= c(c,b) f d <> mempty,[(a,f b),(c,f d)])/flip State.evalState (a,b) $ zoom both (use id)a <> b  ::  m =>  s t ->  t m a ->  s m a  :: ( m,  c) =>  s t ->  t m c ->  s m c  :: ( m,  w) =>  s t ->  r w t m c ->  r w s m c  :: ( m,  w,  c) =>  s t ->  r w t m c ->  r w s m c  :: ( m,  w,  e) =>  s t ->  e ( r w t m) c ->  e ( r w s m) c  :: ( m,  w,  c,  e) =>  s t ->  e ( r w t m) c ->  e ( r w s m) c ... lensThis type family is used by $ to describe the common effect type.lensThis type family is used by $ to describe the common effect type.lens  =  22&7(C) 2012-2016 Edward Kmett, (C) 2006-2012 Neil Mitchell BSD-style (see the file LICENSE)Edward Kmett  experimental Rank2Types Trustworthy '(?u lensA generic applicative transformation that maps over the immediate subterms. is to  what  is to This really belongs in  Data.Data.lensNave  using 2. This does not attempt to optimize the traversal.This is primarily useful when the children are immediately obvious, and for benchmarking.lens&Find every occurrence of a given type a recursively that doesn't require passing through something of type a using , while avoiding traversal of areas that cannot contain a value of type a.This is  with a more liberal signature.lensFind descendants of type a non-transitively, while avoiding computation of areas that cannot contain values of type a using .$ is a useful default definition for 'lens performs like , except when s ~ a%, it returns itself and nothing else.lens This automatically constructs a  from an function.(2,4) & upon fst *~ 5(10,4) (s -> a) ->  [Int] s alensThe design of 5 doesn't allow it to search inside of values of type a for other values of type a. $ provides this additional recursion.Like , - trusts the user supplied function more than  using it directly as the accessor. This enables reading from the resulting  to be considerably faster at the risk of generating an illegal lens.(upon' (tail.tail) .~ [10,20] $ [1,2,3,4] [1,2,10,20]lens This automatically constructs a  from a field accessor.The index of the  can be used as an offset into   ({ ) or into the list returned by   .The design of 5 doesn't allow it to search inside of values of type a for other values of type a.  provides this additional recursion, but at the expense of performance.2onceUpon (tail.tail) .~ [10,20] $ [1,2,3,4] -- BAD [1,10,20]/upon (tail.tail) .~ [10,20] $ [1,2,3,4] -- GOOD [1,2,10,20]When in doubt, use  instead.lensThis more trusting version of 1 uses your function directly as the getter for a .This means that reading from  is considerably faster than ./However, you pay for faster access in two ways: 'When passed an illegal field accessor,  will give you a , that quietly violates the laws, unlike , which will give you a legal " that avoids modifying the target.Modifying with the lens is slightly slower, since it has to go back and calculate the index after the fact.4When given a legal field accessor, the index of the  can be used as an offset into   (w ) or into the list returned by   .When in doubt, use  instead.  '(C) 2012-16 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett  provisional Rank2Types Trustworthy .9>?L|5lensA  type is one where we know how to extract its immediate self-similar children. Example 1: import Control.Applicative import Control.Lens import Control.Lens.Plated import Data.Data import Data.Data.Lens ()  data Expr = Val , | Neg Expr | Add Expr Expr deriving (,,,,)   instance  Expr where  f (Neg e) = Neg  f e  f (Add a b) = Add  f a  f b  _ a =  a or  instance  Expr where  =   Example 2: import Control.Applicative import Control.Lens import Control.Lens.Plated import Data.Data import Data.Data.Lens ()    (Tree a) where  =  ;Note the big distinction between these two implementations.The former will only treat children directly in this tree as descendents, the latter will treat trees contained in the values under the tips also as descendants!When in doubt, pick a  and just use the various ...Of" combinators rather than pollute  with orphan instances!>If you want to find something unplated and non-recursive with  use the ...OnOf variant with  , though those usecases are much better served in most cases by using the existing  combinators! e.g.   D     )This same ability to explicitly pass the 8 in question is why there is no analogue to uniplate's Biplate.Moreover, since we can allow custom traversals, we implement reasonable defaults for polymorphic data types, that only  into themselves, and not their polymorphic arguments.lens- of the immediate children of this structure.5If you're using GHC 7.2 or newer and your type has a  instance,  will default to  and you can choose to not override it with your own definition.lensCompose through a platelens  s a ->  s a  ::  s =>  s a ->  s a  ::  s =>  s s a b ->  s s a b  ::  s =>  s s a b ->  s s a b lens'Extract the immediate descendants of a  container.  D   lensRewrite by applying a rule everywhere you can. Ensures that the rule cannot be applied anywhere in the result: propRewrite r x =  (  r) ( ( r x)) Usually  is more appropriate, but  can give better compositionality. Given two single transformations f and g, you can construct  \a -> f a  g a2 which performs both rewrites until a fixed point.lensRewrite by applying a rule everywhere you can. Ensures that the rule cannot be applied anywhere in the result: propRewriteOf l r x =  (  r) ( l ( l r x)) Usually  is more appropriate, but  can give better compositionality. Given two single transformations f and g, you can construct  \a -> f a  g a2 which performs both rewrites until a fixed point.  ::   a a -> (a ->  a) -> a -> a  ::  a a -> (a ->  a) -> a -> a  ::  a a -> (a ->  a) -> a -> a  ::  a a -> (a ->  a) -> a -> a lens4Rewrite recursively over part of a larger structure.  ::  a =>   s a -> (a ->  a) -> s -> s  ::  a =>  s a -> (a ->  a) -> s -> s  ::  a =>  s a -> (a ->  a) -> s -> s  ::  a =>  s a -> (a ->  a) -> s -> s lensRewrite recursively over part of a larger structure using a specified .  ::   s a ->   a a -> (a ->  a) -> s -> s  ::  s a ->  a a -> (a ->  a) -> s -> s  ::  s a ->  a a -> (a ->  a) -> s -> s  ::  s a ->  a a -> (a ->  a) -> s -> s lensRewrite by applying a monadic rule everywhere you can. Ensures that the rule cannot be applied anywhere in the result.lensRewrite by applying a monadic rule everywhere you recursing with a user-specified . Ensures that the rule cannot be applied anywhere in the result.lensRewrite by applying a monadic rule everywhere inside of a structure located by a user-specified . Ensures that the rule cannot be applied anywhere in the result.lensRewrite by applying a monadic rule everywhere inside of a structure located by a user-specified , using a user-specified  for recursion. Ensures that the rule cannot be applied anywhere in the result.lens0Retrieve all of the transitive descendants of a  container, including itself.lensGiven a  that knows how to locate immediate children, retrieve all of the transitive descendants of a node, including itself.  ::  a a -> a -> [a] lensGiven a  that knows how to find  parts of a container retrieve them and all of their descendants, recursively.lensGiven a  that knows how to locate immediate children, retrieve all of the transitive descendants of a node, including itself that lie in a region indicated by another .  l D  l   lens*Fold over all transitive descendants of a  container, including itself.lensGiven a  that knows how to locate immediate children, fold all of the transitive descendants of a node, including itself.  ::  a a ->  a a lensGiven a  that knows how to find  parts of a container fold them and all of their descendants, recursively.  ::  a =>  s a ->  s a lensGiven a  that knows how to locate immediate children, fold all of the transitive descendants of a node, including itself that lie in a region indicated by another .  ::  s a ->  a a ->  s a lens;Transform every element in the tree, in a bottom-up manner.7For example, replacing negative literals with literals:  negLits = ) $ \x -> case x of Neg (Lit i) -> Lit ( i) _ -> x lensTransform every element in the tree in a bottom-up manner over a region indicated by a .  ::  a =>  s a -> (a -> a) -> s -> s  ::  a =>  s a -> (a -> a) -> s -> s lens8Transform every element by recursively applying a given  in a bottom-up manner.  ::  a a -> (a -> a) -> a -> a  ::  a a -> (a -> a) -> a -> a lens3Transform every element in a region indicated by a ! by recursively applying another  in a bottom-up manner.  ::  s a ->  a a -> (a -> a) -> s -> s  ::  s a ->  a a -> (a -> a) -> s -> s lensTransform every element in the tree, in a bottom-up manner, monadically.lensTransform every element in the tree in a region indicated by a supplied %, in a bottom-up manner, monadically.  :: ( m,  a) =>  s a -> (a -> m a) -> s -> m s lens8Transform every element in a tree using a user supplied - in a bottom-up manner with a monadic effect.  ::  m =>  a a -> (a -> m a) -> a -> m a lensTransform every element in a tree that lies in a region indicated by a supplied , walking with a user supplied . in a bottom-up manner with a monadic effect.  ::  m =>  s a ->  a a -> (a -> m a) -> s -> m s lensReturn a list of all of the editable contexts for every location in the structure, recursively. propUniverse x =  x    ( x) propId x =  ( x) [ w | w <-  x]  D   lensReturn a list of all of the editable contexts for every location in the structure, recursively, using a user-specified  to walk each layer. propUniverse l x =  l x    ( l x) propId l x =  ( x) [ w | w <-  l x]  ::  a a -> a -> [ a a a] lensReturn a list of all of the editable contexts for every location in the structure in an areas indicated by a user supplied , recursively using .  b D  b   ::  a =>  s a -> s -> [ a a s] lensReturn a list of all of the editable contexts for every location in the structure in an areas indicated by a user supplied +, recursively using another user-supplied  to walk each layer.  ::  s a ->  a a -> s -> [ a a s] lensThe one-level version of . This extracts a list of the immediate children as editable contexts.Given a context you can use  to see the values,  at what the structure would be like with an edited result, or simply  the original structure. propChildren x =  l x    ( l x) propId x =  ( x) [ w | w <-  l x]  =    lens An alias for  6, provided for consistency with the other combinators.  D    ::  s a -> s -> [ (->) a a s]  ::  s a -> s -> [ (->) a a s]  ::  s a -> s -> [ (->) a a s]  ::  i s a -> s -> [ ( i) a a s]  ::  i s a -> s -> [ ( i) a a s] lensExtract one level of / from a container in a region specified by one , using another.  b l D   (b  l)  ::  s a ->  a a -> s -> [ (->) a a s]  ::  s a ->  a a -> s -> [ (->) a a s]  ::  s a ->  a a -> s -> [ (->) a a s]  ::  s a ->  i a a -> s -> [ ( i) a a s]  ::  s a ->  i a a -> s -> [ ( i) a a s] lensPerform a fold-like computation on each value, technically a paramorphism.  :: " a a -> (a -> [r] -> r) -> a -> r lensPerform a fold-like computation on each value, technically a paramorphism.  D   lens!Fold the immediate children of a  container.  z c f =   (c  f) z lens The original uniplate% combinator, implemented in terms of  as a .  D    The resulting  is safer to use as it ignores 'over-application' and deals gracefully with under-application, but it is only a proper  if you don't change the list !lens Implement  operation for a type using its  instance..Note: the behavior may be different than with  in some special cases.  doesn't look through other types in a group of mutually recursive types.For example consider mutually recursive even and odd natural numbers:data Even = Z | E Odd deriving (Show, Generic, Data); data Odd = O Even deriving (Show, Generic, Data)Then , which is based on 2, finds all even numbers less or equal than four: import Data.Data.Lens (uniplate)%universeOf uniplate (E (O (E (O Z)))) (O (E (O Z))),E (O Z),Z]but  doesn't see through Odd.#universeOf gplate (E (O (E (O Z))))[E (O (E (O Z)))] If using  is not an option, you can still write the traversal manually. It is sometimes useful to use helper traversals:{"let oddeven :: Traversal' Odd Even oddeven f (O n) = O <$> f n% evenplate :: Traversal' Even Even evenplate f Z = pure Z) evenplate f (E n) = E <$> oddeven f n:}&universeOf evenplate (E (O (E (O Z)))) (O (E (O Z))),E (O Z),Z]lens Implement  operation for a type using its  instance.lensignoredlensrecursive match under outer  instancelensignoredlensmatchlensignoredlensignoredlensignoredlensignoredlensrecursive matchlensrecursive matchlensrecursive match,,9 ((C) 2012-16 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett  provisionalportable Safe-InferredPlensThis % can be used to change the type of a ( by mapping the elements to new values. Sadly, you can't create a valid  for a Set., but you can manipulate it by reading using   and reindexing it via .lensConstruct a set from a ,  Y, W, \ or  O.  ::  a =>  s a -> s ->  a  :: ( a,  a) =>  s a -> s ->  a  ::  a =>  s a -> s ->  a  ::  a =>  s a -> s ->  a  :: ( a,  a) =>  s a -> s ->  a lensAn  between a  and a  with unit values. \mathcal{O}(1).(C) 2012-16 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett  provisionalportable Safe-InferredQRR)(C) 2014-2016 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett  experimental non-portable Safe-InferredUlensConstruct a map from a  IndexedGetter,  Z, X or ]%The construction is left-biased (see ), i.e. the first occurrences of keys in the fold or traversal order are preferred.!toMapOf folded ["hello", "world"]"fromList [(0,"hello"),(1,"world")]8toMapOf (folded . ifolded) [('a',"alpha"),('b', "beta")]%fromList [('a',"alpha"),('b',"beta")]*toMapOf (folded <.> folded) ["foo", "bar"]fromList [((0,0),'f'),((0,1),'o'),((0,2),'o'),((1,0),'b'),((1,1),'a'),((1,2),'r')]?toMapOf ifolded $ Map.fromList [('a', "hello"), ('b', "world")]&fromList [('a',"hello"),('b',"world")]  ::  IndexedGetter i s a -> s ->  i a  ::  i =>  IndexedFold i s a -> s ->  i a  ::  IndexedLens' i s a -> s ->  i a  ::  i => IndexedTraversal' i s a -> s ->  i a *(C) 2012-16 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett  provisionalportable TrustworthyYlensThis % can be used to change the type of a ( by mapping the elements to new values. Sadly, you can't create a valid  for a ., but you can manipulate it by reading using   and reindexing it via .,over setmapped (+1) (Set.fromList [1,2,3,4])fromList [2,3,4,5]lensConstruct a set from a ,  Y, W, \ or  O.setOf folded ["hello","world"]fromList ["hello","world"]5setOf (folded._2) [("hello",1),("world",2),("!!!",3)]fromList [1,2,3]  ::  s a -> s ->  a  ::  a =>  s a -> s ->  a  ::  s a -> s ->  a  ::  s a -> s ->  a  ::  a =>  s a -> s ->  a +(C) 2012-2016 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett  experimental non-portableNone&>?`Wlens This isomorphism can be used to pack (or unpack) lazy ."hello"^.packed -- :: Text"hello" pack x D x   unpack x D x      D    lens This isomorphism can be used to unpack (or pack) lazy ."hello"^.unpacked -- :: String"hello" pack x D x     unpack x D x   This  is provided for notational convenience rather than out of great need, since  D    lensThis is an alias for * that makes it clearer how to use it with ().  =    _Text # "hello" -- :: Text"hello"lensConvert between lazy  and  .  fromLazyText x D x    toLazyText x D x     lens(Traverse the individual characters in a .anyOf text (=='c') "chello"True  =  .   When the type is unambiguous, you can also use the more general each.  D each $Note that when just using this as a ,   can be more efficient.lensEncode/Decode a lazy  to/from lazy  , via UTF-8.Note: This function does not decode lazily, as it must consume the entire input before deciding whether or not it fails.ByteString.unpack (utf8 # "L") [226,152,131],(C) 2012-2016 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett  experimental non-portableNone&?flens This isomorphism can be used to pack (or unpack ) strict ."hello"^.packed -- :: Text"hello" pack x D x   unpack x D x      D     D   pack unpack lens This isomorphism can be used to unpack (or pack) lazy ."hello"^.unpacked -- :: String"hello"This  is provided for notational convenience rather than out of great need, since  D    pack x D x     unpack x D x    D   unpack pack lensThis is an alias for / that makes it more obvious how to use it with  > _Text # "hello" -- :: Text"hello"lensConvert between strict  and  . fromText x D x    ( toLazyText x) D x     lens-Traverse the individual characters in strict .anyOf text (=='o') "hello"TrueWhen the type is unambiguous, you can also use the more general each.  D  .    D each $Note that when just using this as a ,   can be more efficient.lensEncode/Decode a strict  to/from strict  , via UTF-8. utf8 # "L""\226\152\131"-(C) 2012-16 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett  experimental non-portableNone&>?klensTraversals for strict or lazy lens This isomorphism can be used to pack (or unpack) strict or lazy . pack x D x   unpack x D x      D    lensConvert between strict or lazy  and a . fromText x D x   lens5Traverse the individual characters in strict or lazy .  =  .   lens This isomorphism can be used to unpack (or pack) both strict or lazy . unpack x D x   pack x D x     This  is provided for notational convenience rather than out of great need, since  D    lensThis is an alias for * that makes it clearer how to use it with ().  =    _Text # "hello" :: Strict.Text"hello".(C) 2012-2016 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett  provisional non-portable Trustworthy?r lens sliced i n provides a  that edits the n elements starting at index i from a .This is only a valid 3 if you do not change the length of the resulting .Attempting to return a longer or shorter vector will result in violations of the  laws.Vector.fromList [1..10] ^. sliced 2 5 == Vector.fromList [3,4,5,6,7]True(Vector.fromList [1..10] & sliced 2 5 . mapped .~ 0) == Vector.fromList [1,2,0,0,0,0,0,8,9,10]Truelens Similar to , but returning a .(toVectorOf both (8,15) :: Vector.Vector Int) == Vector.fromList [8,15]TruelensConvert a list to a  (or back.)([1,2,3] ^. vector :: Vector.Vector Int) == Vector.fromList [1,2,3]True'Vector.fromList [0,8,15] ^. from vector[0,8,15]lens Convert a  to a finite  (or back.)lens Convert a  to a finite  from right to left (or back.)lens Convert a  back and forth to an initializer that when run produces a copy of the .lens Convert a 4 to a version that doesn't retain any extra memory.lensThis = will ignore any duplicates in the supplied list of indices.>toListOf (ordinals [1,3,2,5,9,10]) $ Vector.fromList [2,4..40][4,8,6,12,20,22]lensLike ix$ but polymorphic in the vector type.lens.Indexed vector traversal for a generic vector.lens>Different vector implementations are isomorphic to each other.lensi starting indexlensn length  /(C) 2012-16 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett  experimental non-portable Trustworthy'(9>?|8#lensExtract 2 element of a (potentially monomorphic) container.3Notably, when applied to a tuple, this generalizes  ! to arbitrary homogeneous tuples.(1,2,3) & each *~ 10 (10,20,30)3It can also be used on monomorphic containers like  or .-over each Char.toUpper ("hello"^.Text.packed)"HELLO"-("hello","world") & each.each %~ Char.toUpper("HELLO","WORLD")lenslenslenslenslenslens  :: ( i,   a,   b) =>  ( i a) ( i b) a blens  ::  i =>  ( i a) ( i b) a blens  ::     lens  ::     lens  ::     lens  ::     lens  :: ( a,  b) =>  ( a) ( b) a blens  :: ( a,  b) =>  ( a) ( b) a blens  :: ( a,  b) =>  ( a) ( b) a blens  ::  ( a) ( b) a blens  ::  ( a) ( b) a blens  ::  ( a) ( b) a blens  ::  ( a a) ( b b) a blens  ::  ( a) ( b) a blens  ::  (  a) (  b) a blens  ::  (NonEmpty a) (NonEmpty b) a blens  ::  [a] [b] a blens  ::  ( c a) ( c b) a blens  ::  ( c a) ( c b) a blens  ::  ( c a) ( c b) a blens  :: ( a,  b) =>  ( a) ( b) a blens  :: , (a,a,a,a,a,a,a,a,a) (b,b,b,b,b,b,b,b,b) a blens  :: ( (a,a,a,a,a,a,a,a) (b,b,b,b,b,b,b,b) a blens  :: $ (a,a,a,a,a,a,a) (b,b,b,b,b,b,b) a blens  ::  (a,a,a,a,a,a) (b,b,b,b,b,b) a blens  ::  (a,a,a,a,a) (b,b,b,b,b) a blens  ::  (a,a,a,a) (b,b,b,b) a blens  ::  (a,a,a) (b,b,b) a blens  ::  (a,a) (b,b) a b0(C) 2012-16 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett  experimental non-portable Trustworthy'(9>?lens provides a  that can be used to read, write or delete the value associated with a key in a $-like container on an ad hoc basis.An instance of  should satisfy:  k D  k   lens!Map.fromList [(1,"world")] ^.at 1 Just "world"at 1 ?~ "hello" $ Map.emptyfromList [(1,"hello")]Note: 5-like containers form a reasonable instance, but not *-like ones, where you cannot satisfy the  laws.lensProvides a simple  lets you  the value at a given key in a 0 or element at an ordinal position in a list or .lensNB: Setting the value of this  will only set the value in  if it is already present.!If you want to be able to insert missing values, you want ."Seq.fromList [a,b,c,d] & ix 2 %~ ffromList [a,b,f c,d]"Seq.fromList [a,b,c,d] & ix 2 .~ efromList [a,b,e,d]Seq.fromList [a,b,c,d] ^? ix 2Just cSeq.fromList [] ^? ix 2NothinglensThis provides a common notion of a value at an index that is shared by both  and .lensThis class provides a simple  that lets you view (and modify) information about whether or not a container contains a given .lens'IntSet.fromList [1,2,3,4] ^. contains 3True'IntSet.fromList [1,2,3,4] ^. contains 5False/IntSet.fromList [1,2,3,4] & contains 3 .~ FalsefromList [1,2,4]lensAn indexed version of .)IntSet.fromList [1,2,3,4] ^@. icontains 3(3,True))IntSet.fromList [1,2,3,4] ^@. icontains 5 (5,False)IntSet.fromList [1,2,3,4] & icontains 3 %@~ \i x -> if odd i then not x else xfromList [1,2,4]IntSet.fromList [1,2,3,4] & icontains 3 %@~ \i x -> if even i then not x else xfromList [1,2,3,4]lensAn indexed version of .%Seq.fromList [a,b,c,d] & iix 2 %@~ f'fromList [a,b,f' 2 c,d]$Seq.fromList [a,b,c,d] & iix 2 .@~ hfromList [a,b,h 2,d] Seq.fromList [a,b,c,d] ^@? iix 2 Just (2,c)Seq.fromList [] ^@? iix 2NothinglensA definition of  for types with an  instance. This is the default if you don't specify a definition for .lens,Delete the value associated with a key in a -like container  k =  k .~ Nothing lensAn indexed version of .$Map.fromList [(1,"world")] ^@. iat 1(1,Just "world")iat 1 %@~ (\i x -> if odd i then Just "hello" else Nothing) $ Map.emptyfromList [(1,"hello")]iat 2 %@~ (\i x -> if odd i then Just "hello" else Nothing) $ Map.empty fromList []lens  ::  ->  (a,a,a,a,a,a,a,a,a) alens  ::  ->  (a,a,a,a,a,a,a,a) alens  ::  ->  (a,a,a,a,a,a,a) alens  ::  ->  (a,a,a,a,a,a) alens  ::  ->  (a,a,a,a,a) alens  ::  ->  (a,a,a,a) alens  ::  ->  (a,a,a) alens  ::  ->  (a,a) alens arr  i D arr   i arr  [(i,e)] D  i  e  arr lens arr  i D arr   i arr  [(i,e)] D  i  e  arr  1(C) 2012-2016 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett  experimentalTemplateHaskell Trustworthy>lensProvides substitution for typeslensPerform substitution for typeslensProvides for the extraction of free type variables, and alpha renaming.lensWhen performing substitution into this traversal you're not allowed to substitute in a name that is bound internally or you'll violate the . laws, when in doubt generate your names with .lensContains some amount of s insidelensTraverse all the typeslensHas a lensExtract (or modify) the  of somethinglens Traverse free type variableslens'Substitute using a map of names in for free type variableslens Provides a - of the types of each field of a constructor.lens of the types of the named fields of a constructor.lens _TySynInstD ::   6 -- template-haskell-2.15+ _TySynInstD ::   (, :) -- template-haskell-2.9 through 2.14 _TySynInstD ::   (, [], ) -- Earlier versions lens _StandaloneDerivD ::   ( , , 1) -- template-haskell-2.12+ _StandaloneDerivD ::   (, ) -- Earlier versions lens _DataInstD ::   (,  [], ,  , [], [+]) -- template-haskell-2.15+ _DataInstD ::   (, , [],  , [], [7]) -- template-haskell-2.12 through 2.14 _DataInstD ::   (, , [],  , [],  ) -- Earlier versions lens _NewtypeInstD ::   (,  [], ,  , , [.]) -- template-haskell-2.15+ _NewtypeInstD ::   (, , [],  , , [:]) -- template-haskell-2.12 through 2.14 _NewtypeInstD ::   (, , [],  , ,  ) -- Earlier versions lens  _DataD ::   (, , [],  , [], [']) -- template-haskell-2.12+ _DataD ::   (, , [ ],  , [],  ) -- Earlier versions lens  _NewtypeD ::   (, , [],  , , [*]) -- template-haskell-2.12+ _NewtypeD ::   (, , [ ],  , ,  ) -- Earlier versions lens  _RuleP ::   (,  [], [], , , &) -- template-haskell-2.15+ _RuleP ::   (, [], , , ) -- Earlier versions lens  _TupE ::   [ %] -- template-haskell-2.16+ _TupE ::   [] -- Earlier versions lens _UnboxedTupE ::   [ ,] -- template-haskell-2.16+ _UnboxedTupE ::   [] -- Earlier versions lens _DoE ::   ( , [%]) -- template-haskell-2.17+ _DoE ::   ['] -- Earlier versions lens  _MDoE ::   ( , [&]) -- template-haskell-2.17+ _MDoE ::   ['] -- Earlier versions lens  _ConP ::   (, [], [&]) -- template-haskell-2.18+ _ConP ::   ( , []) -- Earlier versions lens  _PlainTV ::  ( flag) (., flag) -- template-haskell-2.17+ _PlainTV ::    -- Earlier versions lens  _KindedTV ::  ( flag) (, flag, )) -- template-haskell-2.17+ _KindedTV ::   (, ) -- Earlier versions lensOn template-haskell-2.11.0.0 or later, if a  or  has multiple s, the leftmost  will be chosen.2+(C) 2014-2016 Edward Kmett and Eric Mertens BSD-style (see the file LICENSE)Edward Kmett  experimental non-portable Trustworthylens Generate a Prism for each constructor of a data type. Isos generated when possible. Reviews are created for constructors with existentially quantified constructors and GADTs.e.g. data FooBarBaz a = Foo Int | Bar a | Baz Int Char makePrisms ''FooBarBaz  will create _Foo :: Prism' (FooBarBaz a) Int _Bar :: Prism (FooBarBaz a) (FooBarBaz b) a b _Baz :: Prism' (FooBarBaz a) (Int, Char) lens Generate a Prism for each constructor of a data type and combine them into a single class. No Isos are created. Reviews are created for constructors with existentially quantified constructors and GADTs.e.g. data FooBarBaz a = Foo Int | Bar a | Baz Int Char makeClassyPrisms ''FooBarBaz  will create class AsFooBarBaz s a | s -> a where _FooBarBaz :: Prism' s (FooBarBaz a) _Foo :: Prism' s Int _Bar :: Prism' s a _Baz :: Prism' s (Int,Char) _Foo = _FooBarBaz . _Foo _Bar = _FooBarBaz . _Bar _Baz = _FooBarBaz . _Baz instance AsFooBarBaz (FooBarBaz a) a  Generate an As class of prisms. Names are selected by prefixing the constructor name with an underscore. Constructors with multiple fields will construct Prisms to tuples of those fields.In the event that the name of a data type is also the name of one of its constructors, the name of the Prism= generated for the data type will be prefixed with an extra _& (if the data type name is prefix) or .5 (if the name is infix) to disambiguate it from the Prism< for the corresponding constructor. For example, this code: 9data Quux = Quux Int | Fred Bool makeClassyPrisms ''Quux  will create: class AsQuux s where __Quux :: Prism' s Quux -- Data type prism _Quux :: Prism' s Int -- Constructor prism _Fred :: Prism' s Bool _Quux = __Quux . _Quux _Fred = __Quux . _Fred instance AsQuux Quux lensGenerate prisms for the given lensType constructor name lensType constructor name lensgenerate top-level definitions 31(C) 2014-2016 Edward Kmett, (C) 2014 Eric Mertens BSD-style (see the file LICENSE)Edward Kmett  experimental non-portableSafe lensTracks the field class s that have been created so far. We consult these so that we may avoid creating duplicate classes.lensThe optional rule to create a class and method around a monomorphic data type. If this naming convention is provided, it generates a "classy" lens.lens'Name to give to generated field optics.lens Simple top-level definition namelens+makeFields-style class name and method namelens Field Names -> Target Field Name -> Definition NameslensCompute the field optics for the type identified by the given type name. Lenses will be computed when possible, Traversals otherwise.lens:Name of the data type that lenses are being generated for.lensNames of the class and the main method it generates, respectively.lens:Name of the data type that lenses are being generated for.lensNames of all fields (including the field being named) in the data type.lensName of the field being named.lensName(s) of the lens functions. If empty, no lens is created for that field.4/(C) 2012-16 Edward Kmett, 2012-13 Michael Sloan BSD-style (see the file LICENSE)Edward Kmett  experimental non-portableSafe'lensGenerate "simple" optics even when type-changing optics are possible. (e.g.  instead of )lensIndicate whether or not to supply the signatures for the generated lenses.Disabling this can be useful if you want to provide a more restricted type signature or if you want to supply hand-written haddocks.lens"Generate "updateable" optics when . When ,  s will be generated instead of s and  s will be generated instead of es. This mode is intended to be used for types with invariants which must be maintained by "smart" constructors.lensGenerate optics using lazy pattern matches. This can allow fields of an undefined value to be initialized with lenses: 8data Foo = Foo {_x :: Int, _y :: Bool} deriving Show  ( &  .~ True) ''Foo  9> undefined & x .~ 8 & y .~ True Foo {_x = 8, _y = True} The downside of this flag is that it can lead to space-leaks and code-size/compile-time increases when generated for large records. By default this flag is turned off, and strict optics are generated.When using lazy optics the strict optic can be recovered by composing with : strictOptic = ($!) . lazyOptic lens'Create the class if the constructor is  and the  rule matches.lens3 to access the convention for naming fields in our .lens1 to access the option for naming "classy" lenses.lensRules for making fairly simple partial lenses, ignoring the special cases for isomorphisms and traversals, and not making any classes. It uses .lensA  that strips the _ off of the field name, lowercases the name, and skips the field if it doesn't start with an '_'.lens Construct a  value for generating top-level definitions using the given map from field names to definition names.lens Create a  from explicit pairings of (fieldName, lensName).lens Create a 3 from a mapping function. If the function returns []#, it creates no lens for the field.lens?Rules for making lenses and traversals that precompose another .lensA  used by .lensBuild lenses (and traversals) with a sensible default configuration.e.g.  data FooBar = Foo { _x, _y ::  } | Bar { _x ::  }  ''FooBar  will create x ::  FooBar  x f (Foo a b) = (\a' -> Foo a' b) <$> f a x f (Bar a) = Bar <$> f a y ::  FooBar  y f (Foo a b) = (\b' -> Foo a b') <$> f b y _ c@(Bar _) = pure c  =   lensMake lenses and traversals for a type, and create a class when the type has no arguments.e.g. !data Foo = Foo { _fooX, _fooY ::  }  ''Foo  will create class HasFoo t where foo ::  t Foo fooX ::  t  fooX = foo . go where go f (Foo x y) = (\x' -> Foo x' y) <$> f x fooY ::  t  fooY = foo . go where go f (Foo x y) = (\y' -> Foo x y') <$> f y instance HasFoo Foo where foo = id  =   lensMake lenses and traversals for a type, and create a class when the type has no arguments. Works the same as  except that (a) it expects that record field names do not begin with an underscore, (b) all record fields are made into lenses, and (c) the resulting lens is prefixed with an underscore.lens?Derive lenses and traversals, specifying explicit pairings of (fieldName, lensName).If you map multiple names to the same label, and it is present in the same constructor then this will generate a .e.g. . [("_foo", "fooLens"), ("baz", "lbaz")] ''Foo , [("_barX", "bar"), ("_barY", "bar")] ''Bar lensDerive lenses and traversals, using a named wrapper class, and specifying explicit pairings of (fieldName, traversalName).Example usage: = "HasFoo" "foo" [("_foo", "fooLens"), ("bar", "lbar")] ''Foo lens)Build lenses with a custom configuration.lensMake lenses for all records in the given declaration quote. All record syntax in the input will be stripped off.e.g. 3declareLenses [d| data Foo = Foo { fooX, fooY ::  } deriving  |]  will create data Foo = Foo   deriving  fooX, fooY ::  Foo Int lens Similar to  , but takes a declaration quote.lensFor each record in the declaration quote, make lenses and traversals for it, and create a class when the type has no arguments. All record syntax in the input will be stripped off.e.g. 3declareClassy [d| data Foo = Foo { fooX, fooY ::  } deriving  |]  will create data Foo = Foo   deriving  class HasFoo t where foo :: ' t Foo instance HasFoo Foo where foo =  fooX, fooY :: HasFoo t =>  t  lens Similar to  , but takes a declaration quote.lens Generate a [( for each constructor of each data type.e.g. declarePrisms [d| data Exp = Lit Int | Var String | Lambda{ bound::String, body::Exp } |]  will create data Exp = Lit Int | Var String | Lambda { bound::String, body::Exp } _Lit :: Prism' Exp Int _Var :: Prism' Exp String _Lambda :: Prism' Exp (String, Exp) lensBuild # instance for each newtype.lens  declareFields =  lensDeclare lenses for each records in the given declarations, using the specified 7. Any record syntax in the input will be stripped off.lensBuild Wrapped instance for a given newtypelens#Field rules for fields in the form  _prefix_fieldname lensA  for .lens#Field rules for fields in the form % prefixFieldname or _prefixFieldname  If you want all fields to be lensed, then there is no reason to use an _? before the prefix. If any of the record fields leads with an _& then it is assume a field without an _ should not have a lens created.Note: The prefix must be the same as the typename (with the first letter lowercased). This is a change from lens versions before lens 4.5. If you want the old behaviour, use  lensA  for .lens#Field rules for fields in the form  _fieldname ( (the leading underscore is mandatory).Note: The primary difference to  is that for classUnderscoreNoPrefixFields the field names are not expected to be prefixed with the type name. This might be the desired behaviour when the DuplicateRecordFields extension is enabled.lensA  for .lensField rules fields in the form % prefixFieldname or _prefixFieldname  If you want all fields to be lensed, then there is no reason to use an _? before the prefix. If any of the record fields leads with an _& then it is assume a field without an _ should not have a lens created. Note that prefix may be any string of characters that are not uppercase letters. (In particular, it may be arbitrary string of lowercase letters and numbers) This is the behavior that  had in lens 4.4 and earlier.lensA  for .lens$Generate overloaded field accessors.e.g data Foo a = Foo { _fooX :: ,, _fooY :: a } newtype Bar = Bar { _barX :: % } makeFields ''Foo makeFields ''Bar  will create _fooXLens :: Lens' (Foo a) Int _fooYLens :: Lens (Foo a) (Foo b) a b class HasX s a | s -> a where x :: Lens' s a instance HasX (Foo a) Int where x = _fooXLens class HasY s a | s -> a where y :: Lens' s a instance HasY (Foo a) a where y = _fooYLens _barXLens :: Iso' Bar Char instance HasX Bar Char where x = _barXLens For details, see .  makeFields =   lensGenerate overloaded field accessors based on field names which are only prefixed with an underscore (e.g. _name.), not additionally with the type name (e.g. _fooName).1This might be the desired behaviour in case the DuplicateRecordFields language extension is used in order to get rid of the necessity to prefix each field name with the type name.As an example: data Foo a = Foo { _x :: &, _y :: a } newtype Bar = Bar { _x :: 5 } makeFieldsNoPrefix ''Foo makeFieldsNoPrefix ''Bar will create classes class HasX s a | s -> a where x :: Lens' s a class HasY s a | s -> a where y :: Lens' s a together with instances instance HasX (Foo a) Int instance HasY (Foo a) a where instance HasX Bar Char where For details, see . makeFieldsNoPrefix =   lens (Field Name, Definition Name)lensA function that maps a  fieldName to lensNames.00(C) 2012-16 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett  experimental non-portable Safe-Inferredr   !"#%$,&'()+*.-/3542106789?>@AYstuvwxyz{|}~ 5(C) 2012-16 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett  experimentalGHCNone .?lens:Convert from the data type to its representation (or back)'"hello"^.generic.from generic :: String"hello"lens:Convert from the data type to its representation (or back)lens9You can access fields of `data (f :*: g) p` by using its  and  instances.6(C) 2012-16 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett  provisional non-portable Trustworthy?2lens sliced i n provides a  that edits the n elements starting at index i from a .This is only a valid 3 if you do not change the length of the resulting .Attempting to return a longer or shorter vector will result in violations of the  laws.Vector.fromList [1..10] ^. sliced 2 5 == Vector.fromList [3,4,5,6,7]True(Vector.fromList [1..10] & sliced 2 5 . mapped .~ 0) == Vector.fromList [1,2,0,0,0,0,0,8,9,10]Truelens Similar to , but returning a .0toVectorOf both (8,15) == Vector.fromList [8,15]TruelensConvert a list to a  (or back),[1,2,3] ^. vector == Vector.fromList [1,2,3]True[1,2,3] ^. vector . from vector[1,2,3]Vector.fromList [0,8,15] ^. from vector . vector == Vector.fromList [0,8,15]Truelens Convert a 4 to a version that doesn't retain any extra memory.lensThis = will ignore any duplicates in the supplied list of indices.>toListOf (ordinals [1,3,2,5,9,10]) $ Vector.fromList [2,4..40][4,8,6,12,20,22]lensi starting indexlensn length7(C) 2012-16 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett  experimental Rank2Types Safe-InferredplensA  for working with a  of a  value.lensA  for working with a  of a  value.8(C) 2012-16 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett  provisionalMTPCs Safe-Inferred?lensA  that focuses on the root of a .view root $ Node 42 []42lensA 3 returning the direct descendants of the root of a    D 9(C) 2012-16 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett  experimental non-portable Safe-Inferred?lensA  is isomorphic to a   m D m  Seq.fromList [a,b,c] ^. viewLa :< fromList [b,c]Seq.empty ^. viewLEmptyLEmptyL ^. from viewL fromList []*review viewL $ a Seq.:< Seq.fromList [b,c]fromList [a,b,c]lensA  is isomorphic to a   m D m  Seq.fromList [a,b,c] ^. viewRfromList [a,b] :> cSeq.empty ^. viewREmptyREmptyR ^. from viewR fromList []*review viewR $ Seq.fromList [a,b] Seq.:> cfromList [a,b,c]lensTraverse the first n elements of a 'Seq.fromList [a,b,c,d,e] ^.. slicedTo 2[a,b]*Seq.fromList [a,b,c,d,e] & slicedTo 2 %~ ffromList [f a,f b,c,d,e]+Seq.fromList [a,b,c,d,e] & slicedTo 10 .~ xfromList [x,x,x,x,x]lensTraverse all but the first n elements of a )Seq.fromList [a,b,c,d,e] ^.. slicedFrom 2[c,d,e],Seq.fromList [a,b,c,d,e] & slicedFrom 2 %~ ffromList [a,b,f c,f d,f e]-Seq.fromList [a,b,c,d,e] & slicedFrom 10 .~ xfromList [a,b,c,d,e]lens(Traverse all the elements numbered from i to j of a *Seq.fromList [a,b,c,d,e] & sliced 1 3 %~ ffromList [a,f b,f c,d,e]lens Construct a  from a ,  Y, W, \ or  O.seqOf folded ["hello","world"]fromList ["hello","world"]5seqOf (folded._2) [("hello",1),("world",2),("!!!",3)]fromList [1,2,3]  ::  s a -> s ->  a  ::  s a -> s ->  a  ::  s a -> s ->  a  ::  s a -> s ->  a  ::  s a -> s ->  a :(C) 2012-16 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett  provisionalportable Safe-Inferredlens IntSet isn't Foldable, but this ) can be used to access the members of an .&sumOf members $ setOf folded [1,2,3,4]10lensThis * 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 elements might change but you can manipulate it by reading using  and reindexing it via ./over setmapped (+1) (IntSet.fromList [1,2,3,4])fromList [2,3,4,5]lens Construct an  from a , , ,  or .setOf folded [1,2,3,4]fromList [1,2,3,4]5setOf (folded._2) [("hello",1),("world",2),("!!!",3)]fromList [1,2,3]  ::  s  -> s ->   ::  s  -> s ->   ::  s  -> s ->   ::  s  -> s ->   ::  s  -> s ->  ;(C) 2012-16 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett  experimental non-portable Safe-Inferred&?Qlens Access the  of a  number.(a :+ b)^._realPartaa :+ b & _realPart *~ 2 a * 2 :+ b  ::  f => (a -> f a) ->  a -> f ( a)lens Access the  of a  number.(a :+ b)^._imagPartba :+ b & _imagPart *~ 2 a :+ b * 2  ::  f => (a -> f a) ->  a -> f ( a)lens This isn't quite a legal  . Notably the  l ( l b a) = blaw is violated when you set a  value with 0  and non-zero  as the ) information is lost, or with a negative  which flips the  and retains a positive . So don't do that!)Otherwise, this is a perfectly cromulent .lens Access the  of a  number. (10.0 :+ 20.0) & _magnitude *~ 2 20.0 :+ 40.0 This isn't quite a legal  . Notably the  l ( l b a) = b(law is violated when you set a negative . This flips the  and retains a positive . So don't do that!)Otherwise, this is a perfectly cromulent . Setting the  of a zero  number assumes the  is 0.lens Access the  of a  number.4(mkPolar 10 (2-pi) & _phase +~ pi & view _phase) D 2True This isn't quite a legal  . Notably the  l ( l b a) = blaw is violated when you set a  outside the range (-, ]. The phase is always in that range when queried. So don't do that!)Otherwise, this is a perfectly cromulent .lens Access the  of a  number.*(2.0 :+ 3.0) & _conjugate . _imagPart -~ 1 2.0 :+ 4.02(mkPolar 10.0 2.0 ^. _conjugate . _phase) D (-2.0)True  <(C) 2012-2016 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett  experimental non-portable Safe-Inferred&?lens (or ) a list of bytes into a   D     x D x    x D x     "[104,101,108,108,111]^.packedBytes"hello"lens (or ) a  into a list of bytes  D     x D x    x D x     ""hello"^.packedChars.unpackedBytes[104,101,108,108,111]lensTraverse each  in a .This  walks the  in a tree-like fashion enable zippers to seek to locations in logarithmic time and accelerating many monoidal queries, but up to associativity (and constant factors) it is equivalent to the much slower:  D     *anyOf bytes (== 0x80) (Char8.pack "hello")False$Note that when just using this as a ,   can be more efficient.lens (or ) a list of characters into a When writing back to the  it is assumed that every  lies between 'x00' and 'xff'.  D     x D x    x D x     "hello"^.packedChars.each.re (base 16 . enum).to (\x -> if Prelude.length x == 1 then '0':x else x) "68656c6c6f"lens (or ) a list of characters into a When writing back to the  it is assumed that every  lies between 'x00' and 'xff'.  D     x D x    x D x     0[104,101,108,108,111]^.packedBytes.unpackedChars"hello"lens#Traverse the individual bytes in a  as characters.When writing back to the  it is assumed that every  lies between 'x00' and 'xff'.This  walks the  in a tree-like fashion enable zippers to seek to locations in logarithmic time and accelerating many monoidal queries, but up to associativity (and constant factors) it is equivalent to the much slower:  =    anyOf chars (== 'h') "hello"True=(C) 2012-2016 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett  experimental non-portable Safe-Inferred&? vlens (or ) a list of bytes into a .  D     x D x    x D x     8[104,101,108,108,111]^.packedBytes == Char8.pack "hello"Truelens (or ) a  into a list of bytes  D     x D x    x D x     ""hello"^.packedChars.unpackedBytes[104,101,108,108,111]lens#Traverse the individual bytes in a .This  walks each strict  chunk in a tree-like fashion enable zippers to seek to locations more quickly and accelerate many monoidal queries, but up to associativity (and constant factors) it is equivalent to the much slower:  D     *anyOf bytes (== 0x80) (Char8.pack "hello")False$Note that when just using this as a ,   can be more efficient.lens (or ) a list of characters into a .When writing back to the  it is assumed that every  lies between 'x00' and 'xff'.  D     x D x    x D x     "hello"^.packedChars.each.re (base 16 . enum).to (\x -> if Prelude.length x == 1 then '0':x else x) "68656c6c6f"lens (or ) a list of characters into a When writing back to the  it is assumed that every  lies between 'x00' and 'xff'.  D     x D x    x D x     0[104,101,108,108,111]^.packedBytes.unpackedChars"hello"lens#Traverse the individual bytes in a  as characters.When writing back to the  it is assumed that every  lies between 'x00' and 'xff'.This  walks each strict  chunk in a tree-like fashion enable zippers to seek to locations more quickly and accelerate many monoidal queries, but up to associativity (and constant factors) it is equivalent to:  =     anyOf chars (== 'h') "hello"True>(C) 2012-16 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett  experimental non-portable Safe-Inferred&?6lensTraversals for ByteStrings.lens (or () a list of bytes into a strict or lazy  ByteString.  x D x    x D x      D    lens (or -) a list of characters into a strict or lazy  ByteString.When writing back to the  ByteString it is assumed that every  lies between 'x00' and 'xff'.  x D x    x D x      D    lensTraverse each  in a strict or lazy  ByteStringThis  walks each strict  ByteString chunk in a tree-like fashion enable zippers to seek to locations more quickly and accelerate many monoidal queries, but up to associativity (and constant factors) it is equivalent to the much slower:  D       ( 0x80) ::  ByteString ->  lens2Traverse the individual bytes in a strict or lazy  ByteString as characters.When writing back to the  ByteString it is assumed that every  lies between 'x00' and 'xff'.This  walks each strict  ByteString chunk in a tree-like fashion enable zippers to seek to locations more quickly and accelerate many monoidal queries, but up to associativity (and constant factors) it is equivalent to the much slower:  D       ( 'c') ::  ByteString ->  lens (or ) a  ByteString into a list of bytes  D     x D x    x D x      ::   []  ::   [] lens (or /) a list of characters into a strict (or lazy)  ByteStringWhen writing back to the  ByteString it is assumed that every  lies between 'x00' and 'xff'.  D     x D x    x D x      ::     ::     ?(C) 2012-16 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett  experimentalLiberalTypeSynonyms Safe-Inferred?0lensBitwise  the target(s) of a  or ._2 .|.~ 6 $ ("hello",3) ("hello",7) () ::  a =>  s t a a -> a -> s -> t () ::  a =>  s t a a -> a -> s -> t () ::  a =>  s t a a -> a -> s -> t () :: ( a,  a) =>  s t a a -> a -> s -> t lensBitwise  the target(s) of a  or ._2 .&.~ 7 $ ("hello",254) ("hello",6) () ::  a =>  s t a a -> a -> s -> t () ::  a =>  s t a a -> a -> s -> t () ::  a =>  s t a a -> a -> s -> t () :: ( a,  a) =>  s t a a -> a -> s -> t lensModify the target(s) of a ,  or  by computing its bitwise  with another value.*execState (do _1 .&.= 15; _2 .&.= 3) (7,7)(7,3) () :: ( s m,  a) =>  s a -> a -> m () () :: ( s m,  a) =>  s a -> a -> m () () :: ( s m,  a) =>  s a -> a -> m () () :: ( s m,  a) =>  s a -> a -> m () lensModify the target(s) of a ,  or  by computing its bitwise  with another value.*execState (do _1 .|.= 15; _2 .|.= 3) (7,7)(15,7) () :: ( s m,  a) =>  s a -> a -> m () () :: ( s m,  a) =>  s a -> a -> m () () :: ( s m,  a) =>  s a -> a -> m () () :: ( s m,  a) =>  s a -> a -> m () lensBitwise  the target(s) of a  (or ), returning the result (or a monoidal summary of all of the results)._2 <.|.~ 6 $ ("hello",3)(7,("hello",7)) () ::  a => $ s t a a -> a -> s -> (a, t) () ::  a => # s t a a -> a -> s -> (a, t) () :: ( a,  a) =>  s t a a -> a -> s -> (a, t) lensBitwise  the target(s) of a  or , returning the result (or a monoidal summary of all of the results)._2 <.&.~ 7 $ ("hello",254)(6,("hello",6)) () ::  a => $ s t a a -> a -> s -> (a, t) () ::  a => # s t a a -> a -> s -> (a, t) () :: ( a,  a) =>  s t a a -> a -> s -> (a, t) lensModify the target(s) of a  (or ) by computing its bitwise  with another value, returning the result (or a monoidal summary of all of the results traversed).runState (_1 <.&.= 15) (31,0) (15,(15,0)) () :: ( s m,  a) =>  s a -> a -> m a () :: ( s m,  a,  a) =>  s a -> a -> m a lensModify the target(s) of a , (or ) by computing its bitwise  with another value, returning the result (or a monoidal summary of all of the results traversed).runState (_1 <.|.= 7) (28,0) (31,(31,0)) () :: ( s m,  a) =>  s a -> a -> m a () :: ( s m,  a,  a) =>  s a -> a -> m a lensBitwise  the target(s) of a  or , and return the original value, or a monoidal summary of the original values.%When you do not need the old value, () is more flexible._2 <<.&.~ 7 $ ("hello", 254)(254,("hello",6)) () ::  a => $ s t a a -> a -> s -> (a, t) () ::  a => # s t a a -> a -> s -> (a, t) () :: ( a,  a) =>  s t a a -> a -> s -> (a, t) lensBitwise  the target(s) of a  or , and return the original value, or a monoidal summary of the original values.%When you do not need the old value, () is more flexible._2 <<.|.~ 6 $ ("hello", 3)(3,("hello",7)) () ::  a => $ s t a a -> a -> s -> (a, t) () ::  a => # s t a a -> a -> s -> (a, t) () :: ( a,  a) =>  s t a a -> a -> s -> (a, t) lensModify the target(s) of a , (or ) by computing its bitwise  with another value, returning the original value (or a monoidal summary of all the original values).%When you do not need the old value, () is more flexible.runState (_1 <<.&.= 15) (31,0) (31,(15,0)) () :: ( s m,  a) =>  s a -> a -> m a () :: ( s m,  a,  a) =>  s a -> a -> m a lensModify the target(s) of a , (or ) by computing its bitwise  with another value, returning the original value (or a monoidal summary of all the original values).%When you do not need the old value, () is more flexible.runState (_1 <<.|.= 7) (28,0) (28,(31,0)) () :: ( s m,  a) =>  s a -> a -> m a () :: ( s m,  a,  a) =>  s a -> a -> m a lensThis < can be used to access the value of the nth bit in a number. n is only a legal  into b if 0  n   ( :: b). 16^.bitAt 4True 15^.bitAt 4False15 & bitAt 4 .~ True3116 & bitAt 4 .~ False0lens,Get the nth byte, counting from the low end. n is a legal  into b iff 0  n   ( ( :: b)) 8(0xff00 :: Word16)^.byteAt 00(0xff00 :: Word16)^.byteAt 1255 byteAt 1 .~ 0 $ 0xff00 :: Word160byteAt 0 .~ 0xff $ 0 :: Word16255lens)Traverse over all bits in a numeric type.+The bit position is available as the index.toListOf bits (5 :: Word8)/[True,False,True,False,False,False,False,False]If you supply this an !, the result will be an infinite ;, which can be productively consumed, but not reassembled.lensTraverse over all the bytes in an integral type, from the low end.,The byte position is available as the index.(toListOf bytewise (1312301580 :: Word32) [12,34,56,78]If you supply this an !, the result will be an infinite ;, which can be productively consumed, but not reassembled.Why isn't this function called bytes to match 5? Alas, there is already a function by that name in Data.ByteString.Lens. 444444444444@(C) 2012-16 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett  provisional&MPTCs, Rank2Types, LiberalTypeSynonyms Safe-Inferred3lensThis setter can be used to derive a new  from an old IAarray by applying a function to each of the indices to look it up in the old . This is a  contravariant .  D     D     ( b) f arr  i D arr  f i  ( ( b) f arr) D b A(C) 2012-16 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett  provisionalportable Safe-Inferred4lens$Evaluate the elements targeted by a , , ,  or ! according to the given strategy.  =  B(C) 2012-2016 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett  provisionalportable Trustworthy:*lensEvaluate the targets of a  or / into a data structure according to the given .  =   =   =   ::  s a ->  a ->  s  ::  s a ->  a ->  s  :: (a ->  a) -> s ->  s) ->  a ->  s lensEvaluate the targets of a  or 7 according into a data structure according to a given  in parallel.  =    ::  s a ->  a ->  s  ::  s a ->  a ->  s  :: ((a ->  a) -> s ->  s) ->  a ->  s lens Transform a , , ,  or 7 to first evaluates its argument according to a given  before proceeding.    ::  t =>  a ->  [a] lens Transform a , , ,  or 0 to evaluate its argument according to a given  in parallel with evaluating.    ::  t =>  a ->  [a] C(C) 2014-2016 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett  provisionalControl.Monad.Error Safe-Inferred>K lensYou need this when using .lens$Catch exceptions that match a given  (or any  , really).  ::  e m => % e a -> m r -> (a -> m r) -> m r  ::  e m => & e a -> m r -> (a -> m r) -> m r  ::  e m => ! e a -> m r -> (a -> m r) -> m r  ::  e m => ' e a -> m r -> (a -> m r) -> m r  ::  e m => % e a -> m r -> (a -> m r) -> m r  ::  e m => ' e a -> m r -> (a -> m r) -> m r lens$Catch exceptions that match a given  (or any ), discarding the information about the match. This is particularly useful when you have a  e () where the result of the  or = isn't particularly valuable, just the fact that it matches.  ::  e m =>  e a -> m r -> m r -> m r  ::  e m =>  e a -> m r -> m r -> m r  ::  e m =>  e a -> m r -> m r -> m r  ::  e m =>  e a -> m r -> m r -> m r  ::  e m =>  e a -> m r -> m r -> m r  ::  e m =>  e a -> m r -> m r -> m r lens A version of  with the arguments swapped around; useful in situations where the code for the handler is shorter.  ::  e m => % e a -> (a -> m r) -> m r -> m r  ::  e m => & e a -> (a -> m r) -> m r -> m r  ::  e m => ! e a -> (a -> m r) -> m r -> m r  ::  e m => ' e a -> (a -> m r) -> m r -> m r  ::  e m => ' e a -> (a -> m r) -> m r -> m r  ::  e m => % e a -> (a -> m r) -> m r -> m r lens A version of  with the arguments swapped around; useful in situations where the code for the handler is shorter.  ::  e m =>  e a -> m r -> m r -> m r  ::  e m =>  e a -> m r -> m r -> m r  ::  e m =>  e a -> m r -> m r -> m r  ::  e m =>  e a -> m r -> m r -> m r  ::  e m =>  e a -> m r -> m r -> m r  ::  e m =>  e a -> m r -> m r -> m r lens takes a  (or any 0) to select which exceptions are caught If the  Exception/ does not match the predicate, it is re-thrown.  ::  e m =>  e a -> m r -> m ( a r)  ::  e m =>  e a -> m r -> m ( a r)  ::  e m =>  e a -> m r -> m ( a r)  ::  e m =>  e a -> m r -> m ( a r)  ::  e m =>  e a -> m r -> m ( a r)  ::  e m =>  e a -> m r -> m ( a r) lensThis function exists to remedy a gap between the functionality of Control.Exception and Control.Monad.Error. Control.Exception supplies  and a notion of , which we duplicate here in a form suitable for working with any  instance.Sometimes you want to catch two different sorts of error. You could do something like f =  _Foo handleFoo ( _Bar handleBar expr) However, there are a couple of problems with this approach. The first is that having two exception handlers is inefficient. However, the more serious issue is that the second exception handler will catch exceptions in the first, e.g. in the example above, if  handleFoo uses 2 then the second exception handler will catch it.Instead, we provide a function , which would be used thus: f =  expr [  # _Foo handleFoo ,  # _Bar handleBar ] lens Throw an  Exception described by a .  l D  l   ::  e m =>  e t -> t -> a  ::  e m =>  e t -> t -> a lens Similar to  but specialised for the common case of error constructors with no arguments. .data MyError = Foo | Bar makePrisms ''MyError  _Foo ::  MyError m => m a   D(C) 2012-16 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett  provisional Rank2Types Trustworthy >PlensA lens product. There is no law-abiding way to do this in general. Result is only a valid > if the input lenses project disjoint parts of the structure s). Otherwise "you get what you put in" law  l ( l v s) D v is violated bylet badLens :: Lens' (Int, Char) (Int, Int); badLens = lensProduct _1 _1(view badLens (set badLens (1,2) (3,'x'))(2,2)but we should get (1,2).Are you looking for ?lens A dual of : a prism sum.The law   l ( l b) D  b  breaks withlet badPrism :: Prism' (Maybe Char) (Either Char Char); badPrism = prismSum _Just _Just.preview badPrism (review badPrism (Right 'x'))Just (Left 'x') We put in  value, but get back .Are you looking for  ?lensA generalization of *ing folds: A union of disjoint traversals.+Traversing the same entry twice is illegal.Are you looking for ?E Safe-InferredU lensProfunctor optic.lens Converts a \ to a / -based one.  :: \ s t a b -> LensP s t a b lens Converts a O to a / -based one.  :: O s t a b -> IsoP s t a b lens Converts a [ to a / -based one.  :: [ s t a b -> PrismP s t a b lens Converts a l to a / -based one.  :: l s t a b -> SetterP s t a b lens Converts a W to a / -based one.  :: W s t a b -> TraversalP s t a b lens Obtain a [ from a / -based one.  :: PrismP s t a b -> [ s t a b lens Obtain a O from a / -based one.  :: IsoP s t a b -> O s t a b lens Obtain a \ from a / -based one.  :: LensP s t a b -> \ s t a b lens Obtain a l from a / -based one.  :: SetterP s t a b -> l s t a b lens Obtain a W from a / -based one.  :: TraversalP s t a b -> W s t a b  (C) 2012-16 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett  experimental non-portable Safe-InferredU   F(C) 2012-16 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett  provisionalportable Safe-InferredXlensCheck to see if this  matches.is _Left (Right 12)False is hex "3f79"True (C) 2013-16 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett  experimental non-portable Safe-InferredYg   !"#%$,&'()+*.-/3542106789?>@AYstuvwxyz{|}~    !"#%$,&'()+*.-/3542106789?>@AYstuvwxyz{|}~ G(C) 2012-16 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett  provisionalControl.Exception Trustworthy &>lensThis  is thrown by lens7 when the user somehow manages to rethrow an internal  .lens  ::       ::     lens%There is no information carried in a  .  ::    ()  ::   () lensCompaction found an object that cannot be compacted. Functions cannot be compacted, nor can mutable objects or pinned objects.lens  ::     ::    lens*Information about why a compaction failed.  ::     ::    lensAn expression that didn't typecheck during compile time was called. This is only possible with -fdefer-type-errors.lens  ::     ::    lens$Details about the failed type check.  ::     ::    lens.This thread has exceeded its allocation limit.lens  ::     ::    lens2There is no additional information carried in an  .  ::   ()  ::   () lens#This is thrown when the user calls .lens  ::     ::    lensRetrieve the argument given to . is isomorphic to a .0catching _ErrorCall (error "touch down!") return "touch down!"  ::     ::    lensA record update was performed on a constructor without the appropriate field. This can only happen with a datatype with multiple constructors, where some fields are in one constructor but not another.lens  ::     ::    lensInformation about the source location where the record was updated.  ::     ::    lensA record selector was applied to a constructor without the appropriate field. This can only happen with a datatype with multiple constructors, where some fields are in one constructor but not another.lens  ::     ::    lensInformation about the source location where the record selection occurred.  ::     ::    lens'An uninitialised record field was used.lens  ::     ::    lensInformation about the source location where the record was constructed.  ::     ::    lensA pattern match failed.lens  ::     ::    lens5Information about the source location of the pattern.  ::     ::    lensA class method without a definition (neither a default definition, nor a definition in the appropriate instance) was called.lens  ::     ::    lens,Extract a description of the missing method.  ::     ::    lensThere are no runnable threads, so the program is deadlocked. The  # is raised in the main thread only.lens  ::     ::    lens%There is no information carried in a  .  ::   ()  ::   () lens"The thread is waiting to retry an  transaction, but there are no other references to any TVars involved, so it can't ever continue.lens  ::     ::    lens0There is no additional information carried in a  .  ::   ()  ::   () lensThe thread is blocked on an ,, but there are no other references to the  so it can't ever continue.lens  ::     ::    lens0There is no additional information carried in a  .  ::   ()  ::   () lens?Thrown when the program attempts to call atomically, from the , package, inside another call to atomically.lens  ::     ::    lens0There is no additional information carried in a  .  ::   ()  ::   () lensThrown when the runtime system detects that the computation is guaranteed not to terminate. Note that there is no guarantee that the runtime system will notice whether any given computation is guaranteed to terminate or not.lens  ::     ::    lens0There is no additional information carried in a  .  ::   ()  ::   () lensAsynchronous exceptions.lensThere are several types of .  ::     ::    lens was applied to .lens  ::     ::    lensThis  contains provides information about what assertion failed in the .handling _AssertionFailed (\ xs -> "caught" <$ guard ("" `isInfixOf` xs) ) $ assert False (return "uncaught")"caught"  ::     ::    lens)Exceptions generated by array operations.lensExtract information about an .  ::     ::    lensArithmetic exceptions.lens  ::     ::    lensExceptions that occur in the IO . An  records a more specific error type, a descriptive string and maybe the handle that was used when the error was flagged.Due to their richer structure relative to other exceptions, these have a more carefully overloaded signature.lensUnfortunately the name  ioException is taken by base for throwing IOExceptions.  ::     ::    %Many combinators for working with an  are available in System.IO.Error.Lens.lensTraverse the strongly typed  contained in 6 where the type of your function matches the desired .  :: ( f,  a) => (a -> f a) ->  -> f  lens$Catch exceptions that match a given  (or any  , really).catching _AssertionFailed (assert False (return "uncaught")) $ \ _ -> return "caught""caught"  ::  m =>  # a -> m r -> (a -> m r) -> m r  ::  m =>  $ a -> m r -> (a -> m r) -> m r  ::  m =>   a -> m r -> (a -> m r) -> m r  ::  m =>  % a -> m r -> (a -> m r) -> m r  ::  m =>  # a -> m r -> (a -> m r) -> m r  ::  m =>  % a -> m r -> (a -> m r) -> m r lens$Catch exceptions that match a given  (or any ), discarding the information about the match. This is particularly useful when you have a  e () where the result of the  or = isn't particularly valuable, just the fact that it matches.catching_ _AssertionFailed (assert False (return "uncaught")) $ return "caught""caught"  ::  m =>   a -> m r -> m r -> m r  ::  m =>   a -> m r -> m r -> m r  ::  m =>   a -> m r -> m r -> m r  ::  m =>   a -> m r -> m r -> m r  ::  m =>   a -> m r -> m r -> m r  ::  m =>   a -> m r -> m r -> m r lens A version of  with the arguments swapped around; useful in situations where the code for the handler is shorter.handling _NonTermination (\_ -> return "caught") $ throwIO NonTermination"caught"  ::  m =>  # a -> (a -> m r) -> m r -> m r  ::  m =>  $ a -> (a -> m r) -> m r -> m r  ::  m =>   a -> (a -> m r) -> m r -> m r  ::  m =>  % a -> (a -> m r) -> m r -> m r  ::  m =>  % a -> (a -> m r) -> m r -> m r  ::  m =>  # a -> (a -> m r) -> m r -> m r lens A version of  with the arguments swapped around; useful in situations where the code for the handler is shorter.handling_ _NonTermination (return "caught") $ throwIO NonTermination"caught"  ::  m =>   a -> m r -> m r -> m r  ::  m =>   a -> m r -> m r -> m r  ::  m =>   a -> m r -> m r -> m r  ::  m =>   a -> m r -> m r -> m r  ::  m =>   a -> m r -> m r -> m r  ::  m =>   a -> m r -> m r -> m r lens A variant of  that takes a  (or any /) to select which exceptions are caught (c.f. ,  ). If the / does not match the predicate, it is re-thrown.  ::  m =>   a -> m r -> m ( a r)  ::  m =>   a -> m r -> m ( a r)  ::  m =>   a -> m r -> m ( a r)  ::  m =>   a -> m r -> m ( a r)  ::  m =>   a -> m r -> m ( a r)  ::  m =>   a -> m r -> m ( a r) lens A version of - that discards the specific exception thrown.  ::  m =>   a -> m r -> m (Maybe r)  ::  m =>   a -> m r -> m (Maybe r)  ::  m =>   a -> m r -> m (Maybe r)  ::  m =>   a -> m r -> m (Maybe r)  ::  m =>   a -> m r -> m (Maybe r)  ::  m =>   a -> m r -> m (Maybe r) lens Throw an  described by a . Exceptions may be thrown from purely functional code, but may only be caught within the IO .  l D  l   ::   t -> t -> r  ::   t -> t -> r lens Similar to  but specialised for the common case of error constructors with no arguments. .data MyError = Foo | Bar makePrisms ''MyError  _Foo ::  MonadError MyError m => m a lens A variant of " that can only be used within the IO  (or any other  instance) to throw an  described by a . Although 5 has a type that is a specialization of the type of ), the two functions are subtly different:  l e `seq` x D  e  l e `seq` x D x !The first example will cause the  e7 to be raised, whereas the second one won't. In fact,  will only cause an * to be raised when it is used within the  instance. The * variant should be used in preference to  to raise an  within the  because it guarantees ordering with respect to other monadic operations, whereas  does not.  l D  l   ::  m =>   t -> t -> m r  ::  m =>   t -> t -> m r lens raises an  specified by a  in the target thread.  thread l D  l ( thread)  ::  ->   t -> t -> m a  ::  ->   t -> t -> m a lensThis $ can be used to purely map over the ;s an arbitrary expression might throw; it is a variant of  in the same way that  is a variant of . )'mapException' D 'over' 'mappedException'This view that every Haskell expression can be regarded as carrying a bag of s is detailed in @A Semantics for Imprecise Exceptions@ by Peyton Jones & al. at PLDI @99. return "caught") $ assert False (return "uncaught") & mappedException %~ \ (AssertionFailed _) -> Overflow"caught"lens%This is a type restricted version of 0, which avoids the type ambiguity in the input  when using .8The following maps any exception to arithmetic overflow:handling _Overflow (\_ -> return "caught") $ assert False (return "uncaught") & mappedException' .~ Overflow"caught"lensHandle arithmetic .  D     ::     ::    lensHandle arithmetic .  D     ::     ::    lens$Handle arithmetic loss of precision.  D     ::     ::    lensHandle division by zero.  D     ::     ::    lens/Handle exceptional _Denormalized floating pure.  D     ::     ::    lens  D     ::     ::    lensAn attempt was made to index an array outside its declared bounds.  D     ::     ::    lensAn attempt was made to evaluate an element of an array that had not been initialized.  D     ::     ::    lens8The current thread's stack exceeded its limit. Since an  has been raised, the thread's stack will certainly be below its limit again, but the programmer should take remedial action immediately.  ::   ()  ::   () lensThe program's heap is reaching its limit, and the program should take action to reduce the amount of live data it has.Notes:+It is undefined which thread receives this .GHC currently does not throw  exceptions.  ::   ()  ::   () lensThis & is raised by another thread calling , or by the system if it needs to terminate the thread for some reason.  ::   ()  ::   () lensThis  is raised by default in the main thread of the program when the user requests to terminate the program via the usual mechanism(s) (e.g. Control-C in the console).  ::   ()  ::   ()   H(C) 2012-2016 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett  experimental non-portable Safe-Inferred&?lensAny  can be thrown as an lensThis 8 allows you to traverse the typed value contained in a  where the type required by your function matches that of the contents of the , or construct a  value out of whole cloth. It can also be used to catch or throw a  value as .  ::  a =>   a  ::  a =>   a I(C) 2012-16 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett  provisionalportable Safe-Inferred&-? lensThis * can be used to model the fact that every  type is a subset of .Embedding through the  only succeeds if the 2 would pass through unmodified when re-extracted.lens?A prism that shows and reads integers in base-2 through base-36Note: This is an improper prism, since leading 0s are stripped when reading."100" ^? base 16Just 256 1767707668033969 ^. re (base 36) "helloworld"lens  =  2lens  =  8lens  =  10lens  =  16lens  n =   (+n) (subtract n)[1..3]^..traverse.adding 1000[1001,1002,1003]lens  n =   (subtract n) ((+n)  n =   ( n) lens  n = iso (*n) (/n)Note: This errors for n = 05 & multiplying 1000 +~ 35.003let fahrenheit = multiplying (9/5).adding 32 in 230^.from fahrenheit110.0lens   n =   (/n) (*n)  n =   ( n)Note: This errors for n = 0lens  n =   (**n) (**recip n)Note: This errors for n = 0au (_Wrapping Sum . from (exponentiating 2)) (foldMapOf each) (3,4) == 5Truelens  =    8au (_Wrapping Sum . negated) (foldMapOf each) (3,4) == 7True9au (_Wrapping Sum) (foldMapOf (each.negated)) (3,4) == -7True  J(C) 2017 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett  provisionalportable Safe-Inferred&lens 9Naturals [] = 0 Naturals (h:t) = 1 + Pair h (Naturals t) lens )Sum (Left q) = 2*q Sum (Right q) = 2*q+1 lens+interleaves the bits of two natural numberslensThe natural numbers are isomorphic to the product of the natural numbers with itself. N = N*NlensThe natural numbers are isomorphic to disjoint sums of natural numbers embedded as evens or odds. N = 2*Nlens>The natural numbers are isomorphic to lists of natural numbersK(C) 2013-16 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett  provisionalControl.Exception Safe-Inferred&>[lens*Exit codes that a program can return with:lens!indicates successful termination;  ::   ()  ::   () lensindicates program failure with an exit code. The exact interpretation of the code is operating-system dependent. In particular, some values may be prohibited (e.g. 0 on a POSIX-compliant system).  ::     ::    L(C) 2012-16 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett  experimental Rank2Types Safe-Inferredlens'Modify the path by adding another path.(both ~ "bin" $ ("hello","world")) == ("hello" "bin", "world" "bin")True () ::  s a   ->  -> s -> a () ::  s a   ->  -> s -> a () ::  s a   ->  -> s -> a () ::  s a   ->  -> s -> a lensModify the target(s) of a , ,  or  by adding a path.execState (both = "bin") ("hello","world") == ("hello" "bin", "world" "bin")True () ::  s m =>  s  ->  -> m () () ::  s m =>  s  ->  -> m () () ::  s m =>  s  ->  -> m () () ::  s m =>  s  ->  -> m () lens+Add a path onto the end of the target of a  and return the result3When you do not need the result of the operation, () is more flexible.lens+Add a path onto the end of the target of a 0 into your monad's state and return the result.3When you do not need the result of the operation, () is more flexible.lens+Add a path onto the end of the target of a  and return the original value.*When you do not need the original value, () is more flexible.lens)Add a path onto the end of a target of a 3 into your monad's state and return the old value.3When you do not need the result of the operation, () is more flexible.lens'Modify the path by adding an extension.#both <.>~ "txt" $ ("hello","world")("hello.txt","world.txt") () ::  s a   ->  -> s -> a () ::  s a   ->  -> s -> a () ::  s a   ->  -> s -> a () ::  s a   ->  -> s -> a lensModify the target(s) of a , ,  or  by adding an extension.-execState (both <.>= "txt") ("hello","world")("hello.txt","world.txt") () ::  s m =>  s  ->  -> m () () ::  s m =>  s  ->  -> m () () ::  s m =>  s  ->  -> m () () ::  s m =>  s  ->  -> m () lens1Add an extension onto the end of the target of a  and return the result"_1 <<.>~ "txt" $ ("hello","world")#("hello.txt",("hello.txt","world"))3When you do not need the result of the operation, () is more flexible.lens1Add an extension onto the end of the target of a 0 into your monad's state and return the result.,evalState (_1 <<.>= "txt") ("hello","world") "hello.txt"3When you do not need the result of the operation, () is more flexible.lens1Add an extension onto the end of the target of a  but return the old value#_1 <<<.>~ "txt" $ ("hello","world")("hello",("hello.txt","world"))%When you do not need the old value, () is more flexible.lens1Add an extension onto the end of the target of a 3 into your monad's state and return the old value.,runState (_1 <<<.>= "txt") ("hello","world")("hello",("hello.txt","world"))%When you do not need the old value, () is more flexible.lensA ( for reading and writing to the basenameNote: This is  a legal  unless the outer  has both a directory and filename component and the generated basenames are not null and contain no directory separators.(basename .~ "filename" $ "path" "name.png") == "path" "filename.png"TruelensA ) for reading and writing to the directoryNote: this is not a legal  unless the outer  already has a directory component, and generated directories are not null.(("long" "path" "name.txt") ^. directory) == "long" "path"TruelensA ) for reading and writing to the extensionNote: This is not a legal =, unless you are careful to ensure that generated extension * components are either null or start with " and do not contain any internal s.(extension .~ ".png" $ "path" "name.txt") == "path" "name.png"TruelensA - for reading and writing to the full filenameNote: This is not a legal <, unless you are careful to ensure that generated filename = components are not null and do not contain any elements of s.(filename .~ "name.txt" $ "path" "name.png") == "path" "name.txt"True 444444444444M(C) 2012-2016 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett  experimental Rank2Types Safe-Inferred>?lensWhere the error happened.lens Error type specific information.lens2The handle used by the action flagging this error.lens the error is related to.lens leading to this error, if any.lensWhat type of error it is                 V                                      hha`ZY_^[OlXW]\g                                                                                f e   c b  k                                             i                                [   O      l  Z  Y  _  ^  W  X   ]   \                                                                                                                         ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! " " "" " " " " " " " " " " " " " " " " " " " " " " " " # # ## # # ## # # # # # # # # ### # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # ############################################################################################################################################################################################################################$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$%%%o%p%%%%%%%%%%%%%%%%%%%%&&&&&&&&&&&''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''((()**+++++++,,,,,,,----------...........////////////////////////////////////00000000000000000000000000000000000000000000000000000011111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111122222333333333333333333333344444444444444444444444444444444444444445555555555555555666667788999999:::;;;;;;~;;;;<<<<<<<<========>>>>>>>>>>>????????????????@ABBBBCCCCCCCCCCCCCCCCDDDEEEEEEEEEEEFGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGHHHHHIIIIIIIIIIIIIJJJJJJKKKKKKKKLLLLLLLLLLLLLLLLMMMMMMMMMMMMMMMMMMMMMMMMMd STSS      T|nt00000000lens-5.2-EPfKN924fCBQ9RamOzsMpControl.Lens.TraversalControl.Lens.Internal.CTypesControl.Lens.GetterControl.Lens.ReviewControl.Lens.SetterControl.Lens.EqualityControl.Lens.LensControl.Lens.IndexedControl.Lens.IsoControl.Lens.PrismControl.Lens.FoldControl.Lens.Internal.FoldControl.Lens.Internal.IsoControl.Lens.Internal.ListControl.Lens.Internal.LevelControl.Lens.Internal.IndexedControl.Lens.Internal.GetterControl.Lens.Internal.ContextControl.Lens.Internal.BazaarControl.Lens.Internal.MagmaControl.Lens.Internal.Prism Control.Lens.Internal.ProfunctorControl.Lens.Internal.ReviewControl.Lens.Internal.SetterControl.Lens.Internal.ZoomControl.Lens.TypeControl.Lens.TupleControl.Lens.LevelControl.Lens.ReifiedControl.Lens.Internal.Exception Control.Lens.Internal.ByteStringControl.Lens.EmptyControl.Lens.ConsControl.Lens.Internal.DequeControl.Lens.WrappedControl.Lens.Internal.THControl.Lens.ZoomData.Data.LensControl.Lens.PlatedData.HashSet.Lens Data.Map.Lens Data.Set.LensData.Text.Lazy.LensData.Text.Strict.LensData.Text.LensData.Vector.Generic.LensControl.Lens.EachControl.Lens.AtLanguage.Haskell.TH.LensControl.Lens.Internal.PrismTHControl.Lens.Internal.FieldTHControl.Lens.THGHC.Generics.LensData.Vector.LensData.Typeable.LensData.Tree.LensData.Sequence.LensData.IntSet.LensData.Complex.LensData.ByteString.Strict.LensData.ByteString.Lazy.LensData.ByteString.LensData.Bits.LensData.Array.LensControl.Seq.Lens Control.Parallel.Strategies.LensControl.Monad.Error.LensControl.Lens.UnsoundControl.Lens.ProfunctorControl.Lens.ExtrasControl.Exception.LensData.Dynamic.Lens Numeric.LensNumeric.Natural.LensSystem.Exit.LensSystem.FilePath.LensSystem.IO.Error.LensControl.Lens.Internal.InstancesIsoControl.Lens.Internal.Prelude Data.IntMapIntMapControl.Monad.Trans.State.LazyState indexed64indexed TraversalIndexedTraversalFold IndexedFoldPrismLens IndexedLensGetter IndexedGetterLensLikeOverlastOffirstOfmapM_ traverse1Of_ traverseOf_ cloneLensBazaartakingAccessor backwardsSetterControl.Monad.RWSRWSTZoomzoomControl.Monad.TransFreeTControl.Monad.ErrorErrorTControl.Monad.Trans.MaybeMaybeTControl.Monad.Trans.ListListTControl.Monad.WriterWriterTControl.Monad.StateStateTControl.Lens.Internal _imagPart Data.ComplexComplex traversedGetting Data.FoldableFoldable foldMapOf Data.MonoidMonoidrereviewpreview^?Control.Lens.CombinatorsmatchingData.TraversabletraverselengthOfNumeric.NaturalNaturalprismoutsidefromData.Text.InternalTextsetviewovercloneTraversal TraversableData.Functor.Compose getComposeCompose fmapDefaultuse_2atimap Traversal'Setter'^..~%~+~Iso'-~*~//~^~^^~**~||~&&~?~<>~%=+=-=*=//=^=^^=**=||=&&=.=?=<>=%@~ withIndex<.~<.=anyOfControl.Applicative Applicative Data.Functor<$>ConstPrelude. ifoldMapOf Data.TypeablecastControl.Lens.Extrais_EmptyAsEmptynullunfoldrdroppingfoldMapfoldfoldrfoldltoListandoranyallproductsum_1 traverseOf traverse__LeftforOffor_forM_ sequence_Data.SemigroupFirstLast maximumByfindfoldr1foldl1foldr'foldl' Data.Listfoldl1'foldrMfoldlM Data.Maybe listToMaybe Control.MonadMonadControl.TraversableControl.Lens.Isomorphic itraverseOfimapMOfiforMOf elemIndex elemIndices findIndex findIndicesData.Functor.Contravariant Contravariantifor transpose mapAccumR mapAccumLuniplatebiplate contextsOfControl.Comonad.Store.ClasspospeekeachReifiedTraversal runTraversal_AssertionFailed _ErrorCallPrism'Lens'Handler_NonTermination_StackOverflowalaalafData.MapMapjoinControl.Monad.Reader.Classlocalplate Data.Just isNothingextractIndexedfoldedData.List.Lens Data.Map.LazyunionData.Text.Lazymap Data.TextSimpleWrapped Control.LensData.ByteStringpackunpackData.ByteString.Char8Data.ByteString.LazyData.ByteString.Lazy.Char8 ByteStringControl.Exceptioncatches alongsidewithoutfailingControl.Lens.OperatorserrorControl.Monad.STMSTMControl.Concurrent.MVarMVartrytryJust catchJustCatchIOthrowControl.Concurrent killThreadSystem.FilePath extSeparatorpathSeparatorsbaseGHC.PtrPtr contramapData.Bifunctorbimap Bifunctor>$Data.Functor.Identity runIdentityIdentityData.Functor.ConstgetConstData.Type.EqualityRefl:~: Data.Function&<&>0indexed-traversable-0.1.2-8tk2uvVrRDXLSkH9yi4BjIData.Foldable.WithIndexitoListifoldlMifoldrMifind iconcatMapiforM_imapM_ifor_ itraverse_noneinoneiallianyData.Traversable.WithIndex imapAccumL imapAccumRiforMimapM WithIndexFunctorWithIndexifoldl'ifoldr'ifoldlifoldr ifoldMap'ifoldMapFoldableWithIndex itraverseTraversableWithIndex(profunctors-5.6.2-9vNzvGgyOfD3fg6imGaJobData.Profunctor.Unsafe ProfunctorData.Profunctor.Choiceright'left'Choicermaplmapdimap&reflection-2.1.6-CzOlI803nFuvt8AikdOutData.Reflection sequenceBy traverseBy foldMapByfoldBy reifiedMemptyreifiedMappend ReifiedMonoid*semigroupoids-5.3.7-7Y7iDwoAbzxBaKugG291Lz Data.Semigroup.Traversable.Class traverse1 Traversable1 Reversing reversingExchange$fProfunctorExchange$fFunctorExchange$fReversingVector$fReversingVector0$fReversingVector1$fReversingSeq$fReversingVector2$fReversingText$fReversingText0$fReversingByteString$fReversingByteString0$fReversingNonEmpty $fReversing[] ordinalNub stripSuffixFlowsrunFlows Deepening runDeepeningLevelTwoOneZero deepening$fTraversableWithIndexiLevel$fFoldableWithIndexiLevel$fFunctorWithIndexiLevel$fTraversableLevel$fFoldableLevel$fFunctorLevel$fMonoidDeepening$fSemigroupDeepening$fApplicativeFlows $fApplyFlows$fFunctorFlows $fEqLevel $fOrdLevel $fShowLevel $fReadLevel Indexing64 runIndexing64Indexing runIndexing runIndexed Indexable Conjoineddistrib conjoinedindexing indexing64asIndex $fConjoined->$fIndexablei->$fIndexableiIndexed$fConjoinedIndexed$fArrowLoopIndexed$fArrowApplyIndexed$fArrowChoiceIndexed$fArrowIndexed$fCategoryTYPEIndexed$fStrongIndexed$fChoiceIndexed$fCorepresentableIndexed$fCosieveIndexed(,)$fRepresentableIndexed$fSieveIndexed->$fCostrongIndexed$fClosedIndexed$fProfunctorIndexed$fMonadFixIndexed$fMonadIndexed $fBindIndexed$fApplicativeIndexed$fApplyIndexed$fFunctorIndexed$fMonoidIndexing$fSemigroupIndexing$fContravariantIndexing$fApplicativeIndexing$fApplyIndexing$fFunctorIndexing$fContravariantIndexing64$fApplicativeIndexing64$fApplyIndexing64$fFunctorIndexing64AlongsideRightgetAlongsideRight AlongsideLeftgetAlongsideLeftnoEffect$fBitraversableAlongsideLeft$fBifoldableAlongsideLeft$fBifunctorAlongsideLeft$fTraversable1AlongsideLeft$fFoldable1AlongsideLeft$fTraversableAlongsideLeft$fFoldableAlongsideLeft$fContravariantAlongsideLeft$fFunctorAlongsideLeft$fBitraversableAlongsideRight$fBifoldableAlongsideRight$fBifunctorAlongsideRight$fTraversable1AlongsideRight$fFoldable1AlongsideRight$fTraversableAlongsideRight$fFoldableAlongsideRight$fContravariantAlongsideRight$fFunctorAlongsideRight$fReadAlongsideRight$fShowAlongsideRight$fReadAlongsideLeft$fShowAlongsideLeft RightmostRPureRLeafRStepLeftmostLPureLLeafLStep NonEmptyDListgetNonEmptyDList Sequenced getSequenced TraversedF getTraversedF Traversed getTraversedFolding getFolding getLeftmost getRightmost$fMonoidFolding$fSemigroupFolding$fMonoidTraversed$fSemigroupTraversed$fMonoidTraversedF$fSemigroupTraversedF$fMonoidSequenced$fSemigroupSequenced$fSemigroupNonEmptyDList$fMonoidLeftmost$fSemigroupLeftmost$fMonoidRightmost$fSemigroupRightmost PretextT'PretextT runPretextTPretext'Pretext runPretextContext'ContextSellablesellIndexedComonadStoreiposipeekipeeksiseekiseeks iexperimentcontextIndexedComonadiextract iduplicateiextendIndexedFunctorifmap$fSellable->Context$fComonadContext$fFunctorContext$fIndexedComonadContext$fIndexedFunctorContext$fComonadStoreaContext$fIndexedComonadStoreContext$fSellablepPretext$fComonadStoreaPretext$fIndexedComonadStorePretext$fComonadPretext$fIndexedComonadPretext$fFunctorPretext$fIndexedFunctorPretext$fContravariantPretextT$fSellablepPretextT$fComonadStoreaPretextT$fIndexedComonadStorePretextT$fComonadPretextT$fIndexedComonadPretextT$fFunctorPretextT$fIndexedFunctorPretextT BazaarT1'BazaarT1 runBazaarT1Bazaar1'Bazaar1 runBazaar1Bizarre1bazaar1BazaarT'BazaarT runBazaarTBazaar' runBazaarBizarrebazaar$fComonadApplyBazaar$fComonadBazaar$fApplicativeBazaar $fApplyBazaar$fFunctorBazaar$fBizarrepBazaar$fSellablepBazaar$fIndexedComonadBazaar$fIndexedFunctorBazaar$fMonoidBazaarT$fSemigroupBazaarT$fContravariantBazaarT$fComonadApplyBazaarT$fComonadBazaarT$fApplicativeBazaarT$fApplyBazaarT$fFunctorBazaarT$fBizarrepBazaarT$fSellablepBazaarT$fIndexedComonadBazaarT$fIndexedFunctorBazaarT$fComonadApplyBazaar1$fComonadBazaar1$fApplyBazaar1$fFunctorBazaar1$fBizarre1pBazaar1$fSellablepBazaar1$fIndexedComonadBazaar1$fIndexedFunctorBazaar1$fSemigroupBazaarT1$fContravariantBazaarT1$fComonadApplyBazaarT1$fComonadBazaarT1$fApplyBazaarT1$fFunctorBazaarT1$fBizarre1pBazaarT1$fSellablepBazaarT1$fIndexedComonadBazaarT1$fIndexedFunctorBazaarT1 TakingWhileMaficMolten runMoltenMagmaMagmaAp MagmaPure MagmaFmaprunMagmarunMaficrunTakingWhile $fShowMagma$fTraversableWithIndexiMagma$fFoldableWithIndexiMagma$fFunctorWithIndexiMagma$fTraversableMagma$fFoldableMagma$fFunctorMagma$fComonadMolten$fIndexedComonadMolten$fIndexedFunctorMolten$fBizarreIndexedMolten$fSellableIndexedMolten$fApplicativeMolten $fApplyMolten$fFunctorMolten$fIndexedFunctorMafic$fBizarreIndexedMafic$fSellable->Mafic$fApplicativeMafic $fApplyMafic$fFunctorMafic$fIndexedFunctorTakingWhile$fContravariantTakingWhile$fBizarrepTakingWhile$fApplicativeTakingWhile$fApplyTakingWhile$fFunctorTakingWhileMarket'Market$fChoiceMarket$fProfunctorMarket$fFunctorMarket WrappedPafbWrapPafb unwrapPafb$fChoiceWrappedPafb$fProfunctorWrappedPafb Reviewableretagged $fReviewablepSettable untainted untaintedDot taintedDot$fSettableCompose$fSettableBackwards$fSettableIdentity EffectRWS getEffectRWSEffect getEffect FocusingFreeunfocusingFreeFreedgetFreed FocusingErr unfocusingErrErrgetErr FocusingMay unfocusingMayMaygetMay FocusingOn unfocusingOn FocusingPlusunfocusingPlus FocusingWithunfocusingWithFocusing unfocusing$fApplicativeFocusing$fApplyFocusing$fFunctorFocusing$fApplicativeFocusingWith$fApplyFocusingWith$fFunctorFocusingWith$fApplicativeFocusingPlus$fApplyFocusingPlus$fFunctorFocusingPlus$fApplicativeFocusingOn$fApplyFocusingOn$fFunctorFocusingOn $fMonoidMay$fSemigroupMay$fApplicativeFocusingMay$fApplyFocusingMay$fFunctorFocusingMay $fMonoidErr$fSemigroupErr$fApplicativeFocusingErr$fApplyFocusingErr$fFunctorFocusingErr $fMonoidFreed$fSemigroupFreed$fApplicativeFocusingFree$fApplyFocusingFree$fFunctorFocusingFree$fApplicativeEffect $fApplyEffect$fMonoidEffect$fSemigroupEffect$fContravariantEffect$fFunctorEffect$fContravariantEffectRWS$fApplicativeEffectRWS$fApplyEffectRWS$fFunctorEffectRWSOver'IndexedLensLike'IndexedLensLike LensLike'Optical'OpticalOptic'OpticIndexPreservingFold1 IndexedFold1Fold1IndexPreservingFoldIndexPreservingGetterAs Equality'EqualityAReviewReviewIndexPreservingSetter'IndexPreservingSetterIndexedSetter' IndexedSetterIndexPreservingTraversal1'IndexPreservingTraversal1IndexPreservingTraversal'IndexPreservingTraversalIndexedTraversal1'IndexedTraversal1IndexedTraversal' Traversal1' Traversal1IndexPreservingLens'IndexPreservingLens IndexedLens'Setting'SettingAnIndexedSetter'AnIndexedSetterASetter'ASettermappedlifted contramappedargumentsettingsets cloneSettercloneIndexPreservingSettercloneIndexedSetterset'~<%=<+=<-=<*==<<~<<>~<<>=overA<%@~<<%@~%%@~%%@=<%@=<<%@=^#storing#~#%~#%%~#=#%=<#%~<#%=#%%=<#~<#=devoidunitedhead1last1fusing $fApplyFirst1$fFunctorFirst1Field19_19Field18_18Field17_17Field16_16Field15_15Field14_14Field13_13Field12_12Field11_11Field10_10Field9_9Field8_8Field7_7Field6_6Field5_5Field4_4Field3_3Field2Field1_1'_2'_3'_4'_5'_6'_7'_8'_9'_10'_11'_12'_13'_14'_15'_16'_17'_18'_19'$fGIxedkknM1M1ab$fGIxed'Fnss'st'ab$fGIxed'Tnss'ts'ab$fGIxedTYPETYPEn:*::*:ab$fGIxedTYPEkZK1K1ab3$fField1(,,,,,,,,,,,,,,,,,,)(,,,,,,,,,,,,,,,,,,)aa'1$fField1(,,,,,,,,,,,,,,,,,)(,,,,,,,,,,,,,,,,,)aa'/$fField1(,,,,,,,,,,,,,,,,)(,,,,,,,,,,,,,,,,)aa'-$fField1(,,,,,,,,,,,,,,,)(,,,,,,,,,,,,,,,)aa'+$fField1(,,,,,,,,,,,,,,)(,,,,,,,,,,,,,,)aa')$fField1(,,,,,,,,,,,,,)(,,,,,,,,,,,,,)aa''$fField1(,,,,,,,,,,,,)(,,,,,,,,,,,,)aa'%$fField1(,,,,,,,,,,,)(,,,,,,,,,,,)aa'#$fField1(,,,,,,,,,,)(,,,,,,,,,,)aa'!$fField1(,,,,,,,,,)(,,,,,,,,,)aa'$fField1(,,,,,,,,)(,,,,,,,,)aa'$fField1(,,,,,,,)(,,,,,,,)aa'$fField1(,,,,,,)(,,,,,,)aa'$fField1(,,,,,)(,,,,,)aa'$fField1(,,,,)(,,,,)aa'$fField1(,,,)(,,,)aa'$fField1(,,)(,,)aa'$fField1(,)(,)aa'$fField1PairPairaa'$fField1:*::*:ff'$fField1ProductProductff'$fField1IdentityIdentityab3$fField2(,,,,,,,,,,,,,,,,,,)(,,,,,,,,,,,,,,,,,,)bb'1$fField2(,,,,,,,,,,,,,,,,,)(,,,,,,,,,,,,,,,,,)bb'/$fField2(,,,,,,,,,,,,,,,,)(,,,,,,,,,,,,,,,,)bb'-$fField2(,,,,,,,,,,,,,,,)(,,,,,,,,,,,,,,,)bb'+$fField2(,,,,,,,,,,,,,,)(,,,,,,,,,,,,,,)bb')$fField2(,,,,,,,,,,,,,)(,,,,,,,,,,,,,)bb''$fField2(,,,,,,,,,,,,)(,,,,,,,,,,,,)bb'%$fField2(,,,,,,,,,,,)(,,,,,,,,,,,)bb'#$fField2(,,,,,,,,,,)(,,,,,,,,,,)bb'!$fField2(,,,,,,,,,)(,,,,,,,,,)bb'$fField2(,,,,,,,,)(,,,,,,,,)bb'$fField2(,,,,,,,)(,,,,,,,)bb'$fField2(,,,,,,)(,,,,,,)bb'$fField2(,,,,,)(,,,,,)bb'$fField2(,,,,)(,,,,)bb'$fField2(,,,)(,,,)bb'$fField2(,,)(,,)bb'$fField2(,)(,)bb'$fField2PairPairbb'$fField2:*::*:gg'$fField2ProductProductgg'3$fField3(,,,,,,,,,,,,,,,,,,)(,,,,,,,,,,,,,,,,,,)cc'1$fField3(,,,,,,,,,,,,,,,,,)(,,,,,,,,,,,,,,,,,)cc'/$fField3(,,,,,,,,,,,,,,,,)(,,,,,,,,,,,,,,,,)cc'-$fField3(,,,,,,,,,,,,,,,)(,,,,,,,,,,,,,,,)cc'+$fField3(,,,,,,,,,,,,,,)(,,,,,,,,,,,,,,)cc')$fField3(,,,,,,,,,,,,,)(,,,,,,,,,,,,,)cc''$fField3(,,,,,,,,,,,,)(,,,,,,,,,,,,)cc'%$fField3(,,,,,,,,,,,)(,,,,,,,,,,,)cc'#$fField3(,,,,,,,,,,)(,,,,,,,,,,)cc'!$fField3(,,,,,,,,,)(,,,,,,,,,)cc'$fField3(,,,,,,,,)(,,,,,,,,)cc'$fField3(,,,,,,,)(,,,,,,,)cc'$fField3(,,,,,,)(,,,,,,)cc'$fField3(,,,,,)(,,,,,)cc'$fField3(,,,,)(,,,,)cc'$fField3(,,,)(,,,)cc'$fField3(,,)(,,)cc'3$fField4(,,,,,,,,,,,,,,,,,,)(,,,,,,,,,,,,,,,,,,)dd'1$fField4(,,,,,,,,,,,,,,,,,)(,,,,,,,,,,,,,,,,,)dd'/$fField4(,,,,,,,,,,,,,,,,)(,,,,,,,,,,,,,,,,)dd'-$fField4(,,,,,,,,,,,,,,,)(,,,,,,,,,,,,,,,)dd'+$fField4(,,,,,,,,,,,,,,)(,,,,,,,,,,,,,,)dd')$fField4(,,,,,,,,,,,,,)(,,,,,,,,,,,,,)dd''$fField4(,,,,,,,,,,,,)(,,,,,,,,,,,,)dd'%$fField4(,,,,,,,,,,,)(,,,,,,,,,,,)dd'#$fField4(,,,,,,,,,,)(,,,,,,,,,,)dd'!$fField4(,,,,,,,,,)(,,,,,,,,,)dd'$fField4(,,,,,,,,)(,,,,,,,,)dd'$fField4(,,,,,,,)(,,,,,,,)dd'$fField4(,,,,,,)(,,,,,,)dd'$fField4(,,,,,)(,,,,,)dd'$fField4(,,,,)(,,,,)dd'$fField4(,,,)(,,,)dd'3$fField5(,,,,,,,,,,,,,,,,,,)(,,,,,,,,,,,,,,,,,,)ee'1$fField5(,,,,,,,,,,,,,,,,,)(,,,,,,,,,,,,,,,,,)ee'/$fField5(,,,,,,,,,,,,,,,,)(,,,,,,,,,,,,,,,,)ee'-$fField5(,,,,,,,,,,,,,,,)(,,,,,,,,,,,,,,,)ee'+$fField5(,,,,,,,,,,,,,,)(,,,,,,,,,,,,,,)ee')$fField5(,,,,,,,,,,,,,)(,,,,,,,,,,,,,)ee''$fField5(,,,,,,,,,,,,)(,,,,,,,,,,,,)ee'%$fField5(,,,,,,,,,,,)(,,,,,,,,,,,)ee'#$fField5(,,,,,,,,,,)(,,,,,,,,,,)ee'!$fField5(,,,,,,,,,)(,,,,,,,,,)ee'$fField5(,,,,,,,,)(,,,,,,,,)ee'$fField5(,,,,,,,)(,,,,,,,)ee'$fField5(,,,,,,)(,,,,,,)ee'$fField5(,,,,,)(,,,,,)ee'$fField5(,,,,)(,,,,)ee'3$fField6(,,,,,,,,,,,,,,,,,,)(,,,,,,,,,,,,,,,,,,)ff'1$fField6(,,,,,,,,,,,,,,,,,)(,,,,,,,,,,,,,,,,,)ff'/$fField6(,,,,,,,,,,,,,,,,)(,,,,,,,,,,,,,,,,)ff'-$fField6(,,,,,,,,,,,,,,,)(,,,,,,,,,,,,,,,)ff'+$fField6(,,,,,,,,,,,,,,)(,,,,,,,,,,,,,,)ff')$fField6(,,,,,,,,,,,,,)(,,,,,,,,,,,,,)ff''$fField6(,,,,,,,,,,,,)(,,,,,,,,,,,,)ff'%$fField6(,,,,,,,,,,,)(,,,,,,,,,,,)ff'#$fField6(,,,,,,,,,,)(,,,,,,,,,,)ff'!$fField6(,,,,,,,,,)(,,,,,,,,,)ff'$fField6(,,,,,,,,)(,,,,,,,,)ff'$fField6(,,,,,,,)(,,,,,,,)ff'$fField6(,,,,,,)(,,,,,,)ff'$fField6(,,,,,)(,,,,,)ff'3$fField7(,,,,,,,,,,,,,,,,,,)(,,,,,,,,,,,,,,,,,,)gg'1$fField7(,,,,,,,,,,,,,,,,,)(,,,,,,,,,,,,,,,,,)gg'/$fField7(,,,,,,,,,,,,,,,,)(,,,,,,,,,,,,,,,,)gg'-$fField7(,,,,,,,,,,,,,,,)(,,,,,,,,,,,,,,,)gg'+$fField7(,,,,,,,,,,,,,,)(,,,,,,,,,,,,,,)gg')$fField7(,,,,,,,,,,,,,)(,,,,,,,,,,,,,)gg''$fField7(,,,,,,,,,,,,)(,,,,,,,,,,,,)gg'%$fField7(,,,,,,,,,,,)(,,,,,,,,,,,)gg'#$fField7(,,,,,,,,,,)(,,,,,,,,,,)gg'!$fField7(,,,,,,,,,)(,,,,,,,,,)gg'$fField7(,,,,,,,,)(,,,,,,,,)gg'$fField7(,,,,,,,)(,,,,,,,)gg'$fField7(,,,,,,)(,,,,,,)gg'3$fField8(,,,,,,,,,,,,,,,,,,)(,,,,,,,,,,,,,,,,,,)hh'1$fField8(,,,,,,,,,,,,,,,,,)(,,,,,,,,,,,,,,,,,)hh'/$fField8(,,,,,,,,,,,,,,,,)(,,,,,,,,,,,,,,,,)hh'-$fField8(,,,,,,,,,,,,,,,)(,,,,,,,,,,,,,,,)hh'+$fField8(,,,,,,,,,,,,,,)(,,,,,,,,,,,,,,)hh')$fField8(,,,,,,,,,,,,,)(,,,,,,,,,,,,,)hh''$fField8(,,,,,,,,,,,,)(,,,,,,,,,,,,)hh'%$fField8(,,,,,,,,,,,)(,,,,,,,,,,,)hh'#$fField8(,,,,,,,,,,)(,,,,,,,,,,)hh'!$fField8(,,,,,,,,,)(,,,,,,,,,)hh'$fField8(,,,,,,,,)(,,,,,,,,)hh'$fField8(,,,,,,,)(,,,,,,,)hh'3$fField9(,,,,,,,,,,,,,,,,,,)(,,,,,,,,,,,,,,,,,,)ii'1$fField9(,,,,,,,,,,,,,,,,,)(,,,,,,,,,,,,,,,,,)ii'/$fField9(,,,,,,,,,,,,,,,,)(,,,,,,,,,,,,,,,,)ii'-$fField9(,,,,,,,,,,,,,,,)(,,,,,,,,,,,,,,,)ii'+$fField9(,,,,,,,,,,,,,,)(,,,,,,,,,,,,,,)ii')$fField9(,,,,,,,,,,,,,)(,,,,,,,,,,,,,)ii''$fField9(,,,,,,,,,,,,)(,,,,,,,,,,,,)ii'%$fField9(,,,,,,,,,,,)(,,,,,,,,,,,)ii'#$fField9(,,,,,,,,,,)(,,,,,,,,,,)ii'!$fField9(,,,,,,,,,)(,,,,,,,,,)ii'$fField9(,,,,,,,,)(,,,,,,,,)ii'4$fField10(,,,,,,,,,,,,,,,,,,)(,,,,,,,,,,,,,,,,,,)jj'2$fField10(,,,,,,,,,,,,,,,,,)(,,,,,,,,,,,,,,,,,)jj'0$fField10(,,,,,,,,,,,,,,,,)(,,,,,,,,,,,,,,,,)jj'.$fField10(,,,,,,,,,,,,,,,)(,,,,,,,,,,,,,,,)jj',$fField10(,,,,,,,,,,,,,,)(,,,,,,,,,,,,,,)jj'*$fField10(,,,,,,,,,,,,,)(,,,,,,,,,,,,,)jj'($fField10(,,,,,,,,,,,,)(,,,,,,,,,,,,)jj'&$fField10(,,,,,,,,,,,)(,,,,,,,,,,,)jj'$$fField10(,,,,,,,,,,)(,,,,,,,,,,)jj'"$fField10(,,,,,,,,,)(,,,,,,,,,)jj'6$fField11(,,,,,,,,,,,,,,,,,,)(,,,,,,,,,,,,,,,,,,)kkkk'4$fField11(,,,,,,,,,,,,,,,,,)(,,,,,,,,,,,,,,,,,)kkkk'2$fField11(,,,,,,,,,,,,,,,,)(,,,,,,,,,,,,,,,,)kkkk'0$fField11(,,,,,,,,,,,,,,,)(,,,,,,,,,,,,,,,)kkkk'.$fField11(,,,,,,,,,,,,,,)(,,,,,,,,,,,,,,)kkkk',$fField11(,,,,,,,,,,,,,)(,,,,,,,,,,,,,)kkkk'*$fField11(,,,,,,,,,,,,)(,,,,,,,,,,,,)kkkk'($fField11(,,,,,,,,,,,)(,,,,,,,,,,,)kkkk'&$fField11(,,,,,,,,,,)(,,,,,,,,,,)kkkk'4$fField12(,,,,,,,,,,,,,,,,,,)(,,,,,,,,,,,,,,,,,,)ll'2$fField12(,,,,,,,,,,,,,,,,,)(,,,,,,,,,,,,,,,,,)ll'0$fField12(,,,,,,,,,,,,,,,,)(,,,,,,,,,,,,,,,,)ll'.$fField12(,,,,,,,,,,,,,,,)(,,,,,,,,,,,,,,,)ll',$fField12(,,,,,,,,,,,,,,)(,,,,,,,,,,,,,,)ll'*$fField12(,,,,,,,,,,,,,)(,,,,,,,,,,,,,)ll'($fField12(,,,,,,,,,,,,)(,,,,,,,,,,,,)ll'&$fField12(,,,,,,,,,,,)(,,,,,,,,,,,)ll'4$fField13(,,,,,,,,,,,,,,,,,,)(,,,,,,,,,,,,,,,,,,)mm'2$fField13(,,,,,,,,,,,,,,,,,)(,,,,,,,,,,,,,,,,,)mm'0$fField13(,,,,,,,,,,,,,,,,)(,,,,,,,,,,,,,,,,)mm'.$fField13(,,,,,,,,,,,,,,,)(,,,,,,,,,,,,,,,)mm',$fField13(,,,,,,,,,,,,,,)(,,,,,,,,,,,,,,)mm'*$fField13(,,,,,,,,,,,,,)(,,,,,,,,,,,,,)mm'($fField13(,,,,,,,,,,,,)(,,,,,,,,,,,,)mm'4$fField14(,,,,,,,,,,,,,,,,,,)(,,,,,,,,,,,,,,,,,,)nn'2$fField14(,,,,,,,,,,,,,,,,,)(,,,,,,,,,,,,,,,,,)nn'0$fField14(,,,,,,,,,,,,,,,,)(,,,,,,,,,,,,,,,,)nn'.$fField14(,,,,,,,,,,,,,,,)(,,,,,,,,,,,,,,,)nn',$fField14(,,,,,,,,,,,,,,)(,,,,,,,,,,,,,,)nn'*$fField14(,,,,,,,,,,,,,)(,,,,,,,,,,,,,)nn'4$fField15(,,,,,,,,,,,,,,,,,,)(,,,,,,,,,,,,,,,,,,)oo'2$fField15(,,,,,,,,,,,,,,,,,)(,,,,,,,,,,,,,,,,,)oo'0$fField15(,,,,,,,,,,,,,,,,)(,,,,,,,,,,,,,,,,)oo'.$fField15(,,,,,,,,,,,,,,,)(,,,,,,,,,,,,,,,)oo',$fField15(,,,,,,,,,,,,,,)(,,,,,,,,,,,,,,)oo'4$fField16(,,,,,,,,,,,,,,,,,,)(,,,,,,,,,,,,,,,,,,)pp'2$fField16(,,,,,,,,,,,,,,,,,)(,,,,,,,,,,,,,,,,,)pp'0$fField16(,,,,,,,,,,,,,,,,)(,,,,,,,,,,,,,,,,)pp'.$fField16(,,,,,,,,,,,,,,,)(,,,,,,,,,,,,,,,)pp'4$fField17(,,,,,,,,,,,,,,,,,,)(,,,,,,,,,,,,,,,,,,)qq'2$fField17(,,,,,,,,,,,,,,,,,)(,,,,,,,,,,,,,,,,,)qq'0$fField17(,,,,,,,,,,,,,,,,)(,,,,,,,,,,,,,,,,)qq'4$fField18(,,,,,,,,,,,,,,,,,,)(,,,,,,,,,,,,,,,,,,)rr'2$fField18(,,,,,,,,,,,,,,,,,)(,,,,,,,,,,,,,,,,,)rr'4$fField19(,,,,,,,,,,,,,,,,,,)(,,,,,,,,,,,,,,,,,,)ss' AccessingIndexedGettingtoitolikeilikeviewsuses listening ilistening listenings ilisteningsiviewiviewsiuseiuses^@.gettinguntoun#reviewsreusereuses reviewingSuffixedsuffixedPrefixedprefixedAPrism'APrism withPrism clonePrismprism'asidebelowisn't matching'_Right_Just_Nothing_Voidonlynearly_Show$fPrefixedByteString$fPrefixedByteString0$fPrefixedText$fPrefixedText0 $fPrefixed[]$fSuffixedByteString$fSuffixedByteString0$fSuffixedText$fSuffixedText0 $fSuffixed[]foldingifoldingfoldring ifoldringfolded64repeated replicatedcycledunfoldediteratedfiltered filteredBy takingWhile droppingWhilewordedlinedfoldOffoldrOffoldlOftoListOf toNonEmptyOf^..andOforOfallOfnoneOf productOfsumOfforOf_ sequenceAOf_for1Of_ sequence1Of_mapMOf_forMOf_ sequenceOf_asumOfmsumOfelemOf notElemOf concatMapOfconcatOf^?!first1Oflast1OfnullOf notNullOf maximumOf maximum1Of minimumOf minimum1Of maximumByOf minimumByOffindOffindMOflookupOffoldr1Offoldl1OffoldrOf'foldlOf' foldr1Of' foldl1Of'foldrMOffoldlMOfhashasn'tpreipreipreviewpreviews ipreviewspreuseipreusepreusesipreusesifoldrOfifoldlOfianyOfiallOfinoneOf itraverseOf_iforOf_imapMOf_iforMOf_ iconcatMapOfifindOfifindMOf ifoldrOf' ifoldlOf' ifoldrMOf ifoldlMOf itoListOf^@..^@?^@?! elemIndexOf elemIndicesOf findIndexOf findIndicesOf ifiltered itakingWhileidroppingWhilefoldByOf foldMapByOf TraverseMax traverseMax TraverseMin traverseMin Traversing1' Traversing' Traversing1 TraversingAnIndexedTraversal1'AnIndexedTraversal'AnIndexedTraversal1AnIndexedTraversal ATraversal1' ATraversal1 ATraversal' ATraversal traversal sequenceAOfmapMOfforMOf sequenceOf transposeOf mapAccumROf mapAccumLOfscanr1Ofscanl1OflociilocipartsOfipartsOfpartsOf' ipartsOf' unsafePartsOfiunsafePartsOfunsafePartsOf'iunsafePartsOf'singularunsafeSingularholesOfholes1Ofbothboth1besidecloneIndexPreservingTraversalcloneIndexedTraversalcloneTraversal1cloneIndexPreservingTraversal1cloneIndexedTraversal1iforOf imapAccumROf imapAccumLOf traversed1 traversed64ignored elementOfelement elementsOfelementsfailover ifailoverdeepOf confusing traverseByOf sequenceByOf$fApplicativeHoles $fApplyHoles$fFunctorHoles$fTraverseMinkMap$fTraverseMinIntIntMap$fTraverseMaxkMap$fTraverseMaxIntIntMaplevelsilevels ReifiedPrism' ReifiedPrismrunPrism ReifiedIso' ReifiedIsorunIsoReifiedIndexedSetter'ReifiedIndexedSetterrunIndexedSetterReifiedSetter' ReifiedSetter runSetterReifiedIndexedFoldrunIndexedFold ReifiedFoldrunFoldReifiedIndexedGetterrunIndexedGetter ReifiedGetter runGetterReifiedTraversal'ReifiedIndexedTraversal'ReifiedIndexedTraversalrunIndexedTraversalReifiedIndexedLens'ReifiedIndexedLensrunIndexedLens ReifiedLens' ReifiedLensrunLens$fArrowLoopReifiedGetter$fArrowChoiceReifiedGetter$fArrowApplyReifiedGetter$fArrowReifiedGetter$fCategoryTYPEReifiedGetter$fChoiceReifiedGetter$fStrongReifiedGetter$fConjoinedReifiedGetter$fCostrongReifiedGetter$fRepresentableReifiedGetter$fSieveReifiedGetterIdentity$fCorepresentableReifiedGetter$fCosieveReifiedGetterIdentity$fClosedReifiedGetter$fProfunctorReifiedGetter$fMonadReadersReifiedGetter$fMonadReifiedGetter$fBindReifiedGetter$fApplicativeReifiedGetter$fApplyReifiedGetter$fComonadApplyReifiedGetter$fComonadReifiedGetter$fExtendReifiedGetter$fFunctorReifiedGetter$fDistributiveReifiedGetter$fApplyReifiedIndexedGetter$fFunctorReifiedIndexedGetter$fStrongReifiedIndexedGetter#$fRepresentableReifiedIndexedGetter$fSieveReifiedIndexedGetter(,) $fProfunctorReifiedIndexedGetter$fPlusReifiedFold$fAltReifiedFold$fMonoidReifiedFold$fSemigroupReifiedFold$fMonadReadersReifiedFold$fMonadPlusReifiedFold$fMonadReifiedFold$fBindReifiedFold$fAlternativeReifiedFold$fApplicativeReifiedFold$fApplyReifiedFold$fFunctorReifiedFold$fArrowApplyReifiedFold$fArrowChoiceReifiedFold$fArrowReifiedFold$fCategoryTYPEReifiedFold$fChoiceReifiedFold$fStrongReifiedFold$fRepresentableReifiedFold$fSieveReifiedFold[]$fProfunctorReifiedFold$fStrongReifiedIndexedFold!$fRepresentableReifiedIndexedFold $fSieveReifiedIndexedFoldCompose$fProfunctorReifiedIndexedFold$fFunctorReifiedIndexedFold$fPlusReifiedIndexedFold$fAltReifiedIndexedFold$fMonoidReifiedIndexedFold$fSemigroupReifiedIndexedFoldHandlingException Handleablehandlerhandler_!$fHandleableSomeExceptionmHandler"$fHandleableSomeExceptionIOHandler$fExceptionHandlingException$fExceptionHandling$fShowHandling$fShowHandlingException<..> selfIndex reindexed<.>icomposeindicesindeximappedifolded itraversed ifoldMapBy ifoldMapByOf itraverseBy itraverseByOftraversedStrictTreetraversedStrictTree8 traversedLazytraversedLazy8 AnEquality' AnEquality IdenticalrunEqsubstEqmapEqfromEqsimplysimple cloneEqualityequality equality' overEquality underEquality fromLeibniz fromLeibniz' withEqualityAnIso'AnIsoListReversedSwappedLazyStrictisowithIsocloneIsoauaufxplatxplatfunderenummappingnonnon'anoncurried uncurriedflippedswappedstrictlazyreversed involutedmagmaimagma contramapping dimappinglmappingrmapping bimappingfirsting secondingcoercedEmpty $fAsEmptyText$fAsEmptyText0$fAsEmptyByteString$fAsEmptyByteString0 $fAsEmptySeq$fAsEmptyVector$fAsEmptyVector0$fAsEmptyVector1$fAsEmptyIntSet$fAsEmptyHashSet $fAsEmptySet$fAsEmptyIntMap$fAsEmptyHashMap $fAsEmptyMap$fAsEmptyZipList $fAsEmpty[] $fAsEmpty(,,) $fAsEmpty(,) $fAsEmptyDual$fAsEmptyFirst $fAsEmptyLast$fAsEmptyMaybe $fAsEmptySum$fAsEmptyProduct$fAsEmptyEvent $fAsEmptyAll $fAsEmptyAny $fAsEmpty()$fAsEmptyOrderingSnoc_SnocCons_Cons:>:<<|consuncons_head_tail_init_last|>snocunsnoc$fConsVectorVectorab$fConsVectorVectorab0$fConsVectorVectorab1$fConsVectorVectorab2$fConsTextTextCharChar$fConsTextTextCharChar0$$fConsByteStringByteStringWord8Word8%$fConsByteStringByteStringWord8Word80$fConsSeqSeqab$fConsZipListZipListab $fCons[][]ab$fSnocTextTextCharChar$fSnocTextTextCharChar0$$fSnocByteStringByteStringWord8Word8%$fSnocByteStringByteStringWord8Word80$fSnocVectorVectorab$fSnocVectorVectorab0$fSnocVectorVectorab1$fSnocVectorVectorab2$fSnocSeqSeqab$fSnocZipListZipListab $fSnoc[][]abDequeBD singletonsizefromList$fSnocDequeDequeab$fConsDequeDequeab $fMonoidDeque$fSemigroupDeque$fTraversableWithIndexIntDeque$fTraversableDeque$fFoldableWithIndexIntDeque$fFoldableDeque$fMonadPlusDeque $fMonadDeque $fBindDeque$fReversingDeque$fAlternativeDeque $fPlusDeque $fAltDeque$fApplicativeDeque $fApplyDeque$fFunctorWithIndexIntDeque$fFunctorDeque $fOrdDeque $fEqDeque $fShowDeque Rewrapping Rewrapped Unwrapped _Wrapped' _GWrapped' _Unwrapped'_Wrapped _Unwrappedop _Wrapping' _Unwrapping' _Wrapping _Unwrapping$fWrappedCTimer $fWrappedCKey $fWrappedCId$fWrappedCFsFilCnt$fWrappedCFsBlkCnt$fWrappedCClockId$fWrappedCBlkCnt$fWrappedCBlkSize$fWrappedCBool $fWrappedFd$fWrappedCRLim$fWrappedCTcflag$fWrappedCSpeed $fWrappedCCc $fWrappedCUid$fWrappedCNlink $fWrappedCGid$fWrappedCSsize $fWrappedCPid $fWrappedCOff$fWrappedCMode $fWrappedCIno $fWrappedCDev $fWrapped:.: $fWrappedM1 $fWrappedK1 $fWrappedRec1 $fWrappedPar1$fWrappedCUIntMax$fWrappedCIntMax$fWrappedCUIntPtr$fWrappedCIntPtr$fWrappedCSUSeconds$fWrappedCUSeconds$fWrappedCTime$fWrappedCClock$fWrappedCSigAtomic$fWrappedCWchar$fWrappedCSize$fWrappedCPtrdiff$fWrappedCDouble$fWrappedCFloat$fWrappedCULLong$fWrappedCLLong$fWrappedCULong$fWrappedCLong$fWrappedCUInt $fWrappedCInt$fWrappedCUShort$fWrappedCShort$fWrappedCUChar$fWrappedCSChar$fWrappedCChar$fWrappedCompactionFailed$fWrappedTypeError$fWrappedErrorCall$fWrappedRecUpdError$fWrappedRecSelError$fWrappedRecConError$fWrappedPatternMatchFail$fWrappedNoMethodError$fWrappedAssertionFailed$fWrappedTagged$fWrappedComposeCF$fWrappedComposeFC$fWrappedCompose $fWrappedOp$fWrappedEquivalence$fWrappedComparison$fWrappedPredicate$fWrappedOption$fWrappedWrappedMonoid $fWrappedLast$fWrappedFirst $fWrappedMax $fWrappedMin$fWrappedStatic $fWrappedDual $fWrappedSemi$fWrappedWrappedCategory$fWrappedMaybeApply$fWrappedWrappedApplicative$fWrappedVector$fWrappedVector0$fWrappedVector1$fWrappedVector2$fWrappedCayley$fWrappedForget$fWrappedWrappedArrow$fWrappedCostar $fWrappedStar $fWrappedSeq $fWrappedSet $fWrappedMap$fWrappedIntSet$fWrappedIntMap$fWrappedHashSet$fWrappedHashMap$fWrappedIterT$fWrappedFreeT$fWrappedCoiterT$fWrappedCofreeT $fWrappedApT $fWrappedAlt$fWrappedCatchT$fWrappedTracedT$fWrappedWrappedBifunctor$fWrappedTannen$fWrappedJoker $fWrappedJoin $fWrappedFlip $fWrappedFix$fWrappedClown $fWrappedBiff$fWrappedListT$fWrappedErrorT$fWrappedWriterT$fWrappedWriterT0$fWrappedStateT$fWrappedStateT0 $fWrappedRWST$fWrappedRWST0$fWrappedReverse$fWrappedReaderT$fWrappedMaybeT$fWrappedIdentityT$fWrappedIdentity$fWrappedExceptT$fWrappedContT$fWrappedConstant$fWrappedCompose0$fWrappedBackwards$fWrappedErrno $fWrappedDown$fWrappedArrowMonad $fWrappedAp $fWrappedAlt0$fWrappedLast0$fWrappedFirst0 $fWrappedEndo$fWrappedDual0$fWrappedConst$fWrappedNonEmpty$fWrappedZipList$fWrappedWrappedArrow0$fWrappedWrappedMonad$fWrappedKleisli$fWrappedProduct $fWrappedSum $fWrappedAny $fWrappedAll$fRewrappedCTimert$fRewrappedCKeyt$fRewrappedCIdt$fRewrappedCFsFilCntt$fRewrappedCFsBlkCntt$fRewrappedCClockIdt$fRewrappedCBlkCntt$fRewrappedCBlkSizet$fRewrappedCBoolt$fRewrappedFdt$fRewrappedCRLimt$fRewrappedCTcflagt$fRewrappedCSpeedt$fRewrappedCCct$fRewrappedCUidt$fRewrappedCNlinkt$fRewrappedCGidt$fRewrappedCSsizet$fRewrappedCPidt$fRewrappedCOfft$fRewrappedCModet$fRewrappedCInot$fRewrappedCDevt$fRewrapped:.:t$fRewrappedM1t$fRewrappedK1t$fRewrappedRec1t$fRewrappedPar1t$fRewrappedCUIntMaxt$fRewrappedCIntMaxt$fRewrappedCUIntPtrt$fRewrappedCIntPtrt$fRewrappedCSUSecondst$fRewrappedCUSecondst$fRewrappedCTimet$fRewrappedCClockt$fRewrappedCSigAtomict$fRewrappedCWchart$fRewrappedCSizet$fRewrappedCPtrdifft$fRewrappedCDoublet$fRewrappedCFloatt$fRewrappedCULLongt$fRewrappedCLLongt$fRewrappedCULongt$fRewrappedCLongt$fRewrappedCUIntt$fRewrappedCIntt$fRewrappedCUShortt$fRewrappedCShortt$fRewrappedCUChart$fRewrappedCSChart$fRewrappedCChart$fRewrappedCompactionFailedt$fRewrappedTypeErrort$fRewrappedErrorCallt$fRewrappedRecUpdErrort$fRewrappedRecSelErrort$fRewrappedRecConErrort$fRewrappedPatternMatchFailt$fRewrappedNoMethodErrort$fRewrappedAssertionFailedt$fRewrappedTaggedt$fRewrappedComposeCFt$fRewrappedComposeFCt$fRewrappedComposet$fRewrappedOpt$fRewrappedEquivalencet$fRewrappedComparisont$fRewrappedPredicatet$fRewrappedOptiont$fRewrappedWrappedMonoidt$fRewrappedLastt$fRewrappedFirstt$fRewrappedMaxt$fRewrappedMint$fRewrappedStatict$fRewrappedDualt$fRewrappedSemit$fRewrappedWrappedCategoryt$fRewrappedMaybeApplyt$fRewrappedWrappedApplicativet$fRewrappedVectort$fRewrappedVectort0$fRewrappedVectort1$fRewrappedVectort2$fRewrappedCayleyt$fRewrappedForgett$fRewrappedWrappedArrowt$fRewrappedCostart$fRewrappedStart$fRewrappedSeqt$fRewrappedSett$fRewrappedMapt$fRewrappedIntSett$fRewrappedIntMapt$fRewrappedHashSett$fRewrappedHashMapt$fRewrappedIterTt$fRewrappedFreeTt$fRewrappedCoiterTt$fRewrappedCofreeTt$fRewrappedApTt$fRewrappedAltt$fRewrappedCatchTt$fRewrappedTracedTt$fRewrappedWrappedBifunctort$fRewrappedTannent$fRewrappedJokert$fRewrappedJoint$fRewrappedFlipt$fRewrappedFixt$fRewrappedClownt$fRewrappedBifft$fRewrappedListTt$fRewrappedErrorTt$fRewrappedWriterTt$fRewrappedWriterTt0$fRewrappedStateTt$fRewrappedStateTt0$fRewrappedRWSTt$fRewrappedRWSTt0$fRewrappedReverset$fRewrappedReaderTt$fRewrappedMaybeTt$fRewrappedIdentityTt$fRewrappedIdentityt$fRewrappedExceptTt$fRewrappedContTt$fRewrappedConstantt$fRewrappedComposet0$fRewrappedBackwardst$fRewrappedErrnot$fRewrappedDownt$fRewrappedArrowMonadt$fRewrappedApt$fRewrappedAltt0$fRewrappedLastt0$fRewrappedFirstt0$fRewrappedEndot$fRewrappedDualt0$fRewrappedConstt$fRewrappedNonEmptyt$fRewrappedZipListt$fRewrappedWrappedArrowt0$fRewrappedWrappedMonadt$fRewrappedKleislit$fRewrappedProductt$fRewrappedSumt$fRewrappedAnyt$fRewrappedAllt$fRewrappingstappsTappsE1toTupleTtoTupleEtoTuplePconAppsTnewNames unfoldTypedatatypeTypeKindeddropSigsIfNonDataFam quantifyType quantifyType' tvbToTypeunSigT isDataFamilytraversalTypeNametraversal'TypeName lensTypeName lens'TypeName isoTypeName iso'TypeNamegetterTypeName foldTypeName prismTypeNameprism'TypeNamereviewTypeNamewrappedTypeNameunwrappedTypeNamerewrappedTypeName_wrapped'ValName isoValName prismValName untoValNamephantomValNamephantom2composeValName idValName fmapValName pureValName apValName rightDataName leftDataName inlinePragmaMagnifymagnify MagnifiedZoomed$fZoomListTListTst$fZoomErrorTErrorTst$fZoomFreeTFreeTst$fZoomExceptTExceptTst$fZoomMaybeTMaybeTst$fZoomWriterTWriterTst$fZoomWriterTWriterTst0$fZoomRWSTRWSTst$fZoomRWSTRWSTst0$fZoomIdentityTIdentityTst$fZoomReaderTReaderTst$fZoomStateTStateTst$fZoomStateTStateTst0$fMagnifyIdentityTIdentityTba$fMagnifyRWSTRWSTba$fMagnifyRWSTRWSTba0$fMagnify->->ba$fMagnifyReaderTReaderTba gtraversetinplatetemplateuponupon'onceUpon onceUpon'$fExceptionFieldException$fShowFieldExceptionGPlated1GPlatedPlated...deepchildrenrewrite rewriteOf rewriteOn rewriteOnOfrewriteM rewriteMOf rewriteMOn rewriteMOnOfuniverse universeOf universeOn universeOnOfcosmoscosmosOfcosmosOn cosmosOnOf transform transformOn transformOf transformOnOf transformM transformMOn transformMOftransformMOnOfcontexts contextsOn contextsOnOfholesholesOn holesOnOfparaOfpara composOpFoldpartsgplategplate1 $fPlatedPat $fPlatedStmt $fPlatedType $fPlatedCon $fPlatedDec $fPlatedExp $fPlatedTree$fPlatedCofree$fPlatedCofreeT $fPlatedF $fPlatedFreeT $fPlatedFree $fPlated[]$fGPlatedkaURec $fGPlatedkaV1 $fGPlatedkaU1 $fGPlatedkaK1$fGPlatedkaK10$fGPlatedka:*:$fGPlatedka:+: $fGPlatedkaM1$fGPlated1kfURec$fGPlated1k1f:.:$fGPlated1kfRec1$fGPlated1kfRec10$fGPlated1kfV1$fGPlated1kfU1$fGPlated1TYPEfPar1$fGPlated1kfK1$fGPlated1kf:*:$fGPlated1kf:+:$fGPlated1kfM1 setmappedsetOfhashMaptoMapOfpackedunpacked_Textbuildertextutf8IsText $fIsTextText $fIsTextText0 $fIsText[]sliced toVectorOfvectorasStream asStreamRclonedforcedordinalsvectorIxvectorTraverse convertedEach$fEachTheseTheseab$fEachTheseTheseab0$fEachMaybeMaybeab$fEachPairPairab$fEachEitherEitherab$fEachUArrayUArrayab$fEachArrayArrayab$fEachByteStringByteStringab$fEachByteStringByteStringab0$fEachTextTextab$fEachTextTextab0$fEachVectorVectorab$fEachVectorVectorab0$fEachVectorVectorab1$fEachVectorVectorab2$fEachTreeTreeab$fEachSeqSeqab$fEachEitherEitherab0$fEachMaybeMaybeab0$fEachIdentityIdentityab$fEachNonEmptyNonEmptyab $fEach[][]ab$fEachHashMapHashMapab$fEachIntMapIntMapab$fEachMapMapab$fEachComplexComplexab$fEach(,,,,,,,,)(,,,,,,,,)ab$fEach(,,,,,,,)(,,,,,,,)ab$fEach(,,,,,,)(,,,,,,)ab$fEach(,,,,,)(,,,,,)ab$fEach(,,,,)(,,,,)ab$fEach(,,,)(,,,)ab$fEach(,,)(,,)ab$fEach(,)(,)abAtIxedixIxValueContainscontainsIndex icontainsiixixAtsansiat$fContainsHashSet $fContainsSet$fContainsIntSet$fIxed(,,,,,,,,)$fIxed(,,,,,,,)$fIxed(,,,,,,) $fIxed(,,,,,) $fIxed(,,,,) $fIxed(,,,) $fIxed(,,) $fIxed(,) $fAtHashSet$fAtSet $fAtIntSet $fAtHashMap$fAtMap $fAtIntMap $fAtMaybe$fIxedByteString$fIxedByteString0 $fIxedText $fIxedText0 $fIxedVector $fIxedVector0 $fIxedVector1 $fIxedVector2 $fIxedUArray $fIxedArray $fIxedHashSet $fIxedIntSet $fIxedSet $fIxedHashMap $fIxedMap $fIxedIntMap $fIxedSeq $fIxedTree$fIxedIdentity$fIxedNonEmpty$fIxed[] $fIxedMaybe$fIxed-> SubstType substType HasTypeVars typeVarsExHasTypestypesHasNamenametypeVars substTypeVars conFieldsconNamedFields locFileName locPackage locModulelocStartlocEnd funDepInputs funDepOutputs fieldExpNamefieldExpExpression fieldPatNamefieldPatPattern matchPattern matchBodymatchDeclarationsfixityPrecedencefixityDirection clausePattern clauseBody clauseDecsinjectivityAnnOutputinjectivityAnnInputstypeFamilyHeadNametypeFamilyHeadTyVarBndrstypeFamilyHeadResultSigtypeFamilyHeadInjectivityAnnbangSourceUnpackednessbangSourceStrictnessderivClauseStrategyderivClauseCxt_ClassI _ClassOpI_TyConI_FamilyI _PrimTyConI _DataConI_VarI_TyVarI_PatSynI_FunD_ValD_TySynD_ClassD _InstanceD _Overlappable _Overlapping _Overlaps _Incoherent_SigD _ForeignD_InfixD_PragmaD _TySynInstD _RoleAnnotD_StandaloneDerivD _DefaultSigD _DataInstD _NewtypeInstD_ClosedTypeFamilyD_DataD _NewtypeD _DataFamilyD_OpenTypeFamilyD_PatSynD _PatSynSigD_ImplicitParamBindD_Unidir _ImplBidir _ExplBidir _PrefixPatSyn _InfixPatSyn _RecordPatSyn_NormalC_RecC_InfixC_ForallC_GadtC _RecGadtC_NoSourceUnpackedness_SourceNoUnpack _SourceUnpack_NoSourceStrictness _SourceLazy _SourceStrict _DecidedLazy_DecidedStrict_DecidedUnpack_ImportF_ExportF_CCall_StdCall_CApi_Prim _JavaScript_Unsafe_Safe_Interruptible_InlineP _SpecialiseP_SpecialiseInstP_RuleP_AnnP_LineP _CompleteP _NoInline_Inline _Inlinable_ConLike_FunLike _AllPhases _FromPhase _BeforePhase_RuleVar _TypedRuleVar_ModuleAnnotation_TypeAnnotation_ValueAnnotation_FunDep tySynEqnLHStySynEqnPatternstySynEqnResult_InfixL_InfixR_InfixN_VarE_ConE_LitE_AppE _AppTypeE_InfixE_UInfixE_ParensE_LamE _LamCaseE_TupE _UnboxedTupE _UnboxedSumE_CondE _MultiIfE_LetE_CaseE_DoE_CompE _ArithSeqE_ListE_SigE_RecConE_RecUpdE_StaticE _UnboundVarE_LabelE_MDoE_ImplicitParamVarE _GuardedB_NormalB_NormalG_PatG_BindS_LetS_NoBindS_ParS_RecS_FromR _FromThenR_FromToR _FromThenToR_CharL_StringL _IntegerL _RationalL _IntPrimL _WordPrimL _FloatPrimL _DoublePrimL _StringPrimL _CharPrimL _BytesPrimL_LitP_VarP_TupP _UnboxedTupP _UnboxedSumP_ConP_InfixP_UInfixP_ParensP_TildeP_BangP_AsP_WildP_RecP_ListP_SigP_ViewP_ForallT_AppT_SigT_VarT_ConT _PromotedT_TupleT_UnboxedTupleT _UnboxedSumT_ArrowT _EqualityT_ListT_PromotedTupleT _PromotedNilT_PromotedConsT_StarT _ConstraintT_LitT_InfixT_UInfixT_ParensT _WildCardT _AppKindT_ImplicitParamT _ForallVisT_PlainTV _KindedTV_NoSig_KindSig _TyVarSig _NumTyLit _StrTyLit _NominalR_RepresentationalR _PhantomR_InferR_StockStrategy_AnyclassStrategy_NewtypeStrategy$fHasNameInjectivityAnn$fHasNameTypeFamilyHead$fHasNameRuleBndr$fHasNameForeign $fHasNameCon $fHasNameName$fHasNameTyVarBndr $fHasTypes[]$fHasTypesTySynEqn$fHasTypesForeign $fHasTypesCon$fHasTypesType$fHasTypeVarsMaybe$fHasTypeVars[]$fHasTypeVarsCon$fHasTypeVarsType$fHasTypeVarsName$fHasTypeVarsTyVarBndr $fSubstType[]$fSubstTypeType makePrismsmakeClassyPrisms makeDecPrisms$fHasTypeVarsNCon$fEqNConHasFieldClasses ClassyNamerDefNameTopName MethodName FieldNamer LensRules _simpleLenses _generateSigs_generateClasses _allowIsos _allowUpdates _lazyPatterns _fieldToDef _classyLensesmakeFieldOpticsmakeFieldOpticsForDecmakeFieldOpticsForDec' $fShowDefName $fEqDefName $fOrdDefName simpleLensesgenerateSignaturesgenerateUpdateableOpticsgenerateLazyPatterns createClass lensField lensClass lensRulesunderscoreNoPrefixNamer lensRulesForlookingupNamer mappingNamer classyRules classyRules_ makeLenses makeClassy makeClassy_ makeLensesFor makeClassyFormakeLensesWith declareLensesdeclareLensesFor declareClassydeclareClassyFor declarePrismsdeclareWrapped declareFieldsdeclareLensesWith makeWrappedunderscoreFieldsunderscoreNamercamelCaseFieldscamelCaseNamerclassUnderscoreNoPrefixFieldsclassUnderscoreNoPrefixNamerabbreviatedFieldsabbreviatedNamer makeFieldsmakeFieldsNoPrefixdefaultFieldRulesgenericgeneric1_V1_U1_Par1_Rec1_K1_M1_L1_R1_UAddr_UChar_UDouble_UFloat_UInt_UWord_cast_gcastrootbranchesviewLviewRslicedTo slicedFromseqOfmembers Conjugate ImaginaryRealPolar _realPart_polar _magnitude_phase _conjugateCharsBytes packedBytes unpackedBytesbytes packedChars unpackedCharschars IsByteString$fIsByteStringByteString$fIsByteStringByteString0.|.~.&.~.&.=.|.=<.|.~<.&.~<.&.=<.|.=<<.&.~<<.|.~<<.&.=<<.|.=bitAtbyteAtbitsbytewiseixmappedevalOfparOfafter throughoutcatching catching_handling handling_tryingthrowing throwing_$fHandleableemHandler$fMonoidHandler $fPlusHandler $fAltHandler$fSemigroupHandler$fFunctorHandler lensProductprismSumadjoinOpticPfromLensfromIso fromPrism fromSetter fromTraversaltoPrismtoIsotoLenstoSetter toTraversalAsHandlingException__HandlingException_HandlingExceptionAsCompactionFailed__CompactionFailed_CompactionFailed AsTypeError __TypeError _TypeErrorAsAllocationLimitExceeded__AllocationLimitExceeded_AllocationLimitExceeded AsErrorCall __ErrorCall AsRecUpdError __RecUpdError _RecUpdError AsRecSelError __RecSelError _RecSelError AsRecConError __RecConError _RecConErrorAsPatternMatchFail__PatternMatchFail_PatternMatchFailAsNoMethodError__NoMethodError_NoMethodError AsDeadlock __Deadlock _DeadlockAsBlockedIndefinitelyOnSTM__BlockedIndefinitelyOnSTM_BlockedIndefinitelyOnSTMAsBlockedIndefinitelyOnMVar__BlockedIndefinitelyOnMVar_BlockedIndefinitelyOnMVarAsNestedAtomically__NestedAtomically_NestedAtomicallyAsNonTermination__NonTerminationAsAsyncException_AsyncExceptionAsAssertionFailed__AssertionFailedAsArrayException_ArrayExceptionAsArithException_ArithException AsIOException _IOExceptionHandlingException_HandlingException__CompactionFailed_CompactionFailed__ TypeError_ TypeError__AllocationLimitExceeded_AllocationLimitExceeded__ ErrorCall_ ErrorCall__ RecUpdError_ RecUpdError__ RecSelError_ RecSelError__ RecConError_ RecConError__PatternMatchFail_PatternMatchFail__NoMethodError_NoMethodError__ Deadlock_ Deadlock__BlockedIndefinitelyOnSTM_BlockedIndefinitelyOnSTM__BlockedIndefinitelyOnMVar_BlockedIndefinitelyOnMVar__NestedAtomically_NestedAtomically__NonTermination_NonTermination__UserInterrupt_ ThreadKilled_ HeapOverflow_StackOverflow_AsyncException_AssertionFailed_AssertionFailed__UndefinedElement_IndexOutOfBounds_ArrayException_RatioZeroDenominator_ Denormal_ DivideByZero_LossOfPrecision_ Underflow_ Overflow_ArithException_ IOException_ Exception exceptiontrying_ throwingM throwingTomappedExceptionmappedException' _Overflow _Underflow_LossOfPrecision _DivideByZero _Denormal_RatioZeroDenominator_IndexOutOfBounds_UndefinedElement _HeapOverflow _ThreadKilled_UserInterrupt$fAsIOExceptionSomeException$fAsIOExceptionIOException$fAsArithExceptionSomeException $fAsArithExceptionArithException$fAsArrayExceptionSomeException $fAsArrayExceptionArrayException $fAsAssertionFailedSomeException"$fAsAssertionFailedAssertionFailed$fAsAsyncExceptionSomeException $fAsAsyncExceptionAsyncException$fAsNonTerminationSomeException $fAsNonTerminationNonTermination!$fAsNestedAtomicallySomeException$$fAsNestedAtomicallyNestedAtomically*$fAsBlockedIndefinitelyOnMVarSomeException6$fAsBlockedIndefinitelyOnMVarBlockedIndefinitelyOnMVar)$fAsBlockedIndefinitelyOnSTMSomeException4$fAsBlockedIndefinitelyOnSTMBlockedIndefinitelyOnSTM$fAsDeadlockSomeException$fAsDeadlockDeadlock$fAsNoMethodErrorSomeException$fAsNoMethodErrorNoMethodError!$fAsPatternMatchFailSomeException$$fAsPatternMatchFailPatternMatchFail$fAsRecConErrorSomeException$fAsRecConErrorRecConError$fAsRecSelErrorSomeException$fAsRecSelErrorRecSelError$fAsRecUpdErrorSomeException$fAsRecUpdErrorRecUpdError$fAsErrorCallSomeException$fAsErrorCallErrorCall($fAsAllocationLimitExceededSomeException2$fAsAllocationLimitExceededAllocationLimitExceeded$fAsTypeErrorSomeException$fAsTypeErrorTypeError!$fAsCompactionFailedSomeException$$fAsCompactionFailedCompactionFailed"$fAsHandlingExceptionSomeException&$fAsHandlingExceptionHandlingException AsDynamic_DynamicDynamic$fAsDynamicSomeException$fAsDynamicDynamicIntegralintegralbinaryoctaldecimalhexadding subtracting multiplyingdividingexponentiatingnegatedNaturalsSumPair_Pair_Sum _Naturals AsExitCode _ExitCode ExitFailure_ ExitSuccess_ _ExitSuccess _ExitFailure$fAsExitCodeSomeException$fAsExitCodeExitCode~=<~<=<<~<<=<.>~<.>=<<.>~<<.>=<<<.>~<<<.>=basename directory extensionfilenamelocation descriptionhandlefileNameerrno errorType_AlreadyExists _NoSuchThing _ResourceBusy_ResourceExhausted_EOF_IllegalOperation_PermissionDenied _UserError_UnsatisfiedConstraints _SystemError_ProtocolError _OtherError_InvalidArgument_InappropriateType_HardwareFault_UnsupportedOperation _TimeExpired_ResourceVanished _Interruptedghc-prim GHC.TypesIntGHC.IntInt8Int16Int32Int64WordGHC.WordWord8Word16Word32Word64 bitReverse64 bitReverse32 bitReverse16 bitReverse8 byteSwap64 byteSwap32 byteSwap16 GHC.MaybeNothingJustGHC.Base++GHC.PrimseqGHC.Listfilterzip System.IOprint Data.Tuplefstsnd otherwise$coerceGHC.Real fromIntegral realToFracGHC.EnumBoundedminBoundmaxBoundEnumpredsucctoEnumfromEnum enumFromToenumFromThenToenumFrom enumFromThen GHC.ClassesEq==/= GHC.FloatFloatingatanhacoshasinhtanhcoshsinhatanacosasintancossinlogBase**sqrtlogpiexp Fractionalrecip fromRational/divModquotRemmoddivrem toIntegerquotreturn>>=>>Functorfmap<$GHC.NumNumsignumabs fromIntegernegate-+*Ord<<=>maxmin>=compareGHC.ReadRead readsPrecreadList toRational RealFloatatan2isIEEEisNegativeZeroisDenormalized isInfiniteisNaN scaleFloat significandexponent encodeFloat decodeFloat floatRange floatRadix floatDigitsRealFracfloorceilingroundproperFractiontruncateGHC.ShowShowshowListshow showsPrecControl.Monad.Fail MonadFailfailpure<*>*>liftA2<*lengthelemmapM sequenceAsequence Semigroup<>sconcatstimesmemptymappendmconcatBoolFalseTrueCharDoubleFloatinteger-wired-inGHC.Integer.TypeIntegerMaybeOrderingGTLTEQRationalIO Data.EitherEitherLeftRight Coercibleideitherphantom Data.VoidabsurdVoid WrappedMonad WrapMonad unwrapMonadZipList getZipListreadIOreadLn appendFile writeFilereadFileinteract getContentsgetLinegetCharputStrLnputStrputCharGHC.IO.ExceptionioErrorGHC.IOFilePathIOErrornotElem concatMapconcatData.Semigroup.InternalDualgetDualEndoappEndo Data.OldListunwordswordsunlineslines Text.Readreadreads Data.ProxyProxylex readParenText.ParserCombinators.ReadPReadSlcmgcd^^^oddeven showParen showStringshowCharshowsShowSunzip3unzipzipWith3zipWithzip3!!lookupreversebreakspansplitAtdroptake dropWhile takeWhilecycle replicaterepeatiteratescanr1scanrscanl1scanlinitlasttailheadmaybeuncurrycurrysubtractasTypeOfuntil$!flipconst=<< Alternativeempty<|>somemanyNonEmpty:|StringGHC.Err undefinederrorWithoutStackTrace&&||not#..#Data.Profunctor.RepCorepresentableCorep cotabulateData.Profunctor.SieveSievesieveCosievecosieveCochoiceunleftunrightData.Profunctor.StrongStrongfirst'second'Costrongunfirstunsecond%tagged-0.8.6.1-A3E8I7zg2qBFE9O5vQsg6C Data.TaggedTaggedunTagged Representable$comonad-5.0.8-DrzarP33Ajl7kpsuStRFeZ ComonadStorepeeksseekseeks experiment!free-5.1.9-6pWxIjgE9TnCzg8uQLrzj5Control.Monad.Trans.FreeFreeFData.Functor.Bind.ClassApplyliftM mtl-2.2.2Control.Monad.State.Class MonadStateControl.Monad.Writer.Classpass MonadWritercensor Control.ArrowArrowstate+kan-extensions-5.2.5-7Bx41RMlC8BL1Hx660d6IIData.Functor.YonedaYoneda MonadReaderlistengetsmsum MonadPlus fromMaybetransformers-0.5.6.2Control.Monad.Trans.ReaderReaderControl.Applicative.Backwards BackwardsswaprunStateControl.ComonadData.Bitraversable BitraversableBitraversable1Data.Functor.Day.CurriedCurriedGHC.Exception.Typeexceptions-0.10.4Control.Monad.Catch SomeExceptionbytestring-0.10.10.0Data.ByteString.InternalData.ByteString.Lazy.Internalfirstsecondcontainers-0.6.2.1Data.Sequence.InternalSeq&vector-0.13.0.0-Isuxt6i9i5JITGRjEhCjvK Data.VectorVector text-1.2.3.2 GHC.GenericsGenericData.Set.InternalData.Map.InternalData.IntSet.InternalData.IntMap.Internal4unordered-containers-0.2.19.1-ARlYDgKGRsAGn3XTR9LnoMData.HashSet.InternalData.HashMap.Internaltemplate-haskellLanguage.Haskell.TH.SyntaxConTghc-boot-th-8.10.2GHC.LanguageExtensions.Type PolyKindsKindSignatures TypeFamilies TyVarBndrTypeControl.Monad.Trans.RWS.StrictRWS Control.Monad.Trans.State.StrictControl.Monad.Trans.ErrorError Data.DatagmapMDataGeneric1HashSet'hashable-1.4.1.0-IypROHlyjAZLPs4aCIu8orData.Hashable.ClassHashableHashMapSetData.Text.Internal.BuilderBuildertoStrictData.Vector.Generic.BaseData.Vector.Fusion.BundleBundleGHC.IxIx array-0.5.4.0Data.Array.BaseIArrayUArrayGHC.ArrArrayData.Text.Internal.LazyData.Vector.Unboxed.BaseUnboxForeign.StorableStorableData.Vector.Storable(primitive-0.7.4.0-Jn1nYXToEHPK8exID3XEUlData.Primitive.TypesPrimData.Vector.Primitive Data.TreeTreeD:R:IxValue(,,,,,,,,)D:R:IxValue(,,,,,,,)D:R:IxValue(,,,,,,)D:R:IxValue(,,,,,)D:R:IxValue(,,,,)D:R:IxValue(,,,)D:R:IxValue(,,)D:R:IxValue(,)!//newNameNameDecTySynEqn DerivStrategyCxt,th-abstraction-0.4.4.0-42zopQTBYuCFgJGGATTem&Language.Haskell.TH.Datatype.TyVarBndr TyVarBndrUnitKindCon DerivClausePragmaRuleBndrExpPhasesModNameStmtPatGadtCRecGadtCData.Typeable.InternalTypeablegcast subForestViewLviewlViewRviewrIntSetrealPartimagPartpolar magnitudephase conjugate Data.Bits.|.Bits.&.bitSizeixmapbounds'parallel-3.2.2.0-HTf2o2horULDwL7cXUB9uv Control.Seq seqFoldableControl.Parallel.StrategiesStrategyevalTraversableEvalparTraversablerdeepseqControl.Monad.Error.Class MonadError throwErrorCompactionFailedControl.Exception.Base TypeErrorAllocationLimitExceeded GHC.Exception ErrorCall RecUpdError RecSelError RecConErrorPatternMatchFail NoMethodErrorDeadlockBlockedIndefinitelyOnSTMBlockedIndefinitelyOnMVarNestedAtomicallyNonTerminationAsyncExceptionassertAssertionFailedArrayExceptionArithException IOException MonadCatch MonadThrow GHC.Conc.SyncthrowToThreadId mapException HeapOverflowExitCode