o T            ! " # $ % & ' ( ) * + , - . / 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 { | } ~         !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFG 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 { | } ~                                                         !"#$%&'()*+,-./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%[%\%]%^_`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+g+h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,{,|,},~,,,,,,,,------------------------------------............................//////////////////////////////////////////////////////0000000000000 0 0 0 0 0000000000000000000 0!0"0#0$0%0&0'0(0)0*0+0,0-0.0/000102030405060708090:0;0<0=0>0?0@0A0B0C0D0E0F0G0H0I0J0K0L0M0N0O0P0Q0R0S0T0U0V0W0X0Y0Z0[0\0]0^0_0`0a0b0c0d0e0f0g0h0i0j0k0l0m0n0o0p0q0r0s0t0u0v0w0x0y0z0{0|0}0~0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000011111111111111111122222333333333 3 3 3 3 3333333333333333333 3!3"3#3$3%3&3'4(5)5*5+5,5-5.5/505152535455565768696:6;7<8=9>9?9@9A9B9C9D9E9F9G9H9I9J9K9L9M: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@{@|@}@~AABBCCCCCDDDDDDDDDDDDDDDDEEEEEEEEEEEEEEEEFFFFFFFFFFFFFFFFFFFFFFFFFGGGGGGGGGGGGGHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH 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 ;H <H =H >H ?H @H AH BH CH DH EH FH GI HI II JI KI LJ MJ NJ OJ PJ QJ RJ SJPKSafe T U V W X Y Z [ \ ] ^ _ ` U [ \ ] ^ _ ` T U V W X Y Z [ \ ] ^ _ ` (C) 2012-2016 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> experimental non-portableSafe:DR IWrap a monadic effect with a phantom type argument. Used when magnifying LM.#3Wrap a monadic effect with a phantom type argument.&Used by N to O into PQ)Make a  a out of  b for result collection.,Used by N to O into RS./Make a  a out of  c for error handling.2Used by N to O into RS.5Make a  a out of  d for error handling.8Used by N to O into TU or VW.;Used by N to O into XY.>Used by N to O into LM.AUsed by N to O into Z[.I !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefgh$ !"#$%&'()*+,-./0123456789:;<=>?@ABC$ABC>?@;<=89:234567,-./01&'()*+#$% !"1 !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefgh +(C) 2013-2016 Edward Kmett and Eric Mertens BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> experimental non-portable Trustworthy i<Compatibility shim for recent changes to template haskell's  ej%Apply arguments to a type constructorkApply arguments to a functionl-Construct a tuple type given a list of types.m4Construct a tuple value given a list of expressions.n3Construct a tuple pattern given a list of patterns.o&Apply arguments to a type constructor.pReturn  f contained in a  g.r/Generate many new names from a given base name.(ijklmnopqr base name count stuvwxyz{|}~(ijklmnopqrstuvwxyz{|}~(ijklmnopqrstuvwxyz{|}~(ijklmnopqrstuvwxyz{|}~ (C) 2012-2016 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> provisional non-portableSafe Anything  must be isomorphic to the   h. \So you can pass our ], into combinators from other lens libraries.(C) 2012-2016 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> provisional non-portableSafe 9:;<=DRrThis class is provided mostly for backwards compatibility with lens 3.8, but it can also shorten type signatures.2This is a profunctor used internally to implement Review#It plays a role similar to that of ^ or Const do for Control.Lens.Getter+(C) 2014-2016 Edward Kmett and Eric Mertens BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> provisional non-portableSafehReturn 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]strict upper bound ordinals )unique, in-bound ordinals, in order seen i i(C) 2012-2016 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> experimental non-portableSafe %&9;<=OT This is an illegal  j7 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.This is an illegal  a used to construct a single .This 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 _`i, 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  nodes, so  can only occur at the root. kAppend 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  l' instance, and just use it directly in  as needed.Generate the leaf of a given 4 based on whether or not we're at the correct depth. mWalk down one constructor in a , veering left. nWalk down one constructor in a , veering right.This is an illegal  j.This is an illegal  a. k m n  k m na(C) 2012-2016 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> experimental non-portableSafe(C) 2012-2016 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> provisional non-portableSafe/9;<=The  o equivalent for a   j  h. (C) 2012-2016 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> experimental non-portableSafe:OT  Used for  b. Used for  c. Used for  d. Used for  e.Used internally by f and the like. The argument a" of the result should not be used!Used internally by g and the like. The argument a" of the result should not be used!A  a for a   j.Obtain the minimum.Obtain the maximum. Extract the @ element. This will fairly eagerly determine that it can return  p( the moment it sees any element at all. Extract the @ element. This will fairly eagerly determine that it can return  p( the moment it sees any element at all.)&(C) 2016 Edward Kmett and Eric Mertens BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> experimental non-portable TrustworthyOT(C) 2012-2016 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> experimental non-portableNone 9:;<=DORT  j composition of hi  q with a  h , used by j. j composition of hi  r with a  h , used by k.]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 -> bnThis class permits overloading of function application for things that also admit a notion of a key or index.Build a function from an  function. This is a  that is both  s by f and  t 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.- is strong enough to let us distribute every   over every Haskell  h+. This is effectively a generalization of  u.^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. Transform a l into an m or a  n into an  o, etc.  :: l s t a b -> m  r s t a b  :: p s t a b -> m  r s t a b  :: q s t a b -> r  r s t a b  :: s s t a b -> r  r s t a b  :: n s a -> o  r s a  :: t s a -> u  r s a  ::   r p => v ( f) s t a b -> w p f s t a b  Transform a l into an m or a  n into an  o, etc.This combinator is like > except that it handles large traversals and folds gracefully.   :: l s t a b -> m  q s t a b   :: p s t a b -> m  q s t a b   :: q s t a b -> r  q s t a b   :: s s t a b -> r  q s t a b   :: n s a -> o  q s a   :: t s a -> u  q s a   ::   q p => v ( f) s t a b -> w p f s t a b HFold 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. When composed with an  IndexedFold or IndexedTraversal this yields an () Fold of the indices.2      !"#$%&'()*+      )      !"#$%&'()*+(C) 2012-2016 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> experimental non-portableNone9:;<=?DEORT, type , p g a s = - p g a a s-This is a generalized form of 5o that can be repeatedly cloned with less impact on its performance, and which permits the use of an arbitrary  .The extra phantom  h" is used to let us lie and claim t-compatibility under limited circumstances. This is used internally to permit a number of combinators to gracefully degrade when applied to a  n or t.0 type 0 p a s = 1 p a a s1This is a generalized form of 5o that can be repeatedly cloned with less impact on its performance, and which permits the use of an arbitrary  4 type 4 a s = 5 a a s50The indexed store can be used to characterize a q and is used by x.5 a b t is isomorphic to newtype 5 a b t = 5 { runContext :: forall f.  h f => (a -> f b) -> f t } , and to exists s. (s, q s t a b).A 5 is like a q3 that has already been applied to a some structure.7'This is used internally to construct a y, 5 or 1 from a singleton value.9This is an indexed analogue to  v# for when you are working with an A.:This is the generalization of  w to an indexed comonad store.;This is the generalization of  x to an indexed comonad store.<This is the generalization of  y to an indexed comonad store.=This is the generalization of  z to an indexed comonad store.>This is the generalization of  { to an indexed comonad store.?This is the generalization of  | to an indexed comonad store.@2We can always forget the rest of the structure of w: and obtain a simpler indexed comonad store model called 5.A6This is a Bob Atkey -style 2-argument indexed comonad.It exists as a superclass for A( and expresses the functoriality of an A 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.B?extract from an indexed comonadic value when the indices match.C9duplicate an indexed comonadic value splitting the index.D;extend a indexed comonadic computation splitting the index.E6This is a Bob Atkey -style 2-argument indexed functor.It exists as a superclass for A( and expresses the functoriality of an A in its third argument. }We can convert any  K to a function, possibly losing information about an index in the process.2,-./0123456789:;<=>?@ABCDEF }GHIJKLMNOPQRSTUVWXYZ[\,-./0123456789:;=<>?@ABCDEFEFABCD9:;<=>?@785641230-./,!,-./0123456789:;<=>?@ABCDEF }GHIJKLMNOPQRSTUVWXYZ[\(C) 2012-16 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> provisional Rank2TypesNone%&+,9:;<=DOT-]vThis is a convenient alias for use when you need to consume either indexed or non-indexed lens-likes based on context. type ] p f = g (^ p f) ^vThis is a convenient alias for use when you need to consume either indexed or non-indexed lens-likes based on context._FConvenient alias for constructing simple indexed lenses and their ilk.`?Convenient alias for constructing indexed lenses and their ilk.a type a f = g (b f) bMany combinators that accept a  can also accept a  in limited situations.'They do so by specializing the type of  h" that they require of the caller.If a function accepts a b f s t a b for some  h f, then they may be passed a . Further, if f is an  j, they may also be passed a .c type c p q f s a = g (d p q f) s a d type b f s t a b = d (->) (->) f s t a b  type ^ p f s t a b = d p (->) f s t a b type f p f s t a b = d p p f s t a b e type e p f s a = g (f p f) s a fA valid f l should satisfy the laws: l  ~ "a  ~ l ( Procompose f g) =  Procompose (l f) (l g)  This gives rise to the laws for s, y, u, , , , , m, j, and p5 as well along with their index-preserving variants. type b f s t a b = f (->) f s t a b gA g , g  , ... can be used instead of a ,E, ... whenever the type variables don't change upon setting a value. =z :: g  ({| a) a } :: g ( Int) [a] a .Note: To use this alias in your own code with b f or , you may have to turn on LiberalTypeSynonyms.2This is commonly abbreviated as a "prime" marker, e.g.  = g .jA relevant Fold (aka j) has one or more targets.kAn k can be used as a m, but when composed with an , l, or  yields an l respectively.lEvery l is a valid  n and can be used for ~.mA mU describes how to retrieve multiple values in a way that can be composed with other b constructions.A m s aC provides a structure with operations very similar to those of the  typeclass, see   and the other m combinators.!By convention, if there exists a foo method that expects a  (f a), then there should be a fooOf method that takes a m s a and a value of type s.A p is a legal m that just ignores the supplied . Unlike a l a m is read-only. Since a m, cannot be used to write back there are no  laws that apply.nAn n can be used as a p, but when composed with an , l, or  yields an l, l or o respectively.oEvery o is a valid  o and can be used for ~ like a p.pA pT describes how to retrieve a single value in a way that can be composed with other b constructions. Unlike a  a p is read-only. Since a p, 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 p can be used directly as a  n, since it just ignores the  j.q Composable asTypeOf0. Useful for constraining excess polymorphism, foo . (id :: As Int) . bar.rA g s.sA witness that (a ~ s, b ~ t).Note: Composition with an s is index-preserving.tA g u.uA u l is a & that can also be turned around with  to obtain a p in the opposite direction.There are two laws that a u should satisfy: First, if I  or  a value with a u and then  c or use ( ), I will get it back:  c l ( l b) "a Just b #Second, if you can extract a value a using a u l from a value s, then the value s is completely described by l and a:If  c l s "a Just a then  l a "a sThese two laws imply that the  laws hold for every u and that we  at most 1 element:   l x <= 1 "It may help to think of this as a y& that can be partial in one direction.Every u is a valid .Every y is a valid u.For example, you might have a t 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 :: t 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 u 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 u(, you will get your original input back.5^.re _Left ^? _LeftJust 5&Another interesting way to think of a u! is as the categorical dual of a  -- a co-8, so to speak. This is what permits the construction of .Note: Composition with a u is index-preserving.vKIf you see this in a signature for a function, the function is expecting a w% (in practice, this usually means a u).wThis is a limited form of a u that can only be used for re operations. Like with a p#, there are no laws to state for a w.You can generate a w by using unto. You can also use any u or y directly as a w.x type x = g y y2Isomorphism families can be composed with another  using (.) and id. Since every y is both a valid  and a valid u<, the laws for those types imply the following laws for an y f: f .  f "a id  f . f "a id Note: Composition with an y# is index- and measure- preserving.z type IndexedPreservingSetter' i = g IndexedPreservingSetter {An { can be composed with a },  or + and leaves the index intact, yielding an }.| type | i = g (} i) }Every } is a valid .The ! laws are still required to hold.~A ~ 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 ~ = ~  The only b 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  h laws apply to a :  l id "a id  l f .  l g "a  l (f . g) "These can be stated more directly: l  ~ "a  ~ l f .  . l g "a l (f .  . g) You can compose a  with a  or a  using (. ) from the Prelude" and the result is always only a  and nothing more.over traverse f [a,b,c,d][f a,f b,f c,f d]over _1 f (a,b)(f a,b)"over (traverse._1) f [(a,b),(c,d)][(f a,b),(f c,d)]over both f (a,b) (f a,f b)$over (traverse.both) f [(a,b),(c,d)][(f a,f b),(f c,f d)] type  = g  An , leaves any index it is composed with alone. type  i = g ( i) Every  is a valid l or  o.The  constraint is used to allow an  to be used directly as a l.The l! 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. type  = g  A  can be used directly as a ] or a m (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 y as a , and composition of a  (or  or y ) with a  (or  or y ) 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  ~ "a  ~  u (t f) . t g "a  . t ( .  u 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! type  = g  An , leaves any index it is composed with alone. type  i = g ( i) Every  is a valid  and a valid m. type  = g  A , 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 ] or .You can also use a  for ~ as if it were a m or p. Since every  is a valid , the  laws are required of any  you create: l  ~ "a  ~  u (l f) . l g "a  . l ( .  u f . g) type  s t a b = forall f.  h f => b f s t a b 5]^_`abcdefghijklmnopqrstuvwxyz{|}~5]^_`abcdefghijklmnopqrstuvwxyz{|}~5srqyxutwv~pmj}|oli{znkhgba^]`_dcfe5]^_`abcdefghijklmnopqrstuvwxyz{|}~(C) 2012-16 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> provisional Rank2TypesNone %&9:;<=OTY type  = g ( i) >When you see this as an argument to a function, it expects an  type  = g  =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 ,, or use it directly with combinators like  and ().Build a  from a getter and a setter.  ::  h: f => (s -> a) -> (s -> b -> t) -> (a -> f b) -> s -> f t s ^. lens getter settergetter ss & lens getter setter .~ b setter s bs & lens getter setter %~ fsetter s (f (getter s)) ! :: (s -> a) -> (s -> a -> s) ->  s a Build an index-preserving  from a t and a ]. Build an  from a t and a ].0This 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)(&) 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: () "a   _It may be beneficial to think about it as if it had these even more restricted types, however: () ::  h f => s* s t a b -> (a -> f b) -> s -> f t () ::  h f => ) s t a b -> (a -> f b) -> s -> f t () ::  j f => l# 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) () :: s0 s t a b -> (a -> (r, b)) -> s -> (r, t) () :: / s t a b -> (a -> (r, b)) -> s -> (r, t) () ::  a m => l) s t a b -> (a -> (m, b)) -> s -> (m, t) Modify the target of a @ in the current state returning some extra information of type r or modify all targets of a l= 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)) () "a (   ) It may be useful to think of (O), instead, as having either of the following more restricted type signatures: () ::   s m => s( s s a b -> (a -> (r, b)) -> m r () ::   s m => ' s s a b -> (a -> (r, b)) -> m r () :: (  s m,  a r) => l! s s a b -> (a -> (r, b)) -> m r Infix flipped  u. () =    u This is convenient to  2 argument order of composite functions defined as: fab ?? a = fmap ($ a) fab For the  h instance  f = ((->) r)= you can reason about this function as if the definition was () "a  : (h ?? x) ah a xexecState ?? [] $ modify (1:)[1]%over _2 ?? ("hello","world") $ length ("hello",5)(over ?? length ?? ("hello","world") $ _2 ("hello",5)Lift a F so it can run under a function (or other corepresentable profunctor).  ::  s t a b -> % (e -> s) (e -> t) (e -> a) (e -> b) "(\x -> (x-1,x+1)) ^. inside _1 $ 549runState (modify (1:) >> modify (2:)) ^. (inside _2) $ [][2,1]8Merge two lenses, getters, setters, folds or traversals.  "a       :: t s a -> t s' a -> t ( c s s') a  ::  n s a ->  n s' a ->  n ( c s s') a  ::  s a ->  s' a ->  ( c s s') a  ::  s a ->  s' a ->  ( c s s') a  ::  s a ->  s' a ->  ( c s s') a  This is a  that updates either side of an  c&, where both sides have the same type.  "a      Left a^.chosenaRight a^.chosenaRight "hello"^.chosen"hello"Right a & chosen *~ b Right (a * b)  ::  ( c a a) ( c b b) a b  f (  a) =     f a  f (  a) =     f a  makes a  from two other lenses or a pS from two other getters by executing them on their respective halves of a product.*(Left a, Right b)^.alongside chosen chosen(a,b)4(Left a, Right b) & alongside chosen chosen .~ (c,d)(Left c,Right d)  ::  s t a b ->  s' t' a' b' ->  (s,s') (t,t') (a,a') (b,b')  :: p s t a b -> p s' t' a' b' -> p (s,s') (t,t') (a,a') (b,b') This  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 w "a w     s > f w "a w     f  ::  (4 a s) a  ::  p =>  (0 p a s) a  ::  p =>  (, p g a s) a  Cloning a G is one way to make sure you aren't given something weaker, such as a lP 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")Clone a  as an IndexedPreservingLens4 that just passes through whatever index is on any , l, o or  it is composed with. Clone an  as an  with the same index.Modify the target of a  and return the result.3When you do not need the result of the operation, () is more flexible. () :: * s t a b -> (a -> b) -> s -> (b, t) () :: s+ s t a b -> (a -> b) -> s -> (b, t) () ::  a b => l$ s t a b -> (a -> b) -> s -> (b, t) -Increment the target of a numerically valued  and return the result.2When you do not need the result of the addition, () is more flexible. () ::   a =>  s a -> a -> s -> (a, s) () ::   a =>  s a -> a -> s -> (a, s) -Decrement the target of a numerically valued  and return the result.5When you do not need the result of the subtraction, () is more flexible. () ::   a =>  s a -> a -> s -> (a, s) () ::   a =>  s a -> a -> s -> (a, s) ,Multiply the target of a numerically valued  and return the result.8When you do not need the result of the multiplication, () is more flexible. () ::   a =>  s a -> a -> s -> (a, s) () ::   a =>  s a -> a -> s -> (a, s) +Divide the target of a fractionally valued  and return the result.2When you do not need the result of the division, () is more flexible. () ::   a =>  s a -> a -> s -> (a, s) () ::   a =>  s a -> a -> s -> (a, s) )Raise the target of a numerically valued  to a non-negative   power and return the result.3When you do not need the result of the operation, () is more flexible. () :: (  a,   e) =>  s a -> e -> s -> (a, s) () :: (  a,   e) =>  s a -> e -> s -> (a, s) *Raise the target of a fractionally valued  to an   power and return the result.3When you do not need the result of the operation, () is more flexible. () :: (  a,   e) =>  s a -> e -> s -> (a, s) () :: (  a,   e) =>  s a -> e -> s -> (a, s) ,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)  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)  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) Modify 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) () :: s+ s t a b -> (a -> b) -> s -> (a, t) () ::  a a => l$ s t a b -> (a -> b) -> s -> (a, t) Replace 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) () :: s$ s t a b -> b -> s -> (a, t) () ::  a a => l s t a b -> b -> s -> (a, t) -Increment the target of a numerically valued  and return the old value.%When you do not need the old value, () is more flexible.(a,b) & _1 <<+~ c (a,(a + c,b))(a,b) & _2 <<+~ c (b,(a,b + c)) () ::   a =>  s a -> a -> s -> (a, s) () ::   a => x s a -> a -> s -> (a, s) -Decrement the target of a numerically valued  and return the old value.%When you do not need the old value, () is more flexible.(a,b) & _1 <<-~ c (a,(a - c,b))(a,b) & _2 <<-~ c (b,(a,b - c)) () ::   a =>  s a -> a -> s -> (a, s) () ::   a => x s a -> a -> s -> (a, s) ,Multiply the target of a numerically valued  and return the old value.%When you do not need the old value, () is more flexible.(a,b) & _1 <<*~ c (a,(a * c,b))(a,b) & _2 <<*~ c (b,(a,b * c)) () ::   a =>  s a -> a -> s -> (a, s) () ::   a => x s a -> a -> s -> (a, s) *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 => x s a -> a -> s -> (a, s) )Raise the target of a numerically valued 2 to a non-negative power and return the old value.%When you do not need the old value, () is more flexible. () :: (  a,   e) =>  s a -> e -> s -> (a, s) () :: (  a,   e) => x s a -> e -> s -> (a, s) *Raise the target of a fractionally valued / to an integral power and return the old value.%When you do not need the old value, () is more flexible. () :: (  a,   e) =>  s a -> e -> s -> (a, s) () :: (  a,   e) => x s a -> e -> S -> (a, s) ,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 => x s a -> a -> s -> (a, s)  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) () :: x s   ->   -> s -> ( , s)  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) () :: x" s Bool -> Bool -> s -> (Bool, s) )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")) () ::  a r =>  s r -> r -> s -> (r, s) () ::  a r => x s r -> r -> s -> (r, s) Modify the target of a  into your Monad';s state by a user supplied function and return the result.When applied to a lM, 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 a) =>  s a -> (a -> a) -> m a *Add to the target of a numerically valued  into your Monad's state and return the result.2When you do not need the result of the addition, () is more flexible. () :: (  s m,   a) =>  s a -> a -> m a () :: (  s m,   a) =>  s a -> a -> m a 1Subtract from the target of a numerically valued  into your Monad's state and return the result.5When you do not need the result of the subtraction, () is more flexible. () :: (  s m,   a) =>  s a -> a -> m a () :: (  s m,   a) =>  s a -> a -> m a ,Multiply the target of a numerically valued  into your Monad's state and return the result.8When you do not need the result of the multiplication, () is more flexible. () :: (  s m,   a) =>  s a -> a -> m a () :: (  s m,   a) =>  s a -> a -> m a +Divide the target of a fractionally valued  into your Monad's state and return the result.2When you do not need the result of the division, () is more flexible. () :: (  s m,   a) =>  s a -> a -> m a () :: (  s m,   a) =>  s a -> a -> m a )Raise the target of a numerically valued  into your Monad's state to a non-negative   power and return the result.3When you do not need the result of the operation, () is more flexible. () :: (  s m,   a,   e) =>  s a -> e -> m a () :: (  s m,   a,   e) =>  s a -> e -> m a *Raise the target of a fractionally valued  into your Monad's state to an   power and return the result.3When you do not need the result of the operation, () is more flexible. () :: (  s m,   b,   e) =>  s a -> e -> m a () :: (  s m,   b,   e) =>  s a -> e -> m a ,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  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    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   Modify 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 lK, it 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 a) =>  s a -> (a -> a) -> m a () ::   s m => b" ((,)a) s s a b -> (a -> b) -> m aReplace 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 lK, it 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 t) =>  s a -> a -> m a Modify the target of a  into your Monad'*s state by adding a value and return the old value that was replaced.3When you do not need the result of the operation, () is more flexible. () :: (  s m,   a) =>  s a -> a -> m a () :: (  s m,   a) => x s a -> a -> m a Modify the target of a  into your Monad'/s state by subtracting a value and return the old value that was replaced.3When you do not need the result of the operation, () is more flexible. () :: (  s m,   a) =>  s a -> a -> m a () :: (  s m,   a) => x s a -> a -> m a Modify the target of a  into your Monad'.s state by multipling a value and return the old value that was replaced.3When you do not need the result of the operation, () is more flexible. () :: (  s m,   a) =>  s a -> a -> m a () :: (  s m,   a) => x s a -> a -> m a Modify the target of a  into your  /s state by dividing by a value and return the old value that was replaced.3When you do not need the result of the operation, () is more flexible. () :: (  s m,   a) =>  s a -> a -> m a () :: (  s m,   a) => x s a -> a -> m a Modify the target of a  into your Monad'>s state by raising it by a non-negative power and return the old value that was replaced.3When you do not need the result of the operation, () is more flexible. () :: (  s m,   a,   e) =>  s a -> e -> m a () :: (  s m,   a,   e) => x s a -> a -> m a Modify the target of a  into your Monad';s state by raising it by an integral power and return the old value that was replaced.3When you do not need the result of the operation, () is more flexible. () :: (  s m,   a,   e) =>  s a -> e -> m a () :: (  s m,   a,   e) => x s a -> e -> m a Modify 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) => x s a -> a -> m a Modify 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 => x s   ->   -> m   Modify 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 => x s   ->   -> m   Modify 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,  a r) =>  s r -> r -> m r () :: (  s m,  a r) => x s r -> r -> m r ,Run a monadic action, and set the target of  to its result. () ::   s m => s 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 l= because there are potential loss of state issues otherwise. 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. 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. for Arrows.Unlike ,  can't accept a simple ]-, 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 Adjust the target of an H returning the intermediate result, or adjust all of the targets of an m6 and return a monoidal summary along with the answer. l  f "a l    f /When you do not need access to the index then (() is more liberal in what it can accept.9If you do not need the intermediate result, you can use ( ) or even (). () :: 1 i s t a b -> (i -> a -> b) -> s -> (b, t) () ::  a b => m+ i s t a b -> (i -> a -> b) -> s -> (b, t) Adjust the target of an > returning the old value, or adjust all of the targets of an mH 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 a => m+ i s t a b -> (i -> a -> b) -> s -> (a, t) Adjust the target of an G returning a supplementary result, or adjust all of the targets of an mL and return a monoidal summary of the supplementary results and the answer. () "a   () ::  h f => 0 i s t a b -> (i -> a -> f b) -> s -> f t () ::  j f => m* 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) () ::  a r => m0 i s t a b -> (i -> a -> (r, b)) -> s -> (r, t) Adjust the target of an G returning a supplementary result, or adjust all of the targets of an mW 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,  a r) => m- i s s a b -> (i -> a -> (r, b)) -> s -> m r Adjust the target of an H returning the intermediate result, or adjust all of the targets of an mV 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,  a b) => m# i s s a b -> (i -> a -> b) -> m b Adjust the target of an > returning the old value, or adjust all of the targets of an mL 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,  a b) => m# i s s a b -> (i -> a -> b) -> m a A version of () that works on .("hello","world")^#_2"world" A version of  that works on .$storing _2 "world" ("hello","there")("hello","world")A version of () that works on .!("hello","there") & _2 #~ "world"("hello","world")A version of () that works on .!("hello","world") & _2 #%~ length ("hello",5)A version of () that works on .6("hello","world") & _2 #%%~ \x -> (length x, x ++ "!")(5,("hello","world!"))A version of () that works on .A version of () that works on .A version of () that works on ."("hello","world") & _2 <#%~ length(5,("hello",5))A version of () that works on .A version of () that works on .A version of () that works on ."("hello","there") & _2 <#~ "world"("world",("hello","world"))A version of () that works on .'There is a field for every type in the   . Very zen.[] & mapped.devoid +~ 1[]Nothing & mapped.devoid %~ absNothing  ::    a We can always retrieve a () from any type."hello"^.united()"hello" & united .~ ()"hello"#Fuse a composition of lenses using   to provide  u fusion.#In general, given a pair of lenses foo and bar fusing (foo.bar) = foo.bar  however, foo and bar are either going to  u internally or they are trivial. exploits the  2 lemma to merge these separate uses into a single  u.: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 Ya 456a 564YE144114444444444444444444444444444444444444444444424444444484444444444(C) 2012-16 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> provisional Rank2TypesNone69:;<=?CDOQRT,Provides access to the 9th field of a tuple. Access the 9th field of a tuple.+Provide access to the 8th field of a tuple. Access the 8th field of a tuple.+Provide access to the 7th field of a tuple. Access the 7th field of a tuple..Provides access to the 6th element of a tuple. Access the 6th field of a tuple.,Provides access to the 5th field of a tuple. Access the 5th field of a tuple.+Provide access to the 4th field of a tuple. Access the 4th field of a tuple.,Provides access to the 3rd field of a tuple. Access the 3rd field of a tuple.,Provides access to the 2nd field of a tuple. Access the 2nd field of a tuple._2 .~ "hello" $ (1,(),3,4)(1,"hello",3,4)(1,2,3,4) & _2 *~ 3 (1,6,3,4)_2 print (1,2)2(1,())    :: (s ->  ) -> (a, s) ->       :: ( f, . t) => (a -> f b) -> t (s, a) -> f (t (s, b))   (   ) :: ( t, ! m) => (s -> m) -> t (b, s) -> m (Provides access to 1st field of a tuple.?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' Strict version of Strict version of Strict version of Strict version of Strict version of Strict version of Strict version of Strict version of Strict version of .  k ~(a,b) = (\b' -> (a,b'))  k b 8  k ~(a,b) = (\a' -> (a',b))  k a p        !"#$%&'()*+,-./0123456789:;$e          !"#$%&'()*+,-./0123456789:;(C) 2012-16 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> provisional Rank2TypesNone9:;<=OTC<RThis 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.=RThis is a convenient alias when defining highly polymorphic code that takes both A and ?d as appropriate. If a function takes this it is expecting one of those two things based on context.> type > i = g (? i) ? 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.@0This is a useful alias for use when consuming a ~.0Most user code will never have to use this type. type @ = g A A 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.BThis 0 can be used to map over all of the values in a  h.  u "a K B  "a K  ( ) "a L B 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)] B ::  h f =>  (f a) (f b) a b If you want an { use F  u.CThis setter. can be used to modify all of the values in a  .+You sometimes have to use this rather than B -- due to temporary insanity  h is not a superclass of  .   "a K C over lifted f [a,b,c] [f a,f b,f c]set lifted b (Just a)Just bIf you want an { use F  .DThis 0 can be used to map over all of the inputs to a .  "a K D 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]EThis ( 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) E ::  (b -> r) (a -> r) a b FBuild an index-preserving  from a map-like function.Your supplied function f is required to satisfy: f   "a   f g   f h "a f (g   h) Equational reasoning: F   K "a   K   F "a   Another way to view GK is that it takes a "semantic editor combinator" and transforms it into a . F :: ((a -> b) -> s -> t) ->  s t a b GBuild a , } or { depending on your choice of . G :: ((a -> b) -> s -> t) ->  s t a b HRestore A to a full .I Build an { from any .J Clone an }.KModify the target of a  or all the targets of a  or  with a function.  u "a K B  "a K  G   K "a   K   G "a   Given any valid  l, you can also rely on the law: K l f   K l g = K l (f   g) e.g.Dover mapped f (over mapped g [a,b,c]) == over mapped (f . g) [a,b,c]TrueAnother way to view K 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) K ::  s t a b -> (a -> b) -> s -> t K :: A s t a b -> (a -> b) -> s -> t LReplace the target of a  or all of the targets of a  or  with a constant value. ( ) "a L B set _2 "hello" (1,()) (1,"hello")set mapped () [1,2,3,4] [(),(),(),()]Note: Attempting to L a m or pB will fail at compile time with an relatively nice error message. L ::  s t a b -> b -> s -> t L :: y s t a b -> b -> s -> t L ::  s t a b -> b -> s -> t L ::  s t a b -> b -> s -> t MReplace 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 L), 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 M a m or pB will fail at compile time with an relatively nice error message. M :: ~ s a -> a -> s -> s M :: x s a -> a -> s -> s M ::  s a -> a -> s -> s M ::  s a -> a -> s -> s NModifies the target of a  or all of the targets of a  or  with a user supplied function.This is an infix version of K.  u f "a B N f  f "a  N 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]] (N) :: # s t a b -> (a -> b) -> s -> t (N) :: y& s t a b -> (a -> b) -> s -> t (N) :: % s t a b -> (a -> b) -> s -> t (N) ::  s t a b -> (a -> b) -> s -> t OReplace the target of a  or all of the targets of a  or  with a constant value.This is an infix version of L!, provided for consistency with (]). f   a "a B O f   a (a,b,c,d) & _4 .~ e (a,b,c,e)(42,"world") & _1 .~ "hello"("hello","world")(a,b) & both .~ c(c,c) (O) ::  s t a b -> b -> s -> t (O) :: y s t a b -> b -> s -> t (O) ::  s t a b -> b -> s -> t (O) ::  s t a b -> b -> s -> t PSet the target of a ,  or  to  p a value. l P t "a L l ( p t) Nothing & id ?~ aJust aMap.empty & at 3 ?~ xfromList [(3,x)] (P) ::  s t a ( d b) -> b -> s -> t (P) :: y s t a ( d b) -> b -> s -> t (P) ::  s t a ( d b) -> b -> s -> t (P) ::  s t a ( d b) -> b -> s -> t QSet 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 O 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")])) (Q) :: ! s t a b -> b -> s -> (b, t) (Q) :: y$ s t a b -> b -> s -> (b, t) (Q) :: # s t a b -> b -> s -> (b, t) (Q) ::  s t a b -> b -> s -> (b, t) RSet to  p 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 P 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")])) (R) ::  s t a ( d b) -> b -> s -> (b, t) (R) :: y s t a ( d b) -> b -> s -> (b, t) (R) ::  s t a ( d b) -> b -> s -> (b, t) (R) ::  s t a ( d b) -> b -> s -> (b, t) S0Increment 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)] (S) ::   a => ~ s a -> a -> s -> s (S) ::   a => x s a -> a -> s -> s (S) ::   a =>  s a -> a -> s -> s (S) ::   a =>  s a -> a -> s -> s T/Multiply the target(s) of a numerically valued , y,  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 (T) ::   a => ~ s a -> a -> s -> s (T) ::   a => x s a -> a -> s -> s (T) ::   a =>  s a -> a -> s -> s (T) ::   a =>  s a -> a -> s -> s U0Decrement the target(s) of a numerically valued , y,  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]] (U) ::   a => ~ s a -> a -> s -> s (U) ::   a => x s a -> a -> s -> s (U) ::   a =>  s a -> a -> s -> s (U) ::   a =>  s a -> a -> s -> s V-Divide the target(s) of a numerically valued , y,  or .(a,b) & _1 //~ c (a / c,b)(a,b) & both //~ c (a / c,b / c)("Hawaii",10) & _2 //~ 2("Hawaii",5.0) (V) ::   a => ~ s a -> a -> s -> s (V) ::   a => x s a -> a -> s -> s (V) ::   a =>  s a -> a -> s -> s (V) ::   a =>  s a -> a -> s -> s W,Raise the target(s) of a numerically valued ,  or " to a non-negative integral power.(1,3) & _2 ^~ 2(1,9) (W) :: (  a,   e) => ~ s a -> e -> s -> s (W) :: (  a,   e) => x s a -> e -> s -> s (W) :: (  a,   e) =>  s a -> e -> s -> s (W) :: (  a,   e) =>  s a -> e -> s -> s X-Raise the target(s) of a fractionally valued ,  or  to an integral power.(1,2) & _2 ^^~ (-1)(1,0.5) (X) :: (  a,   e) => ~ s a -> e -> s -> s (X) :: (  a,   e) => x s a -> e -> s -> s (X) :: (  a,   e) =>  s a -> e -> s -> s (X) :: (  a,   e) =>  s a -> e -> s -> s Y/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) (Y) ::   a => ~ s a -> a -> s -> s (Y) ::   a => x s a -> a -> s -> s (Y) ::   a =>  s a -> a -> s -> s (Y) ::   a =>  s a -> a -> s -> s Z Logically   the target(s) of a  -valued  or .both ||~ True $ (False,True) (True,True)both ||~ False $ (False,True) (False,True) (Z) :: ~ s   ->   -> s -> s (Z) :: x s   ->   -> s -> s (Z) ::  s   ->   -> s -> s (Z) ::  s   ->   -> s -> s [ Logically   the target(s) of a  -valued  or .both &&~ True $ (False, True) (False,True)both &&~ False $ (False, True) (False,False) ([) :: ~ s   ->   -> s -> s ([) :: x s   ->   -> s -> s ([) ::  s   ->   -> s -> s ([) ::  s   ->   -> s -> s \Replace 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 => x s a -> a -> m () \ ::   s m =>  s a -> a -> m () \ ::   s m =>  s a -> a -> m () \ ::   s m => ~ s a -> a -> m () ]Replace 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 => x 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.^Map 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 => x 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 => A s s a b -> (a -> b) -> m () _This is an alias for (^).`Replace the target of a  or all of the targets of a  or  in our monadic state with  p& a new value, irrespective of the old.-execState (do at 1 ?= a; at 2 ?= b) Map.emptyfromList [(1,a),(2,b)]1execState (do _1 ?= b; _2 ?= c) (Just a, Nothing)(Just b,Just c) (`) ::   s m => x s ( d a) -> a -> m () (`) ::   s m =>  s ( d a) -> a -> m () (`) ::   s m =>  s ( d a) -> a -> m () (`) ::   s m => ~ s ( d a) -> a -> m () aModify the target(s) of a , y,  or  by adding a value.Example: fresh ::    r m => m  r fresh = do   a 1    %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") (a) :: (  s m,   a) => ~ s a -> a -> m () (a) :: (  s m,   a) => x s a -> a -> m () (a) :: (  s m,   a) =>  s a -> a -> m () (a) :: (  s m,   a) =>  s a -> a -> m () bModify the target(s) of a , y,  or  by subtracting a value.%execState (do _1 -= c; _2 -= d) (a,b) (a - c,b - d) (b) :: (  s m,   a) => ~ s a -> a -> m () (b) :: (  s m,   a) => x s a -> a -> m () (b) :: (  s m,   a) =>  s a -> a -> m () (b) :: (  s m,   a) =>  s a -> a -> m () cModify the target(s) of a , y,  or  by multiplying by value.%execState (do _1 *= c; _2 *= d) (a,b) (a * c,b * d) (c) :: (  s m,   a) => ~ s a -> a -> m () (c) :: (  s m,   a) => x s a -> a -> m () (c) :: (  s m,   a) =>  s a -> a -> m () (c) :: (  s m,   a) =>  s a -> a -> m () dModify the target(s) of a , y,  or  by dividing by a value.'execState (do _1 //= c; _2 //= d) (a,b) (a / c,b / d) (d) :: (  s m,   a) => ~ s a -> a -> m () (d) :: (  s m,   a) => x s a -> a -> m () (d) :: (  s m,   a) =>  s a -> a -> m () (d) :: (  s m,   a) =>  s a -> a -> m () e,Raise the target(s) of a numerically valued ,  or " to a non-negative integral power. (e) :: (  s m,   a,   e) => ~ s a -> e -> m () (e) :: (  s m,   a,   e) => x s a -> e -> m () (e) :: (  s m,   a,   e) =>  s a -> e -> m () (e) :: (  s m,   a,   e) =>  s a -> e -> m () f,Raise the target(s) of a numerically valued ,  or  to an integral power. (f) :: (  s m,   a,   e) => ~ s a -> e -> m () (f) :: (  s m,   a,   e) => x s a -> e -> m () (f) :: (  s m,   a,   e) =>  s a -> e -> m () (f) :: (  s m,   a,   e) =>  s a -> e -> m () g,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) (g) :: (  s m,   a) => ~ s a -> a -> m () (g) :: (  s m,   a) => x s a -> a -> m () (g) :: (  s m,   a) =>  s a -> a -> m () (g) :: (  s m,   a) =>  s a -> a -> m () hModify the target(s) of a , y,  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) (h) ::   s m => ~ s   ->   -> m () (h) ::   s m => x s   ->   -> m () (h) ::   s m =>  s   ->   -> m () (h) ::   s m =>  s   ->   -> m () iModify 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) (i) ::   s m => ~ s   ->   -> m () (i) ::   s m => x s   ->   -> m () (i) ::   s m =>  s   ->   -> m () (i) ::   s m =>  s   ->   -> m () j6Run a monadic action, and set all of the targets of a ,  or  to its result. (j) ::   s m => y s s a b -> m b -> m () (j) ::   s m =>  s s a b -> m b -> m () (j) ::   s m =>  s s a b -> m b -> m () (j) ::   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 j bar ... will store the result in a , , or .kSet with pass-throughKThis is useful for chaining assignment without round-tripping through your   stack. do x <-  k) 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. (k) ::   s m =>  s s a b -> b -> m b (k) ::   s m => y s s a b -> b -> m b (k) ::   s m =>  s s a b -> b -> m b (k) ::   s m =>  s s a b -> b -> m b lSet  p a value with pass-throughKThis is useful for chaining assignment without round-tripping through your   stack. do x <- / "foo" l) 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. (l) ::   s m =>  s s a ( d b) -> b -> m b (l) ::   s m => y s s a ( d b) -> b -> m b (l) ::   s m =>  s s a ( d b) -> b -> m b (l) ::   s m =>  s s a ( d b) -> b -> m b m,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!!!") (m) ::  a a =>  s t a a -> a -> s -> t (m) ::  a a => y s t a a -> a -> s -> t (m) ::  a a =>  s t a a -> a -> s -> t (m) ::  a a =>  s t a a -> a -> s -> t nModify the target(s) of a , y,  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!!!") (n) :: (  s m,  a a) => ~ s a -> a -> m () (n) :: (  s m,  a a) => x s a -> a -> m () (n) :: (  s m,  a a) =>  s a -> a -> m () (n) :: (  s m,  a a) =>  s a -> a -> m () o Write to a fragment of a larger Writer format.pThis is a generalization of  ; that alows you to modify just a portion of the resulting  .qThis is a generalization of  ; that alows you to modify just a portion of the resulting  ! with access to the index of an }.rThis is a generalization of   that alows you to  " just a portion of the resulting  .sThis is a generalization of   that alows you to  " just a portion of the resulting  ", with access to the index of an }.t%Map with index. This is an alias for ~./When you do not need access to the index, then K' is more liberal in what it can accept. K l "a t l     t l "a K l    t :: }) i s t a b -> (i -> a -> b) -> s -> t t :: + i s t a b -> (i -> a -> b) -> s -> t t :: & i s t a b -> (i -> a -> b) -> s -> t uSet with index. Equivalent to t with the current value ignored./When you do not need access to the index, then L' is more liberal in what it can accept. L l "a u l     u :: }$ i s t a b -> (i -> b) -> s -> t u :: & i s t a b -> (i -> b) -> s -> t u :: ! i s t a b -> (i -> b) -> s -> t v Build an } from an -like function.Your supplied function f is required to satisfy: f   "a   f g   f h "a f (g   h) Equational reasoning: v   t "a   t   v "a   Another way to view vu is that it takes a "semantic editor combinator" which has been modified to carry an index and transforms it into a }.wAdjust every target of an },  or  with access to the index. (w) "a t /When you do not need access to the index then (N() is more liberal in what it can accept. l N f "a l w   f (w) :: }* i s t a b -> (i -> a -> b) -> s -> t (w) :: , i s t a b -> (i -> a -> b) -> s -> t (w) :: & i s t a b -> (i -> a -> b) -> s -> t xReplace every target of an },  or  with access to the index. (x) "a u /When you do not need access to the index then (O() is more liberal in what it can accept. l O b "a l x   b (x) :: }% i s t a b -> (i -> b) -> s -> t (x) :: ' i s t a b -> (i -> b) -> s -> t (x) :: ! i s t a b -> (i -> b) -> s -> t y/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 y   f (y) ::   s m => }( i s s a b -> (i -> a -> b) -> m () (y) ::   s m => * i s s a b -> (i -> a -> b) -> m () (y) ::   s m => $ i s t a b -> (i -> a -> b) -> m () zThis is an alias for (y).{0Replace 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 () |ERun an arrow command and use the output to set all the targets of a ,  or  to the result.| can be used very similarly to (jN), 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  c   ( r,  ,  ) | ::   p => y! 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 }} is a deprecated alias for K.~&Map with index. (Deprecated alias for t)./When you do not need access to the index, then }' is more liberal in what it can accept. } l "a ~ l     ~ :: }) i s t a b -> (i -> a -> b) -> s -> t ~ :: + i s t a b -> (i -> a -> b) -> s -> t ~ :: & i s t a b -> (i -> a -> b) -> s -> t C<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~K|}~<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~K~}|A@?>=<GFHIJBCDEKLONSUTVWXYZm[QPR\_]^abcdefginhk`ljopqrsM~tuzvwxy{|}C<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~#N4O4P4Q4R4S4T4U4V4W4X4Y4Z4[4]4^4`4a4b4c4d4e4f4g4h4i4j2k4l4m4n4w4x4y4{4(C) 2012-2016 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> experimental non-portable TrustworthyWThis class provides a generalized notion of list reversal extended to other containers.This is used internally by the sT 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 type  a s t =  a a s t$This type is used internally by the p9 code to provide efficient access to the two parts of a Prism.(C) 2012-2016 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> experimental non-portableNone 9;<=?DEORT NThis alias is helpful when it comes to reducing repetition in type signatures. type  p g a t =  p g a a t  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 ", but there must be a better way!NThis alias is helpful when it comes to reducing repetition in type signatures. type  p a t =  p a a t This is used to characterize a l.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 l1 that has already been applied to some structure.Where a 5 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 .NThis alias is helpful when it comes to reducing repetition in type signatures. type  p g a t =  p g a a t  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 ", but there must be a better way!NThis alias is helpful when it comes to reducing repetition in type signatures. type  p a t =  p a a t This is used to characterize a l.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 l1 that has already been applied to some structure.Where a 5 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 .&This class is used to run the various  variants used in this library.;1(C) 2012-2016 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> experimental non-portableNone%&9;<=DEORTBThis 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 BThis is used to generate an indexed magma from an unindexed sourceTBy constructing it this way we avoid infinite reassociations in sums where possible.;This is a a non-reassociating initially encoded version of .<This provides a way to peek at the internal structure of a l or mRun a J where all the individual leaves have been converted to the expected type Generate a  using from a prefix sum. Generate a ? with leaves only while the predicate holds from left to right.'(C) 2012-16 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> experimental Rank2TypesNone !"#$%&'()*+,-./0123456789:;<=>?@ABC   ,-./0123456789:;=<>?@ABCDEF(C) 2012-16 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> provisional Rank2TypesNone9;<=OTrThis is a convenient alias used when consuming (indexed) getters and (indexed) folds in a highly general fashion.Used to consume an  o.UWhen you see this in a type signature it indicates that you can pass the function a , p, l,  n, p, sI, or one of the indexed variants, and it will just "do the right thing".Most p- combinators are able to be used with both a p or a  nd in limited situations, to do so, they need to be monomorphic in what we are going to extract with  . To be compatible with , l and s. 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  n (or l'), otherwise you can only pass this a p or .Build an (index-preserving) p$ from an arbitrary Haskell function.  f    g "a  (g   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) -> n s a   :: (s -> (i, a)) -> o i s a ,Build an constant-valued (index-preserving) p! from an arbitrary Haskell value.  a    b "a  b a   b "a b a   b "a a   (  b) $This can be useful as a second case failing a m e.g. foo failing  0  :: a -> n s a   :: i -> a -> o i s a View the value pointed to by a p, s or 5 or the result of folding over all the results of a  n or l" that points at a monoidal value.     "a    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 p2 or obtain a monoidal summary of the targets of a mU, It may be useful to think of it as having one of these more restricted signatures:  :: p s a -> s -> a  ::  m =>  n s m -> s -> m  ::  s a -> s -> a  ::  s a -> s -> a  ::  m =>  s m -> s -> m 7In a more general setting, such as when working with a   transformer stack you can use:  ::   s m => p s a -> m a  :: (  s m,  a) =>  n s a -> m a  ::   s m =>  s a -> m a  ::   s m =>  s a -> m a  :: (  s m,  a) =>  s a -> m a -View a function of the value pointed to by a p or G or the result of folding over the result of mapping the targets of a  n or l.  l f "a  (l    f) views (to f) g ag (f a)views _2 length (1,"hello")5As , is commonly used to access the target of a p2 or obtain a monoidal summary of the targets of a mU, It may be useful to think of it as having one of these more restricted signatures:  :: p s a -> (a -> r) -> s -> r  ::  m =>  n! s a -> (a -> m) -> s -> m  :: ! s a -> (a -> r) -> s -> r  ::  s a -> (a -> r) -> s -> r  ::  m =>  s a -> (a -> m) -> s -> m 7In a more general setting, such as when working with a   transformer stack you can use:  ::   s m => p s a -> (a -> r) -> m r  :: (  s m,  r) =>  n 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 View the value pointed to by a p or 5 or the result of folding over all the results of a  n or l" 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 ( ). (a,b)^._2b("hello","world")^._2"world"import Data.Complex$((0, 1 :+ 2), 3)^._1._2.to magnitude2.23606797749979 () :: s -> p s a -> a () ::  m => s ->  n s m -> m () :: s ->  s a -> a () :: s ->  s a -> a () ::  m => s ->  s m -> m Use the target of a , s, or p. in the current state, or use a summary of a  n or l" that points to a monoidal value.evalState (use _1) (a,b)a$evalState (use _1) ("hello","world")"hello"  ::   s m => p s a -> m a  :: (  s m,  r) =>  n s r -> m r  ::   s m =>  s a -> m a  ::   s m =>  s a -> m a  :: (  s m,  r) =>  s r -> m r Use the target of a , s or p. in the current state, or use a summary of a  n or l" that points to a monoidal value.,evalState (uses _1 length) ("hello","world")5  ::   s m => p s a -> (a -> r) -> m r  :: (  s m,  r) =>  n 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 This is a generalized form of  D that only extracts the portion of the log that is focused on by a p . If given a m or a U then a monoidal summary of the parts of the log that are visited will be returned.  ::   w m => p w u -> m a -> m (a, u)  ::   w m =>  w u -> m a -> m (a, u)  ::   w m => x w u -> m a -> m (a, u)  :: (  w m,  a u) => m w u -> m a -> m (a, u)  :: (  w m,  a u) =>  w u -> m a -> m (a, u)  :: (  w m,  a u) => t w u -> m a -> m (a, u) This is a generalized form of  D that only extracts the portion of the log that is focused on by a p . If given a m or a U then a monoidal summary of the parts of the log that are visited will be returned.  ::   w m => o# i w u -> m a -> m (a, (i, u))  ::   w m => $ i w u -> m a -> m (a, (i, u))  :: (  w m,  a u) => l% i w u -> m a -> m (a, (i, u))  :: (  w m,  a u) =>  i w u -> m a -> m (a, (i, u)) This is a generalized form of  D that only extracts the portion of the log that is focused on by a p . If given a m or a U then a monoidal summary of the parts of the log that are visited will be returned.  ::   w m => p( w u -> (u -> v) -> m a -> m (a, v)  ::   w m => ) w u -> (u -> v) -> m a -> m (a, v)  ::   w m => x* w u -> (u -> v) -> m a -> m (a, v)  :: (  w m,  a v) => m* w u -> (u -> v) -> m a -> m (a, v)  :: (  w m,  a v) => $ w u -> (u -> v) -> m a -> m (a, v)  :: (  w m,  a v) => t( w u -> (u -> v) -> m a -> m (a, v) This is a generalized form of  D that only extracts the portion of the log that is focused on by a p . If given a m or a U then a monoidal summary of the parts of the log that are visited will be returned.  ::   w m => o- w u -> (i -> u -> v) -> m a -> m (a, v)  ::   w m => . w u -> (i -> u -> v) -> m a -> m (a, v)  :: (  w m,  a v) => l/ w u -> (i -> u -> v) -> m a -> m (a, v)  :: (  w m,  a v) => ) w u -> (i -> u -> v) -> m a -> m (a, v) View the index and value of an o( into the current environment as a pair.When applied to an l 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. -View a function of the index and value of an o into the current environment.When applied to an lB the result will be a monoidal summary instead of a single answer.   "a    Use the index and value of an o" into the current state as a pair.When applied to an l 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. ,Use a function of the index and value of an o into the current state.When applied to an lB the result will be a monoidal summary instead of a single answer. View the index and value of an o 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 ( ). (  ) :: s -> o i s a -> (i, a) (  ) :: s ->  i s a -> (i, a) AThe result probably doesn't have much meaning when applied to an l.  Coerce a p -compatible b to a a. This is useful when using a  that is not simple as a p or a m.      op     po          8 8(C) 2012-16 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> provisional non-portableNoneOTAn analogue of  for .  :: (b -> t) -> Review' t b  =  .  Turn a p around to get a w  =  .   =  .  un (to length) # [1,2,3]3Turn a u or s around to build a p.If you have an s, B is a more powerful version of this function that will return an s instead of a mere p. 5 ^.re _LeftLeft 56 ^.re (_Left.unto succ)Left 7  "a      "a      "a      "a      :: u s t a b -> p b t  :: y s t a b -> p b t This can be used to turn an s or u around and ? a value (or the current environment) through it the other way.  "a      .  "a   review _Left "mustard"Left "mustard"review (unto succ) 56Usually  is used in the (->)   with a u or sh, in which case it may be useful to think of it as having one of these more restricted type signatures:  :: x s a -> a -> s  :: t s a -> a -> s However, when working with a  9 transformer stack, it is sometimes useful to be able to  the current environment, in which case it may be beneficial to think of it as having one of these slightly more liberal type signatures:  ::   a m => x s a -> m s  ::   a m => t s a -> m s An infix alias for .  f # x "a f x l # x "a x   l #This is commonly used when using a u as a smart constructor. _Left # 4Left 4But it can be used for any u base 16 # 123"7b" (#) :: x s a -> a -> s (#) :: t s a -> a -> s (#) :: w s a -> a -> s (#) :: r s a -> a -> s This can be used to turn an s or u around and U a value (or the current environment) through it the other way, applying a function.  "a      ( f) g "a g   f reviews _Left isRight "mustard"Falsereviews (unto succ) (*2) 38%Usually this function is used in the (->)   with a u or sh, in which case it may be useful to think of it as having one of these more restricted type signatures:  :: x s a -> (s -> r) -> a -> r  :: t s a -> (s -> r) -> a -> r However, when working with a  9 transformer stack, it is sometimes useful to be able to  the current environment, in which case it may be beneficial to think of it as having one of these slightly more liberal type signatures:  ::   a m => x s a -> (s -> r) -> m r  ::   a m => t s a -> (s -> r) -> m r This can be used to turn an s or u around and ? a value (or the current environment) through it the other way.  "a         "a   evalState (reuse _Left) 5Left 5evalState (reuse (unto succ)) 56  ::   a m => t s a -> m s  ::   a m => x s a -> m s This can be used to turn an s or u around and B the current state through it the other way, applying a function.  "a      ( f) g "a   (g   f) *evalState (reuses _Left isLeft) (5 :: Int)True  ::   a m => t s a -> (s -> r) -> m r  ::   a m => x s a -> (s -> r) -> m r vwwv8(C) 2012-16 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> provisional non-portable TrustworthyOT type APrism' = g  KIf you see this in a signature for a function, the function is expecting a u.Convert / to the pair of functions that characterize it.Clone a u6 so that you can reuse the same monomorphically typed u for different purposes.See  and / for examples of why you might want to do this.Build a p. c t a is used instead of  d a to permit the types of s and t to differ. This is usually used to build a t*, when you have to use an operation like  which already returns a  d.Use a u" as a kind of first-class pattern.  :: u s t a b -> $ (t -> r) (s -> r) (b -> r) (a -> r)%Given a pair of prisms, project sums. Viewing a u as a co-,, this combinator can be seen to be dual to .Use a u" to work over part of a structure.lift a u through a Z functor, giving a Prism that matches only if all the elements of the container match the u.:[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"]] Check to see if this u doesn't match.isn't _Left (Right 12)Trueisn't _Left (Left 12)Falseisn't _Empty []False!!Retrieve the value targeted by a uW 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 Nothing"This u provides a  for tweaking the   half of an  c: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  c: _Left # 5Left 5 5^.re _LeftLeft 5#This u provides a  for tweaking the   half of an  c: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  c: _Right # 5Right 5 5^.re _RightRight 5$This u provides a ) for tweaking the target of the value of  p in a  d.over _Just (+1) (Just 2)Just 3Unlike   this is a u*, and so you can use it to inject as well: _Just # 5Just 5 5^.re _JustJust 5Interestingly, m ^? $ "a m Just x ^? _JustJust xNothing ^? _JustNothing%This u provides the  of a   in a  d.Nothing ^? _NothingJust ()Just () ^? _NothingNothing3But you can turn it around and use it to construct   as well: _Nothing # ()Nothing& & is a logically uninhabited data type. This is a u that will always fail to match.'This u0 compares for exact equality with a given value. only 4 # ()4 5 ^? only 4Nothing(This u 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 ( []   :: t [a] ()To comply with the u" 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 u.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. )7This is an improper prism for text formatting based on   and  .This uq 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  !"#$%&'()tu !"#$%&'()ut !"#$%&)'( !"#$%&'()(C) 2012-16 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> provisional Rank2TypesNone 9;<=?DR*This class allows us to use +O part of the environment, changing the environment supplied by many different   transformers. Unlike -4 this can change the environment of a deeply nested   transformer. Also, unlike -", this can be used with any valid p, but cannot be used with a  or m.+MRun a monadic action in a larger environment than it was defined in, using a p.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     into a   with a larger environment type.)This can be used to edit pretty much any  - transformer stack with an environment in it:(1,2) & magnify _2 (+1)33flip Reader.runReader (1,2) $ magnify _1 Reader.ask1Dflip Reader.runReader (1,2,[10..20]) $ magnify (_3._tail) Reader.ask[11,12,13,14,15,16,17,18,19,20] + :: p s a -> (a -> r) -> s -> r + ::  a r => m s a -> (a -> r) -> s -> r + ::  a w => p s t ->   t w st c ->   s w st c + :: ( a w,  a c) => m s a ->   a w st c ->   s w st c ... ,This class allows us to use - in, changing the   supplied by many different  , transformers, potentially quite deep in a   transformer stack.-!Run a monadic action in a larger  " than it was defined in, using a  or .3This is commonly used to lift actions in a simpler     into a     with a larger   type.When applied to a 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   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 - ::   m =>  s t ->   t m a ->   s m a - :: (  m,  a c) =>  s t ->   t m c ->   s m c - :: (  m,  a w) =>  s t ->   r w t m c ->   r w s m c - :: (  m,  a w,  a c) =>  s t ->   r w t m c ->   r w s m c - :: (  m,  a w,   e) =>  s t ->   e (  r w t m) c ->   e (  r w s m) c - :: (  m,  a w,  a c,   e) =>  s t ->   e (  r w t m) c ->   e (  r w s m) c ... .This type family is used by *$ to describe the common effect type./This type family is used by ,$ to describe the common effect type.3 + =  *+,-./0123456789:;<=>?@A*+,-./.*+,-/*+,-./0123456789:;<=>?@A+2-2(C) 2012-16 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> provisionalportable TrustworthyOTBThis % 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 B.CConstruct a set from a p,  n, l, q or s. C ::   a => p s a -> s ->   a C :: (  a,   a) => m s a -> s ->   a C ::   a => x s a -> s ->   a C ::   a =>  s a -> s ->   a C :: (  a,   a) =>  s a -> s ->   a BCBCBCBC(C) 2014-2016 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> experimental non-portableNoneDConstruct a map from a o,  o, m or r%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")]*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")] D :: o i s a -> s ->   i a D ::   i => l i s a -> s ->   i a D ::  i s a -> s ->   i a D ::   i =>  i s a -> s ->   i a DDDD(C) 2012-16 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> provisionalportableNoneOTEThis % can be used to change the type of a  ( by mapping the elements to new values. Sadly, you can't create a valid  for a  ., but you can manipulate it by reading using   and reindexing it via E.(over setmapped (+1) (fromList [1,2,3,4])fromList [2,3,4,5]FConstruct a set from a p,  n, l, q or s.setOf folded ["hello","world"]fromList ["hello","world"]5setOf (folded._2) [("hello",1),("world",2),("!!!",3)]fromList [1,2,3] F :: p s a -> s ->   a F ::   a => m s a -> s ->   a F :: x s a -> s ->   a F ::  s a -> s ->   a F ::   a =>  s a -> s ->   a EFEFEFEF (C) 2012-16 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> provisional Rank2TypesNone9:;<=OTiG Obtain a m( by lifting an operation that returns a   result.+This can be useful to lift operations from  Data.List and elsewhere into a m.[1,2,3,4]^..folding tail[2,3,4]I Obtain a m by lifting   like function.[1,2,3,4]^..foldring foldr [1,2,3,4]JObtain  FoldWithIndex by lifting   like function.K Obtain a m from any   indexed by ordinal position.Just 3^..folded[3]Nothing^..folded[][(1,2),(3,4)]^..folded.both [1,2,3,4]L Obtain a m from any   indexed by ordinal position.MForm a j by repeating the input forever.   "a [ M "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] M :: j a a NA m that replicates its input n times.   n "a [ (N n) 5^..replicated 20)[5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5]OTransform a non-empty m into a j, that loops over its elements over and over.0timingOut $ [1,2,3]^..taking 7 (cycled traverse)[1,2,3,1,2,3,1] O :: j s a -> j s a PBuild a m% that unfolds its values from a seed.  "a [   P ?10^..unfolded (\b -> if b == 0 then Nothing else Just (b, b-1))[10,9,8,7,6,5,4,3,2,1]Qx  Q f returns an infinite j of repeated applications of f to x. [ (Q f) a "a   f a Q :: (a -> a) -> j a a R Obtain an m- that can be composed with to filter another , y, p, m (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 uO, unless you are very careful not to inject a value that matches the predicate.*As a counter example, consider that given evens = R   the second  law is violated:  evens      evens      evens (     ) ,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.S Obtain a m! by taking elements from another m, , y, p or  while a predicate holds.   p "a [ (S p K) 5timingOut $ toListOf (takingWhile (<=3) folded) [1..][1,2,3] S :: (a ->  ) -> m s a -> m s a S :: (a ->  ) -> p s a -> m s a S :: (a ->  ) ->  s a -> m s a -- * See note below S :: (a ->  ) ->  s a -> m s a -- * See note below S :: (a ->  ) -> t s a -> m s a -- * See note below S :: (a ->  ) -> x s a -> m s a -- * See note below S :: (a ->  ) ->  i s a -> l i s a -- * See note below S :: (a ->  ) ->  i s a -> l i s a -- * See note below S :: (a ->  ) -> l i s a -> l i s a S :: (a ->  ) -> o i s a -> l i s a Note: When applied to a , S3 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.T Obtain a m# by dropping elements from another m, , y, p or  while a predicate holds.   p "a [ (T p K) ,toListOf (droppingWhile (<=3) folded) [1..6][4,5,6]-toListOf (droppingWhile (<=3) folded) [1,6,1][6,1] T :: (a ->  ) -> m s a -> m s a T :: (a ->  ) -> p s a -> m s a T :: (a ->  ) ->  s a -> m! s a -- see notes T :: (a ->  ) ->  s a -> m! s a -- see notes T :: (a ->  ) -> t s a -> m! s a -- see notes T :: (a ->  ) -> x s a -> m! s a -- see notes  T :: (a ->  ) ->  s a -> k s a -- see notes T :: (a ->  ) ->  s a -> k s a -- see notes T :: (a ->  ) -> n s a -> k s a T :: (a ->  ) -> k s a -> k s a  T :: (a ->  ) ->  i s a -> l i s a -- see notes T :: (a ->  ) ->  i s a -> l i s a -- see notes T :: (a ->  ) -> o i s a -> l i s a T :: (a ->  ) -> l i s a -> l 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 also pass the predicate! Otherwise subsequent traversals will visit fewer elements and  fusion is not sound.UA m over the individual   of a  . U :: m     U ::       U :: l  r     U ::   r     %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).VA m over the individual   of a  . V :: m     V ::       V :: l  r     V ::   r     %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.W.Map each part of a structure viewed through a , p, m or % to a monoid and combine the results.:foldMapOf (folded . both . _Just) Sum [(Just 21, Just 21)]Sum {getSum = 42}   = W K  W "a   l = W l     W :: p s a -> (a -> r) -> s -> r W ::  a r => m! s a -> (a -> r) -> s -> r W ::  s a -> (a -> r) -> s -> r W :: x! s a -> (a -> r) -> s -> r W ::  a r =>  s a -> (a -> r) -> s -> r W ::  a r => t s a -> (a -> r) -> s -> r W ::  r s a -> (a -> r) -> s -> r X5Combine the elements of a structure viewed through a , p, m or  using a monoid.>foldOf (folded.folded) [[Sum 1,Sum 4],[Sum 8, Sum 8],[Sum 21]]Sum {getSum = 42}   = X K  X "a  X :: p s m -> s -> m X ::  a m => m s m -> s -> m X ::  s m -> s -> m X :: x s m -> s -> m X ::  a m =>  s m -> s -> m X ::  a m => t s m -> s -> m YIRight-associative fold of parts of a structure that are viewed through a , p, m or .   "a Y K  Y :: p) s a -> (a -> r -> r) -> r -> s -> r Y :: m+ s a -> (a -> r -> r) -> r -> s -> r Y :: * s a -> (a -> r -> r) -> r -> s -> r Y :: x+ s a -> (a -> r -> r) -> r -> s -> r Y :: % s a -> (a -> r -> r) -> r -> s -> r Y :: t) s a -> (a -> r -> r) -> r -> s -> r   l "a Y l    Y ::  ( ( r) s a -> (a -> r -> r) -> r -> s -> r ZLLeft-associative fold of the parts of a structure that are viewed through a , p, m or .   "a Z K Z :: p) s a -> (r -> a -> r) -> r -> s -> r Z :: m+ s a -> (r -> a -> r) -> r -> s -> r Z :: * s a -> (r -> a -> r) -> r -> s -> r Z :: x+ s a -> (r -> a -> r) -> r -> s -> r Z :: % s a -> (r -> a -> r) -> r -> s -> r Z :: t) s a -> (r -> a -> r) -> r -> s -> r [#Extract a list of the targets of a m . See also (\).   "a [ K (\) "a   [ \(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 \ K (\) "a   [ (\ ) :: s -> p s a ->  '^..'a :: s -> m s a ->  '^..'a :: s ->  s a ->  '^..'a :: s -> x s a ->  '^..'a :: s ->  s a ->  '^..'a :: s -> t s a -> [a] ]Returns   if every target of a m is  .andOf both (True,False)FalseandOf both (True,True)True   "a ] K ] :: p s   -> s ->   ] :: m s   -> s ->   ] ::  s   -> s ->   ] :: x s   -> s ->   ] ::  s   -> s ->   ] :: t s   -> s ->   ^Returns   if any target of a m is  .orOf both (True,False)TrueorOf both (False,False)False   "a ^ K ^ :: p s   -> s ->   ^ :: m s   -> s ->   ^ ::  s   -> s ->   ^ :: x s   -> s ->   ^ ::  s   -> s ->   ^ :: t s   -> s ->   _Returns   if any target of a m satisfies a predicate.anyOf both (=='x') ('x','y')Trueimport Data.Data.LensBanyOf biplate (== "world") (((),2::Int),"hello",("world",11::Int))True   "a _ K   l "a _ l    _ :: p s a -> (a ->   ) -> s ->   _ :: m s a -> (a ->   ) -> s ->   _ ::  s a -> (a ->   ) -> s ->   _ :: x s a -> (a ->   ) -> s ->   _ ::  s a -> (a ->   ) -> s ->   _ :: t s a -> (a ->   ) -> s ->   `Returns   if every target of a m satisfies a predicate.allOf both (>=3) (4,5)TrueallOf folded (>=2) [1..10]False   "a ` K   l = ` l    ` :: p s a -> (a ->   ) -> s ->   ` :: m s a -> (a ->   ) -> s ->   ` ::  s a -> (a ->   ) -> s ->   ` :: x s a -> (a ->   ) -> s ->   ` ::  s a -> (a ->   ) -> s ->   ` :: t s a -> (a ->   ) -> s ->   aReturns   only if no targets of a m satisfy a predicate.2noneOf each (is _Nothing) (Just 3, Just 4, Just 5)True3noneOf (folded.folded) (<10) [[13,99,20],[3,71,42]]False  l = a l    a :: p s a -> (a ->   ) -> s ->   a :: m s a -> (a ->   ) -> s ->   a ::  s a -> (a ->   ) -> s ->   a :: x s a -> (a ->   ) -> s ->   a ::  s a -> (a ->   ) -> s ->   a :: t s a -> (a ->   ) -> s ->   bCalculate the   of every number targeted by a m.productOf both (4,5)20productOf folded [1,2,3,4,5]120   "a b K [This operation may be more strict than you would expect. If you want a lazier version use ala     W b ::   a => p s a -> s -> a b ::   a => m s a -> s -> a b ::   a =>  s a -> s -> a b ::   a => x s a -> s -> a b ::   a =>  s a -> s -> a b ::   a => t s a -> s -> a cCalculate the   of every number targeted by a m.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 c K [This operation may be more strict than you would expect. If you want a lazier version use ala     W c _1 ::   a => (a, b) -> a c (K   ) :: (  f,   a) => f (a, b) -> a c ::   a => p s a -> s -> a c ::   a => m s a -> s -> a c ::   a =>  s a -> s -> a c ::   a => x s a -> s -> a c ::   a =>  s a -> s -> a c ::   a => t s a -> s -> a d&Traverse over all of the targets of a m (or p), computing an  j (or  h)-based answer, but unlike # do not construct a new structure. d generalizes   to work over any m.When passed a p, d can work over any  h, but when passed a m, d requires an  j.+traverseOf_ both putStrLn ("hello","world")helloworld   "a d K  d _2 ::  h# f => (c -> f r) -> (d, c) -> f () d  ::  j f => (a -> f b) ->  c a c -> f ()   l "a d l    !The rather specific signature of d5 allows it to be used as if the signature was any of: d ::  h f => p$ s a -> (a -> f r) -> s -> f () d ::  j f => m& s a -> (a -> f r) -> s -> f () d ::  h f => % s a -> (a -> f r) -> s -> f () d ::  h f => x& s a -> (a -> f r) -> s -> f () d ::  j f =>  s a -> (a -> f r) -> s -> f () d ::  j f => t$ s a -> (a -> f r) -> s -> f () e&Traverse over all of the targets of a m (or p), computing an  j (or  h)-based answer, but unlike # do not construct a new structure. e generalizes   to work over any m.When passed a p, e can work over any  h, but when passed a m, e requires an  j.   "a e K &forOf_ both ("hello","world") putStrLnhelloworld!The rather specific signature of e5 allows it to be used as if the signature was any of:  l s "a e l s    e ::  h f => p$ s a -> s -> (a -> f r) -> f () e ::  j f => m& s a -> s -> (a -> f r) -> f () e ::  h f => % s a -> s -> (a -> f r) -> f () e ::  h f => x& s a -> s -> (a -> f r) -> f () e ::  j f =>  s a -> s -> (a -> f r) -> f () e ::  j f => t$ s a -> s -> (a -> f r) -> f () f&Evaluate each action in observed by a m9 on a structure from left to right, ignoring the results.   "a f K 5sequenceAOf_ both (putStrLn "hello",putStrLn "world")helloworld f ::  h f => p s (f a) -> s -> f () f ::  j f => m s (f a) -> s -> f () f ::  h f =>  s (f a) -> s -> f () f ::  h f => x s (f a) -> s -> f () f ::  j f =>  s (f a) -> s -> f () f ::  j f => t s (f a) -> s -> f () gMap each target of a mg 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 g K g ::   m => p$ s a -> (a -> m r) -> s -> m () g ::   m => m& s a -> (a -> m r) -> s -> m () g ::   m => % s a -> (a -> m r) -> s -> m () g ::   m => x& s a -> (a -> m r) -> s -> m () g ::   m =>  s a -> (a -> m r) -> s -> m () g ::   m => t$ s a -> (a -> m r) -> s -> m () hh is g# with two of its arguments flipped.'forMOf_ both ("hello","world") putStrLnhelloworld   "a h K h ::   m => p$ s a -> s -> (a -> m r) -> m () h ::   m => m& s a -> s -> (a -> m r) -> m () h ::   m => % s a -> s -> (a -> m r) -> m () h ::   m => x& s a -> s -> (a -> m r) -> m () h ::   m =>  s a -> s -> (a -> m r) -> m () h ::   m => t$ s a -> s -> (a -> m r) -> m () i-Evaluate each monadic action referenced by a m= on the structure from left to right, and ignore the results.4sequenceOf_ both (putStrLn "hello",putStrLn "world")helloworld   "a i K i ::   m => p s (m a) -> s -> m () i ::   m => m s (m a) -> s -> m () i ::   m =>  s (m a) -> s -> m () i ::   m => x s (m a) -> s -> m () i ::   m =>  s (m a) -> s -> m () i ::   m => t s (m a) -> s -> m () j1The sum of a collection of actions, generalizing o.asumOf both ("hello","world") "helloworld",asumOf each (Nothing, Just "hello", Nothing) Just "hello"   "a j K j ::   f => p s (f a) -> s -> f a j ::   f => m s (f a) -> s -> f a j ::   f =>  s (f a) -> s -> f a j ::   f => x s (f a) -> s -> f a j ::   f =>  s (f a) -> s -> f a j ::   f => t s (f a) -> s -> f a k1The sum of a collection of actions, generalizing o.msumOf both ("hello","world") "helloworld",msumOf each (Nothing, Just "hello", Nothing) Just "hello"   "a k K k ::   m => p s (m a) -> s -> m a k ::   m => m s (m a) -> s -> m a k ::   m =>  s (m a) -> s -> m a k ::   m => x s (m a) -> s -> m a k ::   m =>  s (m a) -> s -> m a k ::   m => t s (m a) -> s -> m a l/Does the element occur anywhere within a given m of the structure?%elemOf both "hello" ("hello","world")True   "a l K l ::   a => p s a -> a -> s ->   l ::   a => m s a -> a -> s ->   l ::   a =>  s a -> a -> s ->   l ::   a => x s a -> a -> s ->   l ::   a =>  s a -> a -> s ->   l ::   a => t s a -> a -> s ->   m3Does the element not occur anywhere within a given m of the structure? notElemOf each 'd' ('a','b','c')True notElemOf each 'a' ('a','b','c')False   "a m K m ::   a => p s a -> a -> s ->   m ::   a => m s a -> a -> s ->   m ::   a => x s a -> a -> s ->   m ::   a =>  s a -> a -> s ->   m ::   a =>  s a -> a -> s ->   m ::   a => t s a -> a -> s ->   n)Map a function over all the targets of a m4 of a container and concatenate the resulting lists.)concatMapOf both (\x -> [x, x + 1]) (1,3) [1,2,3,4]   "a n K n :: p# s a -> (a -> [r]) -> s -> [r] n :: m% s a -> (a -> [r]) -> s -> [r] n :: $ s a -> (a -> [r]) -> s -> [r] n :: x% s a -> (a -> [r]) -> s -> [r] n ::  s a -> (a -> [r]) -> s -> [r] o+Concatenate all of the lists targeted by a m into a longer list.concatOf both ("pan","ama")"panama"   "a o K o "a  o :: p s [r] -> s -> [r] o :: m s [r] -> s -> [r] o :: x s [r] -> s -> [r] o ::  s [r] -> s -> [r] o ::  s [r] -> s -> [r] p0Calculate the number of targets there are for a m 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 p K lengthOf _1 ("hello",())1lengthOf traverse [1..10]100lengthOf (traverse.traverse) [[1,2],[3,4],[5,6]]6 p (K   K) :: (  f,   g) => f (g a) ->  r p :: p s a -> s ->  r p :: m s a -> s ->  r p ::  s a -> s ->  r p :: x s a -> s ->  r p ::  s a -> s ->  r qPerform a safe   of a m or  or retrieve  p the result from a p or . When using a  as a partial , or a m as a partial p= 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 sI instead, which can deal more gracefully with heavily left-biased trees.Left 4 ^?_LeftJust 4Right 4 ^?_LeftNothing"world" ^? ix 3Just 'l'"world" ^? ix 20Nothing (q) "a    (q ) :: s -> p s a ->  d a (q ) :: s -> m s a ->  d a (q ) :: s ->  s a ->  d a (q ) :: s -> x s a ->  d a (q ) :: s ->  s a ->  d a rPerform an *UNSAFE*   of a m or  assuming that it is there.Left 4 ^?! _Left4"world" ^?! ix 3'l' (r ) :: s -> p s a -> a (r ) :: s -> m s a -> a (r ) :: s ->  s a -> a (r ) :: s -> x s a -> a (r ) :: s ->  s a -> a s Retrieve the   entry of a m or  or retrieve  p the result from a p or .>The answer is computed in a manner that leaks space less than ala     W- and gives you back access to the outermost  p@ constructor more quickly, but may have worse constant factors.firstOf traverse [1..10]Just 1firstOf both (1,2)Just 1firstOf ignored ()Nothing s :: p s a -> s ->  d a s :: m s a -> s ->  d a s ::  s a -> s ->  d a s :: x s a -> s ->  d a s ::  s a -> s ->  d a t Retrieve the   entry of a m or  or retrieve  p the result from a p or .>The answer is computed in a manner that leaks space less than ala     W- and gives you back access to the outermost  p@ constructor more quickly, but may have worse constant factors.lastOf traverse [1..10]Just 10lastOf both (1,2)Just 2lastOf ignored ()Nothing t :: p s a -> s ->  d a t :: m s a -> s ->  d a t ::  s a -> s ->  d a t :: x s a -> s ->  d a t ::  s a -> s ->  d a uReturns   if this m or ' has no targets in the given container.Note: u on a valid y,  or p should always return  .   "a u K /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 u (K   _1   K) :: (  f,   g) => f (g a, b) ->   u :: p s a -> s ->   u :: m s a -> s ->   u :: x s a -> s ->   u ::  s a -> s ->   u ::  s a -> s ->   vReturns   if this m or ( has any targets in the given container.5A more "conversational" alias for this combinator is .Note: v on a valid y,  or p should always return  .       "a v K /This may be rather inefficient compared to the       check of many containers.notNullOf _1 (1,2)TruenotNullOf traverse [1..10]TruenotNullOf folded []FalsenotNullOf (element 20) [1..10]False v (K   _1   K) :: (  f,   g) => f (g a, b) ->   v :: p s a -> s ->   v :: m s a -> s ->   v :: x s a -> s ->   v ::  s a -> s ->   v ::  s a -> s ->   w2Obtain the maximum element (if any) targeted by a m or  safely.Note: w on a valid y,  or p will always return  p 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 K bIn the interest of efficiency, This operation has semantics more strict than strictly necessary.   (W l ), has lazier semantics but could leak memory. w ::   a => p s a -> s ->  d a w ::   a => m s a -> s ->  d a w ::   a => x s a -> s ->  d a w ::   a =>  s a -> s ->  d a w ::   a =>  s a -> s ->  d a x2Obtain the minimum element (if any) targeted by a m or  safely.Note: x on a valid y,  or p will always return  p a value.minimumOf traverse [1..10]Just 1minimumOf traverse []Nothing0minimumOf (folded.filtered even) [1,4,3,6,7,9,2]Just 2   "a   (  "empty")   x K bIn the interest of efficiency, This operation has semantics more strict than strictly necessary.   (W l ), has lazier semantics but could leak memory. x ::   a => p s a -> s ->  d a x ::   a => m s a -> s ->  d a x ::   a => x s a -> s ->  d a x ::   a =>  s a -> s ->  d a x ::   a =>  s a -> s ->  d a y2Obtain the maximum element (if any) targeted by a m, , , y, or p 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")   y K cmp y :: p s a -> (a -> a ->   ) -> s ->  d a y :: m s a -> (a -> a ->   ) -> s ->  d a y :: x s a -> (a -> a ->   ) -> s ->  d a y ::  s a -> (a -> a ->   ) -> s ->  d a y ::  s a -> (a -> a ->   ) -> s ->  d a z2Obtain the minimum element (if any) targeted by a m, , , y or p 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")   z K cmp z :: p s a -> (a -> a ->   ) -> s ->  d a z :: m s a -> (a -> a ->   ) -> s ->  d a z :: x s a -> (a -> a ->   ) -> s ->  d a z ::  s a -> (a -> a ->   ) -> s ->  d a z ::  s a -> (a -> a ->   ) -> s ->  d a {The { function takes a  (or p, y, m, 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 { :: p s a -> (a ->   ) -> s ->  d a { :: m s a -> (a ->   ) -> s ->  d a { :: x s a -> (a ->   ) -> s ->  d a { ::  s a -> (a ->   ) -> s ->  d a { ::  s a -> (a ->   ) -> s ->  d a    "a { K  l "a { l    8A simpler version that didn't permit indexing, would be: { ::  (  ( d a)) s a -> (a ->   ) -> s ->  d a { l p = Y l (a y -> if p a then  p a else y)   |The | function takes a  (or p, y, m, 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 | :: (  m, p s a) -> (a -> m   ) -> s -> m ( d a) | :: (  m, m s a) -> (a -> m   ) -> s -> m ( d a) | :: (  m, x s a) -> (a -> m   ) -> s -> m ( d a) | :: (  m,  s a) -> (a -> m   ) -> s -> m ( d a) | :: (  m,  s a) -> (a -> m   ) -> s -> m ( d a)  | KA :: (Monad m, Foldable f) => (a -> m Bool) -> f a -> m (Maybe a)  l "a | l    8A simpler version that didn't permit indexing, would be: | :: Monad m =>  (  (m ( d a))) s a -> (a -> m   ) -> s -> m ( d a) | l p = Y* l (a y -> p a >>= x -> if x then return ( p a) else y) $ return   }The } function takes a m (or p, , , y, 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 m instead of lists.0lookupOf folded 4 [(2, 'a'), (4, 'b'), (4, 'c')]Just 'b'.lookupOf each 2 [(2, 'a'), (4, 'b'), (4, 'c')]Just 'a' } ::   k => m s (k,v) -> k -> s ->  d v ~ A variant of Y\ that has no base case and thus may only be applied to lenses and structures such that the . views at least one element of the structure.foldr1Of each (+) (1,2,3,4)10 ~ l f "a   f   [ l   "a ~ K ~ :: p$ s a -> (a -> a -> a) -> s -> a ~ :: m& s a -> (a -> a -> a) -> s -> a ~ :: x& s a -> (a -> a -> a) -> s -> a ~ :: % s a -> (a -> a -> a) -> s -> a ~ ::  s a -> (a -> a -> a) -> s -> a  A variant of Z\ that has no base case and thus may only be applied to lenses and structures such that the - views at least one element of the structure.foldl1Of each (+) (1,2,3,4)10  l f "a   f   [ l   "a  K  :: p$ s a -> (a -> a -> a) -> s -> a  :: m& s a -> (a -> a -> a) -> s -> a  :: x& s a -> (a -> a -> a) -> s -> a  :: % s a -> (a -> a -> a) -> s -> a  ::  s a -> (a -> a -> a) -> s -> a 5Strictly fold right over the elements of a structure.   "a  K  :: p) s a -> (a -> r -> r) -> r -> s -> r  :: m+ s a -> (a -> r -> r) -> r -> s -> r  :: x+ s a -> (a -> r -> r) -> r -> s -> r  :: * s a -> (a -> r -> r) -> r -> s -> r  :: % s a -> (a -> r -> r) -> r -> s -> r MFold over the elements of a structure, associating to the left, but strictly.   "a  K  :: p) s a -> (r -> a -> r) -> r -> s -> r  :: m+ s a -> (r -> a -> r) -> r -> s -> r  :: x+ s a -> (r -> a -> r) -> r -> s -> r  :: * s a -> (r -> a -> r) -> r -> s -> r  :: % s a -> (r -> a -> r) -> r -> s -> r  A variant of  that has no base case and thus may only be applied to folds and structures such that the fold views at least one element of the structure. ~ l f "a   f   [ l  :: p$ s a -> (a -> a -> a) -> s -> a  :: m& s a -> (a -> a -> a) -> s -> a  :: x& s a -> (a -> a -> a) -> s -> a  :: % s a -> (a -> a -> a) -> s -> a  ::  s a -> (a -> a -> a) -> s -> a  A variant of  that has no base case and thus may only be applied to folds and structures such that the fold views at least one element of the structure.  l f "a  f   [ l  :: p$ s a -> (a -> a -> a) -> s -> a  :: m& s a -> (a -> a -> a) -> s -> a  :: x& s a -> (a -> a -> a) -> s -> a  :: % s a -> (a -> a -> a) -> s -> a  ::  s a -> (a -> a -> a) -> s -> a bMonadic fold over the elements of a structure, associating to the right, i.e. from right to left.   "a  K  ::   m => p- s a -> (a -> r -> m r) -> r -> s -> m r  ::   m => m/ s a -> (a -> r -> m r) -> r -> s -> m r  ::   m => x/ s a -> (a -> r -> m r) -> r -> s -> m r  ::   m => . s a -> (a -> r -> m r) -> r -> s -> m r  ::   m => ) s a -> (a -> r -> m r) -> r -> s -> m r aMonadic fold over the elements of a structure, associating to the left, i.e. from left to right.   "a  K  ::   m => p- s a -> (r -> a -> m r) -> r -> s -> m r  ::   m => m/ s a -> (r -> a -> m r) -> r -> s -> m r  ::   m => x/ s a -> (r -> a -> m r) -> r -> s -> m r  ::   m => . s a -> (r -> a -> m r) -> r -> s -> m r  ::   m => ) s a -> (r -> a -> m r) -> r -> s -> m r Check to see if this m or  matches 1 or more entries.has (element 0) []Falsehas _Left (Left 12)Truehas _Right (Left 12)FalseThis will always return   for a  or p.has _1 ("hello","world")True  :: p s a -> s ->    :: m s a -> s ->    :: x s a -> s ->    ::  s a -> s ->    ::  s a -> s ->   Check to see if this m or  has no matches.hasn't _Left (Right 12)Truehasn't _Left (Left 12)FalseThis converts a m to a n5 that returns the first element, if it exists, as a  d.  :: p s a -> n s ( d a)  :: m s a -> n s ( d a)  ::  s a -> n s ( d a)  ::  s a -> n s ( d a)  :: x s a -> n s ( d a)  :: t s a -> n s ( d a) This converts an l to an n@ that returns the first index and element, if they exist, as a  d.  :: o i s a -> n s ( d (i, a))  :: l i s a -> n s ( d (i, a))  ::  i s a -> n s ( d (i, a))  ::  i s a -> n s ( d (i, a)) 'Retrieve the first value targeted by a m or  (or  p the result from a p or  ). See also (q).       "a  K This is usually applied in the    (->) s.  =       :: p s a -> s ->  d a  :: m s a -> s ->  d a  ::  s a -> s ->  d a  :: x s a -> s ->  d a  ::  s a -> s ->  d a OHowever, it may be useful to think of its full generality when working with a  transformer stack:  ::   s m => p s a -> m ( d a)  ::   s m => m s a -> m ( d a)  ::   s m =>  s a -> m ( d a)  ::   s m => x s a -> m ( d a)  ::   s m =>  s a -> m ( d a) 1Retrieve the first index and value targeted by a m or  (or  p the result from a p or  ). See also ().  =     This is usually applied in the    (->) s.  :: o i s a -> s ->  d (i, a)  :: l i s a -> s ->  d (i, a)  ::  i s a -> s ->  d (i, a)  ::  i s a -> s ->  d (i, a) OHowever, it may be useful to think of its full generality when working with a  transformer stack:  ::   s m => o s a -> m ( d (i, a))  ::   s m => l s a -> m ( d (i, a))  ::   s m =>  s a -> m ( d (i, a))  ::   s m =>  s a -> m ( d (i, a)) 5Retrieve a function of the first value targeted by a m or  (or  p the result from a p or ).This is usually applied in the    (->) s.@Retrieve a function of the first index and value targeted by an l or  (or  p the result from an o or ). See also ().  =     This is usually applied in the    (->) s.  :: o$ i s a -> (i -> a -> r) -> s ->  d r  :: l& i s a -> (i -> a -> r) -> s ->  d r  :: % i s a -> (i -> a -> r) -> s ->  d r  ::  i s a -> (i -> a -> r) -> s ->  d r OHowever, it may be useful to think of its full generality when working with a  transformer stack:  ::   s m => o" i s a -> (i -> a -> r) -> m ( d r)  ::   s m => l$ i s a -> (i -> a -> r) -> m ( d r)  ::   s m => # i s a -> (i -> a -> r) -> m ( d r)  ::   s m =>  i s a -> (i -> a -> r) -> m ( d r) 'Retrieve the first value targeted by a m or  (or  p the result from a p or ) into the current state.  =      ::   s m => p s a -> m ( d a)  ::   s m => m s a -> m ( d a)  ::   s m =>  s a -> m ( d a)  ::   s m => x s a -> m ( d a)  ::   s m =>  s a -> m ( d a) 2Retrieve the first index and value targeted by an l or  (or  p the index and result from an o or ) into the current state.  =      ::   s m => o i s a -> m ( d (i, a))  ::   s m => l i s a -> m ( d (i, a))  ::   s m =>  i s a -> m ( d (i, a))  ::   s m =>  i s a -> m ( d (i, a)) 5Retrieve a function of the first value targeted by a m or  (or  p the result from a p or ) into the current state.  =      ::   s m => p s a -> (a -> r) -> m ( d r)  ::   s m => m s a -> (a -> r) -> m ( d r)  ::   s m =>  s a -> (a -> r) -> m ( d r)  ::   s m => x s a -> (a -> r) -> m ( d r)  ::   s m =>  s a -> (a -> r) -> m ( d r) @Retrieve a function of the first index and value targeted by an l or  (or a function of  p the index and result from an o or ) into the current state.  =      ::   s m => o" i s a -> (i -> a -> r) -> m ( d r)  ::   s m => l$ i s a -> (i -> a -> r) -> m ( d r)  ::   s m => # i s a -> (i -> a -> r) -> m ( d r)  ::   s m =>  i s a -> (i -> a -> r) -> m ( d r) This allows you to # the elements of a pretty much any b$ construction in the opposite order.This will preserve indexes on 4 types and will give you the elements of a (finite) m or  in the opposite order."This has no practical impact on a p, ,  or y.NB: To write back through an y, you want to use '. Similarly, to write back through an u, you want to use .Fold an l or / by mapping indices and values to an arbitrary  a with access to the i.-When you don't need access to the index then W% is more flexible in what it accepts. W l "a  l      :: o& i s a -> (i -> a -> m) -> s -> m  ::  a m => l( i s a -> (i -> a -> m) -> s -> m  :: ' i s a -> (i -> a -> m) -> s -> m  ::  a m => " i s a -> (i -> a -> m) -> s -> m JRight-associative fold of parts of a structure that are viewed through an l or  with access to the i.-When you don't need access to the index then Y% is more flexible in what it accepts. Y l "a  l      :: o0 i s a -> (i -> a -> r -> r) -> r -> s -> r  :: l2 i s a -> (i -> a -> r -> r) -> r -> s -> r  :: 1 i s a -> (i -> a -> r -> r) -> r -> s -> r  :: , i s a -> (i -> a -> r -> r) -> r -> s -> r MLeft-associative fold of the parts of a structure that are viewed through an l or  with access to the i.-When you don't need access to the index then Z% is more flexible in what it accepts. Z l "a  l      :: o0 i s a -> (i -> r -> a -> r) -> r -> s -> r  :: l2 i s a -> (i -> r -> a -> r) -> r -> s -> r  :: 1 i s a -> (i -> r -> a -> r) -> r -> s -> r  :: , i s a -> (i -> r -> a -> r) -> r -> s -> r 4Return whether or not any element viewed through an l 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      :: o i s a -> (i -> a ->   ) -> s ->    :: l i s a -> (i -> a ->   ) -> s ->    ::  i s a -> (i -> a ->   ) -> s ->    ::  i s a -> (i -> a ->   ) -> s ->   5Return whether or not all elements viewed through an l 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      :: o i s a -> (i -> a ->   ) -> s ->    :: l i s a -> (i -> a ->   ) -> s ->    ::  i s a -> (i -> a ->   ) -> s ->    ::  i s a -> (i -> a ->   ) -> s ->   =Return whether or not none of the elements viewed through an l or * satisfy a predicate, with access to the i.-When you don't need access to the index then a% is more flexible in what it accepts. a l "a  l      :: o i s a -> (i -> a ->   ) -> s ->    :: l i s a -> (i -> a ->   ) -> s ->    ::  i s a -> (i -> a ->   ) -> s ->    ::  i s a -> (i -> a ->   ) -> s ->   Traverse the targets of an l or  with access to the i, discarding the results.-When you don't need access to the index then d% is more flexible in what it accepts. d l "a  l      ::  h f => o+ i s a -> (i -> a -> f r) -> s -> f ()  ::  j f => l- i s a -> (i -> a -> f r) -> s -> f ()  ::  h f => , i s a -> (i -> a -> f r) -> s -> f ()  ::  j f => ' i s a -> (i -> a -> f r) -> s -> f () Traverse the targets of an l or P with access to the index, discarding the results (with the arguments flipped).  "a      -When you don't need access to the index then e% is more flexible in what it accepts. e l a "a  l a      ::  h f => o+ i s a -> s -> (i -> a -> f r) -> f ()  ::  j f => l- i s a -> s -> (i -> a -> f r) -> f ()  ::  h f => , i s a -> s -> (i -> a -> f r) -> f ()  ::  j f => ' i s a -> s -> (i -> a -> f r) -> f () *Run monadic actions for each target of an l or 3 with access to the index, discarding the results.-When you don't need access to the index then g% is more flexible in what it accepts. g l "a  l      ::   m => o+ i s a -> (i -> a -> m r) -> s -> m ()  ::   m => l- i s a -> (i -> a -> m r) -> s -> m ()  ::   m => , i s a -> (i -> a -> m r) -> s -> m ()  ::   m => ' i s a -> (i -> a -> m r) -> s -> m () *Run monadic actions for each target of an l or P with access to the index, discarding the results (with the arguments flipped).  "a      -When you don't need access to the index then h% is more flexible in what it accepts. h l a "a  l a      ::   m => o+ i s a -> s -> (i -> a -> m r) -> m ()  ::   m => l- i s a -> s -> (i -> a -> m r) -> m ()  ::   m => , i s a -> s -> (i -> a -> m r) -> m ()  ::   m => ' i s a -> s -> (i -> a -> m r) -> m () <Concatenate the results of a function of the elements of an l or  with access to the index.-When you don't need access to the index then n& is more flexible in what it accepts. n l "a  l      "a   :: o* i s a -> (i -> a -> [r]) -> s -> [r]  :: l, i s a -> (i -> a -> [r]) -> s -> [r]  :: + i s a -> (i -> a -> [r]) -> s -> [r]  :: & i s a -> (i -> a -> [r]) -> s -> [r] The  function takes an l or , a predicate that is also supplied the index, a structure and returns the left-most element of the structure matching the predicate, or   if there is no such element.-When you don't need access to the index then {% is more flexible in what it accepts. { l "a  l      :: o i s a -> (i -> a ->   ) -> s ->  d a  :: l i s a -> (i -> a ->   ) -> s ->  d a  ::  i s a -> (i -> a ->   ) -> s ->  d a  ::  i s a -> (i -> a ->   ) -> s ->  d a The  function takes an l or , a monadic predicate that is also supplied the index, a structure and returns in the monad the left-most element of the structure matching the predicate, or   if there is no such element.-When you don't need access to the index then |% is more flexible in what it accepts. | l "a  l      ::   m => o i s a -> (i -> a -> m   ) -> s -> m ( d a)  ::   m => l i s a -> (i -> a -> m   ) -> s -> m ( d a)  ::   m =>  i s a -> (i -> a -> m   ) -> s -> m ( d a)  ::   m =>  i s a -> (i -> a -> m   ) -> s -> m ( d a) Strictly; 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  l      :: o0 i s a -> (i -> a -> r -> r) -> r -> s -> r  :: l2 i s a -> (i -> a -> r -> r) -> r -> s -> r  :: 1 i s a -> (i -> a -> r -> r) -> r -> s -> r  :: , i s a -> (i -> a -> r -> r) -> r -> s -> r RFold over the elements of a structure with an index, associating to the left, but strictly.-When you don't need access to the index then % is more flexible in what it accepts.  l "a  l      :: o2 i s a -> (i -> r -> a -> r) -> r -> s -> r  :: l4 i s a -> (i -> r -> a -> r) -> r -> s -> r  :: 3 i s a -> (i -> r -> a -> r) -> r -> s -> r  :: . i s a -> (i -> r -> a -> r) -> r -> s -> r BMonadic 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  l      ::   m => o4 i s a -> (i -> a -> r -> m r) -> r -> s -> m r  ::   m => l6 i s a -> (i -> a -> r -> m r) -> r -> s -> m r  ::   m => 5 i s a -> (i -> a -> r -> m r) -> r -> s -> m r  ::   m => 0 i s a -> (i -> a -> r -> m r) -> r -> s -> m r UMonadic 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  l      ::   m => o4 i s a -> (i -> r -> a -> m r) -> r -> s -> m r  ::   m => l6 i s a -> (i -> r -> a -> m r) -> r -> s -> m r  ::   m => 5 i s a -> (i -> r -> a -> m r) -> r -> s -> m r  ::   m => 0 i s a -> (i -> r -> a -> m r) -> r -> s -> m r -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        l  :: o i s a -> s -> [(i,a)]  :: l i s a -> s -> [(i,a)]  ::  i s a -> s -> [(i,a)]  ::  i s a -> s -> [(i,a)] An infix version of .Perform a safe   (with index) of an l or  or retrieve  p the index and result from an o or . When using a  as a partial , or an l as a partial o= this can be a convenient way to extract the optional value. ( ) :: s -> o i s a ->  d (i, a) ( ) :: s -> l i s a ->  d (i, a) ( ) :: s ->  i s a ->  d (i, a) ( ) :: s ->  i s a ->  d (i, a) Perform an *UNSAFE*   (with index) of an l or  assuming that it is there. ( ) :: s -> o i s a -> (i, a) ( ) :: s -> l i s a -> (i, a) ( ) :: s ->  i s a -> (i, a) ( ) :: s ->  i s a -> (i, a) 4Retrieve the index of the first value targeted by a l or ! which is equal to a given value.  "a  K  ::   a => l i s a -> a -> s ->  d i  ::   a =>  i s a -> a -> s ->  d i 1Retrieve the indices of the values targeted by a l or " which are equal to a given value.  "a  K  ::   a => l i s a -> a -> s -> [i]  ::   a =>  i s a -> a -> s -> [i] 4Retrieve the index of the first value targeted by a l or  which satisfies a predicate.  "a  K  :: l i s a -> (a ->   ) -> s ->  d i  ::  i s a -> (a ->   ) -> s ->  d i 1Retrieve the indices of the values targeted by a l or  which satisfy a predicate.  "a  K  :: l i s a -> (a ->  ) -> s -> [i]  ::  i s a -> (a ->  ) -> s -> [i]  Filter an l or o, obtaining an l.4[0,0,0,5,5,5]^..traversed.ifiltered (\i a -> i <= a) [0,5,5,5] Compose with R to filter another ,  IndexedIso, o, l (or /) with access to both the value and the index.Note: As with R , this is not a legal L, unless you are very careful not to invalidate the predicate on the target! Obtain an l" by taking elements from another l, , o or  while a predicate holds.  :: (i -> a ->  ) -> l i s a -> l i s a  :: (i -> a ->  ) ->  i s a -> l i s a  :: (i -> a ->  ) ->  i s a -> l i s a  :: (i -> a ->  ) -> o i s a -> l i s a  Obtain an l# by dropping elements from another l, , o or  while a predicate holds.  :: (i -> a ->  ) -> l i s a -> l i s a  :: (i -> a ->  ) ->  i s a -> l i s a -- see notes  :: (i -> a ->  ) ->  i s a -> l i s a -- see notes  :: (i -> a ->  ) -> o i s a -> l i s a  Applying  to an  or - will still allow you to use it as a pseudo-R, but if you change the value of the targets to ones where the predicate returns  , then you will break the  laws and  fusion will no longer be sound.Fold a value using a specified m and  a operations. This is like  where the  % instance can be manually specified.  K "a    :: p) s a -> (a -> a -> a) -> a -> s -> a  :: m+ s a -> (a -> a -> a) -> a -> s -> a  :: * s a -> (a -> a -> a) -> a -> s -> a  :: % s a -> (a -> a -> a) -> a -> s -> a  :: x+ s a -> (a -> a -> a) -> a -> s -> a 'foldByOf both (++) [] ("hello","world") "helloworld"Fold a value using a specified m and  a operations. This is like  where the  % instance can be manually specified.  K "a    :: p5 s a -> (r -> r -> r) -> r -> (a -> r) -> s -> r  :: m7 s a -> (r -> r -> r) -> r -> (a -> r) -> s -> r  :: 1 s a -> (r -> r -> r) -> r -> (a -> r) -> s -> r  :: 6 s a -> (r -> r -> r) -> r -> (a -> r) -> s -> r  :: x7 s a -> (r -> r -> r) -> r -> (a -> r) -> s -> r /foldMapByOf both (+) 0 length ("hello","world")10mGHIJK L MNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ rlmGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~rml\qrGHIJKLPQRMNOSTUVWXYZ[_`a]^bcdefghijknolmpuvstwxyz{|~}mGHIJK L MNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ \8q8r8888(C) 2013-2016 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> experimental non-portableNone*+09:;<=?DET 1This permits the construction of an "impossible" ) that matches only if some function does. There was an  & caused by abusing the internals of a  .Both  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.This builds a  ! for just the targets of a given p (or any p , really).   ... [  H (s ->     "Assertion Failed\n"   s) ,  H (s ->     "Error\n"   s) ] This works ith both the   type provided by Control.Exception:  :: p   a -> (a ->   r) ->   r  :: m   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:  :: p   a -> (a -> m r) ->   m r  :: m   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 5 type provided by Control.Monad.Error.Lens:  :: p e a -> (a -> m r) -> 5 e m r  :: m e a -> (a -> m r) -> 5 e m r  ::  e a -> (a -> m r) -> 5 e m r  ::  e a -> (a -> m r) -> 5 e m r  ::  e a -> (a -> m r) -> 5 e m r This builds a  ! for just the targets of a given p (or any pT, 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:  :: p   a ->   r ->   r  :: m   a ->   r ->   r  ::    a ->   r ->   r  ::    a ->   r ->   r  ::    a ->   r ->   r  and with the   type provided by Control.Monad.Catch:  :: p   a -> m r ->   m r  :: m   a -> m r ->   m r  ::    a -> m r ->   m r  ::    a -> m r ->   m r  ::    a -> m r ->   m r  and with the 5 type provided by Control.Monad.Error.Lens:  :: p e a -> m r -> 5 e m r  :: m e a -> m r -> 5 e m r  ::  e a -> m r -> 5 e m r  ::  e a -> m r -> 5 e m r  ::  e a -> m r -> 5 e m r         (C) 2012-16 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> provisional Rank2Types Trustworthy %&9:;<=?OTCAllows # of the value at the largest index.% of the element at the largest index.Allows ! the value at the smallest index.( of the element with the smallest index. type  f = g ( f) :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  j,a p if f is only a  h and  Contravariant,a  if p is only a  h,a m if f is  h,  Contravariant and  j. type  = g ( i)  type  = g ( i) >When you see this as an argument to a function, it expects an .>When you see this as an argument to a function, it expects an . type  = g  =When you see this as an argument to a function, it expects a . type  = g  =When you see this as an argument to a function, it expects a ..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 ((),(),())  "a  !  l "a  l  "    itraversed "a  itraverse This yields the obvious law:   "a     ::  h f => y) s t a b -> (a -> f b) -> s -> f t  ::  h f => ( s t a b -> (a -> f b) -> s -> f t  ::  j f => # s t a b -> (a -> f b) -> s -> f t  A version of ' with the arguments flipped, such that:forOf each (1,2,3) print123 ((),(),())0This function is only provided for consistency,   is strictly more general.  "a    "a   .    # "a     l s "a  # l s  "   ::  h f => y# s t a b -> s -> (a -> f b) -> f t  ::  h f => # s t a b -> s -> (a -> f b) -> f t  ::  j f => # s t a b -> s -> (a -> f b) -> f t SEvaluate 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    "a    !  l "a  l  ! "a l  !  ::  h f => y s t (f b) b -> s -> f t  ::  h f =>  s t (f b) b -> s -> f t  ::  j f =>  s t (f b) b -> s -> f t .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     l "a  & l  "   ::   m => y) s t a b -> (a -> m b) -> s -> m t  ::   m => ( s t a b -> (a -> m b) -> s -> m t  ::   m => # s t a b -> (a -> m b) -> s -> m t  is a flipped version of $, consistent with the definition of  &.$forMOf both (1,3) $ \x -> [x, x + 1][(1,3),(1,4),(2,3),(2,4)]  & "a     l "a   ( l)  l s "a  & l s  "   ::   m => y) s t a b -> s -> (a -> m b) -> m t  ::   m => ( s t a b -> s -> (a -> m b) -> m t  ::   m => # s t a b -> s -> (a -> m b) -> m t -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  l  !  l "a  (  " l  )  ::   m => y s t (m b) b -> s -> m t  ::   m =>  s t (m b) b -> s -> m t  ::   m =>  s t (m b) b -> s -> m t This 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)] This generalizes  * to an arbitrary .  * "a     accumulates   from right to left.  :: yA 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)  :: b ( + ( A acc)) s t a b -> (acc -> a -> (acc, b)) -> acc -> s -> (acc, t) This generalizes  , to an arbitrary .  , "a     accumulates   from left to right.  :: yA 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)  :: b ( @ 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) This permits the use of  0 over an arbitrary  or .  0 "a     :: y* 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 This permits the use of  1 over an arbitrary  or .  1 "a     :: y* 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 This  allows you to   the individual stores in a .This  allows you to   the individual stores in a  with access to their indices. 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 m the result is merely a p.  :: x s a ->  s [a]  ::  s a ->  s [a]  ::  s a ->  s [a]  :: m s a -> p s [a]  :: p s a -> p s [a] An indexed version of 7 that receives the entire list of indices as its index.A type-restricted version of  that can only be used with a .A type-restricted version of  that can only be used with an . 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 m the result is merely a p (and becomes safe).  :: y s t a b ->  s t [a] [b]  ::  s t a b ->  s t [a] [b]  ::  s t a b ->  s t [a] [b]  :: m s a -> p s [a]  :: p s a -> p s [a] An indexed version of 7 that receives the entire list of indices as its index.The one-level version of $F. 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, F at what the structure would be like with an edited result, or simply  2 the original structure. "propChildren l x = childrenOf l x  3    ( l x) propId l x =   ( 3 x) [ 2 w | w <-  l x]  :: x s a -> s -> [0 (->) a s]  ::  s a -> s -> [0 (->) a s]  ::  s a -> s -> [0 (->) a s]  ::  i s a -> s -> [0 ( i) a s]  ::  i s a -> s -> [0 ( i) a s] This 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 m into a p.The resulting  or p! 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  :: m s a -> p s a  ::  i s t a a ->  i s t a a  :: l i s a -> o i s a This converts a 3 that you "know" will target only one element to a &. It can also be used to transform a m into a p.The resulting  or p 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  :: m s a -> p s a  ::  i s t a b ->  i s t a b  :: l i s a -> o i s a Traverse both parts of a  4 container with matching types.!Usually that type will be a pair.(1,2) & both *~ 10(10,20)"over both length ("hello","world")(5,5)("hello","world")^.both "helloworld"  ::  (a, a) (b, b) a b  ::  ( c a a) ( c b b) a b Apply a different  or m to each side of a  4 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  :: m s a -> m" s' a -> m (s,s') a  :: p s a -> p s' a -> m (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  :: l i s a -> l i s' a -> l i (s,s') a  :: o i s a -> o i s' a -> l 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  :: k s a -> k s' a -> k (s,s') a  :: n s a -> n s' a -> k (s,s') a .("hello",["world","!!!"])^..beside id traverse["hello","world","!!!"]Visit the first n targets of a , m, p 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"  ::  r ->  s a ->  s a  ::  r ->  s a ->  s a  ::  r -> x s a ->  s a  ::  r -> t s a ->  s a  ::  r -> p s a -> m s a  ::  r -> m s a -> m s a  ::  r ->  i s a ->  i s a  ::  r ->  i s a ->  i s a  ::  r -> o i s a -> l i s a  ::  r -> l i s a -> l i s a Visit all but the first n targets of a , m, p or .$("hello","world") ^? dropping 1 both Just "world".Dropping works on infinite traversals as well:[1..] ^? dropping 1 foldedJust 2  ::  r ->  s a ->  s a  ::  r ->  s a ->  s a  ::  r -> x s a ->  s a  ::  r -> t s a ->  s a  ::  r -> p s a -> m s a  ::  r -> m s a -> m s a  ::  r ->  i s a ->  i s a  ::  r ->  i s a ->  i s a  ::  r -> o i s a -> l i s a  ::  r -> l i s a -> l i s a A 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 mT and can be used as a way to pass around traversals that have to be monomorphic in f.!Note: This only accepts a proper  (or ). To clone a  as such, use ."Note: It is usually better to use " and " than to [. The former can execute at full speed, while the latter needs to round trip through the .Plet foo l a = (view (getting (cloneTraversal l)) a, set (cloneTraversal l) 10 a)foo both ("hello","world")("helloworld",(10,10))  :: b ( (->) a b) s t a b ->  s t a b Clone a  yielding an 9 that passes through whatever index it is composed with. Clone an  yielding an  with the same index.A 2 is completely characterized by its behavior on a .Clone a  yielding an 9 that passes through whatever index it is composed with. Clone an  yielding an  with the same index.Traversal 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   l =  l  "   =  !  ::  h f => 0 i s t a b -> (i -> a -> f b) -> s -> f t  ::  j f => + i s t a b -> (i -> a -> f b) -> s -> f t  :: Apply f => * i s t a b -> (i -> a -> f b) -> s -> f t 3Traverse with an index (and the arguments flipped).  l a "a  l a  "    "a    "   ::  h f => 0 i s t a b -> s -> (i -> a -> f b) -> f t  ::  j f => + i s t a b -> s -> (i -> a -> f b) -> f t  :: Apply f => * i s t a b -> s -> (i -> a -> f b) -> f t .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 ' is more liberal in what it can accept.  l "a  l  "    ::   m => 0 i s t a b -> (i -> a -> m b) -> s -> m t  ::   m => + i s t a b -> (i -> a -> m b) -> s -> m t  :: Bind m => * i s t a b -> (i -> a -> m b) -> s -> m t .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    "   ::   m => / i s t a b -> s -> (i -> a -> m b) -> m t  ::   m => * i s t a b -> s -> (i -> a -> m b) -> m t  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)  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)  Traverse any  container. This is an % that is indexed by ordinal position. Traverse any  container. This is an % that is indexed by ordinal position. Traverse any  container. This is an % that is indexed by ordinal position.This is the trivial empty .  ::  i s s a b   "a    ~ 6 & ignored %~ absurd6 Traverse the nth  a ,  or y 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 ->  r ->   r s a  :: m s a ->  r -> l  r s a  Traverse the nth element of a  container.  "a    *Traverse (or fold) selected elements of a  (or m2) where their ordinal positions match a predicate.  ::  s a -> ( r ->  ) ->   r s a  :: m s a -> ( r ->  ) -> l  r s a Traverse elements of a ; container where their ordinal positions match a predicate.  "a     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 5Try 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 Try the first  (or m), falling back on the second  (or m) 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 , y, p, u6 or "affine" Traversal -- one that has 0 or 1 target.Mutatis mutandis for m."[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  :: u s t a b -> u s t a b ->  s t a b  :: m s a -> m s a -> m 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  :: y s t a b ->  s t a b ->  s t a b  :: s s t a b ->  s t a b ->  s t a b  :: p s a -> m s a -> m 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  :: l i s a -> l i s a -> l 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  :: o i s a -> o i s a -> l i s a uTry the second traversal. If it returns no entries, try again with all entries from the first traversal, recursively.  :: m s s -> m s a -> m s a  ::  s s ->  s a ->  s a  ::  s t s t ->  s t a b ->  s t a b  :: m s s -> l i s a -> l i s a  ::  s t s t ->  i s t a b ->  i s t a b Fuse a  by reassociating all of the \<*\>/ operations to the left and fusing all of the  uB 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  j they are given. exploits the  ' lemma to merge their separate uses of  u into a single  uM. and it further exploits an interesting property of the right Kan lift (or  5*) to left associate all of the uses of '( *3)' 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 'Traverse a container using a specified  j. This is like  where the " instance can be specified by any     "a  'Sequence a container using a specified  j. This is like  where the " instance can be specified by any     "a  S 6 7 8 9 : ; < =] ] Q 6 7 8 9 : ; < =5(C) 2012-16 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> provisional Rank2Types Trustworthy%&69:;<=?OQRT*A  with an additional index.2An instance must satisfy a (modified) form of the  laws:  (  ) "a   u ( f)    g "a  >    (\i ->  ?    u (f i)   g i) Traverse an indexed container.  "a     The  of a  container. ;A container that supports folding with an additional index. 2Fold a container by mapping value to an arbitrary  a with access to the index i.-When you don't need access to the index then  % is more flexible in what it accepts.   "a        The l of a   container.      is a fold over the keys of a  .@Data.Map.fromList [(2, "hello"), (1, "world")]^..ifolded.asIndex[1,2] HRight-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       GLeft-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      StrictlyF 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      RFold over the elements of a structure with an index, associating to the left, but strictly.-When you don't need access to the index then % is more flexible in what it accepts.  l "a  l     A  h with an additional index..Instances must satisfy a modified form of the  h laws:  f    g "a  (\i -> f i   g i)  (\_ a -> a) "a   Map with access to the index.The } for a .,If you don't need access to the index, then B% is more flexible in what it accepts. 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")]'Compose a non-indexed function with an  function.Mnemonically, the >, points to the indexing we want to preserve.This is the same as ( ).f   g (and f  g) gives you the index of g unless g is index-preserving, like a u, y or s0, 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")]OUse a value itself as its own index. This is essentially an indexed version of  .VNote: When used to modify the value, this can break the index requirements assumed by + and similar, so this is only properly an o, but it can be used as more.  ::o a a b Remap the index.Composition 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")]Composition of ? functions with a user supplied function for combining indices.This allows you to filter an l, o,  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"]This allows you to filter an l, o,  or  based on an index.0["hello","the","world","!!!"]^?traversed.index 2 Just "world"aReturn 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      `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      hReturn 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 % is more flexible in what it accepts.  "a       f "a      f FDetermines whether no elements of the structure satisfy the predicate.  f "a       f  +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 =      !+Traverse elements with access to the index i6, discarding the results (with the arguments flipped). ! "a     -When you don't need access to the index then  % is more flexible in what it accepts.   a "a ! a     "*Run monadic actions for each target of an l or m3 with access to the index, discarding the results.-When you don't need access to the index then g% is more flexible in what it accepts.   "a *     #*Run monadic actions for each target of an l or mP with access to the index, discarding the results (with the arguments flipped). # "a   " -When you don't need access to the index then h% is more flexible in what it accepts. h l a "a  l a     $gConcatenate 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 $     $ "a   %Searches 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 %     &BMonadic 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 &     'UMonadic 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 '     (-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      ( )3Traverse with an index (and the arguments flipped). for a "a ) a     ) "a    *Map 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 *     +Map 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 + a     + "a   * , Generalizes  to add access to the index.& accumulates state from right to left.  "a ,     - Generalizes  to add access to the index.& accumulates state from left to right.  "a -     The position in the  A is available as the index.Same instance as for [].3The position in the list is available as the index.      !"#$%&'()*+,- B./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~7         !"#$%&'()*+,-./01:       !"#$%&'(   )*+,-./01       !"#$%&'()*+,- B./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~9 9 9  (C) 2012-2016 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> experimental non-portable Trustworthy:MOT Traverse a strict  Cb in a relatively balanced fashion, as a balanced tree with biased runs of elements at the leaves.Traverse a strict  C in a relatively balanced fashion, as a balanced tree with biased runs of elements at the leaves, pretending the bytes are chars.Unpack a lazy  BytestringAn # of the individual bytes in a lazy  DUnpack a lazy  D pretending the bytes are chars.An # of the individual bytes in a lazy  D pretending the bytes are chars. EConversion between  F and  . Should compile to a no-op. GUnsafe conversion between   and  F<. This is a no-op and silently truncates to 8 bits Chars > '\255'=. It is provided as convenience for ByteString construction.Unpack a strict Unpack a strict !, pretending the bytes are chars. H8A 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. ICreate ByteString of size l and use action f to fill it's contents. J K L M N O P Q R S T E G H I J K L M N O P Q R S T E G H I!(C) 2012-16 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> provisional Rank2TypesNone:OTThis provides a breadth-first  of the individual  of any other 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 ( U) 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')]Note:4 Internally this is implemented by using an illegal  j<, as it extracts information in an order that violates the  j laws.This provides a breadth-first ' of the individual levels of any other 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')]Note:4 Internally this is implemented by using an illegal  j<, as it extracts information in an order that violates the  j laws. V W X Y Z V W X Y Z"(C) 2012-16 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> provisional Rank2TypesNone 9;<=DORT type  = g  Reify a u+ so it can be stored safely in a container. type  = g   Reify an y+ so it can be stored safely in a container. type  i = g ( i)  Reify an }+ so it can be stored safely in a container. type  = g  Reify a + so it can be stored safely in a container.Reify a m+ 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")] Reify an o+ so it can be stored safely in a container.Reify a p+ 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) type  = g   A form of 3 that can be stored monomorphically in a container. type  i = g ( i)  Reify an + so it can be stored safely in a container. type  i = g ( i)  Reify an + so it can be stored safely in a container. type  = g  Reify a + so it can be stored safely in a container.i  ,i  Q  #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 %&0:ABMOT  KA generic applicative transformation that maps over the immediate subterms.  is to   what  [ is to  %This really belongs in  Data.Data. Nave  using  \2. This does not attempt to optimize the traversal.YThis is primarily useful when the children are immediately obvious, and for benchmarking. &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.Find 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 $ performs like  , except when s ~ a%, it returns itself and nothing else. 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 aThe 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] 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.This 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. ] inlineable  ^/ _ ` 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 { | } ~  $(C) 2012-16 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> provisional Rank2Types Trustworthy 69:;<=OQRT)A 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  r, | Neg Expr | Add Expr Expr deriving ( , , , , \, )   instance  Expr where  f (Neg e) = Neg   f e  f (Add a b) = Add   f a  U f b  _ a =  ~ 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  U f r  _ t =  ~ 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.- 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.Compose through a plate<Try to apply a traversal to all transitive descendants of a = container, but do not recurse through matching descendants.  ::  s => m s a -> m s a  ::  s => l s a -> l s a  ::  s =>  s s a b ->  s s a b  ::  s =>  s s a b ->  s s a b 'Extract the immediate descendants of a  container.  "a [  oRewrite by applying a rule everywhere you can. Ensures that the rule cannot be applied anywhere in the result: propRewrite r x =   (   r) ($ ( r x)) Usually , is more appropriate, but E can give better compositionality. Given two single transformations f and g, you can construct  a -> f a mplus g a2 which performs both rewrites until a fixed point.oRewrite by applying a rule everywhere you can. Ensures that the rule cannot be applied anywhere in the result: propRewriteOf l r x =   (   r) (% l ( l r x)) Usually . is more appropriate, but E can give better compositionality. Given two single transformations f and g, you can construct  a -> f a mplus g a2 which performs both rewrites until a fixed point.  ::  a a -> (a ->  d a) -> a -> a  ::  a a -> (a ->  d a) -> a -> a  ::  a a -> (a ->  d a) -> a -> a  :: ~ a a -> (a ->  d a) -> a -> a 4Rewrite recursively over part of a larger structure.  ::  a =>  s a -> (a ->  d a) -> s -> s  ::  a =>  s a -> (a ->  d a) -> s -> s  ::  a =>  s a -> (a ->  d a) -> s -> s  ::  a => @ s a -> (a ->  d a) -> s -> s FRewrite recursively over part of a larger structure using a specified .  ::  s a ->  a a -> (a ->  d a) -> s -> s  ::  s a ->  a a -> (a ->  d a) -> s -> s  ::  s a ->  a a -> (a ->  d a) -> s -> s  :: ~ s a -> ~ a a -> (a ->  d a) -> s -> s  wRewrite by applying a monadic rule everywhere you can. Ensures that the rule cannot be applied anywhere in the result.!RRewrite by applying a monadic rule everywhere you recursing with a user-specified B. Ensures that the rule cannot be applied anywhere in the result."`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.#`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.$0Retrieve all of the transitive descendants of a  container, including itself.%Given a mu that knows how to locate immediate children, retrieve all of the transitive descendants of a node, including itself. % :: m a a -> a -> [a] &Given a m that knows how to find N parts of a container retrieve them and all of their descendants, recursively.'Given a m 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 m. [ l "a ' l  (*Fold over all transitive descendants of a  container, including itself.)Given a mq that knows how to locate immediate children, fold all of the transitive descendants of a node, including itself. ) :: m a a -> m a a *Given a m that knows how to find J parts of a container fold them and all of their descendants, recursively. * ::  a => m s a -> m s a +Given a m 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 m. + :: m s a -> m a a -> m s a ,;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 -WTransform 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 .8Transform every element by recursively applying a given  in a bottom-up manner. . ::  a a -> (a -> a) -> a -> a . :: ~ a a -> (a -> a) -> a -> a /3Transform 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 0HTransform every element in the tree, in a bottom-up manner, monadically.1HTransform every element in the tree in a region indicated by a supplied %, in a bottom-up manner, monadically. 1 :: (  m,  a) =>  s a -> (a -> m a) -> s -> m s 28Transform every element in a tree using a user supplied - in a bottom-up manner with a monadic effect. 2 ::   m =>  a a -> (a -> m a) -> a -> m a 3PTransform 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. 3 ::   m =>  s a ->  a a -> (a -> m a) -> s -> m s 4_Return a list of all of the editable contexts for every location in the structure, recursively. propUniverse x = $ x  3    (4 x) propId x =   ( 3 x) [ w | w <- 4 x] 4 "a 5  5wReturn 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  3    (5 l x) propId l x =   ( 3 x) [ w | w <- 5 l x] 5 ::  a a -> a -> [5 a a a] 6{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 . 6 b "a 7 b  6 ::  a =>  s a -> s -> [5 a a s] 7{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. 7 ::  s a ->  a a -> s -> [5 a a s] 8The 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  3    (8 l x) propId x =   ( 3 x) [ w | w <- 8 l x] 8 =   9 An alias for 6, provided for consistency with the other combinators. 9 "a  9 :: x s a -> s -> [1 (->) a a s] 9 ::  s a -> s -> [1 (->) a a s] 9 ::  s a -> s -> [1 (->) a a s] 9 ::  i s a -> s -> [1 ( i) a a s] 9 ::  i s a -> s -> [1 ( i) a a s] :Extract one level of 8/ from a container in a region specified by one , using another. : b l "a  (b   l) : :: x s a -> x a a -> s -> [1 (->) a a s] : ::  s a ->  a a -> s -> [1 (->) a a s] : ::  s a ->  a a -> s -> [1 (->) a a s] : ::  s a ->  i a a -> s -> [1 ( i) a a s] : ::  s a ->  i a a -> s -> [1 ( i) a a s] ;JPerform a fold-like computation on each value, technically a paramorphism. ; :: m" a a -> (a -> [r] -> r) -> a -> r <JPerform a fold-like computation on each value, technically a paramorphism. < "a ;  =!Fold the immediate children of a  container. = z c f = Y  (c   f) z > 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  !? Implement  operation for a type using its   instance.?  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRS* !"#$%&'()*+,-./0123456789:;<=>?+ !"#$%&'()*+,.-/0213456789:<;=>?=  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRS9 %(C) 2012-16 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> provisional Rank2TypesNone %&+DORT TA g U.U>When you see this as an argument to a function, it expects an s.VProvides witness that (s ~ a, b ~ t) holds.XExtract a witness of type s.YSubstituting types with s.Z We can use s" to do substitution into anything.[s is symmetric.\8This 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.]CComposition with this isomorphism is occasionally useful when your , l or yu 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. TUVWXYZ[\] rsTUVWXYZ[\] srUTXYZ[\]VW TUVWXYZ[\](C) 2012-16 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> provisional Rank2Types Trustworthy $<=?OTb!^PAd hoc conversion between "strict" and "lazy" versions of a structure, such as   or  C.`-This class provides for symmetric bifunctors.a a   a "a     f   a = a     f   g   a = a     g  f g   a = a    g f (1,2)^.swapped(2,1)bA g c.c>When you see this as an argument to a function, it expects an y.i<Build a simple isomorphism from a pair of inverse functions.  (i f g) "a f  (j (i f g)) "a g  (i f g) h "a g   h   f  (j (i f g)) h "a f   h   g jInvert an isomorphism. j (j l) "a l k$Extract the two functions, one from s -> a and one from b -> t that characterize an y.l Convert from c back to any y.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  or 7 for more information on why you might want to do this.m Based on && from Conor McBride's work on Epigram.*This version is generalized to accept any y , 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 n Based on ala'& from Conor McBride's work on Epigram.*This version is generalized to accept any y , not just a newtype.'For a version you pass the name of the newtype constructor to, see &.Gauf (_Unwrapping Sum) (foldMapOf both) Prelude.length ("hello","world")10Mnemonically, the German auf plays a similar role to  la, and the combinator is m! with an extra function argument: n :: y8 s t a b -> ((r -> a) -> e -> b) -> (r -> s) -> e -> t but the signature is general.oThe opposite of working  a  is working o an isomorphism. o "a    j o :: y s t a b -> (t -> s) -> b -> a pBThis 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.qThis can be used to lift any y into an arbitrary  h.rIf v is an element of a type a, and a' is a sans the element v, then r v is an isomorphism from  d a' to a. r "a s   ' NKeep in mind this is only a real isomorphism if you treat the domain as being  d (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 5Nothingss p generalizes r (p # ()) to take any unit u/This function generates an isomorphism between  d (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 []tt a p generalizes r a# to take any value and a predicate.This function assumes that p a holds  & and generates an isomorphism between  d (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 []uAThe canonical isomorphism for currying and uncurrying a function. u = i     (fst^.curried) 3 43view curried fst 3 43vAThe canonical isomorphism for uncurrying and currying a function. v = i      v = j u ((+)^.uncurried) (1,2)3w(The isomorphism for flipping a function.((,)^.flipped) 1 2(2,1)xAn yE between the strict variant of a structure and its lazy counterpart. x = j _ See  4http://hackage.haskell.org/package/strict-base-types for an example use.yAn y between a list,  C,  ! fragment, etc. and its reversal."live" ^. reversed"evil""live" & reversed %~ ('d':)"lived"z<Given a function that is its own inverse, this gives you an y using it in both directions. z "a  i "live" ^. involuted reverse"evil"$"live" & involuted reverse %~ ('d':)"lived"{*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 2 so that you can traverse over it multiple times.|+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 V so that you can traverse over it multiple times with access to the original indices.}Lift an y into a  functor. contramapping ::  f => y s t a b -> y* (f a) (f b) (f s) (f t) contramapping ::  f => x s a -> x (f a) (f s) ~ Lift two ys into both arguments of a  simultaneously.  dimapping ::  p => y s t a b -> y s' t' a' b' -> y2 (p a s') (p b t') (p s a') (p t b') dimapping ::  p => x s a -> x s' a' -> x (p a s') (p s a') Lift an y- contravariantly into the left argument of a .  lmapping ::  p => y s t a b -> y- (p a x) (p b y) (p s x) (p t y) lmapping ::  p => x s a -> x (p a x) (p s x) Lift an y* covariantly into the right argument of a .  rmapping ::  p => y s t a b -> y- (p x s) (p y t) (p x a) (p y b) rmapping ::  p => x s a -> x (p x s) (p x a)  Lift two ys into both arguments of a .  bimapping ::  p => y s t a b -> y s' t' a' b' -> y2 (p s s') (p t t') (p a a') (p b b') bimapping ::  p => x s a -> x s' a' -> x (p s s') (p a a') Lift an y into the first argument of a .  firsting ::  p => y s t a b -> y- (p s x) (p t y) (p a x) (p b y) firsting ::  p => x s a -> x (p s x) (p a x) Lift an y into the second argument of a #. This is essentially the same as qL, but it takes a 'Bifunctor p' constraint instead of a 'Functor (p a)' one.  seconding ::  p => y s t a b -> y. (p x s) (p y t) (p x a) (p y b) seconding ::  p => x s a -> x (p x s) (p x a)  <Data types that are representationally equal are isomorphic."This is only available on GHC 7.8+.^_`abcdefghijklmnopqrstuvwxyz{|}~1xy]^_`abcdefghijklmnopqrstuvwxyz{|}~1yxcbijlkmnoq]rstpuvw`af^_hgxyezd{|}~,^_`abcdefghijklmnopqrstuvwxyz{|}~&'(C) 2012-16 Edward Kmett, Michael Sloan BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> experimentalRank2, MPTCs, fundeps Trustworthy$+9;<=DORTbW provides isomorphisms to wrap and unwrap newtypes or data types with one constructor.An isomorphism between s and a.Work under a newtype wrapper.5Const "hello" & _Wrapped %~ Prelude.length & getConst5  "a j   "a j  Given the constructor for a 3 type, return a deconstructor that is its inverse. Assuming the $ instance is legal, these laws hold:  f   f "a   f    f "a   op Identity (Identity 4)4op Const (Const "hello")"hello" This is a convenient version of ! with an argument that's ignored.The user supplied function is ignored, merely its type is used. This is a convenient version of ! with an argument that's ignored.The user supplied function is ignored, merely its type is used. This is a convenient version of ! with an argument that's ignored.The user supplied function is ignored, merely its types are used. This is a convenient version of ! with an argument that's ignored.The user supplied function is ignored, merely its types are used.This 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 This combinator is based on ala'& from Conor McBride's work on Epigram.As with 0, the user supplied function for the newtype is ignored. palaf :: Rewrapping s t => (Unwrapped s -> s) -> ((r -> t) -> e -> s) -> (r -> Unwrapped t) -> e -> Unwrapped s 1alaf Sum foldMap Prelude.length ["hello","world"]10Use wrapping  . unwrapping returns a sorted list.Use wrapping  . unwrapping returns a sorted list.Use wrapping  . unwrapping returns a sorted list.Use wrapping  . unwrapping returns a sorted list.Use wrapping  2. Unwrapping returns some permutation of the list.Use wrapping  2. Unwrapping returns some permutation of the list.       !"#$%       !"#$%'(C) 2012-2016 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> experimental non-portableNone$:b' This isomorphism can be used to   (or   ) strict  ."hello"^.packed -- :: Text"hello"   x "a x  '   x "a x  j ' ' "a j ( ' "a i     ( This isomorphism can be used to   (or  ) lazy  ."hello"^.unpacked -- :: String"hello"This yL is provided for notational convenience rather than out of great need, since ( "a j '   x "a x  j (   x "a x  ' ( "a i     )This is an alias for (/ that makes it more obvious how to use it with  > _Text # "hello" -- :: Text"hello"*Convert between strict   and   .   x "a x  *   (  x) "a x  j * +-Traverse the individual characters in strict  .anyOf text (=='o') "hello"True@When the type is unambiguous, you can also use the more general each. + "a ( .  + "a each $Note that when just using this as a , F  can be more efficient.,EncodeDecode a strict   to from strict  C , via UTF-8. utf8 # "&""\226\152\131" &'()*+ ,&'()*+,'(*+,)& &'()*+ ,((C) 2012-2016 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> experimental non-portableNone$9:;b. This isomorphism can be used to   (or  ) lazy  ."hello"^.packed -- :: Text"hello"   x "a x  .   x "a x  j . . "a j / / This isomorphism can be used to   (or  ) lazy  ."hello"^.unpacked -- :: String"hello"   x "a x  j /   x "a x  . This yL is provided for notational convenience rather than out of great need, since / "a j . 0This is an alias for /* that makes it clearer how to use it with (). 0 = j . _Text # "hello" -- :: Text"hello"1Convert between lazy   and   .   x "a x  1   x "a x  j 1 2(Traverse the individual characters in a  .anyOf text (=='c') "chello"True 2 = / .  @When the type is unambiguous, you can also use the more general each. 2 "a each $Note that when just using this as a , F  can be more efficient.3EncodeDecode a lazy   to from lazy  D , 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] -./012 3-./0123./0213- -./012 3)(C) 2012-16 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> experimental non-portableNone$9:;b4Traversals for strict or lazy  5 This isomorphism can be used to   (or  ) strict or lazy  .   x "a x  5   x "a x  j 5 5 "a j 9 6Convert between strict or lazy   and a  .   x "a x  6 75Traverse the individual characters in strict or lazy  . 7 = 9 .  9 This isomorphism can be used to   (or  ) both strict or lazy  .   x "a x  9   x "a x  j 9 This yL is provided for notational convenience rather than out of great need, since 9 "a j 5 :This is an alias for 9* that makes it clearer how to use it with (). : = j 5 _Text # "hello" :: Strict.Text"hello" 456789:;<=476589:45679:8456789:;<=*(C) 2012-2016 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> provisional non-portable Trustworthy:OT > 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? Similar to [, but returning a  .G(toVectorOf both (8,15) :: Vector.Vector Int) == Vector.fromList [8,15]True@Convert 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]A Convert a   to a finite   (or back.)B Convert a   to a finite   from right to left (or back.)C Convert a  H back and forth to an initializer that when run produces a copy of the  .D Convert a  4 to a version that doesn't retain any extra memory.EThis = 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]FLike ix$ but polymorphic in the vector type.G.Indexed vector traversal for a generic vector.H>Different vector implementations are isomorphic to each other. >i starting indexn length?@ABCDEFGH >?@ABCDEFGH ?D@ABCH>EFG >?@ABCDEFGH+(C) 2012-16 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> provisional non-portable Trustworthy$6BbJisn't _Empty [1,2,3]TrueIJKLMNOPQRSTUVWXYZ[\]^_`abcdefgIJKIJJKIJJKLMNOPQRSTUVWXYZ[\]^_`abcdefg,(C) 2012-16 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> experimental non-portable Trustworthy%&69:;<=?DRhExtract i2 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  C.-over each Char.toUpper ("hello"^.Text.packed)"HELLO"-("hello","world") & each.each %~ Char.toUpper("HELLO","WORLD")j i :: (  i,     a,     b) =>  (  i a) (  i b) a bk i ::   i =>  (  i a) (  i b) a bl i ::   D  D  F  Fm i ::   C  C  F  Fn i ::         o i ::         p i :: (  a,   b) =>  (  a) (  b) a bq i :: (  a,   b) =>  (  a) (  b) a br i :: (  a,   b) =>  (  a) (  b) a bs i ::  (  a) (  b) a bt i ::  (  a) (  b) a bu i ::  ( A a) ( A b) a bv i ::  ( d a) ( d b) a bw i ::  ( a) ( b) a bx i ::  (NonEmpty a) (NonEmpty b) a by i ::  [a] [b] a bz i ::  (  c a) (  c b) a b{ i ::  (  c a) (  c b) a b| i ::  (  c a) (  c b) a b} i :: (  a,   b) =>  (  a) (  b) a b~ i :: , (a,a,a,a,a,a,a,a,a) (b,b,b,b,b,b,b,b,b) a b i :: ( (a,a,a,a,a,a,a,a) (b,b,b,b,b,b,b,b) a b i :: $ (a,a,a,a,a,a,a) (b,b,b,b,b,b,b) a b i ::  (a,a,a,a,a,a) (b,b,b,b,b,b) a b i ::  (a,a,a,a,a) (b,b,b,b,b) a b i ::  (a,a,a,a) (b,b,b,b) a b i ::  (a,a,a) (b,b,b) a b i ::  (a,a) (b,b) a bhijklmnopqrstuvwxyz{|}~hihiihiijklmnopqrstuvwxyz{|}~-(C) 2012-16 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> experimental non-portable Trustworthy $9:;<=?DRbnThis class provides a way to attach or detach elements on the right side of a structure in a flexible manner.  :: u [a] [b] ([a], a) ([b], b)  :: u ( A a) ( A b) ( A a, a) ( A b, b)  :: u (  a) (  b) (  a, a) (  b, b)  :: t   ( ,  )  :: t   ( ,  )  :: t  C ( C,  F) mThis class provides a way to attach or detach elements on the left side of a structure in a flexible manner.  :: u [a] [b] (a, [a]) (b, [b])  :: u ( A a) ( A b) (a,  A a) (b,  A b)  :: u (  a) (  b) (a,   a) (b,   b)  :: t   ( ,  )  :: t   ( ,  )  :: t  C ( F,  C)  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] 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]oAttempt 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])A  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  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) a A  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  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)  ::  (  a) (  a) A 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)  ::  (  a) (  a) A . 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) a ( an element onto the end of a container.This is an infix alias for .Seq.fromList [] |> a fromList [a]Seq.fromList [b, c] |> afromList [b,c,a]LazyT.pack "hello" |> '!'"hello!"( 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!"pAttempt to extract the right-most element from a container, and a version of the container without that element.unsnoc (LazyT.pack "hello!")Just ("hello",'!')unsnoc (LazyT.pack "")Nothingunsnoc (Seq.fromList [b,c,a])Just (fromList [b,c],a)unsnoc (Seq.fromList [])Nothing$"555555.(C) 2012-16 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> experimental non-portableNone9;<=MMA Banker's deque based on Chris Okasaki's "Purely Functional Data Structures"O(1). Determine if a  is  . null emptyTruenull (singleton 1)FalseO(1). Generate a singleton  singleton 1 BD 1 [1] 0 []O(1). Calculate the size of a size (fromList [1,4,6])3O(n) amortized. Construct a  from a list of values.fromList [1,2]BD 1 [1] 1 [2]  Check that a 7 satisfies the balance invariants and rebalance if not.  /(C) 2012-16 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> experimental non-portable Trustworthy%&69:;<=DOQRT 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  should satisfy:  k "a  k     !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. This simple  lets you   the value at a given key in a  0 or element at an ordinal position in a list or  A. This simple  lets you   the value at a given key in a  0 or element at an ordinal position in a list or  A.NB: Setting the value of this  will only set the value in  if it is already present.!If you want to be able to insert missing values, you want ."Seq.fromList [a,b,c,d] & ix 2 %~ ffromList [a,b,f c,d]"Seq.fromList [a,b,c,d] & ix 2 .~ efromList [a,b,e,d]Seq.fromList [a,b,c,d] ^? ix 2Just cSeq.fromList [] ^? ix 2NothingLThis provides a common notion of a value at an index that is shared by both  and .This class provides a simple ` that lets you view (and modify) information about whether or not a container contains a given .'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]An indexed version of .)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]An indexed version of .%Seq.fromList [a,b,c,d] & iix 2 %@~ f'fromList [a,b,f' 2 c,d]$Seq.fromList [a,b,c,d] & iix 2 .@~ hfromList [a,b,h 2,d] Seq.fromList [a,b,c,d] ^@? iix 2 Just (2,c)Seq.fromList [] ^@? iix 2NothingA definition of  for types with an F instance. This is the default if you don't specify a definition for .,Delete the value associated with a key in a  -like container  k =  k .~ Nothing An indexed version of .$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 [] arr   i "a arr   i arr   [(i,e)] "a  i O e   arr  arr   i "a arr   i arr   [(i,e)] "a  i O e   arr 6 30(C) 2012-2016 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> experimentalTemplateHaskell TrustworthyOT Provides substitution for typesPerform substitution for typesGProvides for the extraction of free type variables, and alpha renaming.When 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  .Contains some amount of  s insideTraverse all the typesHas a  fExtract (or modify) the  f of something Traverse free type variables'Substitute using a map of names in for free type variables Provides a - of the types of each field of a constructor. of the types of the named fields of a constructor.On template-haskell-2.11.0.0 or later, if a   or   has multiple  fs, the leftmost  f will be chosen.       !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~     rs !"#$%&'()*+,=>-./4567?@8<9:;ABCDEFGH0123IJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqtuvwxyz{|}~       !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~11(C) 2014-2016 Edward Kmett, (C) 2014 Eric Mertens BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> experimental non-portable TrustworthyM'Name to give to generated field optics.Simple top-level definiton name+makeFields-style class name and method name*Rules to construct lenses for data fields. Allow LensTraversal (otherwise GetterFold)AType Name -> Field Names -> Target Field Name -> Definition NamesCompute the field optics for the type identified by the given type name. Lenses will be computed when possible, Traversals otherwise. qCompute the field optics for a deconstructed Dec When possible build an Iso otherwise build one optic per field. Normalized the Con type into a uniform positional representation, eliminating the variance between records, infix constructors, and normal constructors.For   and  , the leftmost name is chosen. Compute 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. /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. Build 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. Construct an optic clause that returns an unmodified value given a constructor name and the number of fields on that constructor. vConstruct an optic clause suitable for a Getter or Fold by visited the fields identified by their 0 indexed positions JBuild 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 %Build a clause that constructs an Iso Unify 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. =Attempt to unify two given types using a running substitution Perform a limited substitution on type variables. This is used when unifying rank-2 fields when trying to achieve a Getter or Fold. cApply a substitution to a type. This is used after unifying the types of the fields in unifyTypes. Template Haskell wants type variables declared in a forall, so we find all free type variables in a given type and declare them. This function works like  J except that it takes a list of variables to exclude from quantification.1  (constructor name, field name, field type !outer type !normalized constructors !target definition 8optic type, definition type, field count, target fields Outer s type Outer s type Outer s type !     2+(C) 2014-2016 Edward Kmett and Eric Mertens BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> experimental non-portable Trustworthy Normalized constructor 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)  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. IMain entry point into Prism generation for a given type constructor name.Generate prisms for the given  Generate 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. Compute 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. 1Construct either a Review or Prism as appropriate Construct an iso declaration Construct prism expressionprism  reviewer remitter Construct an Iso expressioniso  reviewer remitter Construct a Review expressionunto ((x,y,z) -> Con x y z) (Construct the review portion of a prism. ((x,y,z) -> Con x y z) :: b -> t `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 6Pattern 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 .Construct the remitter suitable for use in an Iso"((Con x y z) -> (x,y,z)) :: s -> a DConstruct 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 GConstruct the classy prisms instance for a given type and constructors.Ninstance Classname OuterType where topMethodName = id conMethodName_n = prism Normalize a single   to its constructor name and field types. Because GADT syntax allows multiple constructors to be defined at the same time, this function can return multiple normalized results. dCompute a prism's name by prefixing an underscore for normal constructors and period for operators. *Quantify all the free variables in a type.)    Type constructor name Type constructor name generate top-level definitions     constructors target constructor  "             3/(C) 2012-16 Edward Kmett, 2012-13 Michael Sloan BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> experimental non-portable TrustworthyM1 ;Monad for emitting top-level declarations as a side effect. ?A data, newtype, data instance or newtype instance declaration. Datatype context. =Type constructor name, or Nothing for a data family instance. List of type parameters 7Create a concrete record type given a substitution to detaParameters. ;Constructors , derivings :: [Name] -- currently not neededThe optional rule to create a class and method around a monomorphic data type. If this naming convention is provided, it generates a "classy" 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.MGenerate "simple" optics even when type-changing optics are possible. (e.g.  instead of )KIndicate 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."Generate "updateable" optics when  . When  , m s will be generated instead of s and p 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.wGenerate 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 'Create the class if the constructor is  and the  rule matches.3 to access the convention for naming fields in our .1 to access the option for naming "classy" lenses. Rules for making fairly simple partial lenses, ignoring the special cases for isomorphisms and traversals, and not making any classes. It uses  . A q that strips the _ off of the field name, lowercases the name, and skips the field if it doesn't start with an '_'.  Construct a f value for generating top-level definitions using the given map from field names to definition names.  Create a  from explicit pairings of (fieldName, lensName).  Create a 3 from a mapping function. If the function returns []#, it creates no lens for the field.?Rules for making lenses and traversals that precompose another . ?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.A  used by .DBuild lenses (and traversals) with a sensible default configuration.e.g.  data FooBar = Foo { _x, _y ::  r } | Bar { _x ::  r }  ''FooBar  will create x ::  FooBar  rL x f (Foo a b) = (\a' -> Foo a' b) <$> f a x f (Bar a) = Bar <$> f a y ::  FooBar  rC y f (Foo a b) = (\b' -> Foo a b') <$> f b y _ c@(Bar _) = pure c  =    ZMake lenses and traversals for a type, and create a class when the type has no arguments.e.g. !data Foo = Foo { _fooX, _fooY ::  r }  ''Foo  will create class HasFoo t where foo ::  t Foo fooX ::  t  rN fooX = foo . go where go f (Foo x y) = (\x' -> Foo x' y) <$> f x fooY ::  t  ri fooY = foo . go where go f (Foo x y) = (\y' -> Foo x y') <$> f y instance HasFoo Foo where foo = id  =   nMake 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.?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 `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 )Build lenses with a custom configuration.qMake 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 ::  r } deriving   |]  will create data Foo = Foo  r  r deriving   fooX, fooY ::  Foo Int  Similar to  , but takes a declaration quote.For 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 ::  r } deriving   |]  will create data Foo = Foo  r  r deriving   class HasFoo t where foo :: ' t Foo instance HasFoo Foo where foo =   fooX, fooY :: HasFoo t =>  t  r  Similar to  , but takes a declaration quote. Generate a p( 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) Build & instance for each newtype.  declareFields =  &PDeclare lenses for each records in the given declarations, using the specified 7. Any record syntax in the input will be stripped off.  Transform NewtypeDs declarations to DataDs and  NewtypeInstDs to  DataInstDs. ZGiven a set of names, build a map from those names to a set of fresh names based on them.Build Wrapped instance for a given newtype#Field rules for fields in the form  _prefix_fieldname  A  for .!#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  #"A  for !.#Field 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.$A  for #.%$Generate overloaded field accessors.e.g data Foo a = Foo { _fooX ::  r+, _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 =  & LTraverse each data, newtype, data instance or newtype instance declaration.?        :Name of the data type that lenses are being generated for.BNames of the class and the main method it generates, respectively.:Name of the data type that lenses are being generated for.GNames of all fields (including the field being named) in the data type.Name of the field being named.KName(s) of the lens functions. If empty, no lens is created for that field.    (Field Name, Definition Name)  A function that maps a  fieldName to lensNames. -Type Name -> Maybe (Class Name, Method Name)  (Field Name, Method Name)       ! !"#$%& " # $  % & '-      !"#$%&-%  &!#   " $9                     ! !"#$%& " # $  % & ' (C) 2012-16 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> experimental non-portableNone&     456]^_`abcdefghijklmnopqrstuvwxyz{|}~<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./GHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./01 !"#$%&'()*+,-./0123456789:;<=>?TUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~IJKhi      !"#$%& (C) 2013-16 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> experimental non-portableNone     456]^_`abcdefghijklmnopqrstuvwxyz{|}~<=>?@ABCDEFGHIJKLM\_opqrstuvxz{|}~     !"#$%&'()*+,-./GHIJKLMNOPQRSTUVWXYZ[]^_`abcdefghijklmnopstuvwxyz{|}~      !"#$%&'()*+,-./01 !"#$%&'()*+,-./0123456789:;<=>?TUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~IJKhi      !"#$%&4(C) 2012-16 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> provisionalportableNone'Check to see if this u matches.is _Left (Right 12)False is hex "3f79"True'    ''' (C) 2012-16 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> experimental non-portableNonev NOPQRSTUVWXYZ[]^`abcdefghijklmnwy \qrv\qr  NOPQRSTUVWXYZ[]^`abcdefghijklmnwy5(C) 2014-2016 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> provisionalControl.Monad.ErrorNone9;<=AT (You need this when using /.*$Catch exceptions that match a given u (or any p , really). * ::  ( e m => t% e a -> m r -> (a -> m r) -> m r * ::  ( e m => & e a -> m r -> (a -> m r) -> m r * ::  ( e m => ! e a -> m r -> (a -> m r) -> m r * ::  ( e m => x' e a -> m r -> (a -> m r) -> m r * ::  ( e m => p% e a -> m r -> (a -> m r) -> m r * ::  ( e m => m' e a -> m r -> (a -> m r) -> m r +$Catch exceptions that match a given u (or any p\), discarding the information about the match. This is particuarly useful when you have a t e () where the result of the u or m= isn't particularly valuable, just the fact that it matches. + ::  ( e m => t e a -> m r -> m r -> m r + ::  ( e m =>  e a -> m r -> m r -> m r + ::  ( e m =>  e a -> m r -> m r -> m r + ::  ( e m => x e a -> m r -> m r -> m r + ::  ( e m => p e a -> m r -> m r -> m r + ::  ( e m => m e a -> m r -> m r -> m r , A version of *d with the arguments swapped around; useful in situations where the code for the handler is shorter. , ::  ( e m => t% e a -> (a -> m r) -> m r -> m r , ::  ( e m => & e a -> (a -> m r) -> m r -> m r , ::  ( e m => ! e a -> (a -> m r) -> m r -> m r , ::  ( e m => x' e a -> (a -> m r) -> m r -> m r , ::  ( e m => m' e a -> (a -> m r) -> m r -> m r , ::  ( e m => p% e a -> (a -> m r) -> m r -> m r - A version of +d with the arguments swapped around; useful in situations where the code for the handler is shorter. - ::  ( e m => t e a -> m r -> m r -> m r - ::  ( e m =>  e a -> m r -> m r -> m r - ::  ( e m =>  e a -> m r -> m r -> m r - ::  ( e m => x e a -> m r -> m r -> m r - ::  ( e m => p e a -> m r -> m r -> m r - ::  ( e m => m e a -> m r -> m r -> m r .. takes a u (or any p0) to select which exceptions are caught If the  Exception/ does not match the predicate, it is re-thrown. . ::  ( e m => t e a -> m r -> m ( c a r) . ::  ( e m =>  e a -> m r -> m ( c a r) . ::  ( e m =>  e a -> m r -> m ( c a r) . ::  ( e m => x e a -> m r -> m ( c a r) . ::  ( e m => p e a -> m r -> m ( c a r) . ::  ( e m => m e a -> m r -> m ( c a r) /BThis 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 = , _Foo handleFoo (, _Bar handleBar expr) However, there are a couple of problems with this approach. The first is that having two exception handlers is inefficient. However, the more serious issue is that the second exception handler will catch exceptions in the first, e.g. in the example above, if  handleFoo uses  )2 then the second exception handler will catch it.Instead, we provide a function /, which would be used thus: f = / expr [ # _Foo handleFoo , # _Bar handleBar ] 0 Throw an  Exception described by a u. 0 l "a  l  ) 0 ::  ( e m => t e t -> t -> a 0 ::  ( e m => x e t -> t -> a *6Helper function to provide conditional catch behavior.()*+,-./0 *123456 ()*+,-./0 *+,-./()0()*+,-./0 *1234566(C) 2012-2016 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> provisionalportable Trustworthy7Evaluate the targets of a  or / into a data structure according to the given  +.  , = 7   =   7 =   7 ::  s a ->  + a ->  + s 7 ::  s a ->  + a ->  + s 7 :: (a ->  - a) -> s ->  - s) ->  + a ->  + s 8Evaluate the targets of a  or 7 according into a data structure according to a given  + in parallel.  . = 8  8 ::  s a ->  + a ->  + s 8 ::  s a ->  + a ->  + s 8 :: ((a ->  - a) -> s ->  - s) ->  + a ->  + s 9 Transform a , m, p,  or 7 to first evaluates its argument according to a given  + before proceeding. 9  /   ::  t =>  + a ->  + [a] : Transform a , m, p,  or 0 to evaluate its argument according to a given  + in parallel with evaluating. :  /   ::  t =>  + a ->  + [a] 789:789:789:789:7(C) 2012-16 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> provisionalportableNone;$Evaluate the elements targeted by a , , y, p or m! according to the given strategy.  0 = ; K;;;;8(C) 2012-16 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> provisional&MPTCs, Rank2Types, LiberalTypeSynonymsNoneOT<This 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 .  1 "a K   < < "a F    1 K (< b) f arr  2 i "a arr  2 f i  3 (K (< b) f arr) "a b <<<<9(C) 2012-16 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> experimentalLiberalTypeSynonymsNone:OT =Bitwise  4 the target(s) of a  or ._2 .|.~ 6 $ ("hello",3) ("hello",7) (=) ::  5 a =>  s t a a -> a -> s -> t (=) ::  5 a => y s t a a -> a -> s -> t (=) ::  5 a =>  s t a a -> a -> s -> t (=) :: ( a,  5 a) =>  s t a a -> a -> s -> t >Bitwise  6 the target(s) of a  or ._2 .&.~ 7 $ ("hello",254) ("hello",6) (>) ::  5 a =>  s t a a -> a -> s -> t (>) ::  5 a => y s t a a -> a -> s -> t (>) ::  5 a =>  s t a a -> a -> s -> t (>) :: ( a,  5 a) =>  s t a a -> a -> s -> t ?Modify the target(s) of a , ~ or  by computing its bitwise  6 with another value.*execState (do _1 .&.= 15; _2 .&.= 3) (7,7)(7,3) (?) :: (  s m,  5 a) => ~ s a -> a -> m () (?) :: (  s m,  5 a) => x s a -> a -> m () (?) :: (  s m,  5 a) =>  s a -> a -> m () (?) :: (  s m,  5 a) =>  s a -> a -> m () @Modify the target(s) of a ,  or  by computing its bitwise  4 with another value.*execState (do _1 .|.= 15; _2 .|.= 3) (7,7)(15,7) (@) :: (  s m,  5 a) => ~ s a -> a -> m () (@) :: (  s m,  5 a) => x s a -> a -> m () (@) :: (  s m,  5 a) =>  s a -> a -> m () (@) :: (  s m,  5 a) =>  s a -> a -> m () ABitwise  4 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)) (A) ::  5 a => y$ s t a a -> a -> s -> (a, t) (A) ::  5 a => # s t a a -> a -> s -> (a, t) (A) :: ( 5 a,  a) =>  s t a a -> a -> s -> (a, t) BBitwise  6 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)) (B) ::  5 a => y$ s t a a -> a -> s -> (a, t) (B) ::  5 a => # s t a a -> a -> s -> (a, t) (B) :: ( 5 a,  a) =>  s t a a -> a -> s -> (a, t) CModify the target(s) of a  (or ) by computing its bitwise  6c with another value, returning the result (or a monoidal summary of all of the results traversed).runState (_1 <.&.= 15) (31,0) (15,(15,0)) (C) :: (  s m,  5 a) =>  s a -> a -> m a (C) :: (  s m,  5 a,  a) =>  s a -> a -> m a DModify the target(s) of a , (or ) by computing its bitwise  4c with another value, returning the result (or a monoidal summary of all of the results traversed).runState (_1 <.|.= 7) (28,0) (31,(31,0)) (D) :: (  s m,  5 a) =>  s a -> a -> m a (D) :: (  s m,  5 a,  a) =>  s a -> a -> m a IThis < can be used to access the value of the nth bit in a number.I n is only a legal  into b if 0  7 n  8  9 ( : :: b). 16^.bitAt 4True 15^.bitAt 4False15 & bitAt 4 .~ True3116 & bitAt 4 .~ False0J,Get the nth byte, counting from the low end.J n is a legal  into b iff 0  7 n  8  ; ( 9 ( : :: b)) 8(0xff00 :: Word16)^.byteAt 00(0xff00 :: Word16)^.byteAt 1255 byteAt 1 .~ 0 $ 0xff00 :: Word160byteAt 0 .~ 0xff $ 0 :: Word16255K)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.LBTraverse 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 is'nt this function called bytes to match K5? Alas, there is already a function by that name in Data.ByteString.Lens.=>?@ABCDEFGHIJKL=>?@ABCDEFGHIJKL=>ABFE@?DCHGIKJL=>?@ABCDEFGHIJKL =4>4?4@4A4B4C4D4E4F4G4H4:(C) 2012-2016 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> experimental non-portableNone$:bO  (or  ) a list of bytes into a  C O "a j P   x "a x  O   x "a x  j O "[104,101,108,108,111]^.packedBytes"hello"P  (or  ) a  C into a list of bytes P "a j O   x "a x  P   x "a x  j P ""hello"^.packedChars.unpackedBytes[104,101,108,108,111]QTraverse each  F in a  C.This  walks the  C 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: Q "a P    *anyOf bytes (== 0x80) (Char8.pack "hello")False$Note that when just using this as a , F   can be more efficient.R (or ) a list of characters into a  CWhen writing back to the  C it is assumed that every   lies between '\x00' and '\xff'. R "a j S  x "a x  R  x "a x  j R c"hello"^.packedChars.each.re (base 16 . enum).to (\x -> if Prelude.length x == 1 then '0':x else x) "68656c6c6f"S (or ) a list of characters into a  CWhen writing back to the  C it is assumed that every   lies between '\x00' and '\xff'. S "a j R  x "a x  S  x "a x  j S 0[104,101,108,108,111]^.packedBytes.unpackedChars"hello"T#Traverse the individual bytes in a  C as characters.When writing back to the  C it is assumed that every   lies between '\x00' and '\xff'.This  walks the  C 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: T = S     anyOf chars (== 'h') "hello"TrueMNOPQRSTMNOPQRSTOPQRSTNMMNOPQRST;(C) 2012-2016 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> experimental non-portableNone$:bW (or ) a list of bytes into a  D. W "a j X   x "a x  W   x "a x  j W 8[104,101,108,108,111]^.packedBytes == Char8.pack "hello"TrueX (or ) a  D into a list of bytes X "a j W   x "a x  X   x "a x  j X ""hello"^.packedChars.unpackedBytes[104,101,108,108,111]Y#Traverse the individual bytes in a  D.This  walks each strict  D 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: Y "a X    *anyOf bytes (== 0x80) (Char8.pack "hello")False$Note that when just using this as a , F  can be more efficient.Z (or ) a list of characters into a  D.When writing back to the  D it is assumed that every   lies between '\x00' and '\xff'. Z "a j [  x "a x  Z  x "a x  j Z c"hello"^.packedChars.each.re (base 16 . enum).to (\x -> if Prelude.length x == 1 then '0':x else x) "68656c6c6f"[ (or ) a list of characters into a  DWhen writing back to the  D it is assumed that every   lies between '\x00' and '\xff'. [ "a j Z  x "a x  [  x "a x  j [ 0[104,101,108,108,111]^.packedBytes.unpackedChars"hello"\#Traverse the individual bytes in a  D as characters.When writing back to the  D it is assumed that every   lies between '\x00' and '\xff'.This  walks each strict  D chunk in a tree-like fashion enable zippers to seek to locations more quickly and accelerate many monoidal queries, but up to associativity (and constant factors) it is equivalent to: \ = [    anyOf chars (== 'h') "hello"TrueUVWXYZ[\UVWXYZ[\WXYZ[\VUUVWXYZ[\<(C) 2012-16 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> experimental non-portableNone$:b]Traversals for ByteStrings.^  (or  () a list of bytes into a strict or lazy  C.   x "a x  ^   x "a x  j ^ ^ "a j d _ (or -) a list of characters into a strict or lazy  C.When writing back to the  C it is assumed that every   lies between '\x00' and '\xff'.  x "a x  _  x "a x  j _ _ "a j e `Traverse each  F in a strict or lazy  CThis  walks each strict  C 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 d    _ ` ( 3 0x80) ::  C ->   a2Traverse the individual bytes in a strict or lazy  C as characters.When writing back to the  C it is assumed that every   lies between '\x00' and '\xff'.This  walks each strict  C 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 "a e    _ a ( 3 'c') ::  C ->   d  (or  ) a  C into a list of bytes d "a j ^   x "a x  d   x "a x  j d d :: x   [ F] d :: x  [ F] e (or /) a list of characters into a strict (or lazy)  CWhen writing back to the  C it is assumed that every   lies between '\x00' and '\xff'. e "a j _  x "a x  e  x "a x  j e e :: x     e :: x    ]^_`abcdefg ]^`_abcde ]^_`adecb]^_`abcdefg=(C) 2012-16 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> experimental non-portableNone$:bl Access the  < of a   number.(a :+ b)^._realPartaa :+ b & _realPart *~ 2 a * 2 :+ b l ::  h f => (a -> f a) ->   a -> f (  a)m Access the  = of a   number.(a :+ b)^._imagPartba :+ b & _imagPart *~ 2 a :+ b * 2 m ::  h f => (a -> f a) ->   a -> f (  a)n This isn't quite a legal  . Notably the  l (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 .o Access the  ? of a   number. (10.0 :+ 20.0) & _magnitude *~ 2 20.0 :+ 40.0 This isn't quite a legal  . Notably the  l (L l b a) = b(law is violated when you set a negative  ?. This flips the  @ and retains a positive  ?. So don't do that!)Otherwise, this is a perfectly cromulent . Setting the  ? of a zero   number assumes the  @ is 0.p Access the  @ of a   number.4(mkPolar 10 (2-pi) & _phase +~ pi & view _phase) "H 2True This isn't quite a legal  . Notably the  l (L l b a) = blaw is violated when you set a  @ outside the range (- A,  A]D. The phase is always in that range when queried. So don't do that!)Otherwise, this is a perfectly cromulent .q Access the  B of a   number.*(2.0 :+ 3.0) & _conjugate . _imagPart -~ 1 2.0 :+ 4.02(mkPolar 10.0 2.0 ^. _conjugate . _phase) "H (-2.0)True hijklmnopq hijklmnopq lmnopqkjih hijklmnopq>(C) 2012-16 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> provisionalportableNoneOTr IntSet isn't Foldable, but this m) can be used to access the members of an  C.&sumOf members $ setOf folded [1,2,3,4]10sThis * can be used to change the contents of an  C( 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 K and reindexing it via s.(over setmapped (+1) (fromList [1,2,3,4])fromList [2,3,4,5]t Construct an  C from a p, m, ,  or y.setOf folded [1,2,3,4]fromList [1,2,3,4]5setOf (folded._2) [("hello",1),("world",2),("!!!",3)]fromList [1,2,3] t :: p s  r -> s ->  C t :: m s  r -> s ->  C t :: x s  r -> s ->  C t ::  s  r -> s ->  C t ::  s  r -> s ->  C rstrstrstrst?(C) 2012-16 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> provisionalportableNone:OTuA u/ 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"vA u/ 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"uvwuvwuvwuvw@(C) 2012-16 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> experimental non-portableNone:OTxA  A is isomorphic to a  D  E m "a m  xSeq.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]yA  A is isomorphic to a  F  G m "a m  ySeq.fromList [a,b,c] ^. viewRfromList [a,b] :> cSeq.empty ^. viewREmptyREmptyR ^. from viewR fromList []&review viewR $ fromList [a,b] Seq.:> cfromList [a,b,c]zTraverse the first n elements of a  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]{Traverse all but the first n elements of a  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]|(Traverse all the elements numbered from i to j of a  A&fromList [a,b,c,d,e] & sliced 1 3 %~ ffromList [a,f b,f c,d,e]} Construct a  A from a p,  n, l, q or s.seqOf folded ["hello","world"]fromList ["hello","world"]5seqOf (folded._2) [("hello",1),("world",2),("!!!",3)]fromList [1,2,3] } :: p s a -> s ->  A a } :: m s a -> s ->  A a } :: x s a -> s ->  A a } ::  s a -> s ->  A a } ::  s a -> s ->  A a xyz{|}xyz{|}xy|z{}xyz{|}A(C) 2012-16 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> provisionalMTPCsNone:~A  that focuses on the root of a  .view root $ Node 42 []42A 3 returning the direct descendants of the root of a    "a  H~~~~B(C) 2012-16 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> experimental Rank2TypesNoneOTA  for working with a  I of a   value.A  for working with a  J of a   value.C(C) 2012-16 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> provisional non-portable Trustworthy:<=OT 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 Similar to [, but returning a  .0toVectorOf both (8,15) == Vector.fromList [8,15]TrueConvert 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 Convert a  4 to a version that doesn't retain any extra memory.This = 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]i starting indexn lengthD(C) 2012-16 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> experimentalGHCNone:BOQRT:Convert from the data type to its representation (or back)'"hello"^.generic.from generic :: String"hello":Convert from the data type to its representation (or back):You can access fields of `data (f :*: g) p` by using it's  and  instancesE(C) 2012-16 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> experimental Rank2TypesNone 'Modify the path by adding another path.O(both </>~ "bin" $ ("hello","world")) == ("hello" </> "bin", "world" </> "bin")True () ::  s a  K  K ->  K -> s -> a () :: y s a  K  K ->  K -> s -> a () ::  s a  K  K ->  K -> s -> a () ::  s a  K  K ->  K -> s -> a Modify the target(s) of a , x, ~ or  by adding a path.WexecState (both </>= "bin") ("hello","world") == ("hello" </> "bin", "world" </> "bin")True () ::   s m => ~ s  K ->  K -> m () () ::   s m => x s  K ->  K -> m () () ::   s m =>  s  K ->  K -> m () () ::   s m =>  s  K ->  K -> m () +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.+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.'Modify the path by adding an extension.#both <.>~ "txt" $ ("hello","world")("hello.txt","world.txt") () ::  s a  K  K ->   -> s -> a () :: y s a  K  K ->   -> s -> a () ::  s a  K  K ->   -> s -> a () ::  s a  K  K ->   -> s -> a Modify the target(s) of a , x, ~ or  by adding an extension.-execState (both <.>= "txt") ("hello","world")("hello.txt","world.txt") () ::   s m => ~ s  K ->   -> m () () ::   s m => x s  K ->   -> m () () ::   s m =>  s  K ->   -> m () () ::   s m =>  s  K ->   -> m () 1Add 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.1Add 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.1Add 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.A ( for reading and writing to the basenameNote: This is   a legal  unless the outer  K| 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"TrueA ) for reading and writing to the directoryNote: this is not a legal  unless the outer  KL already has a directory component, and generated directories are not null.F(("long" </> "path" </> "name.txt") ^. directory) == "long" </> "path"TrueA ) for reading and writing to the extensionNote: This is not a legal =, unless you are careful to ensure that generated extension  K* components are either null or start with " and do not contain any internal s.F(extension .~ ".png" $ "path" </> "name.txt") == "path" </> "name.png"TrueA - for reading and writing to the full filenameNote: This is not a legal <, unless you are careful to ensure that generated filename  K= components are not null and do not contain any elements of s.I(filename .~ "name.txt" $ "path" </> "name.png") == "path" </> "name.txt"True 444444444444F(C) 2012-2016 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> experimental Rank2TypesNone9:;<=Where the error happened. Error type specific information.2The handle used by the action flagging this error. the error is related to. leading to this error, if any.What type of error it isG(C) 2012-16 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> provisionalportableNone$OTbThis u* can be used to model the fact that every   type is a subset of  .Embedding through the u only succeeds if the  2 would pass through unmodified when re-extracted.?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" LLike , but handles up to base-36 MLike , but handles up to base-36 NA safe variant of  M O+Select digits that fall into the given base PA simpler variant of > that only prepends a dash and doesn't know about parentheses QA simpler variant of \ that supports any base, only recognizes an initial dash and doesn't know about parentheses  =  2  =  8  =  10  =  16  n = i (+n) (subtract n)[1..3]^..traverse.adding 1000[1001,1002,1003]  n = i (subtract n) ((+n)  n = j ( n)   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   n = i (/n) (*n)  n = j ( n)Note: This errors for n = 0  n = i (**n) (**recip n)Note: This errors for n = 0Hau (_Wrapping Sum . from (exponentiating 2)) (foldMapOf each) (3,4) == 5True  = i    8au (_Wrapping Sum . negated) (foldMapOf each) (3,4) == 7True9au (_Wrapping Sum) (foldMapOf (each.negated)) (3,4) == -7True L M N O P Q   L M N O P QH(C) 2012-16 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> provisionalControl.Exception Trustworthy $9;<=OTb9This   is thrown by lens7 when the user somehow manages to rethrow an internal .%There is no information carried in a .  :: t  ()  :: t   () #This is thrown when the user calls .Retrieve the argument given to . R is isomorphic to a  .0catching _ErrorCall (error "touch down!") return "touch down!"A 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.CInformation about the source location where the record was updated.A 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.JInformation about the source location where the record selection occurred.'An uninitialised record field was used.HInformation about the source location where the record was constructed.  :: t  S    :: t     A pattern match failed.5Information about the source location of the pattern.  :: t  T    :: t     }A class method without a definition (neither a default definition, nor a definition in the appropriate instance) was called.,Extract a description of the missing method.  :: t  U    :: t     BThere are no runnable threads, so the program is deadlocked. The  V  # is raised in the main thread only.%There is no information carried in a  V  .  :: t  V ()  :: t   () "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.0There is no additional information carried in a  W  .  :: t  W ()  :: t   () The thread is blocked on an  !,, but there are no other references to the  ! so it can't ever continue.0There is no additional information carried in a  X  .  :: t  X ()  :: t   () ?Thrown when the program attempts to call atomically, from the , package, inside another call to atomically.0There is no additional information carried in a  Y  .  :: t  Y ()  :: t   () Thrown 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.0There is no additional information carried in a  Z  .  :: t  Z ()  :: t   () Asynchronous exceptions.There are several types of  [.  :: r  [  [  :: t    [  \ was applied to  .This  B contains provides information about what assertion failed in the  .zhandling _AssertionFailed (\ xs -> "caught" <$ guard ("<interactive>" `isInfixOf` xs) ) $ assert False (return "uncaught")"caught"  :: t  ]    :: t     )Exceptions generated by array operations.Extract information about an  ^.  :: t  ^  ^  :: t    ^ Arithmetic exceptions.Exceptions that occur in the IO  . 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.Unfortunately the name  ioException is taken by base for throwing IOExceptions.  :: t  _  _  :: t    _ %Many combinators for working with an  _ are available in System.IO.Error.Lens. Traverse the strongly typed   contained in  6 where the type of your function matches the desired  .   :: ( j f,   a) => (a -> f a) ->   -> f   $Catch exceptions that match a given u (or any m , really).Ucatching _AssertionFailed (assert False (return "uncaught")) $ \ _ -> return "caught""caught"   ::  ` m => t  # 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 => x  % a -> m r -> (a -> m r) -> m r   ::  ` m => p  # a -> m r -> (a -> m r) -> m r   ::  ` m => m  % a -> m r -> (a -> m r) -> m r $Catch exceptions that match a given u (or any p\), discarding the information about the match. This is particuarly useful when you have a t e () where the result of the u or m= isn't particularly valuable, just the fact that it matches.Ocatching_ _AssertionFailed (assert False (return "uncaught")) $ return "caught""caught"   ::  ` m => t   a -> m r -> m r -> m r   ::  ` m =>    a -> m r -> m r -> m r   ::  ` m =>    a -> m r -> m r -> m r   ::  ` m => x   a -> m r -> m r -> m r   ::  ` m => p   a -> m r -> m r -> m r   ::  ` m => m   a -> m r -> m r -> m r  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 => t  # 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 => x  % a -> (a -> m r) -> m r -> m r   ::  ` m => m  % a -> (a -> m r) -> m r -> m r   ::  ` m => p  # a -> (a -> m r) -> m r -> m r  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 => t   a -> m r -> m r -> m r   ::  ` m =>    a -> m r -> m r -> m r   ::  ` m =>    a -> m r -> m r -> m r   ::  ` m => x   a -> m r -> m r -> m r   ::  ` m => p   a -> m r -> m r -> m r   ::  ` m => m   a -> m r -> m r -> m r  A variant of " that takes a u (or any m/) to select which exceptions are caught (c.f. #, $ ). If the  / does not match the predicate, it is re-thrown.   ::  ` m => t   a -> m r -> m ( c a r)   ::  ` m =>    a -> m r -> m ( c a r)   ::  ` m =>    a -> m r -> m ( c a r)   ::  ` m => x   a -> m r -> m ( c a r)   ::  ` m => p   a -> m r -> m ( c a r)   ::  ` m => m   a -> m r -> m ( c a r)  A version of  - that discards the specific exception thrown.   ::  ` m => t   a -> m r -> m (Maybe r)   ::  ` m =>    a -> m r -> m (Maybe r)   ::  ` m =>    a -> m r -> m (Maybe r)   ::  ` m => x   a -> m r -> m (Maybe r)   ::  ` m => p   a -> m r -> m (Maybe r)   ::  ` m => m   a -> m r -> m (Maybe r)  Throw an   described by a u[. Exceptions may be thrown from purely functional code, but may only be caught within the IO  .   l "a  l  a   :: t   t -> t -> r   :: x   t -> t -> r  A variant of  " that can only be used within the IO   (or any other  ` instance) to throw an   described by a u. 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  S because it guarantees ordering with respect to other monadic operations, whereas   does not.   l "a  l %&   ::  b m => t   t -> t -> m r   ::  b m => x   t -> t -> m r   raises an   specified by a u in the target thread.   thread l "a  l ( c thread)   ::  d -> t   t -> t -> m a   ::  d -> x   t -> t -> m a This $ can be used to purely map over the  ;s an arbitrary expression might throw; it is a variant of  e in the same way that B is a variant of  u. )'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" %This is a type restricted version of  0, which avoids the type ambiguity in the input   when using L.8The following maps any exception to arithmetic overflow:lhandling _Overflow (\_ -> return "caught") $ assert False (return "uncaught") & mappedException' .~ Overflow"caught" Handle arithmetic  .   "a        :: t  f  f   :: t    f Handle arithmetic  .   "a        :: t  f  f   :: t    f $Handle arithmetic loss of precision.   "a        :: t  f  f   :: t    f Handle division by zero.   "a        :: t  f  f   :: t    f /Handle exceptional _Denormalized floating pure.   "a        :: t  f  f   :: t    f  Added in base. 4.6 in response to this libraries discussion: Mhttp://haskell.1045720.n5.nabble.com/Data-Ratio-and-exceptions-td5711246.html   "a        :: t  f  f   :: t    f BAn attempt was made to index an array outside its declared bounds.   "a        :: t  ^     :: t     UAn attempt was made to evaluate an element of an array that had not been initialized.   "a        :: t  ^     :: t     !8The 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.  ! :: t  [ ()  ! :: t   () "wThe 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  g exceptions.  " :: t  [ ()  " :: t   () #This  & is raised by another thread calling '(H, or by the system if it needs to terminate the thread for some reason.  # :: t  [ ()  # :: t   () $This   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).  $ :: t  [ ()  $ :: t   () {                           ! " # $ h % & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @ A B C D E F[                           ! " # $[                              ! " # $j                           ! " # $ h % & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @ A B C D E FI(C) 2012-2016 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> experimental non-portableNone$:<=b GAny  i can be thrown as an   HThis u8 allows you to traverse the typed value contained in a  iO where the type required by your function matches that of the contents of the  i, or construct a  iD value out of whole cloth. It can also be used to catch or throw a  i value as  .  H ::   a => t  i a  H ::   a => t   a  G H I J K G H I G H I G H I J KJ(C) 2013-16 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> provisionalControl.ExceptionNone$9;<=b L*Exit codes that a program can return with: P!indicates successful termination;  P :: t  j ()  P :: t   () Qindicates 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).  Q :: t  j  r  Q :: t    r  L M N O P Q R S L M N O P Q L M Q P N O L M N O P Q R S k)*+,-./-.0,12,13,13,45,46,,78,79,79,:;-.<=>?=>@=>A=BC=BD=BE=BFGHIGHJGHKGHLGHMGHNGHOGHOPQRPQS T T U V V W X X Y Z Z [ \ \ ] ^ ^ _ ` ` a b b c d d e f f g h h i j j k l m n o p q r s t u v w x y z { | } ~                                                                                                          k !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFFGHIIJKLLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrswtuvvwxyz{|}~onutps]mlrq      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcddefghijklmnopqrsstuvwxxyz{{|}~yy~NO                     ! " # $ % & ' ( ) * + g , - . / 0 1 2 3 4 5 6 7 8 b 9 : d e ; < = > ? @ A B C D E F G H I J K c 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 oppqrstuvwxyz{|}~}      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJK L M N O P Q R S!T!U"V"W"p"X"Y"Z"s"["\"]""^"_"`"]"a"b"o"c"d"n"e"f"u"g"h"t"i"j""l""k"l"m"m"n"o"r"p"q"r"q"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/{/|/}/~/////00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 0 0 0 0 0000000000000000000 0!0"0#0$0%0&0'0(0)0*0+0,0-0.0/000102030405060708090:0;0<0=0>0?0@0A0B0C0D0E0F0G0H0I0J0K0L0M0N0O0P0Q0R0S0T0U0V0W0X0Y0Z0[0\0]0^0_0`0a0b0c0d0e0f0g0h0i0j0k0l0m0n0o0p1q1r1s1t1t1u1v1w1x1y1z1{1|1}1~11122222333333333333333333333333333333333333333455555555 55555556666789999999999999999::::::::;;;;;;;;<<<<<<<<<<<======z====>>>???@@@@@@AABBCCCCCDDDDDDDDDDDDDDDD E E E E E E E E E E E E E E E E F F F F F F F F F F F F F F F F F !F "F #F $F %F &F 'F (F )G *G +G,G ,G -G .G /G 0G 1G 2G 3G 4G 5H 6H 7H 8HH 9H :H ;H <H =H >H ?H @H AH BH CH DH EH FH GH HH IH JH KHH LH MH NHH OH PH QH RH SH TH UH VH WH 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 sHHHHHH tHH uH vH wH xH yH zH {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 H H H H H H H H I I I I I J J J J J J J J K K K K K K K K K K K K K ,   ,  ,    ,   ,  ,    , ,  ,  )  =  =  ,   , , ,  , ,  ,,  ,  ,  ,  *,  ) )  ) , , , ,                        Q         , , , ! " ! # ! $,  %)  &, ' (  ) ! * +,  ,,5, - ., / 0, / 1 2 3 4 2 5 6 2hi 2 7[ 2 8M 2 9 : 2 9S ; < = > ? @)  A B C)  D B E F,, G , H I, H J, H K, L, M N) O, H P, H Q, R S, R T, U, V, W, X, Y)  Z, [, \, ], ^, _, `, a, b, c, d, e,f, f, g, h,  i, j,  k, l, m, n, o, p, H q, r, s)  t) u, v, w x, y, z)  {, |, }, ~, H , , , , , , , w , ,  ,  r   , , ,,  )  ,    , , , , , , , , , , 2  ,, 2h 2h , H , H )           ,, B C B     ,  , ! ! ! ! ! , ,  # , # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # ,  , ,  $ ,4 ,4 , M )  )    , ,  B E8 B C8 B 8 B 8 ; <8 ; 8& & & & & & & &           ' '      ( (       !, " # $ % & $ % ', " (  ) *  ) , + ,  -  . / 0  1   2  B 3 4 ;  5,  6,{|, H 7, 8. 9 ;  :  2 ; <  =  >  ?0 @1 A1 B1 C1 D1 E1 F1 G1 H1 I1 J1 K1 L1 M1 N1 O1 P1 E1 Q1 R1 S1 T1 U1 V1 W1 X1 Y1 Z1 [1 \1 ]1 ^1 _1 `1 a2 b2 c  d2 e2 f2 g2 h2 i2 j2 k2 l2 m2 n2 o2 p2 q2 r  s2 t2 u2 b2 v2 w2 x2 y2 y2 R2 z2 {2 |2 }2 V2 ~2 2 2 2 2 2 3 3 3 3 3 3 3 , 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3  5$   $ % $ % : $ % , ,  , ) ) , , y , ,{ ,{ ,{ ,{ ,{ , ,{ B  B  B B  B B 3 ,, ,  G G G G G G ,  ,  ,  ,  ,  ,  ,  ,  ,  ,  , ,  ,  ,   , &  , ,  , ,  ,  H ,  ,  "lens-4.15.1-GIqMfFkWZyYIqq1QNYTt5ZControl.Lens.Internal.CoerceControl.Lens.TraversalControl.Lens.GetterControl.Lens.SetterControl.Lens.ReviewControl.Lens.LensControl.Lens.PrismControl.Lens.IsoControl.Lens.FoldControl.Lens.Internal.FoldControl.Lens.Internal.ZoomControl.Lens.Internal.THControl.Lens.Internal.SetterControl.Lens.Internal.ReviewControl.Lens.Internal.ListControl.Lens.Internal.LevelControl.Lens.Internal.GetterControl.Lens.Internal.IndexedControl.Lens.Internal.ContextControl.Lens.TypeControl.Lens.TupleControl.Lens.Internal.IsoControl.Lens.Internal.PrismControl.Lens.Internal.BazaarControl.Lens.Internal.MagmaControl.Lens.ZoomData.HashSet.Lens Data.Map.Lens Data.Set.LensControl.Lens.Internal.ExceptionControl.Lens.Indexed Control.Lens.Internal.ByteStringControl.Lens.LevelControl.Lens.ReifiedData.Data.LensControl.Lens.PlatedControl.Lens.EqualityControl.Lens.WrappedData.Text.Strict.LensData.Text.Lazy.LensData.Text.LensData.Vector.Generic.LensControl.Lens.EmptyControl.Lens.EachControl.Lens.ConsControl.Lens.Internal.DequeControl.Lens.AtLanguage.Haskell.TH.LensControl.Lens.Internal.FieldTHControl.Lens.Internal.PrismTHControl.Lens.THControl.Lens.ExtrasControl.Monad.Error.Lens Control.Parallel.Strategies.LensControl.Seq.LensData.Array.LensData.Bits.LensData.ByteString.Strict.LensData.ByteString.Lazy.LensData.ByteString.LensData.Complex.LensData.IntSet.LensData.List.LensData.Sequence.LensData.Tree.LensData.Typeable.LensData.Vector.LensGHC.Generics.LensSystem.FilePath.LensSystem.IO.Error.Lens Numeric.LensControl.Exception.LensData.Dynamic.LensSystem.Exit.Lens Paths_lensControl.Monad.RWSRWSTZoomzoomControl.Monad.TransFreeTControl.Monad.ErrorErrorTControl.Monad.Trans.MaybeMaybeTControl.Monad.Trans.ListListTControl.Monad.WriterWriterTControl.Monad.StateStateT backwardsSetterAccessor Data.IntMapIntMapControl.Lens.Internal.InstanceslastOfpreview maximumOf minimumOfmapM_ traverseOf_Control.Monad.Trans.State.LazyState indexed64indexed TraversalIndexedTraversalFold IndexedFoldPrismLens IndexedLensIsoGetter IndexedGetterLensLikeOvercloneBazaar _imagPart Data.ComplexComplex traversedGetting Data.FoldableFoldable foldMapOf Data.MonoidMonoidrereview^?Data.TraversabletraverselengthOfNumeric.NaturalNaturalprismoutsidefromData.Text.InternalTextsetviewover TraversableData.Functor.Compose getComposeCompose Traversal'Setter'^..~%~+~Iso'-~*~//~^~^^~**~||~&&~<>~%=+=-=*=//=^=^^=**=||=&&=.=<>=%@~ withIndex<.~<.=anyOfControl.Applicative Applicative Data.Functor<$> fmapDefaultuse_2atimaptakingControl.Lens.Internal ifoldMapOfcloneTraversal Data.Typeablecast_EmptyAsEmptyControl.Monad.Reader.Classlocalfolded Data.Map.LazyunionPreludeunfoldr_1 traverseOf_LeftforOf Data.Listfoldl1' Control.MonadMonadControl.TraversableControl.Lens.Isomorphic itraverseOfimapMOfiforMOf elemIndex elemIndices findIndex findIndicesControl.ExceptionHandler_AssertionFailed _ErrorCallPrism'Lens'_NonTermination_StackOverflowifor transposeuniplatebiplate contextsOfControl.Comonad.Store.ClasspospeekReifiedTraversal runTraversalControl.Lens.IndexedTraversalmap mapAccumR mapAccumLB Bytestringplate Data.Just isNothingextractIndexed cloneLensalaalafData.MapMapjoin Data.TextData.Text.LazySimpleWrapped Control.LensControl.Lens.CombinatorsControl.Lens.OperatorscatchesData.ByteStringpackunpackData.ByteString.Char8Data.ByteString.LazyData.ByteString.Lazy.Char8 ByteStringSystem.FilePath extSeparatorpathSeparators Data.Char intToDigit digitToIntNumeric showSigned readSignederrorControl.Monad.STMSTMControl.Concurrent.MVarMVartrytryJust catchJustCatchIOthrowControl.Concurrent killThreadghc-primGHC.Primcoercebase(contravariant-1.4-DzaLxukcYo81MHO5zSdeePData.Functor.Contravariant contramap ContravariantData.Functor.Identity runIdentityIdentityData.Bifunctorbimap BifunctorData.Functor.ConstgetConstConst Data.Function&>$&profunctors-5.2-Ftt6hTaJPG87FS5uAEIZltData.Profunctor.Choiceright'left'ChoiceData.Profunctor.Unsafermaplmapdimap Profunctor'reflection-2.1.2-Lwt0A3NRHka1hAeW9AOpLqData.Reflection sequenceBy traverseBy foldMapByfoldBy reifiedMemptyreifiedMappend ReifiedMonoid(semigroupoids-5.1-HP6DQMG4B3NKAis3IyIk4b Data.Semigroup.Traversable.Class traverse1 Traversable1 EffectRWS getEffectRWSEffect getEffect FocusingFreeunfocusingFreeFreedgetFreed FocusingErr unfocusingErrErrgetErr FocusingMay unfocusingMayMaygetMay FocusingOn unfocusingOn FocusingPlusunfocusingPlus FocusingWithunfocusingWithFocusing unfocusing$fContravariantEffectRWS$fApplicativeEffectRWS$fApplyEffectRWS$fFunctorEffectRWS$fApplicativeEffect $fApplyEffect$fMonoidEffect$fSemigroupEffect$fContravariantEffect$fFunctorEffect$fApplicativeFocusingFree$fApplyFocusingFree$fFunctorFocusingFree $fMonoidFreed$fSemigroupFreed$fApplicativeFocusingErr$fApplyFocusingErr$fFunctorFocusingErr $fMonoidErr$fSemigroupErr$fApplicativeFocusingMay$fApplyFocusingMay$fFunctorFocusingMay $fMonoidMay$fSemigroupMay$fApplicativeFocusingOn$fApplyFocusingOn$fFunctorFocusingOn$fApplicativeFocusingPlus$fApplyFocusingPlus$fFunctorFocusingPlus$fApplicativeFocusingWith$fApplyFocusingWith$fFunctorFocusingWith$fApplicativeFocusing$fApplyFocusing$fFunctorFocusing tySynInstD'appsTappsE1toTupleTtoTupleEtoTuplePconAppsTbndrNamefromSetnewNameslensPackageKey mkLensName_tc mkLensName_vtraversalTypeNametraversal'TypeName lensTypeName lens'TypeName isoTypeName iso'TypeNamegetterTypeName foldTypeName prismTypeNameprism'TypeNamereviewTypeNamewrappedTypeNameunwrappedTypeNamerewrappedTypeName_wrapped'ValName isoValName prismValName untoValNamephantomValNamephantom2composeValName idValName fmapValName pureValName apValName rightDataName leftDataNameSettable untainted untaintedDot taintedDot$fSettableCompose$fSettableBackwards$fSettableIdentity Reviewableretagged $fReviewablep ordinalNubFlowsrunFlows Deepening runDeepeningLevelTwoOneZero deepening$fApplicativeFlows $fApplyFlows$fFunctorFlows$fMonoidDeepening$fSemigroupDeepening$fTraversableLevel$fFoldableLevel$fFunctorLevel $fEqLevel $fOrdLevel $fShowLevel $fReadLevelAlongsideRightgetAlongsideRight AlongsideLeftgetAlongsideLeftnoEffect$fBitraversableAlongsideRight$fBifoldableAlongsideRight$fBifunctorAlongsideRight$fTraversable1AlongsideRight$fFoldable1AlongsideRight$fTraversableAlongsideRight$fFoldableAlongsideRight$fContravariantAlongsideRight$fFunctorAlongsideRight$fBitraversableAlongsideLeft$fBifoldableAlongsideLeft$fBifunctorAlongsideLeft$fTraversable1AlongsideLeft$fFoldable1AlongsideLeft$fTraversableAlongsideLeft$fFoldableAlongsideLeft$fContravariantAlongsideLeft$fFunctorAlongsideLeft$fReadAlongsideRight$fShowAlongsideRight$fReadAlongsideLeft$fShowAlongsideLeft RightmostRPureRLeafRStepLeftmostLPureLLeafLStepMaxNoMaxMinNoMin Sequenced getSequenced Traversed getTraversedFolding getFoldinggetMingetMax getLeftmost getRightmost$fMonoidRightmost$fSemigroupRightmost$fMonoidLeftmost$fSemigroupLeftmost $fMonoidMax$fSemigroupMax $fMonoidMin$fSemigroupMin$fMonoidSequenced$fSemigroupSequenced$fMonoidTraversed$fSemigroupTraversed$fMonoidFolding$fSemigroupFoldingcoerce' Indexing64 runIndexing64Indexing runIndexing runIndexed Indexable Conjoineddistrib conjoinedindexing indexing64asIndex$fContravariantIndexing64$fApplicativeIndexing64$fApplyIndexing64$fFunctorIndexing64$fContravariantIndexing$fApplicativeIndexing$fApplyIndexing$fFunctorIndexing$fIndexableiIndexed$fConjoinedIndexed$fArrowLoopIndexed$fArrowApplyIndexed$fArrowChoiceIndexed$fArrowIndexed$fCategoryTYPEIndexed$fStrongIndexed$fChoiceIndexed$fCorepresentableIndexed$fCosieveIndexed(,)$fRepresentableIndexed$fSieveIndexed(->)$fCostrongIndexed$fClosedIndexed$fProfunctorIndexed$fMonadFixIndexed$fMonadIndexed $fBindIndexed$fApplicativeIndexed$fApplyIndexed$fFunctorIndexed$fIndexablei(->)$fConjoined(->) PretextT'PretextT runPretextTPretext'Pretext runPretextContext'ContextSellablesellIndexedComonadStoreiposipeekipeeksiseekiseeks iexperimentcontextIndexedComonadiextract iduplicateiextendIndexedFunctorifmap$fContravariantPretextT$fSellablepPretextT$fComonadStoreaPretextT$fIndexedComonadStorePretextT$fComonadPretextT$fIndexedComonadPretextT$fFunctorPretextT$fIndexedFunctorPretextT$fSellablepPretext$fComonadStoreaPretext$fIndexedComonadStorePretext$fComonadPretext$fIndexedComonadPretext$fFunctorPretext$fIndexedFunctorPretext$fSellable(->)Context$fComonadStoreaContext$fComonadContext$fFunctorContext$fIndexedComonadStoreContext$fIndexedComonadContext$fIndexedFunctorContextOver'IndexedLensLike'IndexedLensLike LensLike'Optical'OpticalOptic'OpticIndexPreservingFold1 IndexedFold1Fold1IndexPreservingFoldIndexPreservingGetterAs Equality'EqualityAReviewReviewIndexPreservingSetter'IndexPreservingSetterIndexedSetter' IndexedSetterIndexPreservingTraversal1'IndexPreservingTraversal1IndexPreservingTraversal'IndexPreservingTraversalIndexedTraversal1'IndexedTraversal1IndexedTraversal' Traversal1' Traversal1IndexPreservingLens'IndexPreservingLens IndexedLens'AnIndexedLens' AnIndexedLensALens'ALenslensiplensilens&~%%~%%=<&>??insidechoosingchosen alongsidelocuscloneIndexPreservingLenscloneIndexedLens<%~<+~<-~<*~~<%=<+=<-=<*==<<~<<>~<<>=overA<%@~<<%@~%%@~%%@=<%@=<<%@=^#storing#~#%~#%%~#=#%=<#%~<#%=#%%=<#~<#=devoidunitedfusingField9_9Field8_8Field7_7Field6_6Field5_5Field4_4Field3_3Field2Field1_1'_2'_3'_4'_5'_6'_7'_8'_9'$fGIxed'Fnss'st'ab$fGIxed'Tnss'ts'ab$fGIxedn:*::*:ab$fGIxednM1M1ab$fGIxedZK1K1ab$fField9(,,,,,,,,)(,,,,,,,,)ii'$fField8(,,,,,,,,)(,,,,,,,,)hh'$fField8(,,,,,,,)(,,,,,,,)hh'$fField7(,,,,,,,,)(,,,,,,,,)gg'$fField7(,,,,,,,)(,,,,,,,)gg'$fField7(,,,,,,)(,,,,,,)gg'$fField6(,,,,,,,,)(,,,,,,,,)ff'$fField6(,,,,,,,)(,,,,,,,)ff'$fField6(,,,,,,)(,,,,,,)ff'$fField6(,,,,,)(,,,,,)ff'$fField5(,,,,,,,,)(,,,,,,,,)ee'$fField5(,,,,,,,)(,,,,,,,)ee'$fField5(,,,,,,)(,,,,,,)ee'$fField5(,,,,,)(,,,,,)ee'$fField5(,,,,)(,,,,)ee'$fField4(,,,,,,,,)(,,,,,,,,)dd'$fField4(,,,,,,,)(,,,,,,,)dd'$fField4(,,,,,,)(,,,,,,)dd'$fField4(,,,,,)(,,,,,)dd'$fField4(,,,,)(,,,,)dd'$fField4(,,,)(,,,)dd'$fField3(,,,,,,,,)(,,,,,,,,)cc'$fField3(,,,,,,,)(,,,,,,,)cc'$fField3(,,,,,,)(,,,,,,)cc'$fField3(,,,,,)(,,,,,)cc'$fField3(,,,,)(,,,,)cc'$fField3(,,,)(,,,)cc'$fField3(,,)(,,)cc'$fField2(,,,,,,,,)(,,,,,,,,)bb'$fField2(,,,,,,,)(,,,,,,,)bb'$fField2(,,,,,,)(,,,,,,)bb'$fField2(,,,,,)(,,,,,)bb'$fField2(,,,,)(,,,,)bb'$fField2(,,,)(,,,)bb'$fField2(,,)(,,)bb'$fField2(,)(,)bb'$fField2:*::*:gg'$fField2ProductProductgg'$fField1(,,,,,,,,)(,,,,,,,,)aa'$fField1(,,,,,,,)(,,,,,,,)aa'$fField1(,,,,,,)(,,,,,,)aa'$fField1(,,,,,)(,,,,,)aa'$fField1(,,,,)(,,,,)aa'$fField1(,,,)(,,,)aa'$fField1(,,)(,,)aa'$fField1(,)(,)aa'$fField1:*::*:ff'$fField1ProductProductff'$fField1IdentityIdentityabSetting'SettingAnIndexedSetter'AnIndexedSetterASetter'ASettermappedlifted contramappedargumentsettingsets cloneSettercloneIndexPreservingSettercloneIndexedSetterset'?~)Mafic$fApplicativeMafic $fApplyMafic$fFunctorMafic$fComonadMolten$fIndexedComonadMolten$fIndexedFunctorMolten$fBizarreIndexedMolten$fSellableIndexedMolten$fApplicativeMolten $fApplyMolten$fFunctorMolten $fShowMagma$fTraversableMagma$fFoldableMagma$fFunctorMagma AccessingIndexedGettingtoitolikeilikeviewsuses listening ilistening listenings ilisteningsiviewiviewsiuseiuses^@.gettinguntoun#reviewsreusereusesAPrism'APrism withPrism clonePrismprism'withoutasidebelowisn'tmatching_Right_Just_Nothing_Voidonlynearly_ShowMagnifymagnify MagnifiedZoomed$fMagnifyIdentityTIdentityTba$fMagnifyRWSTRWSTba$fMagnifyRWSTRWSTba0$fMagnify(->)(->)ba$fMagnifyReaderTReaderTba$fZoomFreeTFreeTst$fZoomExceptTExceptTst$fZoomErrorTErrorTst$fZoomMaybeTMaybeTst$fZoomListTListTst$fZoomWriterTWriterTst$fZoomWriterTWriterTst0$fZoomRWSTRWSTst$fZoomRWSTRWSTst0$fZoomIdentityTIdentityTst$fZoomReaderTReaderTst$fZoomStateTStateTst$fZoomStateTStateTst0 setmappedsetOftoMapOffoldingifoldingfoldring ifoldringfolded64repeated replicatedcycledunfoldediteratedfiltered takingWhile droppingWhilewordedlinedfoldOffoldrOffoldlOftoListOf^..andOforOfallOfnoneOf productOfsumOfforOf_ sequenceAOf_mapMOf_forMOf_ sequenceOf_asumOfmsumOfelemOf notElemOf concatMapOfconcatOf^?!firstOfnullOf notNullOf maximumByOf minimumByOffindOffindMOflookupOffoldr1Offoldl1OffoldrOf'foldlOf' foldr1Of' foldl1Of'foldrMOffoldlMOfhashasn'tpreipreipreviewpreviews ipreviewspreuseipreusepreusesipreusesifoldrOfifoldlOfianyOfiallOfinoneOf itraverseOf_iforOf_imapMOf_iforMOf_ iconcatMapOfifindOfifindMOf ifoldrOf' ifoldlOf' ifoldrMOf ifoldlMOf itoListOf^@..^@?^@?! elemIndexOf elemIndicesOf findIndexOf findIndicesOf ifiltered itakingWhileidroppingWhilefoldByOf foldMapByOfHandlingException Handleablehandlerhandler_$fExceptionHandling$fShowHandling$fExceptionHandlingException!$fHandleableSomeExceptionmHandler"$fHandleableSomeExceptionIOHandler$fShowHandlingException TraverseMax traverseMax TraverseMin traverseMin Traversing1' Traversing' Traversing1 TraversingAnIndexedTraversal1'AnIndexedTraversal'AnIndexedTraversal1AnIndexedTraversal ATraversal1' ATraversal1 ATraversal' ATraversal sequenceAOfmapMOfforMOf sequenceOf transposeOf mapAccumROf mapAccumLOfscanr1Ofscanl1OflociilocipartsOfipartsOfpartsOf' ipartsOf' unsafePartsOfiunsafePartsOfunsafePartsOf'iunsafePartsOf'holesOfsingularunsafeSingularbothbesidedroppingcloneIndexPreservingTraversalcloneIndexedTraversalcloneTraversal1cloneIndexPreservingTraversal1cloneIndexedTraversal1iforOf imapAccumROf imapAccumLOf traversed1 traversed64ignored elementOfelement elementsOfelementsfailover ifailoverfailingdeepOf confusing traverseByOf sequenceByOf$fTraverseMaxkMap$fTraverseMaxIntIntMap$fTraverseMinkMap$fTraverseMinIntIntMapTraversableWithIndex 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 unpackStrict8levelsilevels ReifiedPrism' ReifiedPrismrunPrism ReifiedIso' ReifiedIsorunIsoReifiedIndexedSetter'ReifiedIndexedSetterrunIndexedSetterReifiedSetter' ReifiedSetter runSetterReifiedIndexedFoldrunIndexedFold ReifiedFoldrunFoldReifiedIndexedGetterrunIndexedGetter ReifiedGetter runGetterReifiedTraversal'ReifiedIndexedTraversal'ReifiedIndexedTraversalrunIndexedTraversalReifiedIndexedLens'ReifiedIndexedLensrunIndexedLens ReifiedLens' ReifiedLensrunLens$fStrongReifiedIndexedFold!$fRepresentableReifiedIndexedFold $fSieveReifiedIndexedFoldCompose$fProfunctorReifiedIndexedFold$fFunctorReifiedIndexedFold$fPlusReifiedIndexedFold$fAltReifiedIndexedFold$fMonoidReifiedIndexedFold$fSemigroupReifiedIndexedFold$fPlusReifiedFold$fAltReifiedFold$fMonoidReifiedFold$fSemigroupReifiedFold$fMonadReadersReifiedFold$fMonadPlusReifiedFold$fMonadReifiedFold$fBindReifiedFold$fAlternativeReifiedFold$fApplicativeReifiedFold$fApplyReifiedFold$fFunctorReifiedFold$fArrowApplyReifiedFold$fArrowChoiceReifiedFold$fArrowReifiedFold$fCategoryTYPEReifiedFold$fChoiceReifiedFold$fStrongReifiedFold$fRepresentableReifiedFold$fSieveReifiedFold[]$fProfunctorReifiedFold$fApplyReifiedIndexedGetter$fFunctorReifiedIndexedGetter$fStrongReifiedIndexedGetter#$fRepresentableReifiedIndexedGetter$fSieveReifiedIndexedGetter(,) $fProfunctorReifiedIndexedGetter$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 gtraversetinplatetemplateuponupon'onceUpon onceUpon'$fExceptionFieldException$fShowFieldExceptionGPlatedPlated...deepchildrenrewrite rewriteOf rewriteOn rewriteOnOfrewriteM rewriteMOf rewriteMOn rewriteMOnOfuniverse universeOf universeOn universeOnOfcosmoscosmosOfcosmosOn cosmosOnOf transform transformOn transformOf transformOnOf transformM transformMOn transformMOftransformMOnOfcontexts contextsOn contextsOnOfholesholesOn holesOnOfparaOfpara composOpFoldpartsgplate $fGPlatedaV1 $fGPlatedaU1 $fGPlatedaK1 $fGPlatedaK10 $fGPlateda:*: $fGPlateda:+: $fGPlatedaM1 $fPlatedPat $fPlatedStmt $fPlatedType $fPlatedCon $fPlatedDec $fPlatedExp $fPlatedTree$fPlatedCofree$fPlatedCofreeT $fPlatedF $fPlatedFreeT $fPlatedFree $fPlated[] AnEquality' AnEquality IdenticalrunEqsubstEqmapEqfromEqsimplysimpleStrictstrictSwappedswappedAnIso'AnIsoListReversedLazyisowithIsocloneIsoauaufunderenummappingnonnon'anoncurried uncurriedflippedlazyreversed involutedmagmaimagma contramapping dimappinglmappingrmapping bimappingfirsting secondingcoerced$fStrictRWSTRWST$fStrictWriterTWriterT$fStrictStateTStateT$fStrictTextText$fStrictByteStringByteString$fSwappedEither $fSwapped(,) Rewrapping Rewrapped Unwrapped _Wrapped' _Unwrapped'_Wrapped _Unwrappedop _Wrapping' _Unwrapping' _Wrapping _Unwrapping$fWrappedErrorCall$fRewrappedErrorCallt$fWrappedRecUpdError$fRewrappedRecUpdErrort$fWrappedRecSelError$fRewrappedRecSelErrort$fWrappedRecConError$fRewrappedRecConErrort$fWrappedPatternMatchFail$fRewrappedPatternMatchFailt$fWrappedNoMethodError$fRewrappedNoMethodErrort$fWrappedAssertionFailed$fRewrappedAssertionFailedt$fWrappedTagged$fRewrappedTaggedt$fWrappedComposeCF$fRewrappedComposeCFt$fWrappedComposeFC$fRewrappedComposeFCt$fWrappedCompose$fRewrappedComposet $fWrappedOp$fRewrappedOpt$fWrappedEquivalence$fRewrappedEquivalencet$fWrappedComparison$fRewrappedComparisont$fWrappedPredicate$fRewrappedPredicatet$fWrappedOption$fRewrappedOptiont$fWrappedWrappedMonoid$fRewrappedWrappedMonoidt $fWrappedLast$fRewrappedLastt$fWrappedFirst$fRewrappedFirstt $fWrappedMax$fRewrappedMaxt $fWrappedMin$fRewrappedMint$fWrappedVector$fRewrappedVectort$fWrappedVector0$fRewrappedVectort0$fWrappedVector1$fRewrappedVectort1$fWrappedVector2$fRewrappedVectort2 $fWrappedSeq$fRewrappedSeqt $fWrappedSet$fRewrappedSett $fWrappedMap$fRewrappedMapt$fWrappedIntSet$fRewrappedIntSett$fWrappedIntMap$fRewrappedIntMapt$fWrappedHashSet$fRewrappedHashSett$fWrappedHashMap$fRewrappedHashMapt$fWrappedTracedT$fRewrappedTracedTt$fWrappedWriterT$fRewrappedWriterTt$fWrappedWriterT0$fRewrappedWriterTt0$fWrappedStateT$fRewrappedStateTt$fWrappedStateT0$fRewrappedStateTt0 $fWrappedRWST$fRewrappedRWSTt$fWrappedRWST0$fRewrappedRWSTt0$fWrappedReverse$fRewrappedReverset$fWrappedReaderT$fRewrappedReaderTt$fWrappedMaybeT$fRewrappedMaybeTt$fWrappedListT$fRewrappedListTt$fWrappedIdentityT$fRewrappedIdentityTt$fWrappedIdentity$fRewrappedIdentityt$fWrappedExceptT$fRewrappedExceptTt$fWrappedErrorT$fRewrappedErrorTt$fWrappedContT$fRewrappedContTt$fWrappedConstant$fRewrappedConstantt$fWrappedCompose0$fRewrappedComposet0$fWrappedBackwards$fRewrappedBackwardst $fWrappedDown$fRewrappedDownt$fWrappedArrowMonad$fRewrappedArrowMonadt $fWrappedAlt$fRewrappedAltt$fWrappedLast0$fRewrappedLastt0$fWrappedFirst0$fRewrappedFirstt0 $fWrappedEndo$fRewrappedEndot $fWrappedDual$fRewrappedDualt$fWrappedConst$fRewrappedConstt$fWrappedNonEmpty$fRewrappedNonEmptyt$fWrappedZipList$fRewrappedZipListt$fWrappedWrappedArrow$fRewrappedWrappedArrowt$fWrappedWrappedMonad$fRewrappedWrappedMonadt$fWrappedKleisli$fRewrappedKleislit$fWrappedProduct$fRewrappedProductt $fWrappedSum$fRewrappedSumt $fWrappedAny$fRewrappedAnyt $fWrappedAll$fRewrappedAllt$fRewrappingstpackedunpacked_Textbuildertextutf8IsText $fIsTextText $fIsTextText0 $fIsText[]sliced toVectorOfvectorasStream asStreamRclonedforcedordinalsvectorIxvectorTraverse convertedEmpty $fAsEmptyText$fAsEmptyText0$fAsEmptyByteString$fAsEmptyByteString0 $fAsEmptySeq$fAsEmptyVector$fAsEmptyVector0$fAsEmptyVector1$fAsEmptyIntSet$fAsEmptyHashSet $fAsEmptySet$fAsEmptyIntMap$fAsEmptyHashMap $fAsEmptyMap $fAsEmpty[] $fAsEmpty(,,) $fAsEmpty(,) $fAsEmptyDual$fAsEmptyFirst $fAsEmptyLast$fAsEmptyMaybe $fAsEmptySum$fAsEmptyProduct$fAsEmptyEvent $fAsEmptyAll $fAsEmptyAny $fAsEmpty()$fAsEmptyOrderingEacheach$fEachUArrayUArrayab$fEachArrayArrayab$fEachByteStringByteStringab$fEachByteStringByteStringab0$fEachTextTextab$fEachTextTextab0$fEachVectorVectorab$fEachVectorVectorab0$fEachVectorVectorab1$fEachVectorVectorab2$fEachTreeTreeab$fEachSeqSeqab$fEachMaybeMaybeab$fEachIdentityIdentityab$fEachNonEmptyNonEmptyab $fEach[][]ab$fEachHashMapHashMapab$fEachIntMapIntMapab$fEachMapMapab$fEachComplexComplexab$fEach(,,,,,,,,)(,,,,,,,,)ab$fEach(,,,,,,,)(,,,,,,,)ab$fEach(,,,,,,)(,,,,,,)ab$fEach(,,,,,)(,,,,,)ab$fEach(,,,,)(,,,,)ab$fEach(,,,)(,,,)ab$fEach(,,)(,,)ab$fEach(,)(,)abSnoc_SnocCons_Cons:>:<<|consuncons_head_tail_init_last|>snocunsnoc$fSnocTextTextCharChar$fSnocTextTextCharChar0$$fSnocByteStringByteStringWord8Word8%$fSnocByteStringByteStringWord8Word80$fSnocVectorVectorab$fSnocVectorVectorab0$fSnocVectorVectorab1$fSnocVectorVectorab2$fSnocSeqSeqab $fSnoc[][]ab$fConsVectorVectorab$fConsVectorVectorab0$fConsVectorVectorab1$fConsVectorVectorab2$fConsTextTextCharChar$fConsTextTextCharChar0$$fConsByteStringByteStringWord8Word8%$fConsByteStringByteStringWord8Word80$fConsSeqSeqab $fCons[][]abDequeBDnull singletonsizefromList$fSnocDequeDequeab$fConsDequeDequeab $fMonoidDeque$fSemigroupDeque$fTraversableWithIndexIntDeque$fTraversableDeque$fFoldableWithIndexIntDeque$fFoldableDeque$fMonadPlusDeque $fMonadDeque $fBindDeque$fReversingDeque$fAlternativeDeque $fPlusDeque $fAltDeque$fApplicativeDeque $fApplyDeque$fFunctorWithIndexIntDeque$fFunctorDeque $fOrdDeque $fEqDeque $fShowDequeAtIxedixIxValueContainscontainsIndex icontainsiixixAtsansiat$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(->)$fContainsHashSet $fContainsSet$fContainsIntSet SubstType substType HasTypeVars typeVarsExHasTypestypesHasNamenametypeVars substTypeVars conFieldsconNamedFields locFileName locPackage locModulelocStartlocEnd funDepInputs funDepOutputs fieldExpNamefieldExpExpression fieldPatNamefieldPatPattern matchPattern matchBodymatchDeclarationsfixityPrecedencefixityDirection clausePattern clauseBody clauseDecsinjectivityAnnOutputinjectivityAnnInputstypeFamilyHeadNametypeFamilyHeadTyVarBndrstypeFamilyHeadResultSigtypeFamilyHeadInjectivityAnnbangSourceUnpackednessbangSourceStrictness_ClassI _ClassOpI_TyConI_FamilyI _PrimTyConI _DataConI_VarI_TyVarI_FunD_ValD_TySynD_ClassD _InstanceD _Overlappable _Overlapping _Overlaps _Incoherent_SigD _ForeignD_InfixD_PragmaD _TySynInstD _RoleAnnotD_StandaloneDerivD _DefaultSigD_ClosedTypeFamilyD_DataD _NewtypeD _DataInstD _NewtypeInstD _DataFamilyD_OpenTypeFamilyD_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 _NoInline_Inline _Inlinable_ConLike_FunLike _AllPhases _FromPhase _BeforePhase_RuleVar _TypedRuleVar_ModuleAnnotation_TypeAnnotation_ValueAnnotation_FunDep_TypeFam_DataFamtySynEqnPatternstySynEqnResult_InfixL_InfixR_InfixN_VarE_ConE_LitE_AppE_InfixE_UInfixE_ParensE_LamE _LamCaseE_TupE _UnboxedTupE_CondE _MultiIfE_LetE_CaseE_DoE_CompE _ArithSeqE_ListE_SigE_RecConE_RecUpdE_StaticE _UnboundVarE _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_ConP_InfixP_UInfixP_ParensP_TildeP_BangP_AsP_WildP_RecP_ListP_SigP_ViewP_ForallT_AppT_SigT_VarT_ConT _PromotedT_TupleT_UnboxedTupleT_ArrowT _EqualityT_ListT_PromotedTupleT _PromotedNilT_PromotedConsT_StarT _ConstraintT_LitT_InfixT_UInfixT_ParensT _WildCardT_PlainTV _KindedTV_NoSig_KindSig _TyVarSig _NumTyLit _StrTyLit _NominalR_RepresentationalR _PhantomR_InferR $fSubstType[]$fSubstTypeType$fHasTypeVarsMaybe$fHasTypeVars[]$fHasTypeVarsCon$fHasTypeVarsType$fHasTypeVarsName$fHasTypeVarsTyVarBndr $fHasTypes[]$fHasTypesTySynEqn$fHasTypesForeign $fHasTypesCon$fHasTypesType$fHasNameInjectivityAnn$fHasNameTypeFamilyHead$fHasNameRuleBndr$fHasNameForeign $fHasNameCon $fHasNameName$fHasNameTyVarBndrDefNameTopName MethodName LensRules _simpleLenses _generateSigs_generateClasses _allowIsos _allowUpdates _lazyPatterns _fieldToDef _classyLensesmakeFieldOpticsmakeFieldOpticsForDec $fShowDefName $fEqDefName $fOrdDefName makePrismsmakeClassyPrisms makeDecPrisms$fHasTypeVarsNCon$fEqNCon ClassyNamer FieldNamer simpleLensesgenerateSignaturesgenerateUpdateableOpticsgenerateLazyPatterns createClass lensField lensClass lensRulesunderscoreNoPrefixNamer lensRulesForlookingupNamer mappingNamer classyRules classyRules_ makeLenses makeClassy makeClassy_ makeLensesFor makeClassyFormakeLensesWith declareLensesdeclareLensesFor declareClassydeclareClassyFor declarePrismsdeclareWrapped declareFieldsdeclareLensesWith makeWrappedunderscoreFieldsunderscoreNamercamelCaseFieldscamelCaseNamerabbreviatedFieldsabbreviatedNamer makeFieldsdefaultFieldRulesiscatching catching_handling handling_tryingthrowing$fHandleableemHandler$fMonoidHandler $fPlusHandler $fAltHandler$fSemigroupHandler$fFunctorHandlerevalOfparOfafter throughoutseqOfixmapped.|.~.&.~.&.=.|.=<.|.~<.&.~<.&.=<.|.=<<.&.~<<.|.~<<.&.=<<.|.=bitAtbyteAtbitsbytewiseCharsBytes packedBytes unpackedBytesbytes packedChars unpackedCharschars IsByteString$fIsByteStringByteString$fIsByteStringByteString0 Conjugate ImaginaryRealPolar _realPart_polar _magnitude_phase _conjugatemembersprefixedsuffixed stripSuffixviewLviewRslicedTo slicedFromrootbranches_cast_gcastgenericgeneric1_V1_U1_Par1_Rec1_K1_M1_L1_R1_UAddr_UChar_UDouble_UFloat_UInt_UWord~=<~<=<<~<<=<.>~<.>=<<.>~<<.>=<<<.>~<<<.>=basename directory extensionfilenamelocation descriptionhandlefileNameerrno errorType_AlreadyExists _NoSuchThing _ResourceBusy_ResourceExhausted_EOF_IllegalOperation_PermissionDenied _UserError_UnsatisfiedConstraints _SystemError_ProtocolError _OtherError_InvalidArgument_InappropriateType_HardwareFault_UnsupportedOperation _TimeExpired_ResourceVanished _InterruptedIntegralintegralbinaryoctaldecimalhexadding subtracting multiplyingdividingexponentiatingnegatedAsHandlingException_HandlingException AsErrorCall AsRecUpdError _RecUpdError AsRecSelError _RecSelError AsRecConError _RecConErrorAsPatternMatchFail_PatternMatchFailAsNoMethodError_NoMethodError AsDeadlock _DeadlockAsBlockedIndefinitelyOnSTM_BlockedIndefinitelyOnSTMAsBlockedIndefinitelyOnMVar_BlockedIndefinitelyOnMVarAsNestedAtomically_NestedAtomicallyAsNonTerminationAsAsyncException_AsyncExceptionAsAssertionFailedAsArrayException_ArrayExceptionAsArithException_ArithException AsIOException _IOExceptionHandlingException_ ErrorCall_ RecUpdError_ RecSelError_ RecConError_PatternMatchFail_NoMethodError_ Deadlock_BlockedIndefinitelyOnSTM_BlockedIndefinitelyOnMVar_NestedAtomically_NonTermination_UserInterrupt_ ThreadKilled_ HeapOverflow_StackOverflow_AsyncException_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"$fAsHandlingExceptionSomeException&$fAsHandlingExceptionHandlingException$fAsErrorCallSomeException$fAsErrorCallErrorCall$fAsRecUpdErrorSomeException$fAsRecUpdErrorRecUpdError$fAsRecSelErrorSomeException$fAsRecSelErrorRecSelError$fAsRecConErrorSomeException$fAsRecConErrorRecConError!$fAsPatternMatchFailSomeException$$fAsPatternMatchFailPatternMatchFail$fAsNoMethodErrorSomeException$fAsNoMethodErrorNoMethodError$fAsDeadlockSomeException$fAsDeadlockDeadlock)$fAsBlockedIndefinitelyOnSTMSomeException4$fAsBlockedIndefinitelyOnSTMBlockedIndefinitelyOnSTM*$fAsBlockedIndefinitelyOnMVarSomeException6$fAsBlockedIndefinitelyOnMVarBlockedIndefinitelyOnMVar!$fAsNestedAtomicallySomeException$$fAsNestedAtomicallyNestedAtomically$fAsNonTerminationSomeException $fAsNonTerminationNonTermination$fAsAsyncExceptionSomeException $fAsAsyncExceptionAsyncException $fAsAssertionFailedSomeException"$fAsAssertionFailedAssertionFailed$fAsArrayExceptionSomeException $fAsArrayExceptionArrayException$fAsArithExceptionSomeException $fAsArithExceptionArithException$fAsIOExceptionSomeException$fAsIOExceptionIOException AsDynamic_DynamicDynamic$fAsDynamicSomeException$fAsDynamicDynamic AsExitCode _ExitCode ExitFailure_ ExitSuccess_ _ExitSuccess _ExitFailure$fAsExitCodeSomeException$fAsExitCodeExitCodecatchIOversionbindirlibdirdatadir libexecdir sysconfdir getBinDir getLibDir getDataDir getLibexecDir getSysconfDirgetDataFileNameGHC.Base"free-4.12.4-LgcX9hrtnan8i9EaOvHXkRControl.Monad.Trans.FreeFreeF Data.EitherEitherMaybetemplate-haskellLanguage.Haskell.TH.Lib tySynInstDLanguage.Haskell.TH.SyntaxName TyVarBndrFunctorordinalNubHelperlappendData.Semigroup SemigrouptrimltrimrmemptyJustGHC.IntInt64 GHC.TypesIntData.Profunctor.RepCorepresentable Representablefmap comonad-5-Eyc9WkfrOnk20DfhEff30d ComonadStorepeeksseekseeks experimentcoarrpureid mtl-2.2.1-6qsR1PHUy5lL47Hpoa4jCMControl.Monad.State.Classstate. MonadStateflipLeftRightGHC.NumNumGHC.Real Fractional GHC.FloatFloating GHC.Classes||Bool&&mappendconst Data.VoidVoid+kan-extensions-5.0.1-EdCMiLULir05m6w5mhVhsfData.Functor.YonedaYonedaN8N7N6N5N4N3N2N1N0GTSubtractAddFTSZGIxed'gix'GIxedgixGSizeproxyN0proxyN1proxyN2proxyN3proxyN4proxyN5proxyN6proxyN7proxyN8<$liftM$Control.Monad.Writer.Classpass MonadWritercensorStringChar Control.ArrowArrow MonadReaderlistengetsNothingGHC.ReadReadGHC.ShowShowshowtransformers-0.5.2.0Control.Monad.Trans.ReaderReaderControl.Monad.Trans.RWS.LazyRWS Control.Monad.Trans.State.StrictControl.Monad.Trans.RWS.StrictControl.Monad.Trans.ErrorError2unordered-containers-0.2.7.1-5INwdG7O5Jdakf1CqKoOB Data.HashSetHashSet'hashable-1.2.4.0-Ctl752zbguF6QanxurLOm2Data.Hashable.ClassHashableEqcontainers-0.5.7.1 Data.Map.BaseOrd Data.Set.BaseSetfoldrGHC.Listrepeat replicateiterateevenGHC.Enumsucc/= takeWhile dropWhile Data.OldListwordslinesfoldMapfoldEndofoldltoListTrueandoranyallProductproductSumsum traverse_for_ sequenceA_forM_ sequence_asum Alternativemsum MonadPluselemnotElem concatMapconcatlengthheadFirstLastFalsenotmaximum Data.Maybe fromMaybeGHC.ErrminimumOrdering maximumBy minimumByfindlookupfoldr1foldl1foldr'foldl'foldrMfoldlM listToMaybe Data.Tuplesndifoldr64skipHandling GHC.Exception'exceptions-0.8.3-5OTPYzRazb4DJ75sPncYEhControl.Monad.Catch System.IOprint++ SomeExceptionIOreturn handlerIOhandlerCatchIOControl.Categoryfor sequenceAmapMforMsequence unwrapMonad WrapMonadControl.Applicative.Backwards BackwardsswaprunStatescanr1scanl1Control.Comonad==&bifunctors-5.4.1-4T44Oecc7oBmQFSz9nTeTData.Bitraversable BitraversableData.Functor.Day.CurriedCurriedinswinspinsparrouts unsafeOutsunconsWithDefaultimapList Data.SequenceSeqbytestring-0.10.8.1Data.ByteString.InternalData.ByteString.Lazy.Internalw2cGHC.WordWord8c2w unsafeCreatecreategrainimapBifoldrBimapB8ifoldrB8imapBLifoldrBLimapBL8 ifoldrBL8 fromStrict foldrChunks<*>levelIns levelOuts rmapConst ilevelIns ilevelOuts Data.DatagmapMDatainlinePerformIO GHC.IO.UnsafeunsafePerformIOFollowerOracle fromOracleAnswerHitFollowMissCacheHitMapDataBox dataBoxKey _dataBoxValIsReflFieldExceptionsteplookuponmightBedataBox sybChildren emptyHitMap insertHitMapfixEqcachereadCacheFollowerinsert2hitTest biplateData uniplateDatapartfollowerData.Typeable.InternalTypeablenegate GHC.GenericsGenericgplate'#text-1.2.2.1-9Yh8rJoh8fO2JMLWffT3QsfirstsecondEnumDoubleFloat integer-gmpGHC.Integer.TypeIntegercurryuncurryData.IntSet.BaseData.IntMap.BaseData.HashMap.Base getErrorCallgetRecUpdErrorgetRecSelErrorgetRecConErrorgetPatternMatchFailgetNoMethodErrorfailedAssertion getArrowMonadData.Text.ShowData.Text.Internal.BuilderBuilderfromTexttoStrict toLazyText imapStrict ifoldrStrictData.Text.Internal.Lazy fromLazyTextimapLazy ifoldrLazy&vector-0.11.0.0-6uB77qGCxR6GPLxI2sqsX3Data.Vector.Generic.BaseVectorData.Vector.Fusion.BundleBundleGHC.ArrIx array-0.5.1.1Data.Array.BaseIArrayUArrayArrayData.Vector.Unboxed.BaseUnboxForeign.StorableStorableData.Vector.Storable'primitive-0.6.1.0-Ip44DqhfCp21tTUYbecwaData.Primitive.TypesPrimData.Vector.Primitive Data.Vector Data.TreeTreeHashMap RealFloattailemptycheck!//newNameTypeGadtCRecGadtCsansVarmakeFieldOpticsForDec'normalizeConstructor buildScaffold buildStab OpticStabmakeFieldOpticmakePureClausemakeGetterClausemakeFieldOpticClause makeIsoClause unifyTypesunify1 limitedSubstapplyTypeSubst quantifyType quantifyType'OpticSa OpticType GetterTypeLensTypeIsoType stabToType stabToContext stabToOpticstabToSstabToAmakeClassyDrivermakeClassyClassmakeClassyInstancemakeFieldClassmakeFieldInstancemakeFieldClauses inlinePragmaNCon makePrisms'DecmakeConsPrismscomputePrismTypemakeConOpticExp makeConIsomakeConPrismExp makeConIsoExpmakeConReviewExp makeReviewermakeSimpleRemittermakeFullRemittermakeIsoRemittermakeClassyPrismClassmakeClassyPrismInstance normalizeConCon prismNameclose _nconName_nconCxt _nconTypesStab PrismType ReviewType simplifyStab stabSimplestabTypecomputeOpticTypecomputeReviewTypecomputeIsoTypenconNamenconCxt nconTypesDeclareDataDecl dataContext tyConNamedataParametersfullType constructors$!classyRulesFor deNewtypefreshMaptraverseDataAndNewtypeapps makeDataDeclmakeWrappedForDecmakeRewrappedInstancemakeWrappedInstanceoverHead declareWith runDeclareemit stripFieldsdeRecord dropFieldNameControl.Monad.Error.Class MonadError throwError'parallel-3.2.1.0-6VcN0yUHtcs831TgbJiSSiControl.Parallel.StrategiesStrategyevalTraversableEvalparTraversablerdeepseq Control.Seq seqFoldableixmapbounds Data.Bits.|.Bits.&.<=<bitSize undefineddivrealPartimagPartpolar magnitudephasepi conjugateIntSetViewLviewlViewRviewr subForestgcastGHC.IOFilePath intToDigit' digitToInt' digitToIntMayisDigit' showSigned' readSigned' ErrorCallControl.Exception.Base RecConErrorPatternMatchFail NoMethodErrorGHC.IO.ExceptionDeadlockBlockedIndefinitelyOnSTMBlockedIndefinitelyOnMVarNestedAtomicallyNonTerminationAsyncExceptionassertAssertionFailedArrayException IOException MonadCatch MonadThrow GHC.Conc.SyncthrowToThreadId mapExceptionArithException HeapOverflowtrivial Data.DynamicExitCode