!+vx K                ! " # $%&'()*+,-./0123456789:;<=>?@ABCDE F G H I J K L M N O P Q R S T U V W X Y Z [ \ ] ^ _ ` a b c d e f g h i j k l m n o p q r s t u v wxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abc d e f g h i j k l m n o p q r s t u v w x y z { | } ~                                                                          !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~                                                                 ! " # $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z [ \ ] ^ _ ` a b c d e f ghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,- . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z [ \ ] ^ _ ` a b c d e f g h i j k l m n o p q r s t u v w x y z { | } ~                                                                !!!!!!!!                                                           """"""""""""" "!"""#"$"%"&"'"(")"*"+","-"."/"0"1"2"3#4#5#6#7#8#9#:#;#<#=#>#?#@#A#B#C#D#E#F#G#H#I#J#K#L#M#N#O#P#Q#R#S#T#U#V#W#X#Y$Z$[$\$]$^$_$`$a$b$c$d$e$f$g$h$i$j$k$l$m$n$o$p$q$r$s$t$u%v%w%x%y%z%{%|%}%~%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % % % %%%%%%%%%%%%%%%%%%% %!%"%#%$%%%&%'%(%)%*%+%,%-%.%/%0%1%2%3%4%5%6%7%8%9%:%;%<%=%>%?%@%A%B%C%D%E%F%G%H%I%J%K%L%M%N%O%P%Q%R%S%T%U%V%W%X%Y%Z%[%\%]%^%_%`%a%b%c%d%e%f%g%h%i%j%k%l%m%n%o%p%q%r%s%t%u%v%w%x%y%z%{%|%}%~%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%&&&&&&&&&&&&&&&&&&&&&&&&'''''''''''(((((((((((((((((((((((((((((((((((((((((((((((( ( ( ( ( ((((((((((((((((((( (!("(#($(%)&)'*(+)+*,+,,,-,.,/,0,1-2-3-4-5-6-7-8.9.:.;.<.=.>.?.@.A.B/C/D/E/F/G/H/I/J/K/L/M0N0O0P0Q0R0S0T0U0V0W0X0Y0Z0[0\0]0^0_0`0a0b0c0d0e0f0g0h0i0j0k0l1m1n1o1p1q1r1s1t1u1v1w1x1y1z1{1|1}1~1111111111111111111111111111111111112222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 !2 "2 #2 $2 %2 &2 '2 (2 )2 *2 +2 ,2 -2 .2 /2 02 12 22 32 42 52 62 72 82 92 :2 ;2 <2 =2 >2 ?2 @2 A2 B2 C2 D2 E2 F2 G2 H2 I2 J2 K2 L2 M2 N2 O2 P2 Q2 R2 S2 T2 U2 V2 W2 X2 Y2 Z2 [2 \2 ]2 ^2 _2 `2 a2 b2 c2 d2 e2 f2 g2 h2 i2 j2 k2 l2 m2 n2 o2 p2 q2 r2 s2 t2 u2 v2 w2 x2 y2 z2 {2 |2 }2 ~2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 7 7 7 7 7 8 8 9 9 : : : : : : ; ; ; < < < = = = = = = = = = = > > > > > > > > ? ? ? ? ? ? !? "? #@ $@ %@ &@ '@ (@ )@ *@ +@ ,@ -@ .A /A 0A 1A 2A 3A 4A 5A 6A 7A 8A 9A :A ;A <A =A >B ?C @D AD BD CD DE EE FE GE HE IE JE KE LE ME NE OE PE QE RE SE TF UF VF WG XH YH ZH [H \H ]H ^H _H `H aH bH cH dH eH fH gH hH iH jH kH lH mH nH oH pH qH rH sH tH uH vH wH xH yH zH {H |H }H ~H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H I I I I I J J J J J J J J J J J J J K K K K K K L L L L L L L !L "M #M $M %M &M 'M (M )M *M +M ,M -M .M /M 0M 1M 2N 3N 4N 5N 6N 7N 8N 9N :N ;N <N =N >N ?N @N AN BN CN DN EN FN GN HN IN JNT/(C) 2012-2016 Edward Kmett, (C) 2017 Ryan Scott BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> experimental non-portableSafe2 K L M N O P Q R S T U V W&(C) 2016 Edward Kmett and Eric Mertens BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> experimental non-portable TrustworthySX&'&'(C) 2012-2016 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> provisional non-portableSafe1=?@A.lensThe  X equivalent for a   Y  Z.()*+,-..+,-()* (C) 2012-2016 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> experimental non-portableSafe>SXE Elens Used for  O.Ilens Used for  P.Plens Used for  Q.Slens Used for  R.VlensUsed internally by S and the like. The argument a" of the result should not be used!ESee 4.16 Changelog entry for the explanation of "why not Apply f =>"?YlensUsed internally by  T and the like.\lensUsed internally by U and the like. The argument a" of the result should not be used!_lensA  [ for a   Y.blensObtain the minimum.clensObtain the maximum.dlens Extract the I@ element. This will fairly eagerly determine that it can return  \( the moment it sees any element at all.elens Extract the E@ element. This will fairly eagerly determine that it can return  \( the moment it sees any element at all.%#"! EFGHIJKLMNOPRQSUTVWXYZ[\]^_`abcde%_`a\]^YZ[VWXPRQcSUTbIJKLdEFGHe#"! MNOV(C) 2012-2016 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> experimental non-portableSafel(C) 2012-2016 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> experimental non-portableSafe =>?@AHSVXk wlens Y composition of WX  O with a  Z , used by  Y.zlens Y composition of WX  K with a  Z , used by  Z.}lens]A function with access to a index. This constructor may be useful when you need to store an  in a container to avoid ImpredicativeTypes. %index :: Indexed i a b -> i -> a -> blensnThis class permits overloading of function application for things that also admit a notion of a key or index.lensBuild a function from an  function.lens 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.lens- is strong enough to let us distribute every   over every Haskell  Z+. This is effectively a generalization of  _.lens^This 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 [ into an \ or a  ] into an  ^, etc.  :: [ s t a b -> \  K s t a b  :: _ s t a b -> \  K s t a b  :: ` s t a b -> a  K s t a b  :: b s t a b -> a  K s t a b  :: ] s a -> ^  K s a  :: c s a -> d  K s a  ::   K p => e (z f) s t a b -> f p f s t a blens Transform a [ into an \ or a  ] into an  ^, etc.This combinator is like > except that it handles large traversals and folds gracefully.  :: [ s t a b -> \  O s t a b  :: _ s t a b -> \  O s t a b  :: ` s t a b -> a  O s t a b  :: b s t a b -> a  O s t a b  :: ] s a -> ^  O s a  :: c s a -> d  O s a  ::   O p => e (w f) s t a b -> f p f s t a blensHFold a container with indices returning both the indices and the values.)The result is only valid to compose in a  TraversalD, 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)]C[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 (}) 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')]wxyz{|}~}~z{|wxy(C) 2012-2016 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> experimental non-portableSafe=>?@ACHISVXUlens type  p g a s =  p g a a slensThis is a generalized form of o that can be repeatedly cloned with less impact on its performance, and which permits the use of an arbitrary  .The extra phantom  Z" is used to let us lie and claim c-compatibility under limited circumstances. This is used internally to permit a number of combinators to gracefully degrade when applied to a  ] or c.lens type  p a s =  p a a slensThis is a generalized form of o that can be repeatedly cloned with less impact on its performance, and which permits the use of an arbitrary  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.  Z 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  a to an indexed comonad store.lensThis is the generalization of  b to an indexed comonad store.lensThis is the generalization of  c to an indexed comonad store.lensThis is the generalization of  d to an indexed comonad store.lensThis is the generalization of  e to an indexed comonad store.lensThis is the generalization of  f 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.mThe 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. glensWe can convert any  K to a function, possibly losing information about an index in the process.(C) 2012-2016 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> experimental non-portableSafe =?@ACHISVX!= lensNThis 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 J 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!lensNThis 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 [.Ta.k.a. indexed Cartesian store comonad, indexed Kleene store comonad, or an indexed FunList. *http://twanvl.nl/blog/haskell/non-regular1A  is like a [1 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 .lensNThis 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 J 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!lensNThis 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 [.Ta.k.a. indexed Cartesian store comonad, indexed Kleene store comonad, or an indexed FunList. *http://twanvl.nl/blog/haskell/non-regular1A  is like a [1 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 <ekmett@gmail.com> experimental non-portable Trustworthy'jlensWThis class provides a generalized notion of list reversal extended to other containers.lensThis is used internally by the  bT code to provide efficient access to the two functions that make up an isomorphism.(C) 2012-2016 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> experimental non-portableSafe &'=?@ASX?" (lensThis is an illegal  Y7 used to replace the contents of a list of consecutive .d values representing each layer of a structure into the original shape that they were derived from.Attempting to FlowL something back into a shape other than the one it was taken from will fail.+lensThis is an illegal  [ used to construct a single ...lensThis 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 .l as a PATRICIA trie of the paths into the structure to leaves at a given depth, similar in many ways to a jki, 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 / node you will not find any 1 nodes, so 1 can only occur at the root. hlensAppend a pair of . values to get a new . with path compression.As the .< type is user-visible, we do not expose this as an illegal  i' instance, and just use it directly in + as needed.2lensGenerate the leaf of a given +4 based on whether or not we're at the correct depth. jlensWalk down one constructor in a ., veering left. klensWalk down one constructor in a ., veering right.6lensThis is an illegal  [.8lensThis is an illegal  Y. ()*+,-.0/12 .0/1+,-2()*+(C) 2014-2016 Edward Kmett and Eric Mertens BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> provisional non-portableSafeE?lenshReturn 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]?lensstrict upper bound lensordinals lens)unique, in-bound ordinals, in order seen ??(C) 2012-2016 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> experimental non-portableSafe&'=?@AHISVXU@lensBThis is used to generate an indexed magma from an unindexed sourceLBy 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 GBlensBThis is used to generate an indexed magma from an unindexed sourceTBy constructing it this way we avoid infinite reassociations in sums where possible.Dlens;This is a a non-reassociating initially encoded version of .Glens<This provides a way to peek at the internal structure of a [ or \LlensRun a GJ where all the individual leaves have been converted to the expected typeMlens Generate a G using from a prefix sum.Nlens Generate a G? with leaves only while the predicate holds from left to right.@ABCDEFGKHIJLMNGKHIJLDEFBCM@AN(C) 2012-2016 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> experimental non-portableSafeZMglens type g a s t = h a a s thlens$This type is used internally by the  _9 code to provide efficient access to the two parts of a Prism.ghihig(C) 2012-2016 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> provisional non-portableSafe =>?@AHV`mlensrThis class is provided mostly for backwards compatibility with lens 3.8, but it can also shorten type signatures.nlens2This is a profunctor used internally to implement Review#It plays a role similar to that of l or Const do for Control.Lens.Gettermnmn(C) 2012-2016 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> provisional non-portableSafedplens Anything p must be isomorphic to the    Z.ulens mvlensSo you can pass our n, into combinators from other lens libraries.pqrspqrs+(C) 2013-2016 Edward Kmett and Eric Mertens BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> experimental non-portableSafeq wlens%Apply arguments to a type constructorxlensApply arguments to a functionylens-Construct a tuple type given a list of types.zlens4Construct a tuple value given a list of expressions.{lens3Construct a tuple pattern given a list of patterns.|lens&Apply arguments to a type constructor.}lensReturn  l contained in a  m.lens/Generate many new names from a given base name.lensLDecompose an applied type into its individual components. For example, this: Either Int Char would be unfolded to this: ( n ''Either, [ n ''Int,  n ''Char]) IThis function ignores explicit parentheses and visible kind applications.lens base name lenscount )wxyz{|}~)wxyz{|}~SafeUVXs2  (C) 2012-2016 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> experimental non-portable Trustworthy>HV~ lensIWrap a monadic effect with a phantom type argument. Used when magnifying op.lens3Wrap a monadic effect with a phantom type argument.lensUsed by &q to &r into stlensMake a  [ out of  o for result collection.lensUsed by &q to &r into uv.lensMake a  [ out of  p for error handling.lensUsed by &q to &r into uv.lensMake a  [ out of  q for error handling.lensUsed by &q to &r into wx or yz.lensUsed by &q to &r into {|.lensUsed by &q to &r into op.lensUsed by &q to &r into }~.$$(C) 2012-16 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> experimental Rank2TypesSafe!#"! ()*+,-.EFGHIJKLMNOPRQSUTVWXYZ[\]^_`abcdewxyz{|}~()*+,-.0/12@ABCDEFGKHIJLMNghimnpqrs(C) 2012-16 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> provisional Rank2Types Trustworthy&'-.=>?@AHSX -lensvThis 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) lensvThis is a convenient alias for use when you need to consume either indexed or non-indexed lens-likes based on context.lensFConvenient 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  Z" that they require of the caller.If a function accepts a  f s t a b for some  Z f, then they may be passed a . Further, if f is an  Y, 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  r "a  r 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 ,E, ... whenever the type variables don't change upon setting a value. = ::   ( a) a  ::  ( Int) [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  ] and can be used for .lensA U describes how to retrieve multiple values in a way that can be composed with other  constructions.A  s aC 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 [ 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  ^ and can be used for  like a .lensA T 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 Z 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  ], since it just ignores the  Y.lens Composable asTypeOf0. 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) "a Just 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 "a Just a '  l a "a s Third, if you get non-match t$, you can convert it result back to s:  l s "a Left t '  l t "a Left 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  Integer ! allows you to always go from a  to an Integer,, and provide you with tools to check if an Integer is a  and/or to edit one if it is. nat ::  Integer  nat =    toInteger $ \ i -> if i < 0 then Left i else Right ( fromInteger i) Now we can ask if an Integer 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 Integer.5 ^. re nat -- :: Natural5Similarly we can use a  to  the Left half of an Either:Left "hello" & _Left %~ lengthLeft 5or to construct an Either: 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.lensKIf 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 id. Since every  is both a valid  and a valid <, the laws for those types imply the following laws for an  f: f .   f "a id   f . f "a id 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.IThese are particularly common when talking about monomorphic containers. e.g. sets Data.Text.map ::    Char type   =     lens The only  law that can apply to a   l is that  l y ( l x a) "a  l y a  You can't  a  2 in general, so the other two laws are irrelevant. However, two  Z laws apply to a  :  l id "a id  l f .  l g "a  l (f . g) "These can be stated more directly: l  r "a  r l f . q . l g "a l (f . q . 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 [ or  ^.The } constraint is used to allow an  to be used directly as a [.The [! laws are still required to hold.In addition, the index iW should satisfy the requirement that it stays unchanged even when modifying the value a, otherwise traversals like indices break the  laws.lens type  =   lensA  can be used directly as a n or a  (but not as a e) and provides the ability to both read and update multiple fields, subject to some relatively weak  laws.TThese 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  r "a  r  _ (t f) . t g "a  . t ( .  _ f . g) .One consequence of this requirement is that a K 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 d 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 \.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) "a v 52) Putting back what you got doesn't change anything:  l ( l s) s "a s -3) Setting twice is the same as setting once:  l v' ( l v s) "a  l v' s =These laws are strong enough that the 4 type parameters of a s cannot vary fully independently. For more on how they interact, read the "Why is it a Lens Family?" section of  /http://comonad.com/reader/2012/mirrored-lenses/.1There are some emergent properties of these laws:1)  l s must be injective for every s This is a consequence of law #12)  lZ must be surjective, because of law #2, which indicates that it is possible to obtain any v from some s such that  s v = sX3) 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) "a  l v s Every  can be used directly as a n 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  r "a  r  _ (l f) . l g "a  . l ( .  _ f . g) type  s t a b = forall f.  Z f =>  f s t a b 5     5     (C) 2012-16 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> provisional Rank2Types Trustworthy=>?@ASX[ElensRThis is a convenient alias when defining highly polymorphic code that takes both " and  d as appropriate. If a function takes this it is expecting one of those two things based on context.lensRThis is a convenient alias when defining highly polymorphic code that takes both # and !d 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  Z.  _ "a - $  "a -  ( s) "a . $ 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)] $ ::  Z 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  t.+You sometimes have to use this rather than $ -- due to temporary insanity  Z was not a superclass of  t until GHC 7.10.  u "a - % over lifted f [a,b,c] [f a,f b,f c]set lifted b (Just a)Just bIf you want an  use (  u.&lensThis  0 can be used to map over all of the inputs to a .  "a - & 8getPredicate (over contramapped (*2) (Predicate even)) 5True,getOp (over contramapped (*5) (Op show)) 100"500"YPrelude.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) yPMap 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  v "a  v f g  w f h "a f (g  w h) Equational reasoning: (  w - "a  v -  w ( "a  v Another way to view )K 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.  _ "a - $  "a -  )  w - "a  v -  w ) "a  v Given any valid   l, you can also rely on the law: - l f  w - l g = - l (f  w g) e.g.Dover 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. ( s) "a . $ set _2 "hello" (1,()) (1,"hello")set mapped () [1,2,3,4] [(),(),(),()]Note: Attempting to . a  or B 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 B 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 0lensModifies the target of a  or all of the targets of a   or  with a user supplied function.This is an infix version of -.  _ f "a $ 0 f  f "a  0 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]] (0) ::  # s t a b -> (a -> b) -> s -> t (0) :: & s t a b -> (a -> b) -> s -> t (0) :: % s t a b -> (a -> b) -> s -> t (0) ::  s t a b -> (a -> b) -> s -> t 1lensReplace 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  s a "a $ 1 f  x a (a,b,c,d) & _4 .~ e (a,b,c,e)(42,"world") & _1 .~ "hello"("hello","world")(a,b) & both .~ c(c,c) (1) ::   s t a b -> b -> s -> t (1) ::  s t a b -> b -> s -> t (1) ::  s t a b -> b -> s -> t (1) ::  s t a b -> b -> s -> t 2lensSet the target of a ,  or   to  \ a value. l 2 t "a . l ( \ t) Nothing & id ?~ aJust aMap.empty & at 3 ?~ xfromList [(3,x)]2 can be used type-changily:"('a', ('b', 'c')) & _2.both ?~ 'x'('a',(Just 'x',Just 'x')) (2) ::   s t a ( q b) -> b -> s -> t (2) ::  s t a ( q b) -> b -> s -> t (2) ::  s t a ( q b) -> b -> s -> t (2) ::  s t a ( q b) -> b -> s -> t 3lensSet with pass-through.SThis is mostly present for consistency, but may be useful for chaining assignments.AIf you do not need a copy of the intermediate result, then using l 1 t directly is a good idea.(a,b) & _1 <.~ c (c,(c,b))-("good","morning","vietnam") & _3 <.~ "world"$("world",("good","morning","world"))K(42,Map.fromList [("goodnight","gracie")]) & _2.at "hello" <.~ Just "world"G(Just "world",(42,fromList [("goodnight","gracie"),("hello","world")])) (3) ::  ! s t a b -> b -> s -> (b, t) (3) :: $ s t a b -> b -> s -> (b, t) (3) :: # s t a b -> b -> s -> (b, t) (3) ::  s t a b -> b -> s -> (b, t) 4lensSet to  \ a value with pass-through.WThis is mostly present for consistency, but may be useful for for chaining assignments.AIf you do not need a copy of the intermediate result, then using l 2 d directly is a good idea.import Data.Map as MapF_2.at "hello" <?~ "world" $ (42,Map.fromList [("goodnight","gracie")])B("world",(42,fromList [("goodnight","gracie"),("hello","world")])) (4) ::   s t a ( q b) -> b -> s -> (b, t) (4) ::  s t a ( q b) -> b -> s -> (b, t) (4) ::  s t a ( q b) -> b -> s -> (b, t) (4) ::  s t a ( q b) -> b -> s -> (b, t) 5lens0Increment 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)] (5) ::  y a =>   s a -> a -> s -> s (5) ::  y a =>  s a -> a -> s -> s (5) ::  y a =>  s a -> a -> s -> s (5) ::  y a =>  s a -> a -> s -> s 6lens/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 (6) ::  y a =>   s a -> a -> s -> s (6) ::  y a =>  s a -> a -> s -> s (6) ::  y a =>  s a -> a -> s -> s (6) ::  y a =>  s a -> a -> s -> s 7lens0Decrement 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]] (7) ::  y a =>   s a -> a -> s -> s (7) ::  y a =>  s a -> a -> s -> s (7) ::  y a =>  s a -> a -> s -> s (7) ::  y a =>  s a -> a -> s -> s 8lens-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) (8) ::  z a =>   s a -> a -> s -> s (8) ::  z a =>  s a -> a -> s -> s (8) ::  z a =>  s a -> a -> s -> s (8) ::  z a =>  s a -> a -> s -> s 9lens,Raise the target(s) of a numerically valued ,   or " to a non-negative integral power.(1,3) & _2 ^~ 2(1,9) (9) :: ( y a,  { e) =>   s a -> e -> s -> s (9) :: ( y a,  { e) =>  s a -> e -> s -> s (9) :: ( y a,  { e) =>  s a -> e -> s -> s (9) :: ( y 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) (:) :: ( z a,  { e) =>   s a -> e -> s -> s (:) :: ( z a,  { e) =>  s a -> e -> s -> s (:) :: ( z a,  { e) =>  s a -> e -> s -> s (:) :: ( z 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 A 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 A 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 () AlensThis is an alias for (@).BlensReplace 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) (B) ::   s m =>  s ( q a) -> a -> m () (B) ::   s m =>  s ( q a) -> a -> m () (B) ::   s m =>  s ( q a) -> a -> m () (B) ::   s m =>   s ( q a) -> a -> m () ClensModify the target(s) of a , ,   or  by adding a value.Example: fresh ::    K m => m  K fresh = do  v C 1   v %execState (do _1 += c; _2 += d) (a,b) (a + c,b + d)CexecState (do _1.at 1.non 0 += 10) (Map.fromList [(2,100)],"hello")#(fromList [(1,10),(2,100)],"hello") (C) :: (  s m,  y a) =>   s a -> a -> m () (C) :: (  s m,  y a) =>  s a -> a -> m () (C) :: (  s m,  y a) =>  s a -> a -> m () (C) :: (  s m,  y a) =>  s a -> a -> m () DlensModify the target(s) of a , ,   or  by subtracting a value.%execState (do _1 -= c; _2 -= d) (a,b) (a - c,b - d) (D) :: (  s m,  y a) =>   s a -> a -> m () (D) :: (  s m,  y a) =>  s a -> a -> m () (D) :: (  s m,  y a) =>  s a -> a -> m () (D) :: (  s m,  y a) =>  s a -> a -> m () ElensModify the target(s) of a , ,   or  by multiplying by value.%execState (do _1 *= c; _2 *= d) (a,b) (a * c,b * d) (E) :: (  s m,  y a) =>   s a -> a -> m () (E) :: (  s m,  y a) =>  s a -> a -> m () (E) :: (  s m,  y a) =>  s a -> a -> m () (E) :: (  s m,  y a) =>  s a -> a -> m () FlensModify the target(s) of a , ,   or  by dividing by a value.'execState (do _1 //= c; _2 //= d) (a,b) (a / c,b / d) (F) :: (  s m,  z a) =>   s a -> a -> m () (F) :: (  s m,  z a) =>  s a -> a -> m () (F) :: (  s m,  z a) =>  s a -> a -> m () (F) :: (  s m,  z a) =>  s a -> a -> m () Glens,Raise the target(s) of a numerically valued ,   or " to a non-negative integral power. (G) :: (  s m,  y a,  { e) =>   s a -> e -> m () (G) :: (  s m,  y a,  { e) =>  s a -> e -> m () (G) :: (  s m,  y a,  { e) =>  s a -> e -> m () (G) :: (  s m,  y a,  { e) =>  s a -> e -> m () Hlens,Raise the target(s) of a numerically valued ,   or  to an integral power. (H) :: (  s m,  z a,  { e) =>   s a -> e -> m () (H) :: (  s m,  z a,  { e) =>  s a -> e -> m () (H) :: (  s m,  z a,  { e) =>  s a -> e -> m () (H) :: (  s m,  z a,  { e) =>  s a -> e -> m () Ilens,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) (I) :: (  s m,  | a) =>   s a -> a -> m () (I) :: (  s m,  | a) =>  s a -> a -> m () (I) :: (  s m,  | a) =>  s a -> a -> m () (I) :: (  s m,  | a) =>  s a -> a -> m () JlensModify 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) (J) ::   s m =>   s  ~ ->  ~ -> m () (J) ::   s m =>  s  ~ ->  ~ -> m () (J) ::   s m =>  s  ~ ->  ~ -> m () (J) ::   s m =>  s  ~ ->  ~ -> m () KlensModify 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) (K) ::   s m =>   s  ~ ->  ~ -> m () (K) ::   s m =>  s  ~ ->  ~ -> m () (K) ::   s m =>  s  ~ ->  ~ -> m () (K) ::   s m =>  s  ~ ->  ~ -> m () Llens6Run a monadic action, and set all of the targets of a ,   or  to its result. (L) ::   s m =>  s s a b -> m b -> m () (L) ::   s m =>  s s a b -> m b -> m () (L) ::   s m =>  s s a b -> m b -> m () (L) ::   s m =>   s s a b -> m b -> m () RAs 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 L bar ... will store the result in a ,  , or .MlensSet with pass-throughKThis is useful for chaining assignment without round-tripping through your  t stack. do x <-  M) ninety_nine_bottles_of_beer_on_the_wall AIf you do not need a copy of the intermediate result, then using l ? d$ will avoid unused binding warnings. (M) ::   s m =>   s s a b -> b -> m b (M) ::   s m =>  s s a b -> b -> m b (M) ::   s m =>  s s a b -> b -> m b (M) ::   s m =>  s s a b -> b -> m b NlensSet  \ a value with pass-throughKThis is useful for chaining assignment without round-tripping through your  t stack. do x <- 1 "foo" N) ninety_nine_bottles_of_beer_on_the_wall AIf you do not need a copy of the intermediate result, then using l B d$ will avoid unused binding warnings. (N) ::   s m =>   s s a ( q b) -> b -> m b (N) ::   s m =>  s s a ( q b) -> b -> m b (N) ::   s m =>  s s a ( q b) -> b -> m b (N) ::   s m =>  s s a ( q b) -> b -> m b Olens,Modify the target of a monoidally valued by  ing another value.(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!!!") (O) ::  [ a =>   s t a a -> a -> s -> t (O) ::  [ a =>  s t a a -> a -> s -> t (O) ::  [ a =>  s t a a -> a -> s -> t (O) ::  [ a =>  s t a a -> a -> s -> t PlensModify the target(s) of a , ,   or  by   ing a value.?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!!!") (P) :: (  s m,  [ a) =>   s a -> a -> m () (P) :: (  s m,  [ a) =>  s a -> a -> m () (P) :: (  s m,  [ a) =>  s a -> a -> m () (P) :: (  s m,  [ a) =>  s a -> a -> m () Qlens Write to a fragment of a larger Writer format.RlensThis is a generalization of  < that allows you to modify just a portion of the resulting  .SlensThis is a generalization of  < that allows you to modify just a portion of the resulting  ! with access to the index of an  .TlensThis is a generalization of   that allows you to  " just a portion of the resulting  .UlensThis is a generalization of   that allows you to  " just a portion of the resulting  ", with access to the index of an  .VlensModify the value of the Reader. environment associated with the target of a  , , or . V l  v a "a a V l f  w locally l g "a V l (f  w g) %(1,1) & locally _1 (+1) (uncurry (+))3-"," & locally ($) ("Hello" <>) (<> " world!")"Hello, world!" locally :: MonadReader s m => G s s a b -> (a -> b) -> m r -> m r locally :: MonadReader s m => F s s a b -> (a -> b) -> m r -> m r locally :: MonadReader s m => A s s a b -> (a -> b) -> m r -> m r locally :: MonadReader s m =>  & s s a b -> (a -> b) -> m r -> m r WlensThis is a generalization of V" that allows one to make indexed   changes to a Reader. environment associated with the target of a  , , or . V l f "a W l f . const W l f "a V l f . } ilocally :: MonadReader s m => L s s a b -> (i -> a -> b) -> m r -> m r ilocally :: MonadReader s m => G 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 Xlens%Map with index. This is an alias for b./When you do not need access to the index, then -' is more liberal in what it can accept. - l "a X l  w   X l "a - l  w } X ::  ) i s t a b -> (i -> a -> b) -> s -> t X :: + i s t a b -> (i -> a -> b) -> s -> t X :: & i s t a b -> (i -> a -> b) -> s -> t YlensSet with index. Equivalent to X with the current value ignored./When you do not need access to the index, then .' is more liberal in what it can accept. . l "a Y l  w   Y ::  $ i s t a b -> (i -> b) -> s -> t Y :: & i s t a b -> (i -> b) -> s -> t Y :: ! i s t a b -> (i -> b) -> s -> t Zlens Build an   from an  -like function.Your supplied function f is required to satisfy: f  v "a  v f g  w f h "a f (g  w h) Equational reasoning: Z  w X "a  v X  w Z "a  v Another way to view Zu 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. ([) "a X /When you do not need access to the index then (0() is more liberal in what it can accept. l 0 f "a 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. (\) "a Y /When you do not need access to the index then (1() is more liberal in what it can accept. l 1 b "a 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 "a 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 "a 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 () `lensERun an arrow command and use the output to set all the targets of a ,   or  to the result.` can be used very similarly to (LN), except that the type of the object being modified can change; for example: QrunKleisli 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   ( K,  ~,  ) ` ::   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 alensa is a deprecated alias for -.blens&Map with index. (Deprecated alias for X)./When you do not need access to the index, then a' is more liberal in what it can accept. a l "a b l  w   b ::  ) i s t a b -> (i -> a -> b) -> s -> t b :: + i s t a b -> (i -> a -> b) -> s -> t b :: & i s t a b -> (i -> a -> b) -> s -> t M p    !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abM   #"! )(*+,$%&'-.1057689:;<O=324>A?@CDEFGHIKPJMBNLQRSTUVW/bXY^Z[\]_`p a#04142434445464748494:4;4<4=4?4@4B4C4D4E4F4G4H4I4J4K4L2M4N4O4P4[4\4]4_4 (C) 2012-16 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> provisional Rank2Types Trustworthy&'-.=>?@AHSX ]clens type c =  (d i) dlens>When you see this as an argument to a function, it expects an elens type e =  f flens=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 D in a container, since it is rank-1. You can turn them back into a  with t,, or use it directly with combinators like  and ().glensBuild a  from a getter and a setter. g ::  Z: 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)) g! :: (s -> a) -> (s -> a -> s) ->  s a hlens4Obtain a getter and a setter from a lens, reversing g.ilensBuild an index-preserving  from a c and a n.jlens Build an  from a c and a n.klens0This 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)llens(l&) 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: (l) "a  v _It may be beneficial to think about it as if it had these even more restricted types, however: (l) ::  Z f =>  b* s t a b -> (a -> f b) -> s -> f t (l) ::  Z f => ) s t a b -> (a -> f b) -> s -> f t (l) ::  Y f => [# s t a b -> (a -> f b) -> s -> f t When applied to a v, it can edit the targets of the traversals, extracting a supplemental monoidal summary of its actions, by choosing  f = ((,) m) (l) ::  b0 s t a b -> (a -> (r, b)) -> s -> (r, t) (l) :: / s t a b -> (a -> (r, b)) -> s -> (r, t) (l) ::  [ m => [) s t a b -> (a -> (m, b)) -> s -> (m, t) mlensModify the target of a @ in the current state returning some extra information of type r or modify all targets of a [= 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)) (m) "a (   w) It may be useful to think of (mO), instead, as having either of the following more restricted type signatures: (m) ::   s m =>  b( s s a b -> (a -> (r, b)) -> m r (m) ::   s m => ' s s a b -> (a -> (r, b)) -> m r (m) :: (  s m,  [ r) => [! s s a b -> (a -> (r, b)) -> m r nlensThis is convenient to  2 argument order of composite functions defined as: fab ?? a = fmap ($ a) fab For the  Z instance  f = ((->) r)= you can reason about this function as if the definition was (n) "a  : (h ?? x) ah a xexecState ?? [] $ modify (1:)[1]%over _2 ?? ("hello","world") $ length ("hello",5)(over ?? length ?? ("hello","world") $ _2 ("hello",5)olensLift a F so it can run under a function (or other corepresentable profunctor). o ::  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]plens8Merge two lenses, getters, setters, folds or traversals. q "a p  v  v p :: c s a -> c s' a -> c ( p s s') a p ::  ] s a ->  ] s' a ->  ] ( p s s') a p ::  s a ->  s' a ->  ( p s s') a p ::  s a ->  s' a ->  ( p s s') a p ::  s a ->  s' a ->  ( p s s') a qlens This is a  that updates either side of an  p&, where both sides have the same type. q "a p  v  v Left a^.chosenaRight a^.chosenaRight "hello"^.chosen"hello"Right a & chosen *~ b Right (a * b) q ::  ( p a a) ( p b b) a b q f (  a) =     f a q f (  a) =     f a rlensr makes a  from two other lenses or a S 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) r ::  s t a b ->  s' t' a' b' ->  (s,s') (t,t') (a,a') (b,b') r ::  s a ->  s' a' ->  (s,s') (a,a') slensThis  lets you view the current pos# of any indexed store comonad and seekR to a new position. This reduces the API for working these instances to a single .  w "a w  s  s w "a w  s  s  f w "a w  s  f s ::  ( a s) a s ::  p =>  ( p a s) a s ::  p =>  ( p g a s) a tlens Cloning a G is one way to make sure you aren't given something weaker, such as a [P and can be used as a way to pass around lenses that have to be monomorphic in f.!Note: This only accepts a proper .Zlet example l x = set (cloneLens l) (x^.cloneLens l + 1) x in example _2 ("hello",1,"you")("hello",2,"you")ulensClone a  as an IndexedPreservingLens4 that just passes through whatever index is on any , ,  or  it is composed with.vlens Clone an  as an  with the same index.wlensModify the target of a  and return the result.3When you do not need the result of the operation, () is more flexible. (w) :: * s t a b -> (a -> b) -> s -> (b, t) (w) ::  b+ s t a b -> (a -> b) -> s -> (b, t) (w) ::  [ b => [$ s t a b -> (a -> b) -> s -> (b, t) xlens-Increment the target of a numerically valued  and return the result.2When you do not need the result of the addition, () is more flexible. (x) ::  y a =>  s a -> a -> s -> (a, s) (x) ::  y a =>   s a -> a -> s -> (a, s) ylens-Decrement the target of a numerically valued  and return the result.5When you do not need the result of the subtraction, () is more flexible. (y) ::  y a =>  s a -> a -> s -> (a, s) (y) ::  y a =>   s a -> a -> s -> (a, s) zlens,Multiply the target of a numerically valued  and return the result.8When you do not need the result of the multiplication, () is more flexible. (z) ::  y a =>  s a -> a -> s -> (a, s) (z) ::  y 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. ({) ::  z a =>  s a -> a -> s -> (a, s) ({) ::  z 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. (|) :: ( y a,  { e) =>  s a -> e -> s -> (a, s) (|) :: ( y 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. (}) :: ( z a,  { e) =>  s a -> e -> s -> (a, s) (}) :: ( z 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) () ::  b+ s t a b -> (a -> b) -> s -> (a, t) () ::  [ a => [$ 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) () ::  b$ s t a b -> b -> s -> (a, t) () ::  [ a => [ 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 Data.Map as MapG_2.at "hello" <<?~ "world" $ (42,Map.fromList [("goodnight","gracie")])B(Nothing,(42,fromList [("goodnight","gracie"),("hello","world")])) () ::  s t a ( q b) -> b -> s -> (a, t) () ::  s t a ( q b) -> b -> s -> (a, t) () ::  s t a ( q 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)) () ::  y a =>  s a -> a -> s -> (a, s) () ::  y 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)) () ::  y a =>  s a -> a -> s -> (a, s) () ::  y 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)) () ::  y a =>  s a -> a -> s -> (a, s) () ::  y 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 <<//~ c (a,(a / c,b))("Hawaii",10) & _2 <<//~ 2(10.0,("Hawaii",5.0)) () :: Fractional a =>  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. () :: ( y a,  { e) =>  s a -> e -> s -> (a, s) () :: ( y 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. () :: ( z a,  { e) =>  s a -> e -> s -> (a, s) () :: ( z 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  )ing 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 [M, 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,  y a) =>  s a -> a -> m a () :: (  s m,  y 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,  y a) =>  s a -> a -> m a () :: (  s m,  y 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,  y a) =>  s a -> a -> m a () :: (  s m,  y 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,  z a) =>  s a -> a -> m a () :: (  s m,  z 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,  y a,  { e) =>  s a -> e -> m a () :: (  s m,  y 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,  z b,  { e) =>  s a -> e -> m a () :: (  s m,  z 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 [H, 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 [H, 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 [H, 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 =>  b$ s t a (Maybe b) -> b -> m a () :: (  s m,  [ a) => [ 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,  y a) =>  s a -> a -> m a () :: (  s m,  y 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,  y a) =>  s a -> a -> m a () :: (  s m,  y 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,  y a) =>  s a -> a -> m a () :: (  s m,  y a) =>  s a -> a -> m a lensModify the target of a  into your  t/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,  z a) =>  s a -> a -> m a () :: (  s m,  z 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,  y a,  { e) =>  s a -> e -> m a () :: (  s m,  y 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,  z a,  { e) =>  s a -> e -> m a () :: (  s m,  z a,  { e) =>  s a -> e -> m a lensModify the target of a  into your Monad'<s state by raising it by an arbitrary 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) =>  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  ing 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,  [ 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 =>  b 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 [= because there are potential loss of state issues otherwise.lens 2 a monoidal 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 2 a monoidal 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 n-, 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 H returning the intermediate result, or adjust all of the targets of an \6 and return a monoidal summary along with the answer. l w f "a l    f /When you do not need access to the index then (w() 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 => \+ 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 \H 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 => \+ i s t a b -> (i -> a -> b) -> s -> (a, t) lensAdjust the target of an G returning a supplementary result, or adjust all of the targets of an \L and return a monoidal summary of the supplementary results and the answer. () "a    () ::  Z f => 0 i s t a b -> (i -> a -> f b) -> s -> f t () ::  Y f => \* i s t a b -> (i -> a -> f b) -> s -> f t yIn 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 => \0 i s t a b -> (i -> a -> (r, b)) -> s -> (r, t) lensAdjust the target of an G returning a supplementary result, or adjust all of the targets of an \W within the current state, and return a monoidal summary of the supplementary results. l  f "a   (l  f) () ::   s m => 3 i s s a b -> (i -> a -> (r, b)) -> s -> m r () :: (  s m,  [ r) => \- i s s a b -> (i -> a -> (r, b)) -> s -> m r lensAdjust the target of an H returning the intermediate result, or adjust all of the targets of an \V 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) => \# 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 \L 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) => \# i s s a b -> (i -> a -> b) -> m a lensA version of () that works on f.("hello","world")^#_2"world"lens A version of  that works on f.$storing _2 "world" ("hello","there")("hello","world")lensA version of () that works on f.!("hello","there") & _2 #~ "world"("hello","world")lensA version of () that works on f.!("hello","world") & _2 #%~ length ("hello",5)lensA version of (l) that works on f.6("hello","world") & _2 #%%~ \x -> (length x, x ++ "!")(5,("hello","world!"))lensA version of () that works on f.lensA version of () that works on f.lensA version of (w) that works on f."("hello","world") & _2 <#%~ length(5,("hello",5))lensA version of () that works on f.lensA version of (m) that works on f.lensA version of () that works on f."("hello","there") & _2 <#~ "world"("world",("hello","world"))lensA version of () that works on f.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.barN in the above description is recursive or complex enough to prevent inlining.  ::  s t a b ->  s t a b fcdefghijklmnopqrstuvwxyz{|}~ffedcgjihlmnkpqrowxyz{|}~tuvsFk1l4m4n1w4x4y4z4{4|4}4~44444444444444444444444444444444444444424444444484444444444(C) 2012-16 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> provisional Rank2TypesSafe-8=>?@ACHSUVXD!;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) ->  ~   w  :: ( f, . t) => (a -> f b) -> t (s, a) -> f (t (s, b))   (  w ) :: ( 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 &lens  k ~(a,b) = (\b' -> (a,b'))  k b 99(C) 2012-16 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> provisional Rank2Types Trustworthy=?@ASXlensrThis is a convenient alias used when consuming (indexed) getters and (indexed) folds in a highly general fashion.lensUsed to consume an  ^.lensUWhen you see this in a type signature it indicates that you can pass the function a , , [,  ],  _,  bI, 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  ]d in limited situations, to do so, they need to be monomorphic in what we are going to extract with . To be compatible with , [ and  b. 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  ] (or ['), otherwise you can only pass this a  or .lensBuild an (index-preserving) $ from an arbitrary Haskell function.  f  w  g "a  (g  w f)  a   f "a 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  w  b "a  b a   b "a b a   b "a 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 ,  b or 5 or the result of folding over all the results of a  ] or [" that points at a monoidal value.   w  "a  v  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 U, It may be useful to think of it as having one of these more restricted signatures:  ::  s a -> s -> a  ::  m =>  ] 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  t transformer stack you can use:  ::   s m =>  s a -> m a  :: (  s m,  a) =>  ] 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 G or the result of folding over the result of mapping the targets of a  ] or [.  l f "a  (l  w  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 U, It may be useful to think of it as having one of these more restricted signatures:  ::  s a -> (a -> r) -> s -> r  ::  m =>  ]! 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  t transformer stack you can use:  ::   s m =>  s a -> (a -> r) -> m r  :: (  s m,  r) =>  ] 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  ] or [" that points at a monoidal values.This is the same operation as  with the arguments flipped.YThe fixity and semantics are such that subsequent field accesses can be performed with ( w). (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 ->  ] s m -> m () :: s ->   s a -> a () :: s ->  s a -> a () ::  m => s ->  s m -> m lensUse the target of a ,  b, or . in the current state, or use a summary of a  ] or [" 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) =>  ] 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 ,  b or . in the current state, or use a summary of a  ] or [" that points to a monoidal value.,evalState (uses _1 length) ("hello","world")5  ::   s m =>  s a -> (a -> r) -> m r  :: (  s m,  r) =>  ] 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  D that only extracts the portion of the log that is focused on by a  . If given a  or a U 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  D that only extracts the portion of the log that is focused on by a  . If given a  or a U 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  D that only extracts the portion of the log that is focused on by a  . If given a  or a U 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  D that only extracts the portion of the log that is focused on by a  . If given a  or a U 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 B the result will be a monoidal summary instead of a single answer.  "a   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 B 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.YThe fixity and semantics are such that subsequent field accesses can be performed with ( w). ( ) :: s ->  i s a -> (i, a) ( ) :: s ->  i s a -> (i, a) AThe 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 <ekmett@gmail.com> provisional non-portable TrustworthySXlensAn analogue of  for .  :: (b -> t) -> Review' t b  =  .  lensTurn a  around to get a   =  .   =  .  un (to length) # [1,2,3]3lensTurn a  or  b around to build a .If you have an  b,  B is a more powerful version of this function that will return an  b instead of a mere . 5 ^.re _LeftLeft 56 ^.re (_Left.unto succ)Left 7  "a   w   "a   w   "a   w   "a   w   ::  s t a b ->  b t  ::  s t a b ->  b t lensThis can be used to turn an  b or  around and ? a value (or the current environment) through it the other way.  "a   w   .  "a  v review _Left "mustard"Left "mustard"review (unto succ) 56Usually  is used in the (->)  t with a  or  bh, 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  t9 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 "a f x l # x "a 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  b or  around and U a value (or the current environment) through it the other way, applying a function.  "a   w   ( f) g "a g  w f reviews _Left isRight "mustard"Falsereviews (unto succ) (*2) 38%Usually this function is used in the (->)  t with a  or  bh, 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  t9 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  b or  around and ? a value (or the current environment) through it the other way.  "a   w    w  "a   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  b or  around and B the current state through it the other way, applying a function.  "a   w   ( f) g "a   (g  w f) *evalState (reuses _Left isLeft) (5 :: Int)True  ::   a m =>  s a -> (s -> r) -> m r  ::   a m =>  s a -> (s -> r) -> m r mnnm8 (C) 2012-16 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> provisional non-portable TrustworthySX<>lens type APrism' =   lensKIf 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 t and / for examples of why you might want to do this.lensBuild a  _. p t a is used instead of  q 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  q.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 r.lensUse a " to work over part of a structure.lenslift a  through a Z 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[]M[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 W or return the original value while allowing the type to change if it does not match.matching _Just (Just 12)Right 12@matching _Just (Nothing :: Maybe Int) :: Either (Maybe Bool) Int Left NothinglensThis  provides a  for tweaking the   half of an  p: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  p: _Left # 5Left 5 5^.re _LeftLeft 5lensThis  provides a  for tweaking the   half of an  p: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  p: _Right # 5Right 5 5^.re _RightRight 5lensThis  provides a ) for tweaking the target of the value of  \ in a  q.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 ^?  "a m Just x ^? _JustJust xNothing ^? _JustNothinglensThis  provides the  of a   in a  q.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 "a 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 q is "improper" in the sense that it normalizes the text formatting, but round tripping is idempotent given sane  'Read'/'Show' instances. _Show # 2"2""EQ" ^? _Show :: Maybe OrderingJust EQ  "a     readMaybe  (C) 2012-16 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> provisional Rank2Types Trustworthy ,=>?@ASX =rlens 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.   "a    "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 "a   ( 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.  "a    w  ?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 "a   f a  :: (a -> a) ->  a a lens Obtain a - that can be composed with to filter another , , ,  (or ).Note: This is not a legal L, unless you are very careful not to invalidate the predicate on the target.Note: This is also not a legal M, 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    w  evens      evens (   w  ) ,So, in order for this to qualify as a legal K 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 ).b[(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 L, 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 "a   ( 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 w 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 "a   ( 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 kNote: 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:Blet 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 "b  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  .  ::       ::        ::   K      ::   K     %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  u contains only isolated space characters (and no other characters that count as space, such as non-breaking spaces).lensA  over the individual   of a  .  ::       ::        ::   K      ::   K     %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}   =     "a  I l =  l  w }   ::  s a -> (a -> r) -> s -> r  ::  [ r => " s a -> (a -> r) -> s -> r  ::  i 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  ::  i 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}   =     "a   ::  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 lensIRight-associative fold of parts of a structure that are viewed through a , ,  or .   "a     :: ) 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  J l "a  l  w }  ::  ( ( r) s a -> (a -> r -> r) -> r -> s -> r lensLLeft-associative fold of the parts of a structure that are viewed through a , ,  or .   "a    :: ) 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 ( ).   "a    ( ) "a      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 "a xs    ( ) "a     (  ) :: 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   "a      ::  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   "a      ::  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.LensBanyOf biplate (== "world") (((),2::Int),"hello",("world",11::Int))True   "a    L l "a  l  w }  ::  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   "a    M l =  l  w }  ::  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 N l =  l  w }  ::  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   of every number targeted by a .productOf both (4,5)20productOf folded [1,2,3,4,5]120   "a   [This operation may be more strict than you would expect. If you want a lazier version use ala    w   ::  y a =>  s a -> s -> a  ::  y a =>  s a -> s -> a  ::  y a =>  s a -> s -> a  ::  y a =>  s a -> s -> a  ::  y a =>  s a -> s -> a  ::  y a =>  s a -> s -> a lensCalculate the   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   "a   [This operation may be more strict than you would expect. If you want a lazier version use ala    w   _1 ::  y a => (a, b) -> a  (  w ) :: (  f,  y a) => f (a, b) -> a  ::  y a =>  s a -> s -> a  ::  y a =>  s a -> s -> a  ::  y a =>  s a -> s -> a  ::  y a =>  s a -> s -> a  ::  y a =>  s a -> s -> a  ::  y a =>  s a -> s -> a lens&Traverse over all of the targets of a  (or ), computing an  Y (or  Z)-based answer, but unlike # do not construct a new structure.  generalizes   to work over any .When passed a ,  can work over any  Z, but when passed a ,  requires an  Y.+traverseOf_ both putStrLn ("hello","world")helloworld   "a     _2 ::  Z# f => (c -> f r) -> (d, c) -> f ()    ::  Y f => (a -> f b) ->  p a c -> f ()  O l "a  l  w } !The rather specific signature of 5 allows it to be used as if the signature was any of:  ::  Z f => $ s a -> (a -> f r) -> s -> f ()  ::  Y f => & s a -> (a -> f r) -> s -> f ()  ::  Z f => % s a -> (a -> f r) -> s -> f ()  ::  Z f => & s a -> (a -> f r) -> s -> f ()  ::  Y f =>  s a -> (a -> f r) -> s -> f ()  ::  Y f => $ s a -> (a -> f r) -> s -> f () lens&Traverse over all of the targets of a  (or ), computing an  Y (or  Z)-based answer, but unlike # do not construct a new structure.  generalizes   to work over any .When passed a ,  can work over any  Z, but when passed a ,  requires an  Y.   "a   &forOf_ both ("hello","world") putStrLnhelloworld!The rather specific signature of 5 allows it to be used as if the signature was any of: P l s "a  l s  w }  ::  Z f => $ s a -> s -> (a -> f r) -> f ()  ::  Y f => & s a -> s -> (a -> f r) -> f ()  ::  Z f => % s a -> s -> (a -> f r) -> f ()  ::  Z f => & s a -> s -> (a -> f r) -> f ()  ::  Y f =>  s a -> s -> (a -> f r) -> f ()  ::  Y 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.   "a   5sequenceAOf_ both (putStrLn "hello",putStrLn "world")helloworld  ::  Z f =>  s (f a) -> s -> f ()  ::  Y f =>  s (f a) -> s -> f ()  ::  Z f =>  s (f a) -> s -> f ()  ::  Z f =>  s (f a) -> s -> f ()  ::  Y f =>  s (f a) -> s -> f ()  ::  Y f =>  s (f a) -> s -> f () lens&Traverse over all of the targets of a , computing an   based answer.As long as you have  Y or  Z effect you are better using . The & is useful only when you have genuine   effect.Mtraverse1Of_ both1 (\ks -> Map.fromList [ (k, ()) | k <- ks ]) ("abc", "bcd")fromList [('b',()),('c',())]  ::   f =>  s a -> (a -> f r) -> s -> f () lensSee  and .Hfor1Of_ 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 g on a structure to a monadic action, evaluate these actions from left to right, and ignore the results.'mapMOf_ both putStrLn ("hello","world")helloworld   "a    ::  t m => $ s a -> (a -> m r) -> s -> m ()  ::  t m => & s a -> (a -> m r) -> s -> m ()  ::  t m => % s a -> (a -> m r) -> s -> m ()  ::  t m => & s a -> (a -> m r) -> s -> m ()  ::  t m =>  s a -> (a -> m r) -> s -> m ()  ::  t m => $ s a -> (a -> m r) -> s -> m () lens is # with two of its arguments flipped.'forMOf_ both ("hello","world") putStrLnhelloworld   "a    ::  t m => $ s a -> s -> (a -> m r) -> m ()  ::  t m => & s a -> s -> (a -> m r) -> m ()  ::  t m => % s a -> s -> (a -> m r) -> m ()  ::  t m => & s a -> s -> (a -> m r) -> m ()  ::  t m =>  s a -> s -> (a -> m r) -> m ()  ::  t 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   "a    ::  t m =>  s (m a) -> s -> m ()  ::  t m =>  s (m a) -> s -> m ()  ::  t m =>  s (m a) -> s -> m ()  ::  t m =>  s (m a) -> s -> m ()  ::  t m =>  s (m a) -> s -> m ()  ::  t 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"   "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  ::   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"   "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  ::   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   "a    ::   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   "a    ::   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]   "a      :: # 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"   "a !  ! "a  ! ::  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:C This can be rather inefficient for large containers and just like  ., this will not terminate for infinite folds.   "a "  lengthOf _1 ("hello",())1lengthOf traverse [1..10]100lengthOf (traverse.traverse) [[1,2],[3,4],[5,6]]6 " (  w ) :: (  f,   g) => f (g a) ->  K " ::  s a -> s ->  K " ::  s a -> s ->  K " ::  s a -> s ->  K " ::  s a -> s ->  K " ::  s a -> s ->  K #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.BNote: if you get stack overflows due to this, you may want to use %Z 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 @.  (#) "a   @ It may be helpful to think of #8 as having one of the following more specialized types: (# ) :: s ->  s a ->  q a (# ) :: s ->  s a ->  q a (# ) :: s ->  s a ->  q a (# ) :: s ->  s a ->  q a (# ) :: s ->  s a ->  q 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 ->  q a % ::  s a -> s ->  q a % ::  s a -> s ->  q a % ::  s a -> s ->  q a % ::  s a -> s ->  q 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   entry of a  or  or retrieve  \ the result from a  or .>The answer is computed in a manner that leaks space less than ala    w - 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 ->  q a ' ::  s a -> s ->  q a ' ::  s a -> s ->  q a ' ::  s a -> s ->  q a ' ::  s a -> s ->  q 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 ->  q a ( ::  s a -> s ->  q a ( ::  s a -> s ->  q a ( ::  s a -> s ->  q a ( ::  s a -> s ->  q a )lensReturns   if this  or ' has no targets in the given container.Note: ) on a valid ,  or  should always return  .   "a )  /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 ) (  w _1  w ) :: (  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  .    w   "a *  /This may be rather inefficient compared to the    w   check of many containers.notNullOf _1 (1,2)TruenotNullOf traverse [1..10]TruenotNullOf folded []FalsenotNullOf (element 20) [1..10]False * (  w _1  w ) :: (  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   "a   (  "empty")  w +  bIn the interest of efficiency, This operation has semantics more strict than strictly necessary.  c ( l P), has lazier semantics but could leak memory. + ::   a =>  s a -> s ->  q a + ::   a =>  s a -> s ->  q a + ::   a =>  s a -> s ->  q a + ::   a =>  s a -> s ->  q a + ::   a =>  s a -> s ->  q 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   "a   (  "empty")  w -  bIn the interest of efficiency, This operation has semantics more strict than strictly necessary.  b ( l S), has lazier semantics but could leak memory. - ::   a =>  s a -> s ->  q a - ::   a =>  s a -> s ->  q a - ::   a =>  s a -> s ->  q a - ::   a =>  s a -> s ->  q a - ::   a =>  s a -> s ->  q 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  .EmaximumByOf traverse (compare `on` length) ["mustard","relish","ham"]Just "mustard"`In the interest of efficiency, This operation has semantics more strict than strictly necessary.   cmp "a   (  "empty")  w /  cmp / ::  s a -> (a -> a ->   ) -> s ->  q a / ::  s a -> (a -> a ->   ) -> s ->  q a / ::  s a -> (a -> a ->   ) -> s ->  q a / ::  s a -> (a -> a ->   ) -> s ->  q a / ::  s a -> (a -> a ->   ) -> s ->  q a 0lens2Obtain 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.EminimumByOf traverse (compare `on` length) ["mustard","relish","ham"] Just "ham"   cmp "a   (  "empty")  w 0  cmp 0 ::  s a -> (a -> a ->   ) -> s ->  q a 0 ::  s a -> (a -> a ->   ) -> s ->  q a 0 ::  s a -> (a -> a ->   ) -> s ->  q a 0 ::  s a -> (a -> a ->   ) -> s ->  q a 0 ::  s a -> (a -> a ->   ) -> s ->  q a 1lensThe 1 function takes a  (or , , , or n), 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 1 ::  s a -> (a ->  ~ ) -> s ->  q a 1 ::  s a -> (a ->  ~ ) -> s ->  q a 1 ::  s a -> (a ->  ~ ) -> s ->  q a 1 ::  s a -> (a ->  ~ ) -> s ->  q a 1 ::  s a -> (a ->  ~ ) -> s ->  q a    "a 1  T l "a 1 l  w } 8A simpler version that didn't permit indexing, would be: 1 ::  (  ( q a)) s a -> (a ->  ~ ) -> s ->  q a 1 l p =  l (a y -> if p a then  \ a else y)   2lensThe 2 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.PfindMOf each ( \x -> print ("Checking " ++ show x) >> return (even x)) (1,3,4,6) "Checking 1" "Checking 3" "Checking 4"Just 4PfindMOf each ( \x -> print ("Checking " ++ show x) >> return (even x)) (1,3,5,7) "Checking 1" "Checking 3" "Checking 5" "Checking 7"Nothing 2 :: ( t m,  s a) -> (a -> m  ~ ) -> s -> m ( q a) 2 :: ( t m,  s a) -> (a -> m  ~ ) -> s -> m ( q a) 2 :: ( t m,  s a) -> (a -> m  ~ ) -> s -> m ( q a) 2 :: ( t m,  s a) -> (a -> m  ~ ) -> s -> m ( q a) 2 :: ( t m,  s a) -> (a -> m  ~ ) -> s -> m ( q a)  2 A :: (Monad m, Foldable f) => (a -> m Bool) -> f a -> m (Maybe a) U l "a 2 l  w } 8A simpler version that didn't permit indexing, would be: 2 :: Monad m =>  (  (m ( q a))) s a -> (a -> m  ~ ) -> s -> m ( q a) 2 l p = * l (a y -> p a >>= x -> if x then return ( \ a) else y) $ return   3lensThe 3 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' 3 ::   k =>  s (k,v) -> k -> s ->  q v 4lens 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 4 l f "a   f  w   l   "a 4  4 :: $ s a -> (a -> a -> a) -> s -> a 4 :: & s a -> (a -> a -> a) -> s -> a 4 :: & s a -> (a -> a -> a) -> s -> a 4 :: % s a -> (a -> a -> a) -> s -> a 4 ::  s a -> (a -> a -> a) -> s -> a 5lens 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 5 l f "a   f  w   l   "a 5  5 :: $ s a -> (a -> a -> a) -> s -> a 5 :: & s a -> (a -> a -> a) -> s -> a 5 :: & s a -> (a -> a -> a) -> s -> a 5 :: % s a -> (a -> a -> a) -> s -> a 5 ::  s a -> (a -> a -> a) -> s -> a 6lens5Strictly fold right over the elements of a structure.   "a 6  6 :: ) s a -> (a -> r -> r) -> r -> s -> r 6 :: + s a -> (a -> r -> r) -> r -> s -> r 6 :: + s a -> (a -> r -> r) -> r -> s -> r 6 :: * s a -> (a -> r -> r) -> r -> s -> r 6 :: % s a -> (a -> r -> r) -> r -> s -> r 7lensMFold over the elements of a structure, associating to the left, but strictly.   "a 7  7 :: ) s a -> (r -> a -> r) -> r -> s -> r 7 :: + s a -> (r -> a -> r) -> r -> s -> r 7 :: + s a -> (r -> a -> r) -> r -> s -> r 7 :: * s a -> (r -> a -> r) -> r -> s -> r 7 :: % s a -> (r -> a -> r) -> r -> s -> r 8lens A variant of 6 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. 4 l f "a   f  w   l 8 :: $ s a -> (a -> a -> a) -> s -> a 8 :: & s a -> (a -> a -> a) -> s -> a 8 :: & s a -> (a -> a -> a) -> s -> a 8 :: % s a -> (a -> a -> a) -> s -> a 8 ::  s a -> (a -> a -> a) -> s -> a 9lens A variant of 7 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. 9 l f "a  f  w   l 9 :: $ s a -> (a -> a -> a) -> s -> a 9 :: & s a -> (a -> a -> a) -> s -> a 9 :: & s a -> (a -> a -> a) -> s -> a 9 :: % s a -> (a -> a -> a) -> s -> a 9 ::  s a -> (a -> a -> a) -> s -> a :lensbMonadic fold over the elements of a structure, associating to the right, i.e. from right to left.   "a :  : ::  t m => - s a -> (a -> r -> m r) -> r -> s -> m r : ::  t m => / s a -> (a -> r -> m r) -> r -> s -> m r : ::  t m => / s a -> (a -> r -> m r) -> r -> s -> m r : ::  t m => . s a -> (a -> r -> m r) -> r -> s -> m r : ::  t m => ) s a -> (a -> r -> m r) -> r -> s -> m r ;lensaMonadic fold over the elements of a structure, associating to the left, i.e. from left to right.   "a ;  ; ::  t m => - s a -> (r -> a -> m r) -> r -> s -> m r ; ::  t m => / s a -> (r -> a -> m r) -> r -> s -> m r ; ::  t m => / s a -> (r -> a -> m r) -> r -> s -> m r ; ::  t m => . s a -> (r -> a -> m r) -> r -> s -> m r ; ::  t 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)False>lensThis converts a  to a 5 that returns the first element, if it exists, as a  q. > ::  s a ->  s ( q a) > ::  s a ->  s ( q a) > ::  s a ->  s ( q a) > ::  s a ->  s ( q a) > ::  s a ->  s ( q a) > ::  s a ->  s ( q a) ?lensThis converts an  to an @ that returns the first index and element, if they exist, as a  q. ? ::  i s a ->  s ( q (i, a)) ? ::  i s a ->  s ( q (i, a)) ? ::  i s a ->  s ( q (i, a)) ? ::  i s a ->  s ( q (i, a)) @lens'Retrieve the first value targeted by a  or  (or  \ the result from a  or  ). See also % and #D, which are similar with some subtle differences (explained below).    w   "a @   @ =   w > Unlike #, this function uses a  o 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 (->) sO 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, %m, 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 ->  q a @ ::  s a -> s ->  q a @ ::  s a -> s ->  q a @ ::  s a -> s ->  q a @ ::  s a -> s ->  q a @ ::   s m =>  s a -> m ( q a) @ ::   s m =>  s a -> m ( q a) @ ::   s m =>  s a -> m ( q a) @ ::   s m =>  s a -> m ( q a) @ ::   s m =>  s a -> m ( q a) Alens1Retrieve the first index and value targeted by a  or  (or  \ the result from a  or  ). See also (\). A =   w ? This is usually applied in the    (->) s. A ::  i s a -> s ->  q (i, a) A ::  i s a -> s ->  q (i, a) A ::  i s a -> s ->  q (i, a) A ::  i s a -> s ->  q (i, a) OHowever, it may be useful to think of its full generality when working with a  transformer stack: A ::   s m =>  s a -> m ( q (i, a)) A ::   s m =>  s a -> m ( q (i, a)) A ::   s m =>  s a -> m ( q (i, a)) A ::   s m =>  s a -> m ( q (i, a)) Blens5Retrieve a function of the first value targeted by a  or  (or  \ the result from a  or ).This is usually applied in the    (->) s.Clens@Retrieve a function of the first index and value targeted by an  or  (or  \ the result from an  or ). See also (\). C =   w ? This is usually applied in the    (->) s. C :: $ i s a -> (i -> a -> r) -> s ->  q r C :: & i s a -> (i -> a -> r) -> s ->  q r C :: % i s a -> (i -> a -> r) -> s ->  q r C ::  i s a -> (i -> a -> r) -> s ->  q r OHowever, it may be useful to think of its full generality when working with a  transformer stack: C ::   s m => " i s a -> (i -> a -> r) -> m ( q r) C ::   s m => $ i s a -> (i -> a -> r) -> m ( q r) C ::   s m => # i s a -> (i -> a -> r) -> m ( q r) C ::   s m =>  i s a -> (i -> a -> r) -> m ( q r) Dlens'Retrieve the first value targeted by a  or  (or  \ the result from a  or ) into the current state. D =   w > D ::   s m =>  s a -> m ( q a) D ::   s m =>  s a -> m ( q a) D ::   s m =>  s a -> m ( q a) D ::   s m =>  s a -> m ( q a) D ::   s m =>  s a -> m ( q a) Elens2Retrieve the first index and value targeted by an  or  (or  \ the index and result from an  or ) into the current state. E =   w ? E ::   s m =>  i s a -> m ( q (i, a)) E ::   s m =>  i s a -> m ( q (i, a)) E ::   s m =>  i s a -> m ( q (i, a)) E ::   s m =>  i s a -> m ( q (i, a)) Flens5Retrieve a function of the first value targeted by a  or  (or  \ the result from a  or ) into the current state. F =   w > F ::   s m =>  s a -> (a -> r) -> m ( q r) F ::   s m =>  s a -> (a -> r) -> m ( q r) F ::   s m =>  s a -> (a -> r) -> m ( q r) F ::   s m =>  s a -> (a -> r) -> m ( q r) F ::   s m =>  s a -> (a -> r) -> m ( q r) Glens@Retrieve 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. G =   w ? G ::   s m => " i s a -> (i -> a -> r) -> m ( q r) G ::   s m => $ i s a -> (i -> a -> r) -> m ( q r) G ::   s m => # i s a -> (i -> a -> r) -> m ( q r) G ::   s m =>  i s a -> (i -> a -> r) -> m ( q r) HlensThis allows you to # the elements of a pretty much any $ construction in the opposite order.This will preserve indexes on }4 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 .IlensFold 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 "a I l  w   I :: & i s a -> (i -> a -> m) -> s -> m I ::  [ m => ( i s a -> (i -> a -> m) -> s -> m I :: ' i s a -> (i -> a -> m) -> s -> m I ::  [ m => " i s a -> (i -> a -> m) -> s -> m JlensJRight-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 "a J l  w   J :: 0 i s a -> (i -> a -> r -> r) -> r -> s -> r J :: 2 i s a -> (i -> a -> r -> r) -> r -> s -> r J :: 1 i s a -> (i -> a -> r -> r) -> r -> s -> r J :: , i s a -> (i -> a -> r -> r) -> r -> s -> r KlensMLeft-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 "a K l  w   K :: 0 i s a -> (i -> r -> a -> r) -> r -> s -> r K :: 2 i s a -> (i -> r -> a -> r) -> r -> s -> r K :: 1 i s a -> (i -> r -> a -> r) -> r -> s -> r K :: , i s a -> (i -> r -> a -> r) -> r -> s -> r Llens4Return 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 "a L l  w   L ::  i s a -> (i -> a ->  ~ ) -> s ->  ~ L ::  i s a -> (i -> a ->  ~ ) -> s ->  ~ L ::  i s a -> (i -> a ->  ~ ) -> s ->  ~ L ::  i s a -> (i -> a ->  ~ ) -> s ->  ~ Mlens5Return 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 "a M l  w   M ::  i s a -> (i -> a ->  ~ ) -> s ->  ~ M ::  i s a -> (i -> a ->  ~ ) -> s ->  ~ M ::  i s a -> (i -> a ->  ~ ) -> s ->  ~ M ::  i s a -> (i -> a ->  ~ ) -> s ->  ~ Nlens=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 "a N l  w   N ::  i s a -> (i -> a ->  ~ ) -> s ->  ~ N ::  i s a -> (i -> a ->  ~ ) -> s ->  ~ N ::  i s a -> (i -> a ->  ~ ) -> s ->  ~ N ::  i s a -> (i -> a ->  ~ ) -> s ->  ~ OlensTraverse 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 "a  l  w   O ::  Z f => + i s a -> (i -> a -> f r) -> s -> f () O ::  Y f => - i s a -> (i -> a -> f r) -> s -> f () O ::  Z f => , i s a -> (i -> a -> f r) -> s -> f () O ::  Y f => ' i s a -> (i -> a -> f r) -> s -> f () PlensTraverse the targets of an  or P with access to the index, discarding the results (with the arguments flipped). P "a    w O -When you don't need access to the index then % is more flexible in what it accepts.  l a "a P l a  w   P ::  Z f => + i s a -> s -> (i -> a -> f r) -> f () P ::  Y f => - i s a -> s -> (i -> a -> f r) -> f () P ::  Z f => , i s a -> s -> (i -> a -> f r) -> f () P ::  Y f => ' i s a -> s -> (i -> a -> f r) -> f () Qlens*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 "a  l  w   Q ::  t m => + i s a -> (i -> a -> m r) -> s -> m () Q ::  t m => - i s a -> (i -> a -> m r) -> s -> m () Q ::  t m => , i s a -> (i -> a -> m r) -> s -> m () Q ::  t m => ' i s a -> (i -> a -> m r) -> s -> m () Rlens*Run monadic actions for each target of an  or P with access to the index, discarding the results (with the arguments flipped). R "a    w Q -When you don't need access to the index then % is more flexible in what it accepts.  l a "a  l a  w   R ::  t m => + i s a -> s -> (i -> a -> m r) -> m () R ::  t m => - i s a -> s -> (i -> a -> m r) -> m () R ::  t m => , i s a -> s -> (i -> a -> m r) -> m () R ::  t m => ' i s a -> s -> (i -> a -> m r) -> m () Slens<Concatenate the results of a function of the elements of an  or  with access to the index.-When you don't need access to the index then  & is more flexible in what it accepts.   l "a S l  w   S "a I S :: * i s a -> (i -> a -> [r]) -> s -> [r] S :: , i s a -> (i -> a -> [r]) -> s -> [r] S :: + i s a -> (i -> a -> [r]) -> s -> [r] S :: & i s a -> (i -> a -> [r]) -> s -> [r] TlensThe T 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 1% is more flexible in what it accepts. 1 l "a T l  w   T ::  i s a -> (i -> a ->  ~ ) -> s ->  q a T ::  i s a -> (i -> a ->  ~ ) -> s ->  q a T ::  i s a -> (i -> a ->  ~ ) -> s ->  q a T ::  i s a -> (i -> a ->  ~ ) -> s ->  q a UlensThe U 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 2% is more flexible in what it accepts. 2 l "a U l  w   U ::  t m =>  i s a -> (i -> a -> m  ~ ) -> s -> m ( q a) U ::  t m =>  i s a -> (i -> a -> m  ~ ) -> s -> m ( q a) U ::  t m =>  i s a -> (i -> a -> m  ~ ) -> s -> m ( q a) U ::  t m =>  i s a -> (i -> a -> m  ~ ) -> s -> m ( q a) VlensStrictly; fold right over the elements of a structure with an index.-When you don't need access to the index then 6% is more flexible in what it accepts. 6 l "a V l  w   V :: 0 i s a -> (i -> a -> r -> r) -> r -> s -> r V :: 2 i s a -> (i -> a -> r -> r) -> r -> s -> r V :: 1 i s a -> (i -> a -> r -> r) -> r -> s -> r V :: , i s a -> (i -> a -> r -> r) -> r -> s -> r WlensRFold 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 7% is more flexible in what it accepts. 7 l "a W l  w   W :: 2 i s a -> (i -> r -> a -> r) -> r -> s -> r W :: 4 i s a -> (i -> r -> a -> r) -> r -> s -> r W :: 3 i s a -> (i -> r -> a -> r) -> r -> s -> r W :: . i s a -> (i -> r -> a -> r) -> r -> s -> r XlensBMonadic 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 "a X l  w   X ::  t m => 4 i s a -> (i -> a -> r -> m r) -> r -> s -> m r X ::  t m => 6 i s a -> (i -> a -> r -> m r) -> r -> s -> m r X ::  t m => 5 i s a -> (i -> a -> r -> m r) -> r -> s -> m r X ::  t m => 0 i s a -> (i -> a -> r -> m r) -> r -> s -> m r YlensUMonadic 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 "a Y l  w   Y ::  t m => 4 i s a -> (i -> r -> a -> m r) -> r -> s -> m r Y ::  t m => 6 i s a -> (i -> r -> a -> m r) -> r -> s -> m r Y ::  t m => 5 i s a -> (i -> r -> a -> m r) -> r -> s -> m r Y ::  t m => 0 i s a -> (i -> r -> a -> m r) -> r -> s -> m r Zlens-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 "a      w Z l Z ::  i s a -> s -> [(i,a)] Z ::  i s a -> s -> [(i,a)] Z ::  i s a -> s -> [(i,a)] Z ::  i s a -> s -> [(i,a)] [lensAn infix version of Z.\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 ->  q (i, a) (\ ) :: s ->  i s a ->  q (i, a) (\ ) :: s ->  i s a ->  q (i, a) (\ ) :: s ->  i s a ->  q (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.  "a ^  ^ ::   a =>  i s a -> a -> s ->  q i ^ ::   a =>  i s a -> a -> s ->  q i _lens1Retrieve the indices of the values targeted by a  or " which are equal to a given value.  "a _  _ ::   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.  "a `  ` ::  i s a -> (a ->  ~ ) -> s ->  q i ` ::  i s a -> (a ->  ~ ) -> s ->  q i alens1Retrieve the indices of the values targeted by a  or  which satisfy a predicate.  "a a  a ::  i s a -> (a ->  ~) -> s -> [i] a ::  i s a -> (a ->  ~) -> s -> [i] blens Filter an  or , obtaining an .4[0,0,0,5,5,5]^..traversed.ifiltered (\i a -> i <= a) [0,5,5,5] Compose with b to filter another ,  IndexedIso, ,  (or /) with access to both the value and the index.Note: As with  , this is not a legal L, unless you are very careful not to invalidate the predicate on the target!clens Obtain an " by taking elements from another , ,  or  while a predicate holds. c :: (i -> a ->  ~) ->  i s a ->  i s a c :: (i -> a ->  ~) ->  i s a ->  i s a c :: (i -> a ->  ~) ->  i s a ->  i s a c :: (i -> a ->  ~) ->  i s a ->  i s a Note: Applying c to an  or - will still allow you to use it as a pseudo-P, 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.dlens Obtain an # by dropping elements from another , ,  or  while a predicate holds. d :: (i -> a ->  ~) ->  i s a ->  i s a d :: (i -> a ->  ~) ->  i s a ->  i s a -- see notes d :: (i -> a ->  ~) ->  i s a ->  i s a -- see notes d :: (i -> a ->  ~) ->  i s a ->  i s a Note: As with  applying d to an  or - will still allow you to use it as a pseudo-V, 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.elensFold a value using a specified  and  [ operations. This is like  where the  % instance can be manually specified. e  "a   e :: ) s a -> (a -> a -> a) -> a -> s -> a e :: + s a -> (a -> a -> a) -> a -> s -> a e :: * s a -> (a -> a -> a) -> a -> s -> a e :: % s a -> (a -> a -> a) -> a -> s -> a e :: + s a -> (a -> a -> a) -> a -> s -> a 'foldByOf both (++) [] ("hello","world") "helloworld"flensFold a value using a specified  and  [ operations. This is like  where the  % instance can be manually specified. f  "a   f :: 5 s a -> (r -> r -> r) -> r -> (a -> r) -> s -> r f :: 7 s a -> (r -> r -> r) -> r -> (a -> r) -> s -> r f :: 1 s a -> (r -> r -> r) -> r -> (a -> r) -> s -> r f :: 6 s a -> (r -> r -> r) -> r -> (a -> r) -> s -> r f :: 7 s a -> (r -> r -> r) -> r -> (a -> r) -> s -> r /foldMapByOf both (+) 0 length ("hello","world")10{EIV\      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdef{ #$>?@BACDFEG<=H     !")*%&'(+,-./012674589:;3[\]IJKLMNOPQRSTUVWXYZ^_`abcdIE\Vef 8#8$8[8\8]8(C) 2012-16 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> provisional Rank2Types Trustworthy&',=>?@ACSX z9EglensAllows # of the value at the largest index.hlens% of the element at the largest index.ilensAllows ! the value at the smallest index.jlens( of the element with the smallest index.llens type l f =  (n f) nlens:When you see this as an argument to a function, it expectsto be indexed if p is an instance of } i,to be unindexed if p is (->),a  if f is  Y,a  if f is only a  Z and ,a  if f is only a  Z,a  if f is  Y and .olens type o =  (q i) plens type p =  (r i) qlens>When you see this as an argument to a function, it expects an .rlens>When you see this as an argument to a function, it expects an .slens type s =  t tlens=When you see this as an argument to a function, it expects a .ulens type u =  v vlens=When you see this as an argument to a function, it expects a .wlens.Map each element of a structure targeted by a  or F, 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 ((),(),()) w "a    l "a w l   }   itraversed "a  itraverse This yields the obvious law:  "a w  w ::  Z f => * s t a b -> (a -> f b) -> s -> f t w ::  Z f => ) s t a b -> (a -> f b) -> s -> f t w ::   f => # s t a b -> (a -> f b) -> s -> f t w ::  Y f => $ s t a b -> (a -> f b) -> s -> f t xlens A version of w' with the arguments flipped, such that:forOf each (1,2,3) print123 ((),(),())0This function is only provided for consistency,   is strictly more general. x "a   x "a   . w    "a x    l s "a   l s   } x ::  Z f => # s t a b -> s -> (a -> f b) -> f t x ::  Z f => # s t a b -> s -> (a -> f b) -> f t x ::  Y f => # s t a b -> s -> (a -> f b) -> f t ylensSEvaluate 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)]   "a y  "a    y l "a w l   "a l   y ::  Z f =>  s t (f b) b -> s -> f t y ::  Z f =>  s t (f b) b -> s -> f t y ::  Y f =>  s t (f b) b -> s -> f t zlens.Map each element of a structure targeted by a Z 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)]   "a z   l "a   l   } z ::  t m => ) s t a b -> (a -> m b) -> s -> m t z ::  t m => ( s t a b -> (a -> m b) -> s -> m t z ::  t m => # s t a b -> (a -> m b) -> s -> m t {lens{ is a flipped version of z$, consistent with the definition of  .$forMOf both (1,3) $ \x -> [x, x + 1][(1,3),(1,4),(2,3),(2,4)]   "a {  { l "a   (z l)  l s "a   l s   } { ::  t m => ) s t a b -> s -> (a -> m b) -> m t { ::  t m => ( s t a b -> s -> (a -> m b) -> m t { ::  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])A[(1,3,5),(1,3,6),(1,4,5),(1,4,6),(2,3,5),(2,3,6),(2,4,5),(2,4,6)]   "a |  | l "a z l   | l "a     l   | ::  t m =>  s t (m b) b -> s -> m t | ::  t m =>  s t (m b) b -> s -> m t | ::  t m =>  s t (m b) b -> s -> m t }lensThis generalizes  to an arbitrary .Note: E handles ragged inputs more intelligently, but for non-ragged inputs:&transposeOf traverse [[1,2,3],[4,5,6]][[1,4],[2,5],[3,6]]  "a }   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 .   "a ~  ~ accumulates   from right to left. ~ :: A 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) ~ ::  (  ( A acc)) s t a b -> (acc -> a -> (acc, b)) -> acc -> s -> (acc, t) lensThis generalizes   to an arbitrary .   "a    accumulates   from left to right.  :: A 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 .   "a    :: * 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 .   "a    :: * 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:W 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)oAny 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 G rather than use this combinator. However, it is sometimes convenient.<This is unsafe because if you don't supply at least as many b's as you were given a's, then the reconstruction of t will result in an error!When applied to a  the result is merely a  (and becomes safe).  ::  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 ->  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 _head1qLeft (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 (G. 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, G 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 -> [ (} i) a s]  ::  i s a -> s -> [ (} i) a s] lensThe non-empty version of M. This extract a non-empty list of immediate children accroding to a given  as editable contexts.Dlet 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 ->   ( (} i) a s)  ::  i s a -> s ->   ( (} i) a s) lensTraverse both parts of a   container with matching types.&Usually that type will be a pair. Use 0; 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  ::  ( p a a) ( p 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  ::  ( p a a) ( p 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"  ::  K ->  s a ->  s a  ::  K ->  s a ->  s a  ::  K ->  s a ->  s a  ::  K ->  s a ->  s a  ::  K ->  s a ->  s a  ::  K ->  s a ->  s a  ::  K ->  i s a ->  i s a  ::  K ->  i s a ->  i s a  ::  K ->  i s a ->  i s a  ::  K ->  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  ::  K ->  s a ->  s a  ::  K ->  s a ->  s a  ::  K ->  s a ->  s a  ::  K ->  s a ->  s a  ::  K ->  s a ->  s a  ::  K ->  s a ->  s a  ::  K ->  i s a ->  i s a  ::  K ->  i s a ->  i s a  ::  K ->  i s a ->  i s a  ::  K ->  i s a ->  i s a lensA 2 is completely characterized by its behavior on a . Cloning a G is one way to make sure you aren't given something weaker, such as a T 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 t."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 .Plet 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:F When you don't need access to the index then you can just apply your  directly as a function!  "a   w l =  l     =    ::  Z f => 0 i s t a b -> (i -> a -> f b) -> s -> f t  ::  Y 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). x l a "a  l a      "a       ::  Z f => 0 i s t a b -> s -> (i -> a -> f b) -> f t  ::  Y 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 u 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 z' is more liberal in what it can accept. z l "a  l      ::  t m => 0 i s t a b -> (i -> a -> m b) -> s -> m t  ::  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 "a  l a      "a       ::  t m => / i s t a b -> s -> (i -> a -> m b) -> m t  ::  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 "a  l      :: G i s t a b -> (i -> acc -> a -> (acc, b)) -> acc -> s -> (acc, t)  :: B 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 "a  l      :: G i s t a b -> (i -> acc -> a -> (acc, b)) -> acc -> s -> (acc, t)  :: B 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   "a    r 6 & ignored %~ absurd6lens 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 ->  K ->   K s a  ::  s a ->  K ->   K s a lens Traverse the nth element of a  container.  "a   lens*Traverse (or fold) selected elements of a  (or 2) where their ordinal positions match a predicate.  ::  s a -> ( K ->  ~) ->   K s a  ::  s a -> ( K ->  ~) ->   K s a lensTraverse elements of a ; container where their ordinal positions match a predicate.  "a   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. M :: 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 fThese 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 fThese 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 lensuTry 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  _B 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  Y they are given. exploits the  ' lemma to merge their separate uses of  _ into a single  _M. 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.barN 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  Y. This is like  where the " instance can be specified by any    "a  lens'Sequence a container using a specified  Y. This is like  where the " instance can be specified by any    "a  _%$ghijklmnopqrstuvwxyz{|}~_vutsrpqonlmkwxyz{|}~%$ijgh5(C) 2012-16 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> provisional Rank2TypesSafe>SX lensThis provides a breadth-first  or  of the individual  of any other  or d 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 :M["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.M["hello","world"] & taking 4 (levels (traverse.traverse).traverse) %~ toUpper["HELlo","World"]The resulting  of the ' which is indexed by the depth of each ..7["dog","cat"]^@..levels (traverse.traverse) <. traverse1[(2,'d'),(3,'o'),(3,'c'),(4,'g'),(4,'a'),(5,'t')]  ::  s t a b ->   K s t (. () a) (. () b)  ::  s a ->   K s (. () a) Note:4 Internally this is implemented by using an illegal  Y<, as it extracts information in an order that violates the  Y laws.lensThis provides a breadth-first  or ( of the individual levels of any other  or d 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).itraversedI[((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 ..=["dog","cat"]^@..ilevels (traversed<.>traversed)<.>itraverseda[((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 ->   K s t (. i a) (. i b)  ::  i s a ->   K s (. i a) Note:4 Internally this is implemented by using an illegal  Y<, as it extracts information in an order that violates the  Y laws...(C) 2012-16 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> provisional Rank2TypesSafe =?@AHSVX 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.BThis can also be useful when combining getters in novel ways, as 8 is isomorphic to '(->)' and provides similar instances.P("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 <ekmett@gmail.com> experimental non-portableSafe,-2=>?@ACHIX  lens1This permits the construction of an "impossible" ) that matches only if some function does."lens There was an  & caused by abusing the internals of a  .$lensBoth  exceptions and Control.Exception provide a   type.pThis 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).   ... [ % H (s ->    x "Assertion Failed\n"   s) , % H (s ->    x "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 E type provided by Control.Monad.Error.Lens: % ::  e a -> (a -> m r) -> E e m r % ::  e a -> (a -> m r) -> E e m r % ::   e a -> (a -> m r) -> E e m r % ::   e a -> (a -> m r) -> E e m r % ::  e a -> (a -> m r) -> E e m r &lensThis builds a  ! for just the targets of a given  _ (or any T, really). that ignores its input and just recovers with the stated monadic action.   ... [ & H (  "looped") , & H (  "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 E type provided by Control.Monad.Error.Lens: & ::  e a -> m r -> E e m r & ::  e a -> m r -> E e m r & ::   e a -> m r -> E e m r & ::   e a -> m r -> E e m r & ::  e a -> m r -> E e m r "#$%&$%&"# (C) 2012-16 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> provisional Rank2Types Trustworthy&'8=>?@ACSUVX X*-lensA  with an additional index.2An instance must satisfy a (modified) form of the  laws: . (   ) "a    _ (. f)  w . g "a    w . (\i ->    w  _ (f i)  w g i) .lensTraverse an indexed container. . "a  / /lensThe  of a - container.0lens;A container that supports folding with an additional index.1lens2Fold a container by mapping value to an arbitrary  [ with access to the index i.-When you don't need access to the index then  % is more flexible in what it accepts.   "a 1  w   2lensThe  of a 0 container.2  w  is a fold over the keys of a 0.@Data.Map.fromList [(2, "hello"), (1, "world")]^..ifolded.asIndex[1,2]3lensHRight-associative fold of an indexed container with access to the index i.-When you don't need access to the index then  % is more flexible in what it accepts.   "a 3  w   4lensGLeft-associative fold of an indexed container with access to the index i.-When you don't need access to the index then  % is more flexible in what it accepts.   "a 4  w   5lensStrictlyF fold right over the elements of a structure with access to the index i.-When you don't need access to the index then  % is more flexible in what it accepts.   "a 5  w   6lensRFold 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 7% is more flexible in what it accepts. 7 l "a W l  w   7lensA  Z with an additional index..Instances must satisfy a modified form of the  Z laws: 8 f  w 8 g "a 8 (\i -> f i  w g i) 8 (\_ a -> a) "a  v 8lensMap with access to the index.9lensThe   for a 7.,If you don't need access to the index, then $% is more flexible in what it accepts.:lens Compose an }& 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).withIndexA[(1,"one,ten"),(1,"one,twenty"),(2,"two,thirty"),(2,"two,forty")];lens'Compose a non-indexed function with an } function.Mnemonically, the >, points to the indexing we want to preserve.This is the same as ( w).f  w 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).withIndexE[(10,"one,ten"),(20,"one,twenty"),(30,"two,thirty"),(40,"two,forty")]<lensOUse a value itself as its own index. This is essentially an indexed version of  v.VNote: 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 } 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).withIndexU[((1,10),"one,ten"),((1,20),"one,twenty"),((2,30),"two,thirty"),((2,40),"two,forty")]?lensComposition of }? 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"]Mover (traversed.indices (>0)) Prelude.reverse $ ["He","was","stressed","o_O"]["He","saw","desserts","O_o"]AlensThis allows you to filter an , ,  or  based on an index.0["hello","the","world","!!!"]^?traversed.index 2 Just "world"BlensaReturn whether or not any element in a container satisfies a predicate, with access to the index i.-When you don't need access to the index then  % is more flexible in what it accepts.   "a B  w   Clens`Return whether or not all elements in a container satisfy a predicate, with access to the index i.-When you don't need access to the index then  % is more flexible in what it accepts.   "a C  w   DlenshReturn whether or not none of the elements in a container satisfy a predicate, with access to the index i.-When you don't need access to the index then E% is more flexible in what it accepts. E "a D  w   D f "a    w B f ElensFDetermines whether no elements of the structure satisfy the predicate. E f "a    w   f Flens+Traverse elements with access to the index i, discarding the results.-When you don't need access to the index then  % is more flexible in what it accepts.   l = .  w   Glens+Traverse elements with access to the index i6, discarding the results (with the arguments flipped). G "a   F -When you don't need access to the index then  % is more flexible in what it accepts.   a "a G a  w   Hlens*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.   "a P  w   Ilens*Run monadic actions for each target of an  or \P with access to the index, discarding the results (with the arguments flipped). I "a   H -When you don't need access to the index then % is more flexible in what it accepts.  l a "a  l a  w   JlensgConcatenate the results of a function of the elements of an indexed container with access to the index.-When you don't need access to the index then  % is more flexible in what it accepts.   "a J  w   J "a 1 KlensSearches a container with a predicate that is also supplied the index, returning 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.   "a K  w   LlensBMonadic 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.   "a L  w   MlensUMonadic 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.   "a M  w   Nlens-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.   "a     w N Olens3Traverse with an index (and the arguments flipped). for a "a O a  w   O "a   . PlensMap each element of a structure to a monadic action, evaluate these actions from left to right, and collect the results, with access the index.(When you don't need access to the index  ' is more liberal in what it can accept.   "a P  w   QlensMap each element of a structure to a monadic action, evaluate these actions from left to right, and collect the results, with access its position (and the arguments flipped). forM a "a Q a  w   Q "a   P Rlens Generalizes  to add access to the index.& accumulates state from right to left.  "a R  w   Slens Generalizes  to add access to the index.& accumulates state from left to right.  "a S  w   lensThe position in the   is available as the index.lensSame instance as for [].lens3The position in the list is available as the index.7}~-/.0463512789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVW7}~:>;<=?7890463512BCDEFGHIJKLMN@A-/.OPQRSTUVW:9 ;9 >9 !(C) 2012-2016 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> experimental non-portable Trustworthy>SX n lensTraverse a strict  b 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.lensUnpack a lazy  BytestringlensAn # of the individual bytes in a lazy  lensUnpack a lazy   pretending the bytes are chars.lensAn # of the individual bytes in a lazy   pretending the bytes are chars. lensConversion between  Q and  . Should compile to a no-op. lensUnsafe conversion between   and  Q<. This is a no-op and silently truncates to 8 bits Chars > '\255'=. It is provided as convenience for ByteString construction.lensUnpack a strict lensUnpack a strict !, pretending the bytes are chars. lens8A way of creating ByteStrings outside the IO monad. The Int; argument gives the final size of the ByteString. Unlike  createAndTrimV the ByteString is not reallocated if the final size is less than the estimated size. lensCreate ByteString of size l and use action f to fill it's contents.(C) 2012-16 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> provisional Rank2TypesNone &'-.HSUVX 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 k combinators to make them require simple lenses, simple traversals, simple prisms or simple isos as input.lensCComposition with this isomorphism is occasionally useful when your , [ or u 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 .lensGConvert 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 blens/Convert Leibniz equality to equality. Reverses  in  cases. The type should be understood as 7fromLeibniz' :: (forall f. f s -> f a) -> Equality' s alens A version of B that provides explicit, rather than implicit, equality evidence. (C) 2012-16 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> provisional0Rank2Types, TypeFamilies, FunctionalDependencies Trustworthy%-.@ACHSVXg #lensPAd hoc conversion between "strict" and "lazy" versions of a structure, such as   or  .lens-This class provides for symmetric bifunctors.lens   w  "a  v   f  w  =   w   f   g  w  =   w   g  f g  w  =   w  g f (1,2)^.swapped(2,1)lensA  .lens>When you see this as an argument to a function, it expects an .lens<Build a simple isomorphism from a pair of inverse functions.  ( f g) "a f  ( ( f g)) "a g  ( f g) h "a g  w h  w f  ( ( f g)) h "a f  w h  w g lensInvert an isomorphism.  ( l) "a l lens$Extract the two functions, one from s -> 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]10OYou 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 %.Eauf (_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 J 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.Jxplatf (_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.  "a   w   ::  s t a b -> (t -> s) -> b -> a lensBThis 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  Z.lensIf v is an element of a type a, and a' is a sans the element v, then  v is an isomorphism from  q a' to a.  "a   w  NKeep in mind this is only a real isomorphism if you treat the domain as being  q (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 00JThis combinator is also particularly useful when working with nested maps.e.g.$ When you want to create the nested    when it is missing:<Map.empty & at "hello" . non Map.empty . at "world" ?~ "!!!"/fromList [("hello",fromList [("world","!!!")])]6and when have deleting the last entry from the nested   @ mean that we should delete its entry from the surrounding one:dfromList [("hello",fromList [("world","!!!")])] & at "hello" . non Map.empty . at "world" .~ Nothing fromList []8It can also be used in reverse to exclude a given value:non 0 # rem 10 4Just 2non 0 # rem 10 5Nothinglens p generalizes  (p # ()) to take any unit /This function generates an isomorphism between  q (a |  p a) and a.PMap.singleton "hello" Map.empty & at "hello" . non' _Empty . at "world" ?~ "!!!"/fromList [("hello",fromList [("world","!!!")])]bfromList [("hello",fromList [("world","!!!")])] & at "hello" . non' _Empty . at "world" .~ Nothing fromList []lens a p generalizes  a# to take any value and a predicate.This function assumes that p a holds  & and generates an isomorphism between  q (a |   (p a)) and a.FMap.empty & at "hello" . anon Map.empty Map.null . at "world" ?~ "!!!"/fromList [("hello",fromList [("world","!!!")])]nfromList [("hello",fromList [("world","!!!")])] & at "hello" . anon Map.empty Map.null . at "world" .~ Nothing fromList []lensAThe canonical isomorphism for currying and uncurrying a function.  =      (fst^.curried) 3 43view curried fst 3 43lensAThe canonical isomorphism for uncurrying and currying a function.  =        =   ((+)^.uncurried) (1,2)3lens(The isomorphism for flipping a function.((,)^.flipped) 1 2(2,1)lensAn E between the strict variant of a structure and its lazy counterpart.  =   See  4http://hackage.haskell.org/package/strict-base-types for an example use.lensAn  between a list,  ,  ! fragment, etc. and its reversal."live" ^. reversed"evil""live" & reversed %~ ('d':)"lived"lens<Given a function that is its own inverse, this gives you an  using it in both directions.  "a    "live" ^. involuted reverse"evil"$"live" & involuted reverse %~ ('d':)"lived"lens*This isomorphism can be used to inspect a M to see how it associates the structure and it can also be used to bake the  into a G2 so that you can traverse over it multiple times.lens+This isomorphism can be used to inspect an M to see how it associates the structure and it can also be used to bake the  into a GV so that you can traverse over it multiple times with access to the original indices.lensLift an  into a  functor. contramapping ::  f =>  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 L, 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<Data types that are representationally equal are isomorphic."This is only available on GHC 7.8+3G3G"(C) 2012-16 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> provisional non-portable Trustworthy%8g lensisn't _Empty [1,2,3]True#(C) 2012-16 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> experimental non-portable Trustworthy%=>?@ACHVXg AM3lensnThis class provides a way to attach or detach elements on the right side of a structure in a flexible manner.4lens 4 ::  [a] [b] ([a], a) ([b], b) 4 ::  (  a) (  b) (  a, a) (  b, b) 4 ::  (  a) (  b) (  a, a) (  b, b) 4 ::    ( ,  ) 4 ::    ( ,  ) 4 ::    ( ,  Q) 5lensmThis class provides a way to attach or detach elements on the left side of a structure in a flexible manner.6lens 6 ::  [a] [b] (a, [a]) (b, [b]) 6 ::  (  a) (  b) (a,   a) (b,   b) 6 ::  (  a) (  b) (a,   a) (b,   b) 6 ::    ( ,  ) 6 ::    ( ,  ) 6 ::    ( Q,  ) 9lens: 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];lensoAttempt 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 U is not limited to lists, however. We can also work with other containers, such as a  . Vector.fromList "abcde" ^? _lastJust 'e'Vector.empty ^? _lastNothingC(Vector.fromList "abcde" & _last .~ 'Q') == Vector.fromList "abcdQ"True ? ::  [a] a ? ::  (  a) a ? ::  (  a) a @lensA( an element onto the end of a container.This is an infix alias for A.Seq.fromList [] |> a fromList [a]Seq.fromList [b, c] |> afromList [b,c,a]LazyT.pack "hello" |> '!'"hello!"AlensA( 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!"BlenspAttempt 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 [])Nothing3456789:;<=>?@AB569:;<=834@AB>?7758595:5@5A5$(C) 2012-16 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> experimental non-portableSafe=?@A KYlensMA Banker's deque based on Chris Okasaki's "Purely Functional Data Structures"[lensO(1). Determine if a Y is  . null emptyTruenull (singleton 1)False\lensO(1). Generate a singleton Y singleton 1 BD 1 [1] 0 []]lensO(1). Calculate the size of a Ysize (fromList [1,4,6])3^lensO(n) amortized. Construct a Y from a list of values.fromList [1,2]BD 1 [1] 1 [2] lens Check that a Y7 satisfies the balance invariants and rebalance if not.YZ[\]^YZ]^[\%'(C) 2012-16 Edward Kmett, Michael Sloan BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> experimentalRank2, MPTCs, fundeps Trustworthy%-8=>?@AHSUVXg uwlenswW provides isomorphisms to wrap and unwrap newtypes or data types with one constructor.ylensAn isomorphism between s and a.If your type has a   instance, y will default to |B, 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 ~ "a    "a  ~ lensGiven the constructor for a w3 type, return a deconstructor that is its inverse. Assuming the w$ instance is legal, these laws hold:  f  w f "a  v f  w  f "a  v 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]24PYou may want to think of this combinator as having the following, simpler, type. bala :: 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. oalaf :: Rewrapping s t => (Unwrapped s -> s) -> ((r -> t) -> e -> s) -> (r -> Unwrapped t) -> e -> Unwrapped s 1alaf Sum foldMap Prelude.length ["hello","world"]10zlensUse 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.uvwxyz{|}~wxy}vu~{z|&(C) 2012-16 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> provisional Rank2TypesSafe=>?@ACHSVX lensThis class allows us to use O part of the environment, changing the environment supplied by many different  t transformers. Unlike 4 this can change the environment of a deeply nested  t transformer. Also, unlike ", this can be used with any valid , but cannot be used with a  or .lensMRun a monadic action in a larger environment than it was defined in, using a .This acts like   C, but can in many cases change the type of the environment as well.3This is commonly used to lift actions in a simpler    t into a  t with a larger environment type.)This can be used to edit pretty much any  t- transformer stack with an environment in it:(1,2) & magnify _2 (+1)33flip Reader.runReader (1,2) $ magnify _1 Reader.ask1Dflip 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  t, transformers, potentially quite deep in a  t 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    t into a    t with a larger   type.When applied to a n 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  t 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)<flip State.execState [(a,b),(c,d)] $ zoom traverse $ _2 %= f[(a,f b),(c,f d)]<flip State.runState [(a,b),(c,d)] $ zoom traverse $ _2 <%= f((f b <> f d <> mempty,[(a,f b),(c,f d)])/flip State.evalState (a,b) $ zoom both (use id)a <> b  ::  t m =>  s t ->  ! t m a ->  ! s m a  :: ( t m,  [ c) =>  s t ->  ! t m c ->  ! s m c  :: ( t m,  [ w) =>  s t ->  " r w t m c ->  " r w s m c  :: ( t m,  [ w,  [ c) =>  s t ->  " r w t m c ->  " r w s m c  :: ( t m,  [ w,  # e) =>  s t ->  $ e ( " r w t m) c ->  $ e ( " r w s m) c  :: ( t 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 <ekmett@gmail.com> experimental Rank2Types Trustworthy&'2>EFSUVX lensKA 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.YThis is primarily useful when the children are immediately obvious, and for benchmarking.lens&Find every occurrence of a given type aE recursively that doesn't require passing through something of type a using  &I, 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)<There are however, caveats on how this function can be used!First, the user supplied function must access only one field of the specified type. That is to say the target must be a single element that would be visited by  holesOnOf  BNote: this even permits a number of functions to be used directly.[1,2,3,4] & upon head .~ 0 [0,2,3,4][1,2,3,4] & upon last .~ 5 [1,2,3,5][1,2,3,4] ^? upon tail Just [2,3,4]"" ^? upon tailNothing6Accessing parents on the way down to children is okay:'[1,2,3,4] & upon (tail.tail) .~ [10,20] [1,2,10,20]iSecond, the structure must not contain strict or unboxed fields of the same type that will be visited by  &  :: ( & s,  & a) => (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 M using it directly as the accessor. This enables reading from the resulting F 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. G 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.kModifying 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  ( ) or into the list returned by  .When in doubt, use  instead. 'lens inlineable  (  ((C) 2012-16 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> provisional Rank2Types Trustworthy -8=>?@AHSUVX u[5lensA N type is one where we know how to extract its immediate self-similar children. Example 1: rimport Control.Applicative import Control.Lens import Control.Lens.Plated import Data.Data import Data.Data.Lens ()  data Expr = Val  K, | 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 =  r a or  instance  Expr where  =   Example 2: rimport Control.Applicative import Control.Lens import Control.Lens.Plated import Data.Data import Data.Data.Lens ()  <data Tree a = Bin (Tree a) (Tree a) | Tip a deriving ( , , , , &, ))   instance  (Tree a) where  f (Bin l r) = Bin   f l   f r  _ t =  r t or  instance  & a =>  (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 T, though those usecases are much better served in most cases by using the existing  combinators! e.g.    "a    )This same ability to explicitly pass the 8 in question is why there is no analogue to uniplate's Biplate.xMoreover, 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 A and you can choose to not override it with your own definition.lensCompose through a platelens<Try to apply a traversal to all transitive descendants of a = container, but do not recurse through matching descendants.  ::  s =>  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.  "a    lensoRewrite by applying a rule everywhere you can. Ensures that the rule cannot be applied anywhere in the result: propRewrite r x =   (  w r) ( ( r x)) Usually  is more appropriate, but E 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.lensoRewrite by applying a rule everywhere you can. Ensures that the rule cannot be applied anywhere in the result: propRewriteOf l r x =   (  w r) ( l ( l r x)) Usually  is more appropriate, but E 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 ->  q a) -> a -> a  ::  a a -> (a ->  q a) -> a -> a  ::  a a -> (a ->  q a) -> a -> a  ::   a a -> (a ->  q a) -> a -> a lens4Rewrite recursively over part of a larger structure.  ::  a =>   s a -> (a ->  q a) -> s -> s  ::  a =>  s a -> (a ->  q a) -> s -> s  ::  a =>  s a -> (a ->  q a) -> s -> s  ::  a => " s a -> (a ->  q a) -> s -> s lensFRewrite recursively over part of a larger structure using a specified  .  ::   s a ->   a a -> (a ->  q a) -> s -> s  ::  s a ->  a a -> (a ->  q a) -> s -> s  ::  s a ->  a a -> (a ->  q a) -> s -> s  ::   s a ->   a a -> (a ->  q a) -> s -> s lenswRewrite by applying a monadic rule everywhere you can. Ensures that the rule cannot be applied anywhere in the result.lensRRewrite by applying a monadic rule everywhere you recursing with a user-specified B. Ensures that the rule cannot be applied anywhere in the result.lens`Rewrite by applying a monadic rule everywhere inside of a structure located by a user-specified B. Ensures that the rule cannot be applied anywhere in the result.lens`Rewrite by applying a monadic rule everywhere inside of a structure located by a user-specified , using a user-specified O 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 u 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 N 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 "a  l  lens*Fold over all transitive descendants of a  container, including itself.lensGiven a q 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 J 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 lensWTransform 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 lensHTransform every element in the tree, in a bottom-up manner, monadically.lensHTransform every element in the tree in a region indicated by a supplied %, in a bottom-up manner, monadically.  :: ( t 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.  ::  t m =>  a a -> (a -> m a) -> a -> m a lensPTransform 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.  ::  t m =>  s a ->  a a -> (a -> m a) -> s -> m s lens_Return 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]  "a   lenswReturn 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] lens{Return 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 "a  b   ::  a =>  s a -> s -> [ a a s] lens{Return 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 F. This extracts a list of the immediate children as editable contexts.Given a context you can use  to see the values, F 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.  "a   ::  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 "a  (b  w 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] lensJPerform a fold-like computation on each value, technically a paramorphism.  :: " a a -> (a -> [r] -> r) -> a -> r lensJPerform a fold-like computation on each value, technically a paramorphism.  "a   lens!Fold the immediate children of a  container.  z c f =   (c  w f) z lens The original uniplate% combinator, implemented in terms of  as a .  "a   The resulting  is safer to use as it ignores 'over-application'G 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.lens Implement  operation for a type using its  , instance.lensignoredlensrecursive match under outer  instancelensignoredlensmatchlensignoredlensignored lensignored!lensignored"lensrecursive match#lensrecursive match$lensrecursive match,,9 )(C) 2012-16 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> provisionalportableSafeSX %lensThis  % 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 ,  ], [,  ` or  b. & ::  . 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 %&%&*(C) 2014-2016 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> experimental non-portableSafe J'lensConstruct a map from a  IndexedGetter,  ^, \ or  a%The construction is left-biased (see S), i.e. the first occurences 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"]RfromList [((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 <ekmett@gmail.com> provisionalportable TrustworthySX (lensThis  % can be used to change the type of a  0( by mapping the elements to new values. Sadly, you can't create a valid  for a  0., but you can manipulate it by reading using   and reindexing it via (.(over setmapped (+1) (fromList [1,2,3,4])fromList [2,3,4,5])lensConstruct a set from a ,  ], [,  ` or  b.setOf folded ["hello","world"]fromList ["hello","world"]5setOf (folded._2) [("hello",1),("world",2),("!!!",3)]fromList [1,2,3] ) ::  s a -> s ->  0 a ) ::   a =>  s a -> s ->  0 a ) ::  s a -> s ->  0 a ) ::  s a -> s ->  0 a ) ::   a =>  s a -> s ->  0 a ()(),(C) 2012-2016 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> experimental non-portableNone%=>?g 7+lens This isomorphism can be used to  1 (or  2) lazy *."hello"^.packed -- :: Text"hello"  1 x "a x  +  2 x "a x   + + "a  , ,lens This isomorphism can be used to  2 (or  1) lazy *."hello"^.unpacked -- :: String"hello"  1 x "a x   ,  2 x "a x  + This L is provided for notational convenience rather than out of great need, since , "a  + -lensThis is an alias for ,* that makes it clearer how to use it with (). - =  + _Text # "hello" -- :: Text"hello".lensConvert between lazy * and  3 .  4 x "a x  .  5 x "a 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. / "a each $Note that when just using this as a  , (  can be more efficient.0lensEncode/Decode a lazy * to/from lazy   , via UTF-8.yNote: This function does not decode lazily, as it must consume the entire input before deciding whether or not it fails.ByteString.unpack (utf8 # "&") [226,152,131]*+,-./0+,-/.0*-(C) 2012-2016 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> experimental non-portableNone%>g =2lens This isomorphism can be used to  6 (or  7 ) strict 1."hello"^.packed -- :: Text"hello"  6 x "a x  2  7 x "a x   2 2 "a  3 2 "a   6  7 3lens This isomorphism can be used to  7 (or  6) lazy 1."hello"^.unpacked -- :: String"hello"This L is provided for notational convenience rather than out of great need, since 3 "a  2  6 x "a x   3  7 x "a x  2 3 "a   7  6 4lensThis is an alias for 3/ that makes it more obvious how to use it with  > _Text # "hello" -- :: Text"hello"5lensConvert between strict 1 and  3 .  8 x "a x  5  9 ( 5 x) "a x   5 6lens-Traverse the individual characters in strict 1.anyOf text (=='o') "hello"True@When the type is unambiguous, you can also use the more general each. 6 "a 3 .  6 "a each $Note that when just using this as a  , (  can be more efficient.7lensEncode/Decode a strict 1 to/from strict   , via UTF-8. utf8 # "&""\226\152\131"12345672356741.(C) 2012-16 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> experimental non-portableNone%=>?g r8lensTraversals for strict or lazy <9lens This isomorphism can be used to  6 (or  7) strict or lazy <.  6 x "a x  9  7 x "a x   9 9 "a  = :lensConvert between strict or lazy < and a  3.  8 x "a x  : ;lens5Traverse the individual characters in strict or lazy <. ; = = .  =lens This isomorphism can be used to  7 (or  6) both strict or lazy <.  7 x "a x  =  6 x "a x   = This L is provided for notational convenience rather than out of great need, since = "a  9 >lensThis is an alias for =* that makes it clearer how to use it with (). > =  9 _Text # "hello" :: Strict.Text"hello"8;:9<=>8;:9=></(C) 2012-2016 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> provisional non-portable Trustworthy>SX  Blens 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  :.RAttempting to return a longer or shorter vector will result in violations of the  laws.DVector.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]TrueClens Similar to  , but returning a  :.G(toVectorOf both (8,15) :: Vector.Vector Int) == Vector.fromList [8,15]TrueDlensConvert a list to a  : (or back.)C([1,2,3] ^. vector :: Vector.Vector Int) == Vector.fromList [1,2,3]True'Vector.fromList [0,8,15] ^. from vector[0,8,15]Elens Convert a  : to a finite  ; (or back.)Flens Convert a  : to a finite  ; from right to left (or back.)Glens Convert a  :H back and forth to an initializer that when run produces a copy of the  :.Hlens Convert a  :4 to a version that doesn't retain any extra memory.IlensThis = 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]JlensLike ix$ but polymorphic in the vector type.Klens.Indexed vector traversal for a generic vector.Llens>Different vector implementations are isomorphic to each other.Blensi starting indexlensn length BCDEFGHIJKL CHDEFGLBIJK0(C) 2012-16 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> experimental non-portable Trustworthy&'8=>?@ACHV MlensExtract N2 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")Olens N :: ( < i,  =  > a,  =  > b) =>  ( ? i a) ( ? i b) a bPlens N ::  < i =>  ( ? i a) ( ? i b) a bQlens N ::       Q  QRlens N ::       Q  QSlens N ::   @  @    Tlens N ::         Ulens N :: ( A a,  A b) =>  ( B a) ( B b) a bVlens N :: ( C a,  C b) =>  ( D a) ( D b) a bWlens N :: ( E a,  E b) =>  ( F a) ( F b) a bXlens N ::  (  a) (  b) a bYlens N ::  ( G a) ( G b) a bZlens N ::  (  a) (  b) a b[lens N ::  ( p a a) ( p b b) a b\lens N ::  ( q a) ( q b) a b]lens N ::  (  a) (  b) a b^lens N ::  (NonEmpty a) (NonEmpty b) a b_lens N ::  [a] [b] a b`lens N ::  ( H c a) ( H c b) a balens N ::  ( / c a) ( / c b) a bblens N ::  ( / c a) ( / c b) a bclens N :: ( I a,  I b) =>  ( J a) ( J b) a bdlens N :: , (a,a,a,a,a,a,a,a,a) (b,b,b,b,b,b,b,b,b) a belens N :: ( (a,a,a,a,a,a,a,a) (b,b,b,b,b,b,b,b) a bflens N :: $ (a,a,a,a,a,a,a) (b,b,b,b,b,b,b) a bglens N ::  (a,a,a,a,a,a) (b,b,b,b,b,b) a bhlens N ::  (a,a,a,a,a) (b,b,b,b,b) a bilens N ::  (a,a,a,a) (b,b,b,b) a bjlens N ::  (a,a,a) (b,b,b) a bklens N ::  (a,a) (b,b) a bMNMN1(C) 2012-16 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> experimental non-portable Trustworthy&'8=>?@AHSUVX*llensl provides a Q 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 l should satisfy: o k "a m k  w  mlens!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.nlensProvides a simple  lets you  the value at a given key in a  /0 or element at an ordinal position in a list or  .olensNB: Setting the value of this  will only set the value in m if it is already present.!If you want to be able to insert missing values, you want m."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 2NothingplensLThis provides a common notion of a value at an index that is shared by both n and l.qlensThis class provides a simple ` that lets you view (and modify) information about whether or not a container contains a given s.rlens'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]tlensAn indexed version of r.)IntSet.fromList [1,2,3,4] ^@. icontains 3(3,True))IntSet.fromList [1,2,3,4] ^@. icontains 5 (5,False)NIntSet.fromList [1,2,3,4] & icontains 3 %@~ \i x -> if odd i then not x else xfromList [1,2,4]OIntSet.fromList [1,2,3,4] & icontains 3 %@~ \i x -> if even i then not x else xfromList [1,2,3,4]ulensAn indexed version of o.%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 2NothingvlensA definition of o for types with an lF instance. This is the default if you don't specify a definition for o.wlens,Delete the value associated with a key in a  /-like container w k = m k .~ Nothing xlensAn indexed version of m.$Map.fromList [(1,"world")] ^@. iat 1(1,Just "world")Giat 1 %@~ (\i x -> if odd i then Just "hello" else Nothing) $ Map.emptyfromList [(1,"hello")]Giat 2 %@~ (\i x -> if odd i then Just "hello" else Nothing) $ Map.empty fromList [] Klens o ::  K ->  (a,a,a,a,a,a,a,a,a) a Llens o ::  K ->  (a,a,a,a,a,a,a,a) a Mlens o ::  K ->  (a,a,a,a,a,a,a) a Nlens o ::  K ->  (a,a,a,a,a,a) a Olens o ::  K ->  (a,a,a,a,a) a Plens o ::  K ->  (a,a,a,a) a Qlens o ::  K ->  (a,a,a) a Rlens o ::  K ->  (a,a) alens arr  S i "a arr  o i arr  T [(i,e)] "a o i 1 e  x arr lens arr  S i "a arr  o i arr  T [(i,e)] "a o i 1 e  x arr lmnopqrstuvwx lmwxspnovuqrt2(C) 2012-2016 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> experimentalTemplateHaskell TrustworthySXphlensProvides substitution for typeslensPerform substitution for typeslensGProvides 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  U.lensContains some amount of  Vs insidelensTraverse all the typeslensHas a  llensExtract (or modify) the  l 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.  conFields ::   W  X* -- template-haskell-2.11+ conFields ::   W  Y -- Earlier versions Zlens  sansVar ::   [  X( -- template-haskell-2.11+ sansVar ::   \  Y -- Earlier versions lens of the types of the named fields of a constructor. conNamedFields ::   W  [/ -- template-haskell-2.11+ conNamedFields ::   W  \ -- Earlier versions lens  _ClassOpI ::   ] ( l,  V,  ^1) -- template-haskell-2.11+ _ClassOpI ::   ] ( l,  V,  ^,  _4) -- template-haskell-2.8 through 2.10 _ClassOpI ::   ] ( l,  V,  l,  _) -- Earlier versions lens  _DataConI ::   ] ( l,  V,  ^1) -- template-haskell-2.11+ _DataConI ::   ] ( l,  V,  ^,  _4) -- template-haskell-2.8 through 2.10 _DataConI ::   ] ( l,  V,  l,  _) -- Earlier versions lens  _VarI ::   ] ( l,  V,  q  `-) -- template-haskell-2.11+ _VarI ::   ] ( l,  V,  q  `,  _) -- Earlier versions lens _InstanceD ::   ` ( q  a,  b,  V, [ `+]) -- template-haskell-2.11+ _InstanceD ::   ` ( b,  V, [ `]) -- Earlier versions lens _TySynInstD ::   `  c6 -- template-haskell-2.15+ _TySynInstD ::   ` ( l,  c:) -- template-haskell-2.9 through 2.14 _TySynInstD ::   ` ( l, [ V],  V) -- Earlier versions lens _StandaloneDerivD ::   ` ( q  d,  b,  V1) -- template-haskell-2.12+ _StandaloneDerivD ::   ` ( b,  V) -- Earlier versions lens _DataInstD ::   ` ( b,  q [ m],  V,  q  e, [ W], [ f+]) -- template-haskell-2.15+ _DataInstD ::   ` ( b,  l, [ V],  q  e, [ W], [ f7]) -- template-haskell-2.12 through 2.14 _DataInstD ::   ` ( b,  l, [ V],  q  e, [ W],  b3) -- template-haskell-2.11 _DataInstD ::   ` ( b,  l, [ V], [ W], [ l]) -- Earlier versions lens _NewtypeInstD ::   ` ( b,  q [ m],  V,  q  e,  W, [ f.]) -- template-haskell-2.15+ _NewtypeInstD ::   ` ( b,  l, [ V],  q  e,  W, [ f:]) -- template-haskell-2.12 through 2.14 _NewtypeInstD ::   ` ( b,  l, [ V],  q  e,  W,  b6) -- template-haskell-2.11 _NewtypeInstD ::   ` ( b,  l, [ V],  W, [ l]) -- Earlier versions lens  _DataD ::   ` ( b,  l, [ m],  q  e, [ W], [ f']) -- template-haskell-2.12+ _DataD ::   ` ( b,  l, [ V],  q  e, [ W],  b/) -- template-haskell-2.11 _DataD ::   ` ( b,  l, [ V], [ W], [ l]) -- Earlier versions lens  _NewtypeD ::   ` ( b,  l, [ m],  q  e,  W, [ f*]) -- template-haskell-2.12+ _NewtypeD ::   ` ( b,  l, [ V],  q  e,  W,  b2) -- template-haskell-2.11 _NewtypeD ::   ` ( b,  l, [ V],  W, [ l]) -- Earlier versions lens  _NormalC ::   W ( l, [ X+]) -- template-haskell-2.11+ _NormalC ::   W ( l, [ Y]) -- Earlier versions lens  _RecC ::   W ( l, [ [(]) -- template-haskell-2.11+ _RecC ::   W ( l, [ \]) -- Earlier versions lens  _InfixC ::   W ( X,  l,  X)) -- template-haskell-2.11+ _InfixC ::   W ( Y,  l,  Y) -- Earlier versions lens  _InlineP ::   g ( l,  h,  i,  j') -- template-haskell-2.8+ _InlineP ::   g ( l,  h)) -- Earlier versions lens _SpecialiseP ::   g ( l,  V,  q  h,  j+) -- template-haskell-2.8+ _SpecialiseP ::   g ( l,  V,  q  InlineSpec) -- Earlier versions lens  _RuleP ::   g ( ,  q [ m], [ k],  l,  l,  j&) -- template-haskell-2.15+ _RuleP ::   g ( , [ k],  l,  l,  j) -- Earlier versions lensOn template-haskell-2.11.0.0 or later, if a  m or  n has multiple  ls, the leftmost  l will be chosen.                           ! " # $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z [ \ ] ^ _ ` a b c d e f g h i j k l m n o p q r s t u v w x y z { | } ~   " #                           ! $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z [ \ ] ^ _ ` a b c d e f g h i j k l m n o p q r s t u v w x y z { | } ~  3+(C) 2014-2016 Edward Kmett and Eric Mertens BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> experimental non-portable Trustworthyt olensNormalized constructor lens 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. Odata FooBarBaz a = Foo Int | Bar a | Baz Int Char makePrisms ''FooBarBaz  will create x_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. Udata 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.hIn 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 plensIMain entry point into Prism generation for a given type constructor name. lensGenerate prisms for the given  ` qlensGenerate prisms for the given type, normalized constructors, and an optional name to be used for generating a prism class. This function dispatches between Iso generation, normal top-level prisms, and classy prisms. rlensCompute the full type-changing Prism type given an outer type, list of constructors, and target constructor name. Additionally return  + if the resulting type is a "simple" prism. slens1Construct either a Review or Prism as appropriate tlensConstruct an iso declaration ulensConstruct prism expressionprism  reviewer remitter vlensConstruct an Iso expressioniso  reviewer remitter wlensConstruct a Review expressionunto ((x,y,z) -> Con x y z) xlens(Construct the review portion of a prism. ((x,y,z) -> Con x y z) :: b -> t ylens`Construct the remit portion of a prism. Pattern match only target constructor, no type changingh(x -> case s of Con x y z -> Right (x,y,z) _ -> Left x ) :: s -> Either s a zlens6Pattern match all constructors to enable type-changingt(x -> case s of Con x y z -> Right (x,y,z) Other_n w -> Left (Other_n w) ) :: s -> Either t a {lens.Construct the remitter suitable for use in an Iso"((Con x y z) -> (x,y,z)) :: s -> a |lensDConstruct the classy prisms class for a given type and constructors.class ClassName r  varsin type | r ->  varsin Type where topMethodName :: Prism' r Type conMethodName_n :: Prism' r conTypes_n conMethodName_n = topMethodName . conMethodName_n }lensGConstruct the classy prisms instance for a given type and constructors.Ninstance Classname OuterType where topMethodName = id conMethodName_n = prism ~lensNormalize a single  W) to its constructor name and field types. lensdCompute a prism's name by prefixing an underscore for normal constructors and period for operators. lenspCompute a prism's name with a special case for when the type constructor matches one of the value constructors.The overlapping flag wil be   in the event that: EWe are generating the name of a classy prism for a data type, andDThe data type shares a name with one of its constructors (e.g.,  data A = A).kIn such a scenario, we take care not to generate the same prism name that the constructor receives (e.g., _Ag). For prefix names, we accomplish this by adding an extra underscore; for infix names, an extra dot. lens*Quantify all the free variables in a type. lensType constructor name lensType constructor name lensgenerate top-level definitions ulensconstructors lenstarget constructor lensoverlapping constructor lenstype constructor lensprism name   41(C) 2014-2016 Edward Kmett, (C) 2014 Eric Mertens BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> experimental non-portableSafe lensTracks the field class  lcs 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. lensSimple top-level definiton name lens+makeFields-style class name and method name lens<The rule to create function names of lenses for data fields.YAlthough it's sometimes useful, you won't need the first two arguments most of the time. lens*Rules to construct lenses for data fields. lens Allow LensTraversal (otherwise GetterFold) lensAType Name -> Field Names -> Target Field Name -> Definition Names lensCompute the field optics for the type identified by the given type name. Lenses will be computed when possible, Traversals otherwise. lenszCompute the field optics for a deconstructed datatype Dec When possible build an Iso otherwise build one optic per field. lensNormalized the Con type into a uniform positional representation, eliminating the variance between records, infix constructors, and normal constructors. lensCompute the positional location of the fields involved in each constructor for a given optic definition as well as the type of clauses to generate and the type to annotate the declaration with. lens/Compute the s t a b types given the outer type s} and the categorized field types. Left for fixed and Right for visited. These types are "raw" and will be packaged into an   shortly after creation. lensBuild the signature and definition for a single field optic. In the case of a singleton constructor irrefutable matches are used to enable the resulting lenses to be used on a bottom value. lensBuild an instance for a field. If the field s type contains any type families, will produce an equality constraint to avoid a type family application in the instance head. lensConstruct an optic clause that returns an unmodified value given a constructor name and the number of fields on that constructor. lensvConstruct an optic clause suitable for a Getter or Fold by visited the fields identified by their 0 indexed positions lensJBuild a clause that updates the field at the given indexes When irref is  m the value with me matched with an irrefutable pattern. This is suitable for Lens and Traversal construction lens%Build a clause that constructs an Iso lensUnify the given list of types, if possible, and return the substitution used to unify the types for unifying the outer type when building a definition's type signature. lens=Attempt to unify two given types using a running substitution lensPerform a limited substitution on type variables. This is used when unifying rank-2 fields when trying to achieve a Getter or Fold. lenscApply a substitution to a type. This is used after unifying the types of the fields in unifyTypes. 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  J except that it takes a list of variables to exclude from quantification. lens:Name of the data type that lenses are being generated for.lensBNames of the class and the main method it generates, respectively. lens:Name of the data type that lenses are being generated for.lensGNames of all fields (including the field being named) in the data type.lensName of the field being named.lensKName(s) of the lens functions. If empty, no lens is created for that field. lens(constructor name, field name, field type lens!outer type lens!normalized constructors lens!target definition lens8optic type, definition type, field count, target fields lensOuter s type lensOuter s type lensOuter s type   5/(C) 2012-16 Edward Kmett, 2012-13 Michael Sloan BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> experimental non-portableSafe2 lensbMonad for emitting top-level declarations as a side effect. We also track the set of field class  lOs that have been created and consult them to avoid creating duplicate classes. lens?A data, newtype, data instance or newtype instance declaration. lensDatatype context. lens=Type constructor name, or Nothing for a data family instance. lensList of type parameters lens7Create a concrete record type given a substitution to detaParameters. lens;Constructors , derivings :: [Name] -- currently not needed lensMGenerate "simple" optics even when type-changing optics are possible. (e.g.  instead of ) lensKIndicate 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 qes. This mode is intended to be used for types with invariants which must be maintained by "smart" constructors. lenswGenerate 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.LWhen 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  q 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  f 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 . lens?Rules for making lenses and traversals that precompose another w using a custom function for naming the class, main class method, and a mapping from field names to definition names. lensA   used by  . lensDBuild lenses (and traversals) with a sensible default configuration.e.g.  data FooBar = Foo { _x, _y ::  K } | Bar { _x ::  K }   ''FooBar  will create x ::  FooBar  KL x f (Foo a b) = (\a' -> Foo a' b) <$> f a x f (Bar a) = Bar <$> f a y ::  FooBar  KC y f (Foo a b) = (\b' -> Foo a b') <$> f b y _ c@(Bar _) = pure c   =     lensZMake lenses and traversals for a type, and create a class when the type has no arguments.e.g. !data Foo = Foo { _fooX, _fooY ::  K }   ''Foo  will create class HasFoo t where foo ::  t Foo fooX ::  t  KN fooX = foo . go where go f (Foo x y) = (\x' -> Foo x' y) <$> f x fooY ::  t  Ki fooY = foo . go where go f (Foo x y) = (\y' -> Foo x y') <$> f y instance HasFoo Foo where foo = id   =     lensnMake 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).rIf 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 lens`Derive 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. lensqMake 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 ::  K } deriving   |]  will create data Foo = Foo  K  K 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 ::  K } deriving   |]  will create data Foo = Foo  K  K deriving   class HasFoo t where foo :: ' t Foo instance HasFoo Foo where foo =  v fooX, fooY :: HasFoo t =>  t  K 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 Ndata 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 =     lensPDeclare lenses for each records in the given declarations, using the specified  7. Any record syntax in the input will be stripped off. lens Transform NewtypeDs declarations to DataDs and  NewtypeInstDs to  DataInstDs. lensZGiven a set of names, build a map from those names to a set of fresh names based on them. lensBuild Wrapped instance for a given newtype lens#Field rules for fields in the form  _prefix_fieldname lensA   for  . lens#Field rules for fields in the form % prefixFieldname or _prefixFieldname I 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 classUnderscoreNoPrefixFieldst 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 I 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 ::  K,, _fooY :: a } newtype Bar = Bar { _barX ::  % } makeFields ''Foo makeFields ''Bar  will create I_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 =     lenskGenerate 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 DuplicateRecordFieldso 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 ::  K&, _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 Uinstance HasX (Foo a) Int instance HasY (Foo a) a where instance HasX Bar Char where For details, see  . makeFieldsNoPrefix =     lensLTraverse each data, newtype, data instance or newtype instance declaration. lens (Field Name, Definition Name) lensA function that maps a  fieldName to lensNames. lens-Type Name -> Maybe (Class Name, Method Name) lens (Field Name, Method Name)0 0 (C) 2012-16 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> experimental non-portableNoneVh %$EIV\}~.Gmnp      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~-/.0463512789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVW3456789:;<=>?@ABuvwxyz{|}~MNlmnopqrstuvwx 6(C) 2012-16 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> experimentalGHCNone ->FHSUVX/ 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) lens:You can access fields of `data (f :*: g) p` by using it's  and  instances  7(C) 2012-16 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> provisional non-portable Trustworthy>@ASX 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  .RAttempting to return a longer or shorter vector will result in violations of the  laws.DVector.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]True lens Similar to  , but returning a  .0toVectorOf both (8,15) == Vector.fromList [8,15]True lensConvert 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]LVector.fromList [0,8,15] ^. from vector . vector == Vector.fromList [0,8,15]True 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] lensi starting indexlensn length  8(C) 2012-16 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> experimental Rank2TypesNoneSX\ lensA  for working with a   of a  ) value. lensA  for working with a   of a  ) value.  9(C) 2012-16 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> provisionalMTPCsNone>Ó lensA  that focuses on the root of a  G.view root $ Node 42 []42 lensA 3 returning the direct descendants of the root of a  G    "a    :(C) 2012-16 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> experimental non-portableNone>SX` lensA   is isomorphic to a     m "a m   Seq.fromList [a,b,c] ^. viewLa :< fromList [b,c]Seq.empty ^. viewLEmptyLEmptyL ^. from viewL fromList []&review viewL $ a Seq.:< fromList [b,c]fromList [a,b,c] lensA   is isomorphic to a     m "a m   Seq.fromList [a,b,c] ^. viewRfromList [a,b] :> cSeq.empty ^. viewREmptyREmptyR ^. from viewR fromList []&review viewR $ fromList [a,b] Seq.:> cfromList [a,b,c] lensTraverse the first n elements of a  #fromList [a,b,c,d,e] ^.. slicedTo 2[a,b]&fromList [a,b,c,d,e] & slicedTo 2 %~ ffromList [f a,f b,c,d,e]'fromList [a,b,c,d,e] & slicedTo 10 .~ xfromList [x,x,x,x,x] lensTraverse all but the first n elements of a  %fromList [a,b,c,d,e] ^.. slicedFrom 2[c,d,e](fromList [a,b,c,d,e] & slicedFrom 2 %~ ffromList [a,b,f c,f d,f e])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  &fromList [a,b,c,d,e] & sliced 1 3 %~ ffromList [a,f b,f c,d,e] lens Construct a   from a ,  ], [,  ` or  b.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 <ekmett@gmail.com> provisionalportableNone>SXO lensA / stripping a prefix from a list when used as a 0, or prepending that prefix when run backwards:"preview" ^? prefixed "pre" Just "view""review" ^? prefixed "pre"Nothingprefixed "pre" # "amble" "preamble" lensA / stripping a suffix from a list when used as a /, or appending that suffix when run backwards:"review" ^? suffixed "view" Just "re""review" ^? suffixed "tire"Nothingsuffixed ".o" # "hello" "hello.o"      <(C) 2012-16 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> provisionalportableNoneSXQ lens IntSet isn't Foldable, but this ) can be used to access the members of an  .&sumOf members $ setOf folded [1,2,3,4]10 lensThis * 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 SetZ, because the number of elements might change but you can manipulate it by reading using  and reindexing it via  .(over setmapped (+1) (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  K -> s ->     ::  s  K -> s ->     ::  s  K -> s ->     ::  s  K -> s ->     ::  s  K -> s ->         =(C) 2012-16 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> experimental non-portableNone%>g  lens Access the   of a  J number.(a :+ b)^._realPartaa :+ b & _realPart *~ 2 a * 2 :+ b   ::  Z f => (a -> f a) ->  J a -> f ( J a) lens Access the   of a  J number.(a :+ b)^._imagPartba :+ b & _imagPart *~ 2 a :+ b * 2   ::  Z f => (a -> f a) ->  J a -> f ( J 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  J 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  J number assumes the   is 0. lens Access the   of a  J number.4(mkPolar 10 (2-pi) & _phase +~ pi & view _phase) "H 2True This isn't quite a legal  . Notably the  l (. l b a) = blaw is violated when you set a   outside the range (- ,  ]D. 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  J number.*(2.0 :+ 3.0) & _conjugate . _imagPart -~ 1 2.0 :+ 4.02(mkPolar 10.0 2.0 ^. _conjugate . _phase) "H (-2.0)True           >(C) 2012-2016 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> experimental non-portableNone%>g% lens (or ) a list of bytes into a     "a     x "a x     x "a x     "[104,101,108,108,111]^.packedBytes"hello" lens (or ) a   into a list of bytes   "a     x "a x     x "a x     ""hello"^.packedChars.unpackedBytes[104,101,108,108,111] lensTraverse each  Q 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:   "a    w  *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'.   "a     x "a x     x "a x     c"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'.   "a     x "a x     x "a 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:   =    w  anyOf chars (== 'h') "hello"True                ?(C) 2012-2016 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> experimental non-portableNone%>gB lens (or ) a list of bytes into a  .   "a     x "a x     x "a x     8[104,101,108,108,111]^.packedBytes == Char8.pack "hello"True lens (or ) a   into a list of bytes   "a     x "a x     x "a 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:   "a    w  *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'.   "a   !  x "a x     x "a x     c"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'.  ! "a     x "a x   !  x "a 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:  " =  !  w  anyOf chars (== 'h') "hello"True      ! "    ! "  @(C) 2012-16 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> experimental non-portableNone%>g\~ #lensTraversals for ByteStrings. $lens (or () a list of bytes into a strict or lazy  .  x "a x   $  x "a x    $  $ "a   * %lens (or -) a list of characters into a strict or lazy  .When writing back to the   it is assumed that every   lies between '\x00' and '\xff'.  x "a x   %  x "a x    %  % "a   + &lensTraverse each  Q in a strict or lazy  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:  & "a  *  w    & (  0x80) ::   ->  ~ 'lens2Traverse the individual bytes in a strict or lazy   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 the much slower:  ' "a  +  w    ' (  'c') ::   ->  ~ *lens (or ) a   into a list of bytes  * "a   $  x "a x   *  x "a x    *  * ::  ! [ Q]  * ::  ! [ Q] +lens (or /) a list of characters into a strict (or lazy)  When writing back to the   it is assumed that every   lies between '\x00' and '\xff'.  + "a   %  x "a x   +  x "a x    +  + ::  !    + ::  !   # $ & % ' ( ) * + # $ & % ' * + ) (A(C) 2012-16 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> experimentalLiberalTypeSynonymsNone>SX. .lensBitwise   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 0lensModify the target(s) of a ,   or  by computing its bitwise   with another value.*execState (do _1 .&.= 15; _2 .&.= 3) (7,7)(7,3) ( 0) :: (  s m,   a) =>   s a -> a -> m () ( 0) :: (  s m,   a) =>  s a -> a -> m () ( 0) :: (  s m,   a) =>  s a -> a -> m () ( 0) :: (  s m,   a) =>  s a -> a -> m () 1lensModify the target(s) of a ,  or  by computing its bitwise   with another value.*execState (do _1 .|.= 15; _2 .|.= 3) (7,7)(15,7) ( 1) :: (  s m,   a) =>   s a -> a -> m () ( 1) :: (  s m,   a) =>  s a -> a -> m () ( 1) :: (  s m,   a) =>  s a -> a -> m () ( 1) :: (  s m,   a) =>  s a -> a -> m () 2lensBitwise   the target(s) of a  (or G), returning the result (or a monoidal summary of all of the results)._2 <.|.~ 6 $ ("hello",3)(7,("hello",7)) ( 2) ::   a => $ s t a a -> a -> s -> (a, t) ( 2) ::   a => # s t a a -> a -> s -> (a, t) ( 2) :: (  a,  a) =>  s t a a -> a -> s -> (a, t) 3lensBitwise   the target(s) of a  or F, returning the result (or a monoidal summary of all of the results)._2 <.&.~ 7 $ ("hello",254)(6,("hello",6)) ( 3) ::   a => $ s t a a -> a -> s -> (a, t) ( 3) ::   a => # s t a a -> a -> s -> (a, t) ( 3) :: (  a,  a) =>  s t a a -> a -> s -> (a, t) 4lensModify the target(s) of a  (or ) by computing its bitwise  c with another value, returning the result (or a monoidal summary of all of the results traversed).runState (_1 <.&.= 15) (31,0) (15,(15,0)) ( 4) :: (  s m,   a) =>  s a -> a -> m a ( 4) :: (  s m,   a,  a) =>  s a -> a -> m a 5lensModify the target(s) of a , (or ) by computing its bitwise  c with another value, returning the result (or a monoidal summary of all of the results traversed).runState (_1 <.|.= 7) (28,0) (31,(31,0)) ( 5) :: (  s m,   a) =>  s a -> a -> m a ( 5) :: (  s m,   a,  a) =>  s a -> a -> m a 6lensBitwise   the target(s) of a  or O, 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)) ( 6) ::   a => $ s t a a -> a -> s -> (a, t) ( 6) ::   a => # s t a a -> a -> s -> (a, t) ( 6) :: (  a,  a) =>  s t a a -> a -> s -> (a, t) 7lensBitwise   the target(s) of a  or O, 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)) ( 7) ::   a => $ s t a a -> a -> s -> (a, t) ( 7) ::   a => # s t a a -> a -> s -> (a, t) ( 7) :: (  a,  a) =>  s t a a -> a -> s -> (a, t) 8lensModify the target(s) of a , (or ) by computing its bitwise  f with another value, returning the original value (or a monoidal summary of all the original values).%When you do not need the old value, ( 0) is more flexible.runState (_1 <<.&.= 15) (31,0) (31,(15,0)) ( 8) :: (  s m,   a) =>  s a -> a -> m a ( 8) :: (  s m,   a,  a) =>  s a -> a -> m a 9lensModify the target(s) of a , (or ) by computing its bitwise  f with another value, returning the original value (or a monoidal summary of all the original values).%When you do not need the old value, ( 1) is more flexible.runState (_1 <<.|.= 7) (28,0) (28,(31,0)) ( 9) :: (  s m,   a) =>  s a -> a -> m a ( 9) :: (  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 .~ False0 ;lens,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 :: Word16255 <lens)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. =lensBTraverse 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. . / 0 1 2 3 4 5 6 7 8 9 : ; < = . / 2 3 7 6 1 0 5 4 9 8 : < ; = .4 /4 04 14 24 34 44 54 64 74 84 94B(C) 2012-16 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> provisional&MPTCs, Rank2Types, LiberalTypeSynonymsNoneSX3 >lensThis setter can be used to derive a new  = from an old IAarrayI by applying a function to each of the indices to look it up in the old  =. This is a  contravariant .   "a -  w  >  > "a (  w   - ( > b) f arr   i "a arr   f i   (- ( > b) f arr) "a b  > >C(C) 2012-16 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> provisionalportableNone ?lens$Evaluate the elements targeted by a , , ,  or ! according to the given strategy.   =  ?  ? ?D(C) 2012-2016 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> provisionalportable Trustworthy @lensEvaluate the targets of a  or / into a data structure according to the given  .   =  @  =   @ =  v  @ ::  s a ->   a ->   s  @ ::  s a ->   a ->   s  @ :: (a ->   a) -> s ->   s) ->   a ->   s AlensEvaluate the targets of a  or 7 according into a data structure according to a given   in parallel.   =  A   A ::  s a ->   a ->   s  A ::  s a ->   a ->   s  A :: ((a ->   a) -> s ->   s) ->   a ->   s Blens Transform a , , ,  or 7 to first evaluates its argument according to a given   before proceeding.  B    ::  t =>   a ->   [a] Clens Transform a , , ,  or 0 to evaluate its argument according to a given   in parallel with evaluating.  C    ::  t =>   a ->   [a]  @ A B C @ A B CE(C) 2014-2016 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> provisionalControl.Monad.ErrorNone=?@AEXw DlensYou need this when using  K. Flens$Catch exceptions that match a given  (or any  , really).  F ::   e m => % e a -> m r -> (a -> m r) -> m r  F ::   e m => & e a -> m r -> (a -> m r) -> m r  F ::   e m => ! e a -> m r -> (a -> m r) -> m r  F ::   e m => ' e a -> m r -> (a -> m r) -> m r  F ::   e m => % e a -> m r -> (a -> m r) -> m r  F ::   e m => ' e a -> m r -> (a -> m r) -> m r Glens$Catch exceptions that match a given  (or any \), discarding the information about the match. This is particuarly useful when you have a  e () where the result of the  or = isn't particularly valuable, just the fact that it matches.  G ::   e m =>  e a -> m r -> m r -> m r  G ::   e m =>  e a -> m r -> m r -> m r  G ::   e m =>  e a -> m r -> m r -> m r  G ::   e m =>  e a -> m r -> m r -> m r  G ::   e m =>  e a -> m r -> m r -> m r  G ::   e m =>  e a -> m r -> m r -> m r Hlens A version of  Fd with the arguments swapped around; useful in situations where the code for the handler is shorter.  H ::   e m => % e a -> (a -> m r) -> m r -> m r  H ::   e m => & e a -> (a -> m r) -> m r -> m r  H ::   e m => ! e a -> (a -> m r) -> m r -> m r  H ::   e m => ' e a -> (a -> m r) -> m r -> m r  H ::   e m => ' e a -> (a -> m r) -> m r -> m r  H ::   e m => % e a -> (a -> m r) -> m r -> m r Ilens A version of  Gd with the arguments swapped around; useful in situations where the code for the handler is shorter.  I ::   e m =>  e a -> m r -> m r -> m r  I ::   e m =>  e a -> m r -> m r -> m r  I ::   e m =>  e a -> m r -> m r -> m r  I ::   e m =>  e a -> m r -> m r -> m r  I ::   e m =>  e a -> m r -> m r -> m r  I ::   e m =>  e a -> m r -> m r -> m r Jlens J takes a  (or any 0) to select which exceptions are caught If the  Exception/ does not match the predicate, it is re-thrown.  J ::   e m =>  e a -> m r -> m ( p a r)  J ::   e m =>  e a -> m r -> m ( p a r)  J ::   e m =>  e a -> m r -> m ( p a r)  J ::   e m =>  e a -> m r -> m ( p a r)  J ::   e m =>  e a -> m r -> m ( p a r)  J ::   e m =>  e a -> m r -> m ( p a r) KlensBThis function exists to remedy a gap between the functionality of Control.Exception and Control.Monad.Error. Control.Exception supplies " and a notion of C, which we duplicate here in a form suitable for working with any   instance.VSometimes you want to catch two different sorts of error. You could do something like f =  H _Foo handleFoo ( H _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  K, which would be used thus: f =  K expr [ %# _Foo handleFoo , %# _Bar handleBar ] Llens Throw an  Exception described by a .  L l "a  l   L ::   e m =>  e t -> t -> a  L ::   e m =>  e t -> t -> a lens6Helper function to provide conditional catch behavior. Mlens Similar to  LP but specialised for the common case of error constructors with no arguments. .data MyError = Foo | Bar makePrisms ''MyError  M _Foo ::   MyError m => m a $%& D E F G H I J K L M F G H I J K D E$%& L MF(C) 2012-16 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> provisional Rank2TypesNone =?@AHSVX` Tlens[A 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) "a v is violated byHlet 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  #? Ulens A dual of  T: a prism sum.The law   l ( l b) "a  \ b  breaks withWlet 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  $? VlensA generalization of  *ing folds: A union of disjoint traversals.+Traversing the same entry twice is illegal.Are you looking for %? T U V T U V&(C) 2012-16 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> experimental non-portableNoneoz0123456789:;<=?@BCDEFGHIJKLMNOP[\]_klmnwxyz{|}~ #$[\]:;>9@z9@ #$[\]:;>lmknwxyz{|}~0123456789:;<=?@BCDEFGHIJKLMNOP\_[]G(C) 2012-16 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> provisionalportableNone m WlensCheck to see if this  matches.is _Left (Right 12)False is hex "3f79"True  W W(C) 2013-16 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> experimental non-portableNone" %$EIV\}~.Gmnp      !"#$%&'()*+,-./>AQRSTUVWXYZ^`abcdefghijopqrstuv     !"%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ^_`abcdefghijklmnopqrstuvwxyz{|}~-/.0463512789<=?@ABCDEFGHIJKLMNOPQRSTUVW3456:;<=>?ABuvwxyz{|}~MNlmnopqrstuvwx  %$EIV\}~.Gmnp      !"#$%&'()*+,-./>AQRSTUVWXYZ^`abcdefghijopqrstuv     !"%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ^_`abcdefghijklmnopqrstuvwxyz{|}~-/.0463512789<=?@ABCDEFGHIJKLMNOPQRSTUVW3456:;<=>?ABuvwxyz{|}~MNlmnopqrstuvwx H(C) 2012-16 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> provisionalControl.Exception Trustworthy %=?@ASXgQ XlensThis   is thrown by lens7 when the user somehow manages to rethrow an internal ". Ylens  Y ::  " "  Y ::    " Zlens%There is no information carried in a ".  Z ::  " ()  Z ::    () [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.  ] ::       ] ::      ^lens`An 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.  ` ::       ` ::      alens.This thread has exceeded its allocation limit. blens  b ::       b ::      clens2There is no additional information carried in an    .  c ::    ()  c ::    () dlens#This is thrown when the user calls '. elens  e ::       e ::      flensRetrieve the argument given to '.  is isomorphic to a  .0catching _ErrorCall (error "touch down!") return "touch down!"  f ::       f ::      glensA 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. hlens  h ::       h ::      ilensCInformation about the source location where the record was updated.  i ::       i ::      jlensA 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. klens  k ::       k ::      llensJInformation about the source location where the record selection occurred.  l ::       l ::      mlens'An uninitialised record field was used. nlens  n ::       n ::      olensHInformation about the source location where the record was constructed.  o ::       o ::      plensA pattern match failed. qlens  q ::       q ::      rlens5Information about the source location of the pattern.  r ::       r ::      slens}A class method without a definition (neither a default definition, nor a definition in the appropriate instance) was called. tlens  t ::       t ::      ulens,Extract a description of the missing method.  u ::       u ::      vlensBThere are no runnable threads, so the program is deadlocked. The    # is raised in the main thread only. wlens  w ::       w ::      xlens%There is no information carried in a    .  x ::    ()  x ::    () ylens"The thread is waiting to retry an ()c transaction, but there are no other references to any TVars involved, so it can't ever continue. zlens  z ::       z ::      {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  B contains provides information about what assertion failed in the  .zhandling _AssertionFailed (\ xs -> "caught" <$ guard ("<interactive>" `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  t. An  z records a more specific error type, a descriptive string and maybe the handle that was used when the error was flagged.nDue 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  .   :: ( Y f,   a) => (a -> f a) ->   -> f   lens$Catch exceptions that match a given  (or any  , really).Ucatching _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 particuarly useful when you have a  e () where the result of the  or = isn't particularly valuable, just the fact that it matches.Ocatching_ _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  d with the arguments swapped around; useful in situations where the code for the handler is shorter.Ihandling _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  d with the arguments swapped around; useful in situations where the code for the handler is shorter.Dhandling_ _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 ( p a r)   ::   m =>    a -> m r -> m ( p a r)   ::   m =>    a -> m r -> m ( p a r)   ::   m =>    a -> m r -> m ( p a r)   ::   m =>    a -> m r -> m ( p a r)   ::   m =>    a -> m r -> m ( p 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  t.   l "a  l     ::    t -> t -> r   ::    t -> t -> r lens Similar to  P 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  t (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 "a   e   l e `seq` x "a 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  tS because it guarantees ordering with respect to other monadic operations, whereas   does not.   l "a  l /0   ::   m =>    t -> t -> m r   ::   m =>    t -> t -> m r lens  raises an   specified by a  in the target thread.   thread l "a  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' "a 'over' 'mappedException'NThis 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.<The following maps failed assertions to arithmetic overflow:handling _Overflow (\_ -> 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:lhandling _Overflow (\_ -> return "caught") $ assert False (return "uncaught") & mappedException' .~ Overflow"caught" lensHandle arithmetic  .   "a    w     ::        ::      lensHandle arithmetic  .   "a    w     ::        ::      lens$Handle arithmetic loss of precision.   "a    w     ::        ::      lensHandle division by zero.   "a    w     ::        ::      lens/Handle exceptional _Denormalized floating pure.   "a    w     ::        ::      lens Added in base. 4.6 in response to this libraries discussion: Mhttp://haskell.1045720.n5.nabble.com/Data-Ratio-and-exceptions-td5711246.html   "a    w     ::        ::      lensBAn attempt was made to index an array outside its declared bounds.   "a    w     ::        ::      lensUAn attempt was made to evaluate an element of an array that had not been initialized.   "a    w     ::        ::      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.   ::    ()   ::    () lenswThe 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 12H, 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).   ::    ()   ::    () $%& X Y Z [ \ ] ^ _ ` a b c d f e g h i j k l m n o p q r s t u v w x y z { | } ~  م $%&  | } ~ y z { v w x s t u p q r m n o j k l g h i d f e a b c ^ _ ` [ \ ] X Y Z I(C) 2012-2016 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> experimental non-portableNone%>@AgH lensAny   can be thrown as an  lensThis 8 allows you to traverse the typed value contained in a  O where the type required by your function matches that of the contents of the  , or construct a  D value out of whole cloth. It can also be used to catch or throw a   value as  .   ::  ) a =>    a   ::  ) a =>    a       J(C) 2012-16 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> provisionalportableNone%,>SXg 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-36LNote: This is an improper prism, since leading 0s are stripped when reading."100" ^? base 16Just 256 1767707668033969 ^. re (base 36) "helloworld" lensLike 34, but handles up to base-36 lensLike 35, but handles up to base-36 lensA safe variant of  lens+Select digits that fall into the given base lensA simpler variant of 67> that only prepends a dash and doesn't know about parentheses lensA simpler variant of 68\ that supports any base, only recognizes an initial dash and doesn't know about parentheses lens   =   2 lens   =   8 lens   =   10 lens   =   16 lens   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.003Dlet fahrenheit = multiplying (9/5).adding 32 in 230^.from fahrenheit110.0 lens    n =  (/n) (*n)   n =  (  n)Note: This errors for n = 0 lens   n =  (**n) (**recip n)Note: This errors for n = 0Hau (_Wrapping Sum . from (exponentiating 2)) (foldMapOf each) (3,4) == 5True lens   =   +  +8au (_Wrapping Sum . negated) (foldMapOf each) (3,4) == 7True9au (_Wrapping Sum) (foldMapOf (each.negated)) (3,4) == -7True                K(C) 2017 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> provisionalportableNone%SXg' 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 numbers lensUThe natural numbers are isomorphic to the product of the natural numbers with itself. N = N*N lensbThe natural numbers are isomorphic to disjoint sums of natural numbers embedded as evens or odds. N = 2*N lens>The natural numbers are isomorphic to lists of natural numbers            9Safe't L(C) 2013-16 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> provisionalControl.ExceptionNone%=?@Ag/ 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).   ::     K   ::     K             M(C) 2012-16 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> experimental Rank2TypesNonen "lens'Modify the path by adding another path.O(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.WexecState (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.M(basename .~ "filename" $ "path" </> "name.png") == "path" </> "filename.png"True /lensA ) for reading and writing to the directoryNote: this is not a legal  unless the outer  L already has a directory component, and generated directories are not null.F(("long" </> "path" </> "name.txt") ^. directory) == "long" </> "path"True 0lensA ) 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.F(extension .~ ".png" $ "path" </> "name.txt") == "path" </> "name.png"True 1lensA - 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.I(filename .~ "name.txt" $ "path" </> "name.png") == "path" </> "name.txt"True " # $ % & ' ( ) * + , - . / 0 1 " $ & ( * , # % ' ) + - . / 0 1 "4 #4 $4 %4 &4 '4 (4 )4 *4 +4 ,4 -4N(C) 2012-2016 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> experimental Rank2TypesNone=>?@Au 2lensWhere the error happened. 3lens Error type specific information. 4lens2The handle used by the action flagging this error. 5lens 5 the error is related to. 6lens 6 leading to this error, if any. 7lensWhat type of error it is 2 3 4 5 6 7 8 9 : ; < = > ? @ A B C D E F G H I J 2 3 4 5 6 7 8 9 : ; < = > ? @ A B C D E F G H I J =>?@@AB@C@@D@EF@EG@@HI@HJ@HJ@K@L@MN@MO@MO@PQ@PR@ST@UVWXVYZVY[VY\VW]VW^VW_`ab`ac`ad`ae`af`ag`ah`ahijkijlmnoopqqrstuvwxyz{|}~                                                  Z     hh !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIIJKLMNOPQRSTUVWWXYYZ[\]^_`abcdefghijklmmnnoopqrstquvwxyz{|}~fe     ^]dc_bn !\"#[$%&a`'()*+,-./0123456789:;<=>?@ABCDEFGHIJKL M N O P Q R S T U V W X Y Z [ # \ g ] ^ _ ` a b c d e f g h i j k l m n o p q r s t u v w x y z { | } ~                                                 !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      $                                        U   T             P  O    Q  R                          m           ! " # $ % & ' ( ) * + , - . / 0 1 2 3456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]i^_`abcdefghijklmn%opqrstuvwxyz{|}_~bn^]dc[\a`                                                                 ! " # $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z [ \ ] ^ _ ` a b c d e f g h i j k l m n o!p!q!r!s!t!u!v!wxyzz{|}~                                                          """"""""""""""""""""""""""""""""######################################$$$$$ $ $ $ $ $$$$$$$$$$$$$$$$$$$ %!%"%%#%$%#%%%%&%'%(%)%*%+%,%-%%%.%/%0%1%2%3%4%5%6%7%8%9%:%;%<%=%>%?%@%A%B%C%D%E%F%G%H%I%J%K%L%M%N%O%P%Q%R%S%T%U%V%W%X%Y%Z%[%\%]%^%_%`%a%b%c%d%e%f%g%h%i%j%k%l%m%n%o%p%q%r%s%t%u%v%w%x%y%z%{%|%}%~%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % % % %%%%%%%%%%%%%%%%%%% %!%"%#%$%%%&%'%(%)%*%+%,%-%.%/%0%1%2%3%4%5%6%7%8%9%:%;%<%=%>%?%@%A%B%C%D%E%F%G%H%I%J%K%L%M%N%O%P%Q%R%S%T%U%V%W%X%Y%Z%[%\&]&^&q&r&_&`&a&b&c&d&e&f&g&h&i&j&k&l&m&n&o&p&q&r's't'u'''v'w'x'y'z'{(|(}(~((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((())*++,,,,,,,-------..........///////////0000000000000000000000000000000111111 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 !1 "1 #1 $1 %1 &1 '1 (1 )1 *1 +1 ,1 -1 .1 /1 02 12 22 32 42 52 62 72 82 92 :2 ;2 <2 =2 >2 ?2 @2 A2 B2 C2 D2 E2 F2 G2 H2 I2 J2 K2 L2 M2 N2 O2 P2 Q2 R2 S2 T2 U2 V2 W2 X2 Y2 Z2 [2 \2 ]2 ^2 _2 `2 a2 b2 c2 d2 e2 f2 g2 h2 i2 j2 k2 l2 m2 n2 o2 p2 q2 r2 s2 t2 u2 v2 w2 x2 y2 z2 {2 |2 }2 ~2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 !2 "2 #2 $2 %2 &2 '2 (2 )2 *2 +2 ,2 -2 .2 /3 03 13 23 33 44 54 64 74 84 94 :4 ;4 ;4 <4 =4 >4 ?4 @4 A4 B4 C4 D4 E4 F4 G4 H4 I5 J5 K5 L5 M5 N5 O5 P5 Q5 R5 S5 T5 U5 V5 W5 X5 Y5 Z5 [5 \5 ]5 ^5 _5 `5 a5 b5 c5 d5 e5 f5 g5 h5 i5 j5 k5 l5 m5 n5 o5 p5 q6 r6 s6 t6 u6 v6 w6 x6 y6 z6 {6 |6 }6 ~6 6 6 777778 8 9 9 : : : : :: ; ; ; < <<= = = = = == = = = > > > > > > > > ? ? ? ? ? ? ? ? @ @ @ @ @ @ @ @ @ @ @ A A A A A A A A A A A A A A A A B C D D D D EEE E E E E E"E E E E E E E E F F F GH H H H H H H H H H H H H H HH H H H H H H H H H H H H H H H H H H H H H H H H H H H H HH H H H HH H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H !H "H #H $H %H &H 'H (H )H *H +H ,H -H .H H H H H H /H H H 0H 1H 2H 3H 4H 5H 6H 7H 8H 9H :H ;HH <H =H >H ?H @H AH BH CH DH EH FH GH HH IH JH KH LH MH NH OH PH QH RH SH TH UH VH WH XH YH ZH [H \H ]H ^H _H `H aH bH cH dH eH fI gI hI iI jI kJ lJ mJ@J nJ oJ pJ qJ rJ sJ tJ uJ vJ wK xK yK zK {K |K }L ~L L L L L L L M M M M M M M M M M M M M M M M N N N N N N N N N N N N N N N N N N N N N N N N N =  @  @  @  @  =  @  @  @  @  @ @ @ @ @ @  @ @  V  V  @    @        @  @  @ @ @ @ @ @ @ @  @  @  l@  = =  =  @    @ @  =  @  @ @  @@  @         = @  @@  @  @ @@  @  @  @  @ @  = @  @  @  @  @ @ @  @ @ !@  "=  #@ $@ %@ &@ '@  (@ )@  y@ *@ +@ ,@ -i . /@S@ 0@ 1@ 2@  3@ 4@  5@ 6=  7@ 8@ 9@ :@ ;@  <@@=  =@ >@ ? @@ A'=  B@ C=  D@ E@ F@ G@  H@ I@ J@ K@ L@ M@ N@ ? O P Q R@ @ S T@ U @ U @ V@ W@ X@ Y@ Z@ [@ \@ PWX P ] ^@@ S _ PW ` PW @  a@  b c= d e f@ g hij i@ j  k l m@ n - o p o p"@ q r@ s@@ n t=  u@ v@@ e w x y z! y {!! |! }! ~!  @E @E @  =  =   @ S @ S  @  @ $ @  e  e  e  e f   P  P X P ~ P p P  P v@ @  ' @ @  @ @ @    e  e          @    @     @     e   @  @1 1 1 1 1 1 1 1     2                     3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 @ 5 5 !5 "5 #@@ $ e % e w & e w ' e w ( e w ) e  *@ +@ ,@ -@ .@ /@ 0@ 1@ 2 3@ 2 4@ 2 5= 6= 7@ 2 8@ A 9@ : ; < = > ? = @ A = @ B = @ C = @ D = @ E F G F HE.@ I J@ K L@ I M@ N O@ K P@ K Q@ K R@ K S@ K T@ I U@ I V@ I W@ K X@ K Y@ I Z@ [@ I \@ I ]@ n ^@ I _ o p `@ N0 o p a@ b c@ b d@ K e@ I fJ gJ hJ iJ jJ kJ l9 m9 n9 o9 p9 q9 r9 s9 t@ I u@ v w x lens-4.18-HI3642v7827JTf0vyfqsuPControl.Lens.Internal.CoerceControl.Lens.TraversalControl.Lens.Internal.CTypesControl.Lens.GetterControl.Lens.ReviewControl.Lens.SetterControl.Lens.Internal.TypeableControl.Lens.EqualityControl.Lens.LensControl.Lens.IsoControl.Lens.PrismControl.Lens.FoldControl.Lens.Internal.FoldControl.Lens.Internal.GetterControl.Lens.Internal.IndexedControl.Lens.Internal.ContextControl.Lens.Internal.BazaarControl.Lens.Internal.IsoControl.Lens.Internal.LevelControl.Lens.Internal.ListControl.Lens.Internal.MagmaControl.Lens.Internal.PrismControl.Lens.Internal.ReviewControl.Lens.Internal.SetterControl.Lens.Internal.THControl.Lens.Internal.ZoomControl.Lens.TypeControl.Lens.TupleControl.Lens.LevelControl.Lens.ReifiedControl.Lens.Internal.ExceptionControl.Lens.Indexed Control.Lens.Internal.ByteStringControl.Lens.EmptyControl.Lens.ConsControl.Lens.Internal.DequeControl.Lens.WrappedControl.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.List.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.ExtrasControl.Exception.LensData.Dynamic.Lens Numeric.LensNumeric.Natural.LensSystem.Exit.LensSystem.FilePath.LensSystem.IO.Error.LenslastOffirstOf maximumOf minimumOfmapM_ traverse1Of_ traverseOf_Control.Lens.Internal.InstancesControl.Monad.Trans.State.LazyState indexed64indexed TraversalIndexedTraversalFold IndexedFoldPrismLens IndexedLensIsoGetter IndexedGetterLensLikeOver cloneLensBazaartaking Data.IntMapIntMapAccessor 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.InternalTextsetviewover TraversableData.Functor.Compose getComposeCompose fmapDefaultuse_2atimap Traversal'Setter'^..~%~+~Iso'-~*~//~^~^^~**~||~&&~?~<>~%=+=-=*=//=^=^^=**=||=&&=.=?=<>=%@~ withIndex<.~<.=anyOfControl.Applicative Applicative Data.Functor<$> ifoldMapOfcloneTraversal Data.TypeablecastControl.Lens.Extrais_EmptyAsEmptyPreludeunfoldrdropping_1 traverseOf_LeftforOfData.SemigroupFirstLast Data.Listfoldl1' Control.MonadMonadControl.TraversableControl.Lens.Isomorphic itraverseOfimapMOfiforMOf elemIndex elemIndices findIndex findIndicesData.Functor.Contravariant Contravariantifor transposeuniplatebiplate contextsOfControl.Comonad.Store.ClasspospeekeachReifiedTraversal runTraversalControl.ExceptionHandler_AssertionFailed _ErrorCallPrism'Lens'_NonTermination_StackOverflowControl.Lens.IndexedTraversalmap mapAccumR mapAccumLB BytestringalaalafData.MapMapjoinControl.Monad.Reader.Classlocalplate Data.Just isNothingextractIndexedfolded Data.Map.LazyunionData.Text.Lazy Data.TextSimpleWrapped Control.LensData.ByteStringpackunpackData.ByteString.Char8Data.ByteString.LazyData.ByteString.Lazy.Char8 ByteStringcatches alongsidewithoutfailingControl.Lens.OperatorserrorControl.Monad.STMSTMControl.Concurrent.MVarMVartrytryJust catchJustCatchIOthrowControl.Concurrent killThread Data.Char intToDigit digitToIntNumeric showSigned readSigned Paths_lensSystem.FilePath extSeparatorpathSeparatorsghc-primGHC.PrimcoercebaseGHC.PtrPtr contramap>$Data.Bifunctorbimap BifunctorData.Functor.Identity runIdentityIdentityeqTtypeRepData.Functor.ConstgetConstConstData.Type.EqualityRefl:~: Data.Function&<&>%profunctors-5.5-LPyaBUaDfxdbHLQir3TkdData.Profunctor.Unsafe ProfunctorData.Profunctor.Choiceright'left'Choicermaplmapdimap'reflection-2.1.5-4qtfUoYSp3c7gqYGlkI3YXData.Reflection sequenceBy traverseBy foldMapByfoldBy reifiedMemptyreifiedMappend ReifiedMonoid*semigroupoids-5.3.3-EESwn4HgBKpKioxEXkvG0j Data.Semigroup.Traversable.Class traverse1 Traversable1coerce'#..AlongsideRightgetAlongsideRight AlongsideLeftgetAlongsideLeftnoEffect$fBitraversableAlongsideLeft$fBifoldableAlongsideLeft$fBifunctorAlongsideLeft$fTraversable1AlongsideLeft$fFoldable1AlongsideLeft$fTraversableAlongsideLeft$fFoldableAlongsideLeft$fContravariantAlongsideLeft$fFunctorAlongsideLeft$fBitraversableAlongsideRight$fBifoldableAlongsideRight$fBifunctorAlongsideRight$fTraversable1AlongsideRight$fFoldable1AlongsideRight$fTraversableAlongsideRight$fFoldableAlongsideRight$fContravariantAlongsideRight$fFunctorAlongsideRight$fReadAlongsideRight$fShowAlongsideRight$fReadAlongsideLeft$fShowAlongsideLeft RightmostRPureRLeafRStepLeftmostLPureLLeafLStep NonEmptyDListgetNonEmptyDListMaxNoMaxMinNoMin Sequenced getSequenced TraversedF getTraversedF Traversed getTraversedFolding getFoldinggetMingetMax getLeftmost getRightmost$fMonoidFolding$fSemigroupFolding$fMonoidTraversed$fSemigroupTraversed$fMonoidTraversedF$fSemigroupTraversedF$fMonoidSequenced$fSemigroupSequenced $fMonoidMin$fSemigroupMin $fMonoidMax$fSemigroupMax$fSemigroupNonEmptyDList$fMonoidLeftmost$fSemigroupLeftmost$fMonoidRightmost$fSemigroupRightmost 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$fFunctorIndexing64 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 Reversing reversingExchange$fProfunctorExchange$fFunctorExchange$fReversingVector$fReversingVector0$fReversingVector1$fReversingSeq$fReversingVector2$fReversingText$fReversingText0$fReversingByteString$fReversingByteString0$fReversingNonEmpty $fReversing[]FlowsrunFlows Deepening runDeepeningLevelTwoOneZero deepening$fTraversableLevel$fFoldableLevel$fFunctorLevel$fMonoidDeepening$fSemigroupDeepening$fApplicativeFlows $fApplyFlows$fFunctorFlows $fEqLevel $fOrdLevel $fShowLevel $fReadLevel ordinalNub TakingWhileMaficMolten runMoltenMagmaMagmaAp MagmaPure MagmaFmaprunMagmarunMaficrunTakingWhile $fShowMagma$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 Reviewableretagged $fReviewablepSettable untainted untaintedDot taintedDot$fSettableCompose$fSettableBackwards$fSettableIdentityappsTappsE1toTupleTtoTupleEtoTuplePconAppsTbndrNamefromSetnewNames unfoldTypelensPackageKey mkLensName_tc mkLensName_vtraversalTypeNametraversal'TypeName lensTypeName lens'TypeName isoTypeName iso'TypeNamegetterTypeName foldTypeName prismTypeNameprism'TypeNamereviewTypeNamewrappedTypeNameunwrappedTypeNamerewrappedTypeName_wrapped'ValName isoValName prismValName untoValNamephantomValNamephantom2composeValName idValName fmapValName pureValName apValName rightDataName leftDataName inlinePragma 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'$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'$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#reviewsreusereusesAPrism'APrism withPrism clonePrismprism'asidebelowisn't_Right_Just_Nothing_Voidonlynearly_Showfoldingifoldingfoldring ifoldringfolded64repeated replicatedcycledunfoldediteratedfiltered filteredBy takingWhile droppingWhilewordedlinedfoldOffoldrOffoldlOftoListOf toNonEmptyOf^..andOforOfallOfnoneOf productOfsumOfforOf_ sequenceAOf_for1Of_ sequence1Of_mapMOf_forMOf_ sequenceOf_asumOfmsumOfelemOf notElemOf concatMapOfconcatOf^?!first1Oflast1OfnullOf notNullOf maximum1Of 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 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$fShowHandlingExceptionTraversableWithIndex itraverse itraversedFoldableWithIndexifoldMapifoldedifoldrifoldlifoldr'ifoldl'FunctorWithIndeximapped<..> selfIndex reindexed<.>icomposeindicesindexianyiallinonenone itraverse_ifor_imapM_iforM_ iconcatMapifindifoldrMifoldlMitoListimapMiforM imapAccumR imapAccumL ifoldMapBy ifoldMapByOf itraverseBy itraverseByOf$fTraversableWithIndexVoidK1$fFoldableWithIndexVoidK1$fFunctorWithIndexVoidK1$fTraversableWithIndexiRec1$fFoldableWithIndexiRec1$fFunctorWithIndexiRec1$fTraversableWithIndexEither:+:$fFoldableWithIndexEither:+:$fFunctorWithIndexEither:+:$fTraversableWithIndexEither:*:$fFoldableWithIndexEither:*:$fFunctorWithIndexEither:*:$fTraversableWithIndex(,):.:$fFoldableWithIndex(,):.:$fFunctorWithIndex(,):.:$fTraversableWithIndex()Par1$fFoldableWithIndex()Par1$fFunctorWithIndex()Par1$fTraversableWithIndexVoidU1$fFoldableWithIndexVoidU1$fFunctorWithIndexVoidU1$fTraversableWithIndexVoidV1$fFoldableWithIndexVoidV1$fFunctorWithIndexVoidV1$fTraversableWithIndex()Tagged$fFoldableWithIndex()Tagged$fFunctorWithIndex()Tagged$fTraversableWithIndexVoidProxy$fFoldableWithIndexVoidProxy$fFunctorWithIndexVoidProxy$fTraversableWithIndex[]Tree$fFoldableWithIndex[]Tree$fFunctorWithIndex[]Tree$fFunctorWithIndex(,)TracedT$fFunctorWithIndex(,)ReaderT#$fTraversableWithIndexEitherProduct $fFoldableWithIndexEitherProduct$fFunctorWithIndexEitherProduct $fTraversableWithIndexiIdentityT$fFoldableWithIndexiIdentityT$fFunctorWithIndexiIdentityT$fTraversableWithIndexEitherSum$fFoldableWithIndexEitherSum$fFunctorWithIndexEitherSum $fTraversableWithIndex(,)Compose$fFoldableWithIndex(,)Compose$fFunctorWithIndex(,)Compose$fTraversableWithIndex[]Cofree$fFoldableWithIndex[]Cofree$fFunctorWithIndex[]Cofree$fTraversableWithIndexiArray$fFoldableWithIndexiArray$fFunctorWithIndexiArray$fTraversableWithIndex[]Free$fFoldableWithIndex[]Free$fFunctorWithIndex[]Free$fTraversableWithIndexiMagma$fFoldableWithIndexiMagma$fFunctorWithIndexiMagma$fTraversableWithIndexiLevel$fFoldableWithIndexiLevel$fFunctorWithIndexiLevel$fFunctorWithIndexr->$fTraversableWithIndexkHashMap$fFoldableWithIndexkHashMap$fFunctorWithIndexkHashMap$fTraversableWithIndexkMap$fFoldableWithIndexkMap$fFunctorWithIndexkMap$fTraversableWithIndexIntIntMap$fFoldableWithIndexIntIntMap$fFunctorWithIndexIntIntMap$fTraversableWithIndexIntVector$fFoldableWithIndexIntVector$fFunctorWithIndexIntVector$fTraversableWithIndexIntSeq$fFoldableWithIndexIntSeq$fFunctorWithIndexIntSeq$fTraversableWithIndex()Maybe$fFoldableWithIndex()Maybe$fFunctorWithIndex()Maybe!$fTraversableWithIndexIntNonEmpty$fFoldableWithIndexIntNonEmpty$fFunctorWithIndexIntNonEmpty $fTraversableWithIndexIntZipList$fFoldableWithIndexIntZipList$fFunctorWithIndexIntZipList$fTraversableWithIndexInt[]$fFoldableWithIndexInt[]$fFunctorWithIndexInt[]$fTraversableWithIndexk(,)$fFoldableWithIndexk(,)$fFunctorWithIndexk(,) $fTraversableWithIndex()Identity$fFoldableWithIndex()Identity$fFunctorWithIndex()Identity$fTraversableWithIndexiReverse$fFoldableWithIndexiReverse$fFunctorWithIndexiReverse $fTraversableWithIndexiBackwards$fFoldableWithIndexiBackwards$fFunctorWithIndexiBackwardstraversedStrictTreetraversedStrictTree8 unpackLazy traversedLazy unpackLazy8traversedLazy8 unpackStrict unpackStrict8 AnEquality' AnEquality IdenticalrunEqsubstEqmapEqfromEqsimplysimple cloneEqualityequality equality' overEquality underEquality fromLeibniz fromLeibniz' withEqualityStrictstrictSwappedswappedAnIso'AnIsoListReversedLazyisowithIsocloneIsoauaufxplatxplatfunderenummappingnonnon'anoncurried uncurriedflippedlazyreversed involutedmagmaimagma contramapping dimappinglmappingrmapping bimappingfirsting secondingcoerced$fSwapped(,,,,,,)$fSwapped(,,,,,)$fSwapped(,,,,)$fSwapped(,,,) $fSwapped(,,)$fSwappedTannen $fSwappedBiff $fSwappedFlip $fSwappedSum$fSwappedProduct$fSwappedEither $fSwapped(,) $fStrictSTST$fStrictRWSTRWST$fStrictWriterTWriterT$fStrictStateTStateT$fStrictTextText$fStrictByteStringByteStringEmpty $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[][]abDequeBDnull 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$fWrappedWriterT$fWrappedWriterT0$fWrappedStateT$fWrappedStateT0 $fWrappedRWST$fWrappedRWST0$fWrappedReverse$fWrappedReaderT$fWrappedMaybeT$fWrappedListT$fWrappedIdentityT$fWrappedIdentity$fWrappedExceptT$fWrappedErrorT$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$fRewrappedWriterTt$fRewrappedWriterTt0$fRewrappedStateTt$fRewrappedStateTt0$fRewrappedRWSTt$fRewrappedRWSTt0$fRewrappedReverset$fRewrappedReaderTt$fRewrappedMaybeTt$fRewrappedListTt$fRewrappedIdentityTt$fRewrappedIdentityt$fRewrappedExceptTt$fRewrappedErrorTt$fRewrappedContTt$fRewrappedConstantt$fRewrappedComposet0$fRewrappedBackwardst$fRewrappedErrnot$fRewrappedDownt$fRewrappedArrowMonadt$fRewrappedApt$fRewrappedAltt0$fRewrappedLastt0$fRewrappedFirstt0$fRewrappedEndot$fRewrappedDualt0$fRewrappedConstt$fRewrappedNonEmptyt$fRewrappedZipListt$fRewrappedWrappedArrowt0$fRewrappedWrappedMonadt$fRewrappedKleislit$fRewrappedProductt$fRewrappedSumt$fRewrappedAnyt$fRewrappedAllt$fRewrappingstMagnifymagnify MagnifiedZoomed$fZoomFreeTFreeTst$fZoomExceptTExceptTst$fZoomErrorTErrorTst$fZoomMaybeTMaybeTst$fZoomListTListTst$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 setmappedsetOftoMapOfpackedunpacked_Textbuildertextutf8IsText $fIsTextText $fIsTextText0 $fIsText[]sliced toVectorOfvectorasStream asStreamRclonedforcedordinalsvectorIxvectorTraverse convertedEach$fEachUArrayUArrayab$fEachArrayArrayab$fEachByteStringByteStringab$fEachByteStringByteStringab0$fEachTextTextab$fEachTextTextab0$fEachVectorVectorab$fEachVectorVectorab0$fEachVectorVectorab1$fEachVectorVectorab2$fEachTreeTreeab$fEachSeqSeqab$fEachEitherEitherab$fEachMaybeMaybeab$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_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_FunDeptySynEqnPatternstySynEqnResult_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 _GuardedB_NormalB_NormalG_PatG_BindS_LetS_NoBindS_ParS_FromR _FromThenR_FromToR _FromThenToR_CharL_StringL _IntegerL _RationalL _IntPrimL _WordPrimL _FloatPrimL _DoublePrimL _StringPrimL _CharPrimL_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_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 slicedFromseqOfprefixedsuffixed stripSuffixmembers 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 lensProductprismSumadjoinAsHandlingException__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 _Interrupted GHC.TypesIntGHC.IntInt8Int16Int32Int64WordGHC.WordWord8Word16Word32Word64 byteSwap64 byteSwap32 byteSwap16GHC.BasememptyFunctor GHC.MaybeJustData.Profunctor.RepCorepresentable Representablefmap$comonad-5.0.5-1t7DDbZbcMSAgTS70WFpTS ComonadStorepeeksseekseeks experimentcoarrlappend Semigrouptrimltrimrtemplate-haskellLanguage.Haskell.TH.SyntaxName TyVarBndrConT!free-5.1.2-B7tCH4dyTQ8LXhCvOtAFVrControl.Monad.Trans.FreeFreeF Data.EitherEitherMaybepure<$liftMid.$GHC.NumNumGHC.Real Fractional GHC.FloatFloating GHC.Classes||Bool&& mtl-2.2.2Control.Monad.State.Class MonadStatemappendControl.Monad.Writer.Classpass MonadWritercensorconstStringChar Control.ArrowArrowstateflipLeftRight Data.VoidVoid)kan-extensions-5.2-FoLz4obA2d88CuEaoEEbbFData.Functor.YonedaYoneda MonadReaderlistengetsnotNothingGHC.ReadReadGHC.ShowShowshowfoldrGHC.Listrepeat replicateiterateevenGHC.Enumsucc/= takeWhile dropWhile Data.OldListwordslinesfoldMapfoldData.Semigroup.InternalEndofoldltoListNonEmptyTrueandoranyallProductproductsum traverse_for_ sequenceA_Data.Functor.Bind.ClassApplyforM_ sequence_asum Alternativemsum MonadPluselemEqnotElem concatMapconcatlengthheadFalsemaximum Data.Maybe fromMaybeGHC.ErrOrdminimumOrdering maximumBy minimumByfindlookupfoldr1foldl1foldr'foldl'foldrMfoldlM listToMaybetransformers-0.5.5.0Control.Monad.Trans.ReaderReader Data.TuplesndControl.Categoryfor sequenceAmapMforMsequence unwrapMonad WrapMonadControl.Applicative.Backwards BackwardsswaprunStatescanr1scanl1Control.Comonad==containers-0.6.0.1Data.IntMap.InternalData.Bitraversable BitraversableBitraversable1<*>Data.Functor.Day.CurriedCurriedHandlingGHC.Exception.Type(exceptions-0.10.3-JCVBmzxJmVzJ5RaoaWAPCEControl.Monad.Catch System.IOprint++ SomeExceptionIOreturnData.Sequence.InternalSeqbytestring-0.10.8.2Data.ByteString.InternalData.ByteString.Lazy.Internalw2cc2w unsafeCreatecreate text-1.2.3.1firstsecondEnumDoubleFloat integer-gmpGHC.Integer.TypeIntegercurryuncurry&vector-0.12.0.3-ChzWbiXyvuNAQj0dcU08Sg Data.VectorVectortailemptycheck GHC.GenericsGenericData.Set.InternalData.Map.InternalData.IntSet.Internal3unordered-containers-0.2.10.0-b9YJCQLkMeLUf311RZkQDData.HashSet.BaseData.HashMap.BaseControl.Monad.Trans.RWS.StrictRWS Control.Monad.Trans.State.StrictControl.Monad.Trans.ErrorError Data.DatagmapMDatainlinePerformIO GHC.IO.UnsafeunsafePerformIOData.Typeable.InternalTypeable<|>negateGeneric1HashSet'hashable-1.3.0.0-1RsrIcitxVDKffGN1TuMlmData.Hashable.ClassHashableSetData.Text.Internal.BuilderBuilder fromLazyText toLazyTextData.Text.ShowfromTexttoStrictData.Vector.Generic.BaseData.Vector.Fusion.BundleBundleGHC.ArrIx array-0.5.3.0Data.Array.BaseIArrayUArrayArrayData.Text.Internal.LazyData.Vector.Unboxed.BaseUnboxForeign.StorableStorableData.Vector.Storable(primitive-0.7.0.0-9xMM76CsovTEGnXCHiCdRJData.Primitive.TypesPrimData.Vector.Primitive Data.TreeTreeHashMap RealFloatD:R:IxValue(,,,,,,,,)D:R:IxValue(,,,,,,,)D:R:IxValue(,,,,,,)D:R:IxValue(,,,,,)D:R:IxValue(,,,,)D:R:IxValue(,,,)D:R:IxValue(,,)D:R:IxValue(,)!//newNameTypeConBangType StrictTypesansVar VarBangType VarStrictTypeInfo ParentNameFixityDecOverlapCxtTySynEqn DerivStrategyKind DerivClausePragmaInline RuleMatchPhasesRuleBndrExpGadtCRecGadtCNCon makePrisms'makeConsPrismscomputePrismTypemakeConOpticExp makeConIsomakeConPrismExp makeConIsoExpmakeConReviewExp makeReviewermakeSimpleRemittermakeFullRemittermakeIsoRemittermakeClassyPrismClassmakeClassyPrismInstance normalizeCon prismName prismName'closemakeFieldOpticsForDatatypenormalizeConstructor buildScaffold buildStab OpticStabmakeFieldOpticmakeFieldInstancemakePureClausemakeGetterClausemakeFieldOpticClause makeIsoClause unifyTypesunify1 limitedSubstapplyTypeSubst quantifyType quantifyType'makeClassyDrivermakeClassyClassmakeClassyInstanceDeclareDataDecl dataContext tyConNamedataParametersfullType constructors$!classyRulesFor deNewtypefreshMaptraverseDataAndNewtypegcast subForestViewLviewlViewRviewrIntSetrealPartimagPartpolar magnitudephasepi conjugate Data.Bits.|.Bits.&.<=<bitSize undefineddivixmapbounds'parallel-3.2.2.0-EGl5SOk48TWHAD161C93aQ Control.Seq seqFoldableControl.Parallel.StrategiesStrategyevalTraversableEvalparTraversablerdeepseqControl.Monad.Error.Class MonadError throwErrorGHC.IO.ExceptionCompactionFailedControl.Exception.Base TypeErrorAllocationLimitExceeded GHC.Exception ErrorCall RecUpdError RecSelError RecConErrorPatternMatchFail NoMethodErrorDeadlockBlockedIndefinitelyOnSTMBlockedIndefinitelyOnMVarNestedAtomicallyNonTerminationAsyncExceptionassertAssertionFailedArrayExceptionArithException IOException MonadCatch MonadThrow GHC.Conc.SyncthrowToThreadId mapException HeapOverflow intToDigit' digitToInt' digitToIntMayisDigit' showSigned' readSigned'version getBinDir getLibDir getDynLibDir getDataDir getLibexecDir getSysconfDirgetDataFileNameExitCodeGHC.IOFilePath