kh3      ! " # $ % & ' ( ) * + , - . / 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{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~                                       !!""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" # # # # ##############$$$$$ $!$"$#$$$%$&$'$($)%*%+%,%-%.%/&0&1&2'3'4'5'6'7'8'9':';(<(=(>(?(@(A(B(C(D(E(F(G(H(I(J(K(L(M(N(O(P(Q(R(S(T(U(V(W(X(Y(Z([(\(])^)_)`)a)b)c)d)e)f)g)h)i)j)k)l)m)n)o*p*q*r*s*t*u*v*w*x*y+z+{+|+}+~+++++++++++++++++++++++++++++++++++++++++++,,,,,,,,,,,,,,,,-----........../////////00001233333333333444444555555666666677777788899999:::::: : : : : ::::::;;;;;<<<<==== >!>">#>$>%?&?'@(@)A*A+A,A-A.B/B0B1B2B3B4B5B6C7C8C9C:D;D<D=D>D?D@DADBDCDDDEDFEGEHEIEJEKELFMFNFOFPFQFRFSFTFUFVFWFXFYFZF[F\F]F^F_F`FaFbFcFdFeFfFgFhFiFjFkFlFmFnFoFpFqFrFsFtFuFvFwFxFyFzF{F|F}F~FFFFFGGHHHHIIIIIIIIIIIIIIIIIIIIIIIIIOJ non-portable experimentalEdward Kmett <ekmett@gmail.com> Safe-Inferred non-portable experimentalEdward Kmett <ekmett@gmail.com> Trustworthy type   a s t =  a a s t$This type is used internally by the K code to 0 provide efficient access to the two parts of a Prism.      non-portable experimentalEdward Kmett <ekmett@gmail.com> TrustworthyXThis class provides a generalized notion of list reversal extended to other containers. This is used internally by the L code to provide D efficient access to the two functions that make up an isomorphism.  non-portable experimentalEdward Kmett <ekmett@gmail.com> Trustworthy This is an illegal 7 used to replace the contents of a list of consecutive  values ] representing each layer of a structure into the original shape that they were derived from. Attempting to FlowM something back into a shape other than the one it was taken from will fail. This is an illegal  used to construct a single . JThis data type represents a path-compressed copy of one level of a source N data structure. We can safely use path-compression because we know the depth  of the tree. +Path compression is performed by viewing a  as a PATRICIA trie of the K paths into the structure to leaves at a given depth, similar in many ways  to a MN4, but unlike a regular PATRICIA trie we do not need 6 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. Append 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  ' instance, and just use it directly in  as needed. Generate the leaf of a given  based on whether or not we're at the correct depth. Walk down one constructor in a , veering left. Walk down one constructor in a , veering right. This is an illegal . This is an illegal .     non-portable provisionalEdward Kmett <ekmett@gmail.com> Trustworthy is just a renamed   to give better error ) messages when someone attempts to use a O as a P. 1Most user code will never need to see this type. " Anything " must be isomorphic to the  . Q So you can pass our P- into combinators from other lens libraries.  !"#$% !"#$%"#$% ! !"#$%  non-portable provisionalEdward Kmett <ekmett@gmail.com> Trustworthy)IThis 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  R  or  do for Control.Lens.Getter &'()*&'()*)*&'(&'()*  non-portable provisionalEdward Kmett <ekmett@gmail.com> Safe-Inferred+Used instead of  to report  No instance for (ST +)#when the user attempts to misuse a P as a  O., rather than a monolithic unification error. .IThis class is provided mostly for backwards compatibility with lens 3.8, * but it can also shorten type signatures. /This Generalizes  so we can apply simple  ? transformations to it and so we can get nicer error messages. A  you can /4 ignores its argument, which it carries solely as a  phantom type parameter. By the  and  laws, an instance of . will necessarily satisfy:  =  f = / =  g0The  equivalent for a .  . +,-./0+,-./0./0+,- +,-./0  non-portable experimentalEdward Kmett <ekmett@gmail.com> Trustworthy 1 composition of UV  with a , used  by  W. 4 composition of UV  with a , used  by  X. 7YA 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 -> b:GThis 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  by f and  by g such  that f is left adjoint to g2. 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 . This is effectively a  generalization of . >_This permits us to make a decision at an outermost point about whether or not we use an index. cIdeally any use of this function should be done in such a way so that you compute the same answer, 0 but this cannot be enforced at the type level. ? Transform a Y into an Z or  a [ into an \, etc.    ? :: Y s t a b -> Z  s t a b  ? :: K s t a b -> Z  s t a b  ? :: ] s t a b -> ^  s t a b  ? :: L s t a b -> ^  s t a b  ? :: [ s a -> \  s a  ? :: O s a -> _  s a  ? :: :  p => ` (4 f) s t a b -> a p (->) f s t a b@ Transform a Y into an Z or  a [ into an \, etc. This combinator is like ?? except that it handles large traversals and folds gracefully.    @ :: Y s t a b -> Z  s t a b  @ :: K s t a b -> Z  s t a b  @ :: ] s t a b -> ^  s t a b  @ :: L s t a b -> ^  s t a b  @ :: [ s a -> \  s a  @ :: O s a -> _  s a  @ :: :  p => ` (1 f) s t a b -> a p (->) f s t a b,123456789:;<=>?@     123456789:;<=>?@789<=>:;456?123@#123456789:;<=>?@       non-portable experimentalEdward Kmett <ekmett@gmail.com> TrustworthyA type A p g a s = B p g a a sBThis is a generalized form of J) that can be repeatedly cloned with less F impact on its performance, and which permits the use of an arbitrary <   . The extra phantom # is used to let us lie and claim a Gettable instance under U limited circumstances. This is used internally to permit a number of combinators to & gracefully degrade when applied to a [, O  or ,b. E type E p a s = F p a a sFThis is a generalized form of J) that can be repeatedly cloned with less F impact on its performance, and which permits the use of an arbitrary <    I type I a s = J a a sJ0The indexed store can be used to characterize a ]  and is used by c. J a b t is isomorphic to  newtype J a b t = J { runContext :: forall f.  f => (a -> f b) -> f t },  and to exists s. (s, ] s t a b). A J is like a ]4 that has already been applied to a some structure. L'This is used internally to construct a d, J or F  from a singleton value. NThis is an indexed analogue to # for when you are working with an  V. OThis is the generalization of  to an indexed comonad store. PThis is the generalization of  to an indexed comonad store. QThis is the generalization of  to an indexed comonad store. RThis is the generalization of  to an indexed comonad store. SThis is the generalization of  to an indexed comonad store. TThis is the generalization of  to an indexed comonad store. U2We can always forget the rest of the structure of w and obtain a simpler $ indexed comonad store model called J. V7This is a Bob Atkey -style 2-argument indexed comonad. It exists as a superclass for V! and expresses the functoriality  of an V in its third argument. BThe 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. W@extract from an indexed comonadic value when the indices match. X:duplicate an indexed comonadic value splitting the index. Y<extend a indexed comonadic computation splitting the index. Z7This is a Bob Atkey -style 2-argument indexed functor. It exists as a superclass for V! and expresses the functoriality  of an V in its third argument. We can convert any <   to a function, < possibly losing information about an index in the process. 2ABCDEFGHIJKLMNOPQRSTUVWXYZ[ !"#$%&'()*+,-./0ABCDEFGHIJKLMNOPQRSTUVWXYZ[Z[VWXYNOPQRSTULMJKIFGHEBCDA!ABCDEFGHIJKLMNOPQRSTUVWXYZ[ !"#$%&'()*+,-./0 non-portable experimentalEdward Kmett <ekmett@gmail.com> Trustworthy\OThis alias is helpful when it comes to reducing repetition in type signatures.   type \ p g a t = ] p g a a t ]] is like a), except that it provides a questionable  instance @ To protect this instance it relies on the soundness of another  type, and usage conventions. @For example. This lets us write a suitably polymorphic and lazy e , but there  must be a better way! `OThis alias is helpful when it comes to reducing repetition in type signatures.   type ` p a t = a p a a t aThis is used to characterize a Y. Ta.k.a. indexed Cartesian store comonad, indexed Kleene store comonad, or an indexed FunList.  *http://twanvl.nl/blog/haskell/non-regular1 A a is like a Y2 that has already been applied to some structure. Where a J a b t holds an a and a function from b to  t, a a a b t holds N as and a function from N  bs to t , (where N might be infinite). Mnemonically, a a0 holds many stores and you can easily add more. This is a final encoding of a. d&This class is used to run the various a variants used in this  library. \]^_`abcde123456789:;<=>?@ABC \]^_`abcde deabc`]^_\\]^_`abcde123456789:;<=>?@ABC non-portable experimentalEdward Kmett <ekmett@gmail.com> TrustworthyfCThis is used to generate an indexed magma from an unindexed source MBy constructing it this way we avoid infinite reassociations where possible. hCThis is used to generate an indexed magma from an unindexed source UBy constructing it this way we avoid infinite reassociations in sums where possible. j;This is a a non-reassociating initially encoded version of a. m;This provides a way to peek at the internal structure of a  Y or Z rRun a m< where all the individual leaves have been converted to the  expected type s Generate a m using from a prefix sum. t Generate a m@ with leaves only while the predicate holds from left to right. 'fghijklmnopqrstDEFGHIJKLMNOPQRSTUVWXYZ[fghijklmnopqrstmqponrjklhisfgtfghijklmqponrstDEFGHIJKLMNOPQRSTUVWXYZ[ non-portable experimentalEdward Kmett <ekmett@gmail.com> Trustworthy u Used for f. y Used for g. } Used for h.  Used for i. Used internally by j and the like.  The argument a# of the result should not be used! Used internally by k and the like.  The argument a# of the result should not be used! A  for a  . Obtain the minimum. Obtain the maximum.  Extract the y@ element. This will fairly eagerly determine that it can return \ ( the moment it sees any element at all.  Extract the u@ element. This will fairly eagerly determine that it can return \ ( the moment it sees any element at all. )uvwxyz{|}~]^_`abcdefghijuvwxyz{|}~}~y|{zuxwvuxwvy|{z}~]^_`abcdefghij non-portable provisionalEdward Kmett <ekmett@gmail.com> Trustworthy4Wrap a monadic effect with a phantom type argument. An  - ignores its argument and is isomorphic to a k wrapped around a value. That said, the k% is possibly rather unrelated to any  structure. lmnopqrst lmnopqrst non-portable experimentalEdward Kmett <ekmett@gmail.com> Trustworthy IWrap a monadic effect with a phantom type argument. Used when magnifying lm. This type family is used by n% to describe the common effect type. Used by o to p into qr. Make a  out of u for error handling. Used by o to p into qr. Make a  out of v for error handling. Used by o to p into w or x. Used by o to p into st. Used by o to p into lm. Used by o to p into uv. This type family is used by o% to describe the common effect type. 7yz{|}~%yz{|}~ Rank2Types provisionalEdward Kmett <ekmett@gmail.com> Safe-Inferred/wThis is a convenient alias for use when you need to consume either indexed or non-indexed lens-likes based on context.   type  p f =  ( p f) wThis is a convenient alias for use when you need to consume either indexed or non-indexed lens-likes based on context. GConvenient alias for constructing simple indexed lenses and their ilk. @Convenient alias for constructing indexed lenses and their ilk.   type  f =  ( f) Many combinators that accept a  can also accept a   in limited situations. 'They do so by specializing the type of  that they require of the  caller. If a function accepts a  f s t a b for some  f,  then they may be passed a .  Further, if f is an , they may also be passed a  .   type  p q f s a =  ( p q f) s a    type  f s t a b =  (->) f s t a b    type  p q f s a =  ( p q f) s a    type  f s t a b =  (->) (->) f s t a b A  ,   , ... can  be used instead of a ,, ...  whenever the type variables don't change upon setting a value.    7w ::   (xy a) a  z ::  ( ) [a] a .Note: To use this alias in your own code with  f or  , you may have to turn on LiberalTypeSynonyms. "This is commonly abbreviated as a "prime" marker, e.g.  =  . An  can be used as a , but when composed with an ,  , or  yields an  respectively. An  is an  enriched with access to a k for side-effects. Every  can be used as an (, that simply ignores the access to the k. You can compose an  with another  using ( ) from the Prelude. A  is a  enriched with access to a k for side-effects. Every  can be used as a (, that simply ignores the access to the k. You can compose a  with another  using ( ) from the Prelude. An  can be used as a , but when composed with an ,  , or  yields an ,  or  respectively. An  is an  enriched with access to a k for side-effects. Every  can be used as an . You can compose an  with another  using ( ) from the Prelude. An  is a  enriched with access to a k for side-effects. Every  can be used as an . You can compose an  with another  using ( ) from the Prelude. An  can be used as a , but when composed with an ,  , or  yields an  respectively. Every  is a valid [ and can be used for {. A I describes how to retrieve multiple values in a way that can be composed  with other  constructions. A  s aC provides a structure with operations very similar to those of the |}  typeclass, see ~ and the other  combinators. !By convention, if there exists a foo method that expects a |} (f a), then there should be a  fooOf method that takes a  s a and a value of type s. A  is a legal  that just ignores the supplied .  Unlike a Y a  is read-only. Since a  cannot be used to write back  there are no  laws that apply. An  can be used as a , but when composed with an ,  , or  yields an ,  or  respectively. Every  is a valid \ and can be used for { like a . A ? describes how to retrieve a single value in a way that can be  composed with other  constructions.  Unlike a  a  is read-only. Since a  + cannot be used to write back there are no  laws that can be applied to = it. In fact, it is isomorphic to an arbitrary function from (a -> s).  Moreover, a  can be used directly as a [,  since it just ignores the . A  . A witness that (a ~ s, b ~ t). Note: Composition with an  is index-preserving. A  . A  l is a 0-or-1 target  that can also be turned  around with  to obtain a  in the  opposite direction. There are two laws that a  should satisfy:  First, if I  or  a value with a  and then g or use (), I will get it back:    g l ( l b) "a \ b #Second, if you can extract a value a using a  l from a value s, then the value s is completely described my l and a: If g l s "a \ a then  l a "a s These two laws imply that the  laws hold for every  and that we  at most 1 element:     l x  1 "It may help to think of this as a ' that can be partial in one direction. Every  is a valid . Every  is a valid . For example, you might have a    allows you to always  go from a  to an ,, and provide you with tools to check if an  is  a  and/or to edit one if it is.    nat ::     nat =    \ i ->  if i  0  then  i  else  ( i) Now we can ask if an  is a . 5^?natJust 5 (-5)^?natNothing!We can update the ones that are: (-3,4) & both.nat *~ 2(-3,8)And we can then convert from a  to an . 5 ^. re nat -- :: Natural5Similarly we can use a  to  the  half of an u: Left "hello" & _Left %~ lengthLeft 5or to construct an u:  5^.re _LeftLeft 5#such that if you query it with the ), you will get your original input back. 5^.re _Left ^? _LeftJust 5&Another interesting way to think of a ! is as the categorical dual of a   -- a co-8, so to speak. This is what permits the construction of . Note: Composition with a  is index-preserving.   type  =   2Isomorphism families can be composed with another  using () and . Note: Composition with an $ is index- and measure- preserving.   type IndexedPreservingSetter' i =  IndexedPreservingSetter An  can be composed with a ,  or  * and leaves the index intact, yielding an .   type  i =  ( 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 ::       type  =   The only  law that can apply to a  l is that     l y ( l x a) "a  l y a You can't  a 3 in general, so the other two laws are irrelevant.  However, two  laws apply to a :     l  "a    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  =   An - leaves any index it is composed with alone.   type  i =  ( i) Every  is a valid Y or  \. The 7 constraint is used to allow an  to be used  directly as a Y. The Y" laws are still required to hold.   type  =   A  can be used directly as a P or a  (but not as a ) and provides V the ability to both read and update multiple fields, subject to some relatively weak  laws. UThese have also been known as multilenses, but they have the signature and spirit of     ::  f =>  (f a) (f b) a b 8and the more evocative name suggests their application. Most of the time the  you will want to use is just , but you can also pass any   or  as a , and composition of a  (or  or  ) with a  (or  or )  using () forms a valid . The laws for a  t follow from the laws for  as stated in "#The Essence of the Iterator Pattern".    t  "a    (t f)  t g "a   t (   f  g) .One consequence of this requirement is that a 1 needs to leave the same number of elements as a  candidate for subsequent G that it started with. Another testament to the strength of these laws 4 is that the caveat expressed in section 5.5 of the "Essence of the Iterator Pattern" about exotic   instances that E the same entry multiple times was actually already ruled out by the  second law in that same paper!   type  =   An - leaves any index it is composed with alone.   type  i =  ( i) Every  is a valid  and a valid Z.   type  =   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 b a) "a b "2) Putting back what you got doesn't change anything:     l ( l a) a "a a .3) Setting twice is the same as setting once:     l c ( l b a) "a  l c a =These laws are strong enough that the 4 type parameters of a  cannot C vary fully independently. For more on how they interact, read the "Why is  it a Lens Family?" section of   /http://comonad.com/reader/2012/mirrored-lenses/. Every  can be used directly as a P or  . You can also use a  for { as if it were a   or .  Since every  is a valid , the   laws are required of any  you create:    l  "a    (l f)  l g "a   l (   f  g)    type  s t a b = forall f.  f =>  f s t a b //// Rank2Types provisionalEdward Kmett <ekmett@gmail.com> Trustworthy=QThis is a convenient alias when defining highly polymorphic code that takes both   and 0 as appropriate. If a function takes this it is 5 expecting one of those two things based on context. QThis is a convenient alias when defining highly polymorphic code that takes both   and 0 as appropriate. If a function takes this it is 5 expecting one of those two things based on context.   type  i =  ( i)  Running an % instantiates it to a concrete type. WWhen consuming a setter directly to perform a mapping, you can use this type, but most + user code will not need to use this type.  By choosing  rather than , we get nicer error messages. 0This is a useful alias for use when consuming a . 1Most user code will never have to use this type.   type  =    Running a % instantiates it to a concrete type. WWhen consuming a setter directly to perform a mapping, you can use this type, but most + user code will not need to use this type.  By choosing  rather than , we get nicer error messages. This 0 can be used to map over all of the values in a .     "a     "a    () "a   over mapped f [a,b,c] [f a,f b,f c]over mapped (+1) [1,2,3][2,3,4]set mapped x [a,b,c][x,x,x] [[a,b],[c]] & mapped.mapped +~ x[[a + x,b + x],[c + x]]=over (mapped._2) length [("hello","world"),("leaders","!!!")][("hello",5),("leaders",3)]    ::  f =>  (f a) (f b) a b If you want an  use  . This setter. can be used to modify all of the values in a k. +You sometimes have to use this rather than  -- due to  temporary insanity  is not a superclass of k.     "a   over lifted f [a,b,c] [f a,f b,f c]set lifted b (Just a)Just bIf you want an  use  . This 0 can be used to map over all of the inputs to a .     "a   8getPredicate (over contramapped (*2) (Predicate even)) 5True,getOp (over contramapped (*5) (Op show)) 100"500"UPrelude.map ($ 1) $ over (mapped . wrapping Op . contramapped) (*12) [(*2),(+1),(^3)] [24,13,1728]This ( 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) yFMap over the argument of the result of a function -- i.e., its second  argument: (mapped.argument %~ f) h x y h x (f y)    ::  (b -> r) (a -> r) a b Build 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:       "a      "a  Another way to view  is that it takes a "semantic editor combinator"  and transforms it into a .    :: ((a -> b) -> s -> t) ->  s t a b Build a ,  or  depending on your choice of  .    :: ((a -> b) -> s -> t) ->  s t a b Restore  to a full .  Build an  from any .  Clone an . Modify the target of a  or all the targets of a  or   with a function.     "a     "a       "a      "a  Given any valid  l , you can also rely on the law:     l f   l g =  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  is to say that it transforms a  into a  "semantic editor combinator". over mapped f (Just a) Just (f a)over mapped (*10) [1,2,3] [10,20,30]over _1 f (a,b)(f a,b)over _1 show (10,20) ("10",20)    ::  s t a b -> (a -> b) -> s -> t   ::  s t a b -> (a -> b) -> s -> t Replace the target of a  or all of the targets of a   or  with a constant value.    () "a   set _2 "hello" (1,()) (1,"hello")set mapped () [1,2,3,4] [(),(),(),()]Note: Attempting to  a  or # will fail at compile time with an  relatively nice error message.    ::  s t a b -> b -> s -> t   ::  s t a b -> b -> s -> t   ::  s t a b -> b -> s -> t   ::  s t a b -> b -> s -> t Replace the target of a  or all of the targets of a   or 3 with a constant value, without changing its type. %This is a type restricted version of *, which retains the type of the original. set' mapped x [a,b,c,d] [x,x,x,x]set' _2 "hello" (1,"world") (1,"hello")set' mapped 0 [1,2,3,4] [0,0,0,0]Note: Attempting to adjust  a  or # will fail at compile time with an  relatively nice error message.    ::  s a -> a -> s -> s   ::  s a -> a -> s -> s   ::  s a -> a -> s -> s   ::  s a -> a -> s -> s Modifies the target of a  or all of the targets of a  or   with a user supplied function. This is an infix version of .     f "a   f   f "a   f (a,b,c) & _3 %~ f (a,b,f c)(a,b) & both %~ f (f a,f b)_2 %~ length $ (1,"hello")(1,5)traverse %~ f $ [a,b,c] [f a,f b,f c]traverse %~ even $ [1,2,3][False,True,False]9traverse.traverse %~ length $ [["hello","world"],["!!!"]] [[5,5],[3]]   () :: " s t a b -> (a -> b) -> s -> t  () :: % s t a b -> (a -> b) -> s -> t  () :: $ s t a b -> (a -> b) -> s -> t  () ::  s t a b -> (a -> b) -> s -> t Replace the target of a  or all of the targets of a   or  with a constant value. This is an infix version of !, provided for consistency with ().    f  a "a   f  a (a,b,c,d) & _4 .~ e (a,b,c,e)(42,"world") & _1 .~ "hello"("hello","world")(a,b) & both .~ c(c,c)   () ::  s t a b -> b -> s -> t  () ::  s t a b -> b -> s -> t  () ::  s t a b -> b -> s -> t  () ::  s t a b -> b -> s -> t Set the target of a ,  or  to \ a value.    l  t "a  l (\ t) Nothing & id ?~ aJust aMap.empty & at 3 ?~ xfromList [(3,x)]   () ::  s t a (v b) -> b -> s -> t  () ::  s t a (v b) -> b -> s -> t  () ::  s t a (v b) -> b -> s -> t  () ::  s t a (v b) -> b -> s -> t Set with pass-through. XThis 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  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")]))   () ::  s t a b -> b -> s -> (b, t)  () :: # s t a b -> b -> s -> (b, t)  () :: " s t a b -> b -> s -> (b, t)  () ::  s t a b -> b -> s -> (b, t) Set to \ a value with pass-through. XThis is mostly present for consistency, but may be useful for for chaining assignments. AIf you do not need a copy of the intermediate result, then using l  d directly is a good idea. import Data.Map as MapF_2.at "hello" <?~ "world" $ (42,Map.fromList [("goodnight","gracie")])B("world",(42,fromList [("goodnight","gracie"),("hello","world")]))   () ::  s t a (v b) -> b -> s -> (b, t)  () ::  s t a (v b) -> b -> s -> (b, t)  () ::  s t a (v b) -> b -> s -> (b, t)  () ::  s t a (v b) -> b -> s -> (b, t) 0Increment the target(s) of a numerically valued ,  or . (a,b) & _1 +~ c (a + c,b)(a,b) & both +~ c (a + c,b + c)(1,2) & _2 +~ 1(1,3)"[(a,b),(c,d)] & traverse.both +~ e[(a + e,b + e),(c + e,d + e)]   () ::  a =>  s a -> a -> s -> s  () ::  a =>  s a -> a -> s -> s  () ::  a =>  s a -> a -> s -> s  () ::  a =>  s a -> a -> s -> s /Multiply the target(s) of a numerically valued , ,  or . (a,b) & _1 *~ c (a * c,b)(a,b) & both *~ c (a * c,b * c)(1,2) & _2 *~ 4(1,8)Just 24 & mapped *~ 2Just 48   () ::  a =>  s a -> a -> s -> s  () ::  a =>  s a -> a -> s -> s  () ::  a =>  s a -> a -> s -> s  () ::  a =>  s a -> a -> s -> s 0Decrement the target(s) of a numerically valued , ,  or . (a,b) & _1 -~ c (a - c,b)(a,b) & both -~ c (a - c,b - c)_1 -~ 2 $ (1,2)(-1,2)"mapped.mapped -~ 1 $ [[4,5],[6,7]] [[3,4],[5,6]]   () ::  a =>  s a -> a -> s -> s  () ::  a =>  s a -> a -> s -> s  () ::  a =>  s a -> a -> s -> s  () ::  a =>  s a -> a -> s -> s -Divide the target(s) of a numerically valued , ,  or . (a,b) & _1 //~ c (a / c,b)(a,b) & both //~ c (a / c,b / c)("Hawaii",10) & _2 //~ 2("Hawaii",5.0)   () ::  a =>  s a -> a -> s -> s  () ::  a =>  s a -> a -> s -> s  () ::  a =>  s a -> a -> s -> s  () ::  a =>  s a -> a -> s -> s ,Raise the target(s) of a numerically valued ,  or # to a non-negative integral power. (1,3) & _2 ^~ 2(1,9)   () :: ( a,  e) =>  s a -> e -> s -> s  () :: ( a,  e) =>  s a -> e -> s -> s  () :: ( a,  e) =>  s a -> e -> s -> s  () :: ( a,  e) =>  s a -> e -> s -> s -Raise the target(s) of a fractionally valued ,  or  to an integral power. (1,2) & _2 ^^~ (-1)(1,0.5)   () :: ( a,  e) =>  s a -> e -> s -> s  () :: ( a,  e) =>  s a -> e -> s -> s  () :: ( a,  e) =>  s a -> e -> s -> s  () :: ( a,  e) =>  s a -> e -> s -> s /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 **~ pi $ (1,3)(1,31.54428070019754)   () ::  a =>  s a -> a -> s -> s  () ::  a =>  s a -> a -> s -> s  () ::  a =>  s a -> a -> s -> s  () ::  a =>  s a -> a -> s -> s  Logically  the target(s) of a -valued  or . both ||~ True $ (False,True) (True,True)both ||~ False $ (False,True) (False,True)   () ::  s  ->  -> s -> s  () ::  s  ->  -> s -> s  () ::  s  ->  -> s -> s  () ::  s  ->  -> s -> s  Logically  the target(s) of a -valued  or . both &&~ True $ (False, True) (False,True)both &&~ False $ (False, True) (False,False)   () ::  s  ->  -> s -> s  () ::  s  ->  -> s -> s  () ::  s  ->  -> s -> s  () ::  s  ->  -> s -> s Replace the target of a  or all of the targets of a  or  in our monadic 2 state with a new value, irrespective of the old. This is an alias for (). -execState (do assign _1 c; assign _2 d) (a,b)(c,d)execState (both .= c) (a,b)(c,c)    ::  s m =>  s a -> a -> m ()   ::  s m =>  s a -> a -> m ()   ::  s m =>  s a -> a -> m ()   ::  s m =>  s a -> a -> m () Replace the target of a  or all of the targets of a   or < in our monadic state with a new value, irrespective of the  old. This is an infix version of . %execState (do _1 .= c; _2 .= d) (a,b)(c,d)execState (both .= c) (a,b)(c,c)   () ::  s m =>  s a -> a -> m ()  () ::  s m =>  s a -> a -> m ()  () ::  s m =>  s a -> a -> m ()  () ::  s m =>  s a -> a -> m () 9It puts the state in the monad or it gets the hose again. 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 =>  s a -> (a -> a) -> m ()  () ::  s m =>  s a -> (a -> a) -> m ()  () ::  s m =>  s a -> (a -> a) -> m ()  () ::  s m =>  s a -> (a -> a) -> m ()    () ::  s m =>  s s a b -> (a -> b) -> m () Replace the target of a  or all of the targets of a  or  in our monadic  state with \' a new value, irrespective of the old. -execState (do at 1 ?= a; at 2 ?= b) Map.emptyfromList [(1,a),(2,b)]1execState (do _1 ?= b; _2 ?= c) (Just a, Nothing)(Just b,Just c)   () ::  s m =>  s (v a) -> a -> m ()  () ::  s m =>  s (v a) -> a -> m ()  () ::  s m =>  s (v a) -> a -> m ()  () ::  s m =>  s (v a) -> a -> m () Modify the target(s) of a , ,  or  by adding a value.  Example:    fresh ::   m => m   fresh = do    1    %execState (do _1 += c; _2 += d) (a,b) (a + c,b + d)CexecState (do _1.at 1.non 0 += 10) (Map.fromList [(2,100)],"hello")#(fromList [(1,10),(2,100)],"hello")   () :: ( s m,  a) =>  s a -> a -> m ()  () :: ( s m,  a) =>  s a -> a -> m ()  () :: ( s m,  a) =>  s a -> a -> m ()  () :: ( s m,  a) =>  s a -> a -> m () Modify the target(s) of a , ,  or  by subtracting a value. %execState (do _1 -= c; _2 -= d) (a,b) (a - c,b - d)   () :: ( s m,  a) =>  s a -> a -> m ()  () :: ( s m,  a) =>  s a -> a -> m ()  () :: ( s m,  a) =>  s a -> a -> m ()  () :: ( s m,  a) =>  s a -> a -> m () Modify the target(s) of a , ,  or  by multiplying by value. %execState (do _1 *= c; _2 *= d) (a,b) (a * c,b * d)   () :: ( s m,  a) =>  s a -> a -> m ()  () :: ( s m,  a) =>  s a -> a -> m ()  () :: ( s m,  a) =>  s a -> a -> m ()  () :: ( s m,  a) =>  s a -> a -> m ()  Modify the target(s) of a , ,  or  by dividing by a value. 'execState (do _1 //= c; _2 //= d) (a,b) (a / c,b / d)   ( ) :: ( s m,  a) =>  s a -> a -> m ()  ( ) :: ( s m,  a) =>  s a -> a -> m ()  ( ) :: ( s m,  a) =>  s a -> a -> m ()  ( ) :: ( s m,  a) =>  s a -> a -> m ()  ,Raise the target(s) of a numerically valued ,  or # to a non-negative integral power.   ( ) :: ( s m,  a,  e) =>  s a -> e -> m ()  ( ) :: ( s m,  a,  e) =>  s a -> e -> m ()  ( ) :: ( s m,  a,  e) =>  s a -> e -> m ()  ( ) :: ( s m,  a,  e) =>  s a -> e -> m ()  ,Raise the target(s) of a numerically valued ,  or  to an integral power.   ( ) :: ( s m,  a,  e) =>  s a -> e -> m ()  ( ) :: ( s m,  a,  e) =>  s a -> e -> m ()  ( ) :: ( s m,  a,  e) =>  s a -> e -> m ()  ( ) :: ( s m,  a,  e) =>  s a -> e -> m ()  ,Raise the target(s) of a numerically valued ,  or  to an arbitrary power 'execState (do _1 **= c; _2 **= d) (a,b) (a**c,b**d)   ( ) :: ( s m,  a) =>  s a -> a -> m ()  ( ) :: ( s m,  a) =>  s a -> a -> m ()  ( ) :: ( s m,  a) =>  s a -> a -> m ()  ( ) :: ( s m,  a) =>  s a -> a -> m ()  Modify the target(s) of a , ,  or  by taking their logical  with a value. [execState (do _1 &&= True; _2 &&= False; _3 &&= True; _4 &&= False) (True,True,False,False)(True,False,False,False)   ( ) ::  s m =>  s  ->  -> m ()  ( ) ::  s m =>  s  ->  -> m ()  ( ) ::  s m =>  s  ->  -> m ()  ( ) ::  s m =>  s  ->  -> m () Modify the target(s) of a , 'Iso,  or  by taking their logical  with a value. [execState (do _1 ||= True; _2 ||= False; _3 ||= True; _4 ||= False) (True,True,False,False)(True,True,True,False)   () ::  s m =>  s  ->  -> m ()  () ::  s m =>  s  ->  -> m ()  () ::  s m =>  s  ->  -> m ()  () ::  s m =>  s  ->  -> m () 6Run a monadic action, and set all of the targets of a ,  or  to its result.    () ::  s m =>  s s a b -> m b -> m ()  () ::  s m =>  s s a b -> m b -> m ()  () ::  s m =>  s s a b -> m b -> m ()  () ::  s m =>  s s a b -> m b -> m () 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  bar  ... will store the result in a , , or . Set with pass-through KThis is useful for chaining assignment without round-tripping through your k stack.    do x <- # ) 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.   () ::  s m =>  s s a b -> b -> m b  () ::  s m =>  s s a b -> b -> m b  () ::  s m =>  s s a b -> b -> m b  () ::  s m =>  s s a b -> b -> m b Set \ a value with pass-through KThis is useful for chaining assignment without round-tripping through your k stack.    do x <- ) foo ) 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.   () ::  s m =>  s s a (v b) -> b -> m b  () ::  s m =>  s s a (v b) -> b -> m b  () ::  s m =>  s s a (v b) -> b -> m b  () ::  s m =>  s s a (v b) -> b -> m b ,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!!!")   () ::  a =>  s t a a -> a -> s -> t  () ::  a =>  s t a a -> a -> s -> t  () ::  a =>  s t a a -> a -> s -> t  () ::  a =>  s t a a -> a -> s -> t Modify the target(s) of a , ,  or  by  ing a value. ?execState (do _1 <>= Sum c; _2 <>= Product d) (Sum a,Product b)3(Sum {getSum = a + c},Product {getProduct = b * d}),execState (both <>= "!!!") ("hello","world")("hello!!!","world!!!")   () :: ( s m,  a) =>  s a -> a -> m ()  () :: ( s m,  a) =>  s a -> a -> m ()  () :: ( s m,  a) =>  s a -> a -> m ()  () :: ( s m,  a) =>  s a -> a -> m ()  Write to a fragment of a larger Writer format. This is a generalization of ! that alows you to modify just a  portion of the resulting . This is a generalization of ! that alows you to modify just a  portion of the resulting  with access to the index of an  . This is a generalization of  that alows you to  just a  portion of the resulting . This is a generalization of  that alows you to  just a  portion of the resulting !, with access to the index of an  . %Map with index. This is an alias for . /When you do not need access to the index, then ( is more liberal in what it can accept.     l "a  l     l "a  l  7     :: ) 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  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:       "a      "a  Another way to view  is that it takes a "semantic editor combinator"  and transforms it into a . Adjust every target of an ,  or   with access to the index.    () "a  /When you do not need access to the index then ()) is more liberal in what it can accept.    l  f "a l   f    () :: ) i s t a b -> (i -> a -> b) -> s -> t  () :: + i s t a b -> (i -> a -> b) -> s -> t  () :: & i s t a b -> (i -> a -> b) -> s -> t /Adjust every target in the current state of an ,  or   with access to the index. /When you do not need access to the index then ()) is more liberal in what it can accept.    l  f "a l   f    () ::  s m => ' i s s a b -> (i -> a -> b) -> m ()  () ::  s m => ) i s s a b -> (i -> a -> b) -> m ()  () ::  s m => $ i s t a b -> (i -> a -> b) -> m ()  is a deprecated alias for . &Map with index. (Deprecated alias for ). /When you do not need access to the index, then ( is more liberal in what it can accept.     l "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"     C     "=      Rank2Types provisionalEdward Kmett <ekmett@gmail.com> Safe-Inferred   type  =     Reify a , so it can be stored safely in a container. #   type # =  $ $ Reify an , so it can be stored safely in a container. '   type ' i =  (( i) ( Reify an , so it can be stored safely in a container. +   type + =  , ,Reify a , so it can be stored safely in a container. /Reify a , so it can be stored safely in a container. 2 Reify an , so it can be stored safely in a container. 5Reify a , so it can be stored safely in a container. 8   type 8 =  9 9 A form of 4 that can be stored monomorphically in a container. <   type < i =  (= i) = Reify an , so it can be stored safely in a container. @   type @ i =  (A i) A Reify an , so it can be stored safely in a container. D   type D =  E EReify a , so it can be stored safely in a container. ) !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFG) !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFG)EFGDABC@=>?<9:;8567234/01,-.+()*'$%&# !" !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFG non-portable experimentalEdward Kmett <ekmett@gmail.com> Safe-Inferred HDeprecated. Use . IDeprecated. Use . JDeprecated. Use '. KDeprecated. Use . LDeprecated. Use +. MDeprecated. Use . NDeprecated. Use <. ODeprecated. Use . PDeprecated. Use 8. QDeprecated. Use . RDeprecated. Use D. SDeprecated. Use . HIJKLMNOPQRS HIJKLMNOPQRS SRQPONMLKJIH HIJKLMNOPQRS Rank2Types provisionalEdward Kmett <ekmett@gmail.com> TrustworthyTAd hoc conversion between "strict" and "lazy" versions of a structure,  such as  or . V.This class provides for symmetric bifunctors. W   W  W "a    f  W = W   f   g  W = W   g   f g  W = W   g f (1,2)^.swapped(2,1)XA  Y. Y>When you see this as an argument to a function, it expects an . Z=Build a simple isomorphism from a pair of inverse functions.    (Z f g) "a f   ([ (Z f g)) "a g   (Z f g) h "a g  h  f   ([ (Z f g)) h "a f  h  g [Invert an isomorphism.   [ ([ l) "a l \$Extract the two functions, one from s -> a and  one from b -> t that characterize an . ] Convert from Y back to any . WThis is useful when you need to store an isomorphism as a data type inside a container 6 and later reconstitute it as an overloaded function. See  or 8 for more information on why you might want to do this. ^ Based on  from Conor McBride's work on Epigram. *This version is generalized to accept any  , not just a newtype. #au (wrapping Sum) foldMap [1,2,3,4]10_ Based on ala' from Conor McBride's work on Epigram. *This version is generalized to accept any  , not just a newtype. 'For a version you pass the name of the newtype constructor to, see . Mnemonically, the German auf plays a similar role to  la, and the combinator  is ^" with an extra function argument. Dauf (wrapping Sum) (foldMapOf both) Prelude.length ("hello","world")10`The opposite of working  a  is working ` an isomorphism.    ` "a   [    ` ::  s t a b -> (t -> s) -> b -> a aBThis isomorphism can be used to convert to or from an instance of .  LT^.from enum097^.enum :: Char'a'GNote: this is only an isomorphism from the numeric range actually used E 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. bThis can be used to lift any  into an arbitrary . cCComposition with this isomorphism is occasionally useful when your ,  Y or  has a constraint on an unused 3 argument to force that argument to agree with the # type of a used argument and avoid ScopedTypeVariables or other ugliness. dIf v is an element of a type a, and a' is a sans the element v, then d v is an isomorphism from  v a' to a. NKeep in mind this is only a real isomorphism if you treat the domain as being v (a sans v). 9This is practically quite useful when you want to have a 4 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 00KThis 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 3 should delete its entry from the surrounding one: dfromList [("hello",fromList [("world","!!!")])] & at "hello" . non Map.empty . at "world" .~ Nothing fromList []ee a p generalizes d a$ to take any value and a predicate. This function assumes that p a holds & and generates an isomorphism between v (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 []fBThe canonical isomorphism for currying and uncurrying a function.    f = Z   (fst^.curried) 3 43view curried fst 3 43gBThe canonical isomorphism for uncurrying and currying a function.    g = Z      g = [ f ((+)^.uncurried) (1,2)3h)The isomorphism for flipping a function. ((,)^.flipped) 1 2(2,1)iAn  between a list, , " fragment, etc. and its reversal. "live" ^. reversed"evil""live" & reversed %~ ('d':)"lived"j<Given a function that is its own inverse, this gives you an  using it in both directions.    j "a  Z "live" ^. involuted reverse"evil"$"live" & involuted reverse %~ ('d':)"lived"k*This isomorphism can be used to inspect a  to see how it associates 3 the structure and it can also be used to bake the  into a m so / that you can traverse over it multiple times. l+This isomorphism can be used to inspect an  to see how it associates 3 the structure and it can also be used to bake the  into a m so S that you can traverse over it multiple times with access to the original indices. mLift an  into a  functor.   contramapping ::  f =>  s t a b ->  (f a) (f b) (f s) (f t)  contramapping ::  f =>  s a ->  (f a) (f s) n Lift two s into both arguments of a   simultaneously.   dimapping ::   p =>  s t a b ->  s' t' a' b' ->  (p a s') (p b t') (p s a') (p t b')  dimapping ::   p =>  s a ->  s' a' ->  (p a s') (p s a') oLift an - contravariantly into the left argument of a  .   lmapping ::   p =>  s t a b -> ! (p a x) (p b y) (p s x) (p t y)  lmapping ::   p =>  s a ->  (p a x) (p s x) pLift an * covariantly into the right argument of a  .   rmapping ::   p =>  s t a b -> ! (p x s) (p y t) (p x a) (p y b)  rmapping ::   p =>  s a ->  (p x s) (p x a) $TUVWXYZ[\]^_`abcdefghijklmnop& mTUVWXYZ[\]^_`abcdefghijklmnop&YXZ[]\^_`bcdeafghVWTUijklmm nop"TUVWXYZ[\]^_`abcdefghijklmnop Rank2Types provisionalEdward Kmett <ekmett@gmail.com> TrustworthyqUThis is a convenient alias used when consuming (indexed) getters and (indexed) folds  in a highly general fashion. rUsed to consume an \. s@When you see this in a type signature it indicates that you can  pass the function a , ,  Y, [,  K, L , or one of ( the indexed variants, and it will just "do the right thing". Most - combinators are able to be used with both a  or a  [2 in limited situations, to do so, they need to be 2 monomorphic in what we are going to extract with . To be compatible  with , Y and  L. we also restricted choices of the irrelevant t and  b parameters. If a function accepts a s r s t a b , then when r is a , then  you can pass a [ (or  Y&), otherwise you can only pass this a   or . tBuild a % from an arbitrary Haskell function.    t f  t g "a t (g  f)    a w t f "a f a a ^.to ff a("hello","world")^.to snd"world" 5^.to succ6(0, -5)^._2.to abs5uView the value pointed to by a , L or  4 or the result of folding over all the results of a  [ or Y that points  at a monoidal value.    u  t "a   view (to f) af aview _2 (1,"hello")"hello"view (to succ) 56&view (_2._1) ("hello",("world","!!!"))"world"As u, is commonly used to access the target of a 2 or obtain a monoidal summary of the targets of a , T It may be useful to think of it as having one of these more restricted signatures:    u ::  s a -> s -> a  u ::  m => [ s m -> s -> m  u ::  s a -> s -> a  u ::  s a -> s -> a  u ::  m =>  s m -> s -> m 7In a more general setting, such as when working with a k transformer stack you can use:   u ::  s m =>  s a -> m a  u :: ( s m,  a) => [ s a -> m a  u ::  s m =>  s a -> m a  u ::  s m =>  s a -> m a  u :: ( s m,  a) =>  s a -> m a v-View a function of the value pointed to by a  or  or the result of 5 folding over the result of mapping the targets of a [ or  Y.    v l f "a u (l  t f) views (to f) g ag (f a)views _2 length (1,"hello")5As v, is commonly used to access the target of a 2 or obtain a monoidal summary of the targets of a , T It may be useful to think of it as having one of these more restricted signatures:    v ::  s a -> (a -> r) -> s -> r  v ::  m => [! s a -> (a -> m) -> s -> m  v :: ! s a -> (a -> r) -> s -> r  v ::  s a -> (a -> r) -> s -> r  v ::  m =>  s a -> (a -> m) -> s -> m 7In a more general setting, such as when working with a k transformer stack you can use:    u ::  s m =>  s a -> m a  u :: ( s m,  a) => [ s a -> m a  u ::  s m =>  s a -> m a  u ::  s m =>  s a -> m a  u :: ( s m,  a) =>  s a -> m a    v ::  s m => s r s a -> (a -> r) -> m r wView the value pointed to by a  or  or the - result of folding over all the results of a [ or  Y# that points at a monoidal values. This is the same operation as u with the arguments flipped. HThe 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   (w) :: s ->  s a -> a  (w) ::  m => s -> [ s m -> m  (w) :: s ->  s a -> a  (w) :: s ->  s a -> a  (w) ::  m => s ->  s m -> m xUse the target of a , L, or  - in the current state, or use a summary of a  [ or Y that points  to a monoidal value. evalState (use _1) (a,b)a$evalState (use _1) ("hello","world")"hello"   x ::  s m =>  s a -> m a  x :: ( s m,  r) => [ s r -> m r  x ::  s m =>  s a -> m a  x ::  s m =>  s a -> m a  x :: ( s m,  r) =>  s r -> m r yUse the target of a , L or  - in the current state, or use a summary of a  [ or Y that  points to a monoidal value. ,evalState (uses _1 length) ("hello","world")5   y ::  s m =>  s a -> (a -> r) -> m r  y :: ( s m,  r) => [ s a -> (a -> r) -> m r  y ::  s m =>  s a -> (a -> r) -> m r  y ::  s m =>  s a -> (a -> r) -> m r  y :: ( s m,  r) =>  s a -> (a -> r) -> m r    y ::  s m => s r s t a b -> (a -> r) -> m r zThis is a generalized form of # that only extracts the portion of ! the log that is focused on by a  . If given a  or a  J then a monoidal summary of the parts of the log that are visited will be  returned.   z ::  w m =>  w u -> m a -> m (a, u)  z ::  w m =>  w u -> m a -> m (a, u)  z ::  w m =>  w u -> m a -> m (a, u)  z :: ( w m,  u) =>  w u -> m a -> m (a, u)  z :: ( w m,  u) =>  w u -> m a -> m (a, u)  z :: ( w m,  u) =>  w u -> m a -> m (a, u) {This is a generalized form of # that only extracts the portion of ! the log that is focused on by a  . If given a  or a  J then a monoidal summary of the parts of the log that are visited will be  returned.   { ::  w m => # i w u -> m a -> m (a, (i, u))  { ::  w m => $ i w u -> m a -> m (a, (i, u))  { :: ( w m,  u) => % i w u -> m a -> m (a, (i, u))  { :: ( w m,  u) =>  i w u -> m a -> m (a, (i, u)) |This is a generalized form of # that only extracts the portion of ! the log that is focused on by a  . If given a  or a  J then a monoidal summary of the parts of the log that are visited will be  returned.   | ::  w m => ( w u -> (u -> v) -> m a -> m (a, v)  | ::  w m => ) w u -> (u -> v) -> m a -> m (a, v)  | ::  w m => * w u -> (u -> v) -> m a -> m (a, v)  | :: ( w m,  v) => * w u -> (u -> v) -> m a -> m (a, v)  | :: ( w m,  v) => $ w u -> (u -> v) -> m a -> m (a, v)  | :: ( w m,  v) => ( w u -> (u -> v) -> m a -> m (a, v) }This is a generalized form of # that only extracts the portion of ! the log that is focused on by a  . If given a  or a  J then a monoidal summary of the parts of the log that are visited will be  returned.   } ::  w m => - w u -> (i -> u -> v) -> m a -> m (a, v)  } ::  w m => . w u -> (i -> u -> v) -> m a -> m (a, v)  } :: ( w m,  v) => / w u -> (i -> u -> v) -> m a -> m (a, v)  } :: ( w m,  v) => ) w u -> (i -> u -> v) -> m a -> m (a, v) ~View the index and value of an ) into the current environment as a pair. When applied to an B the result will most likely be a nonsensical monoidal summary of f 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  into the current environment. When applied to an C the result will be a monoidal summary instead of a single answer.    "a  Use the index and value of an # into the current state as a pair. When applied to an B the result will most likely be a nonsensical monoidal summary of f 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  into the current state. When applied to an C the result will be a monoidal summary instead of a single answer. View the value pointed to by a  or . This is the same operation as ~ with the arguments flipped. HThe fixity and semantics are such that subsequent field accesses can be  performed with (). (a,b,c,d)^@._2(1,b)("hello","world","!!!")^@._2 (1,"world")   ( ) :: s ->  i s a -> (i, a)  ( ) :: s ->  i s a -> (i, a) The result probably doesn''t have much meaning when applied to an .  Coerce a .  to a  . This is useful  when using a  that is not simple as a  or a . qrstuvwxyz{|}~+,-./qrstuvwxyz{|}~srqtwuvxyz|~{}/+,-.qrstuvwxyz{|}~ non-portable provisionalEdward Kmett <ekmett@gmail.com> Trustworthy A   KIf you see this in a signature for a function, the function is expecting a  $ (in practice, this usually means a ). A   This is a limited form of a  that can only be used for  operations.  Like with a #, there are no laws to state for a . You can generate a  by using . You can also use any  or   directly as a . An analogue of t for .    :: (b -> t) ->  t b Turn a  or L around to build a . If you have an L, - is a more powerful version of this function  that will return an L instead of a mere .  5 ^.re _LeftLeft 56 ^.re (_Left.unto succ)Left 7    "a u     "a v     "a x     "a y       ::  s t a b ->  b t   ::  s t a b ->  b t This can be used to turn an L or  around and u@ a value (or the current environment) through it the other way.     "a u     .  "a  review _Left "mustard"Left "mustard"review (unto succ) 56Usually  is used in the (->) k with a  or L-, in which case it may be useful to think of < it as having one of these more restricted type signatures:     ::  s a -> a -> s   ::  s a -> a -> s However, when working with a k9 transformer stack, it is sometimes useful to be able to / the current environment, in which case one of ^ these more slightly more liberal type signatures may be beneficial to think of it as having:    ::  a m =>  s a -> m s   ::  a m =>  s a -> m s An infix alias for .     f # x "a f x  l # x "a x w  l #This is commonly used when using a  as a smart constructor.  _Left # 4Left 4But it can be used for any   base 16 # 123"7b"   (#) ::  s a -> a -> s  (#) ::  s a -> a -> s  (#) ::  s a -> a -> s  (#) ::  s a -> a -> s This can be used to turn an L or  around and u@ a value (or the current environment) through it the other way,  applying a function.     "a v     ( f) g "a g  f reviews _Left isRight "mustard"Falsereviews (unto succ) (*2) 38%Usually this function is used in the (->) k with a  or L-, in which case it may be useful to think of < it as having one of these more restricted type signatures:     ::  s a -> (s -> r) -> a -> r   ::  s a -> (s -> r) -> a -> r However, when working with a k9 transformer stack, it is sometimes useful to be able to / the current environment, in which case one of ^ these more slightly more liberal type signatures may be beneficial to think of it as having:    ::  a m =>  s a -> (s -> r) -> m r   ::  a m =>  s a -> (s -> r) -> m r This can be used to turn an L or  around and x@ a value (or the current environment) through it the other way.     "a x       "a  evalState (reuse _Left) 5Left 5evalState (reuse (unto succ)) 56    ::  a m =>  s a -> m s   ::  a m =>  s a -> m s This can be used to turn an L or  around and x- the current state through it the other way,  applying a function.     "a y     ( f) g "a  (g  f) *evalState (reuses _Left isLeft) (5 :: Int)True    ::  a m =>  s a -> (s -> r) -> m r   ::  a m =>  s a -> (s -> r) -> m r  )**) Rank2, MPTCs, fundeps experimentalEdward Kmett <ekmett@gmail.com> Trustworthy6 provides isomorphisms to wrap and unwrap newtypes or " data types with one constructor. An isomorphism between s and a and a related one between t and b, such that when a = b, s = t. This is often used via  to aid type inference. Given the constructor for a  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 alias for [ . .Const "hello" & unwrapped %~ length & getConst5(A convenient type-restricted version of  for aiding type inference. (A convenient type-restricted version of  for aiding type inference.  This is a convenient version of  with an argument that' s ignored. GThe argument is used to specify which newtype the user intends to wrap , by using the constructor for that newtype. The user supplied function is ignored, merely its type is used.  This is a convenient version of  with an argument that' s ignored. BThe argument is used to specify which newtype the user intends to remove , by using the constructor for that newtype. The user supplied function is ignored, merely its type is used.  This is a convenient version of & with two arguments that are ignored. GThese arguments are used to which newtype the user intends to wrap and D should both be the same constructor. This redundancy is necessary ; in order to find the full polymorphic isomorphism family.  The user supplied functions are ignored, merely their types are used.  This is a convenient version of & with two arguments that are ignored. IThese arguments are used to which newtype the user intends to remove and C should both be the same constructor. This redundancy is necessary ; in order to find the full polymorphic isomorphism family.  The user supplied functions are ignored, merely their 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 Sum foldMap [1,2,3,4]10ala Product foldMap [1,2,3,4]24This combinator is based on ala' from Conor McBride's work on Epigram. As with 0, the user supplied function for the newtype is ignored. )alaf Sum foldMap length ["hello","world"]10Use  . unwrapping returns a sorted list. Use  . unwrapping returns a sorted list. Use  . unwrapping returns a sorted list. Use  . unwrapping returns a sorted list. Use  3. Unwrapping returns some permutation of the list. Use  3. Unwrapping returns some permutation of the list. L  K Rank2Types provisionalEdward Kmett <ekmett@gmail.com> TrustworthyThis class allows us to use ? part of the environment, changing the environment supplied by  many different k transformers. Unlike 4 this can change the environment of a deeply nested k transformer.  Also, unlike ", this can be used with any valid , but cannot be used with a  or . MRun a monadic action in a larger environment than it was defined in, using a . This acts like D, but can in many cases change the type of the environment as well. 3This is commonly used to lift actions in a simpler  k into a k! with a larger environment type. )This can be used to edit pretty much any k. 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]    ::  s a -> (a -> r) -> s -> r   ::  r =>  s a -> (a -> r) -> s -> r     ::  w =>  s t ->   t w st c ->   s w st c   :: ( w,  c) =>  s a ->   a w st c ->   s w st c  ... This class allows us to use  in, changing the   supplied by  many different k! transformers, potentially quite  deep in a k 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    k into a   k with a larger   type. When applied to a  Y over H multiple values, the actions for each target are executed sequentially ! and the results are aggregated. )This can be used to edit pretty much any k 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    :: k m =>  s t ->   t m a ->   s m a   :: (k m,  c) =>  s t ->   t m c ->   s m c   :: (k m,  w) =>  s t ->   r w t m c ->   r w s m c   :: (k m,  w,  c) =>  s t ->   r w t m c ->   r w s m c   :: (k m,  w,   e) =>  s t ->  e (  r w t m) c ->  e (  r w s m) c   :: (k m,  w,  c,   e) =>  s t ->  e (  r w t m) c ->  e (  r w s m) c  ...     = v portable provisionalEdward Kmett <ekmett@gmail.com> Safe-InferredThis % can be used to change the type of a  by mapping  the elements to new values. Sadly, you can't create a valid  for a , but you can  manipulate it by reading using  and reindexing it via . (over setmapped (+1) (fromList [1,2,3,4])fromList [2,3,4,5]Construct a set from a , [, Y, ] or L. setOf folded ["hello","world"]fromList ["hello","world"]5setOf (folded._2) [("hello",1),("world",2),("!!!",3)]fromList [1,2,3]    ::  s a -> s ->  a   ::   a =>  s a -> s ->  a   ::  s a -> s ->  a   ::  s a -> s ->  a   ::   a =>  s a -> s ->  a portable provisionalEdward Kmett <ekmett@gmail.com> TrustworthyThis % 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 . Construct a set from a , [, Y, ] or L.    :: " a =>  s a -> s -> ! a   :: (# a, " a) =>  s a -> s -> ! a   :: " a =>  s a -> s -> ! a   :: " a =>  s a -> s -> ! a   :: (# a, " a) =>  s a -> s -> ! a  Rank2Types provisionalEdward Kmett <ekmett@gmail.com> TrustworthyZ Obtain a ( by lifting an operation that returns a $ result. +This can be useful to lift operations from  Data.List and elsewhere into a . [1,2,3,4]^..folding tail[2,3,4] Obtain a  from any $. Just 3^..folded[3]Nothing^..folded[][(1,2),(3,4)]^..folded.both [1,2,3,4]! by repeating the input forever.    % "a   "timingOut $ 5^..taking 20 repeated)[5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5]A  that replicates its input n times.    & n "a  ( n) 5^..replicated 20)[5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5] Transform a  into a - that loops over its elements over and over. 0timingOut $ [1,2,3]^..taking 7 (cycled traverse)[1,2,3,1,2,3,1]Build a & that unfolds its values from a seed.     "a    ?10^..unfolded (\b -> if b == 0 then Nothing else Just (b, b-1))[10,9,8,7,6,5,4,3,2,1]x w  f returns an infinite  of repeated applications of f to x.    ( f) a "a ' f a  Obtain a - that can be composed with to filter another , , ,  (or ). Note: This is not a legal M, unless you are very careful not to invalidate the predicate on the target. Note: This is also not a legal P, unless you are very careful not to inject a value that matches the predicate. *As a counter example, consider that given evens =  ( the second  law is violated:     evens )   evens ) *  evens ()  )) ,So, in order for this to qualify as a legal L 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.  Obtain a ! by taking elements from another , , ,  or  while a predicate holds.    + p "a  ( p ) 5timingOut $ toListOf (takingWhile (<=3) folded) [1..][1,2,3]    :: (a -> ) ->  s a ->  s a   :: (a -> ) ->  s a ->  s a   :: (a -> ) ->  s a ->  s a -- * See note below   :: (a -> ) ->  s a ->  s a -- * See note below   :: (a -> ) ->  s a ->  s a -- * See note below   :: (a -> ) ->  s a ->  s a -- * See note below   :: (a -> ) ->  m s a ->  m s a   :: (a -> ) ->  m s a ->  m s a   :: (a -> ) ->  i s a ->  i s a -- * See note below   :: (a -> ) ->  i s a ->  i s a -- * See note below   :: (a -> ) ->  i s a ->  i s a   :: (a -> ) ->  i s a ->  i s a   :: (a -> ) ->  i m s a ->  i m s a   :: (a -> ) ->  i m s a ->  i m s a Note: When applied to a , 3 yields something that can be used as if it were a , but  which is not a ^ per the laws, unless you are careful to ensure that you do not invalidate the predicate when  writing back through it.  Obtain a # by dropping elements from another , , ,  or  while a predicate holds.    , p "a  ( p ) ,toListOf (droppingWhile (<=3) folded) [1..6][4,5,6]-toListOf (droppingWhile (<=3) folded) [1,6,1][6,1]    :: (a -> ) ->  s a ->  s a   :: (a -> ) ->  s a ->  s a   :: (a -> ) ->  s a -> ! s a -- see notes   :: (a -> ) ->  s a -> ! s a -- see notes   :: (a -> ) ->  s a -> ! s a -- see notes   :: (a -> ) ->  s a -> ! s a -- see notes     :: (a -> ) ->  s a ->  s a -- see notes   :: (a -> ) ->  s a ->  s a -- see notes   :: (a -> ) ->  s a ->  s a   :: (a -> ) ->  s a ->  s a   :: (a -> ) ->  m s a ->  s a     :: (a -> ) ->  m s a ->  m s a     :: (a -> ) ->  i s a ->  i s a -- see notes   :: (a -> ) ->  i s a ->  i s a -- see notes   :: (a -> ) ->  i s a ->  i s a   :: (a -> ) ->  i s a ->  i s a   :: (a -> ) ->  i m s a ->  i s a     :: (a -> ) ->  i m s a ->  i m s a jNote: 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 j new values you assign also pass the predicate! Otherwise subsequent traversals will visit fewer elements  and  fusion is not sound.    | =       "a v   l =  l  7     ::  s a -> (a -> r) -> s -> r   ::  r => ! s a -> (a -> r) -> s -> r   ::  s a -> (a -> r) -> s -> r   :: ! s a -> (a -> r) -> s -> r   ::  r =>  s a -> (a -> r) -> s -> r   ::  r =>  s a -> (a -> r) -> s -> r     :: s r s a -> (a -> r) -> s -> r    | =       "a u     ::  s m -> s -> m   ::  m =>  s m -> s -> m   ::  s m -> s -> m   ::  s m -> s -> m   ::  m =>  s m -> s -> m   ::  m =>  s m -> s -> m IRight-associative fold of parts of a structure that are viewed through a , ,  or .    | "a       :: ) s a -> (a -> r -> r) -> r -> s -> r   :: + s a -> (a -> r -> r) -> r -> s -> r   :: * s a -> (a -> r -> r) -> r -> s -> r   :: + s a -> (a -> r -> r) -> r -> s -> r   :: % s a -> (a -> r -> r) -> r -> s -> r   :: ) s a -> (a -> r -> r) -> r -> s -> r     l "a  l  7     :: s (-( r) s a -> (a -> r -> r) -> r -> s -> r LLeft-associative fold of the parts of a structure that are viewed through a , ,  or .    | "a       :: ) s a -> (r -> a -> r) -> r -> s -> r   :: + s a -> (r -> a -> r) -> r -> s -> r   :: * s a -> (r -> a -> r) -> r -> s -> r   :: + s a -> (r -> a -> r) -> r -> s -> r   :: % s a -> (r -> a -> r) -> r -> s -> r   :: ) s a -> (r -> a -> r) -> r -> s -> r #Extract a list of the targets of a  . See also ().   | "a    () "a .  (A convenient infix (flipped) version of . [[1,2],[3]]^..traverse.traverse[1,2,3] (1,2)^..both[1,2]   | xs "a xs    () "a .     ( ) :: s ->  s a -> [a]  ( ) :: s ->  s a -> [a]  ( ) :: s ->  s a -> [a]  ( ) :: s ->  s a -> [a]  ( ) :: s ->  s a -> [a]  ( ) :: s ->  s a -> [a] Returns  if every target of a  is . andOf both (True,False)FalseandOf both (True,True)True   | "a       ::  s  -> s ->    ::  s  -> s ->    ::  s  -> s ->    ::  s  -> s ->    ::  s  -> s ->    ::  s  -> s ->  Returns  if any target of a  is . orOf both (True,False)TrueorOf both (False,False)False   | "a       ::  s  -> s ->    ::  s  -> s ->    ::  s  -> s ->    ::  s  -> s ->    ::  s  -> s ->    ::  s  -> s ->  Returns  if any target of a  satisfies a predicate. anyOf both (=='x') ('x','y')Trueimport Data.Data.Lens=anyOf biplate (== "world") (((),2::Int),"hello",("world",11))True   | "a       l "a  l  7     ::  s a -> (a ->  ) -> s ->    ::  s a -> (a ->  ) -> s ->    ::  s a -> (a ->  ) -> s ->    ::  s a -> (a ->  ) -> s ->    ::  s a -> (a ->  ) -> s ->    ::  s a -> (a ->  ) -> s ->  Returns  if every target of a  satisfies a predicate. allOf both (>=3) (4,5)TrueallOf folded (>=2) [1..10]False   | "a       l =  l  7     ::  s a -> (a ->  ) -> s ->    ::  s a -> (a ->  ) -> s ->    ::  s a -> (a ->  ) -> s ->    ::  s a -> (a ->  ) -> s ->    ::  s a -> (a ->  ) -> s ->    ::  s a -> (a ->  ) -> s ->  Calculate the / of every number targeted by a . productOf both (4,5)20productOf folded [1,2,3,4,5]120   | "a   Calculate the 0 of every number targeted by a . sumOf both (5,6)11sumOf folded [1,2,3,4]10!sumOf (folded.both) [(1,2),(3,4)]10import Data.Data.Lens8sumOf biplate [(1::Int,[]),(2,[(3::Int,4::Int)])] :: Int10   | "a   @This operation may be more strict than you would expect. If you  want a lazier version use ala 0       _1 ::  a => (a, b) -> a   (  #) :: ($ f,  a) => f (a, b) -> a     ::  a =>  s a -> s -> a   ::  a =>  s a -> s -> a   ::  a =>  s a -> s -> a   ::  a =>  s a -> s -> a   ::  a =>  s a -> s -> a   ::  a =>  s a -> s -> a &Traverse over all of the targets of a  (or ), computing an  (or )-based answer,  but unlike # do not construct a new structure.  generalizes  | to work over any . When passed a ,  can work over any , but when passed a ,  requires  an . +traverseOf_ both putStrLn ("hello","world")helloworld   | "a       _2 :: # f => (c -> f r) -> (d, c) -> f ()    ::  f => (a -> f b) -> u a c -> f ()     l "a  l  7 !The rather specific signature of 6 allows it to be used as if the signature was any of:    ::  f => $ s a -> (a -> f r) -> s -> f ()   ::  f => & s a -> (a -> f r) -> s -> f ()   ::  f => % s a -> (a -> f r) -> s -> f ()   ::  f => & s a -> (a -> f r) -> s -> f ()   ::  f =>  s a -> (a -> f r) -> s -> f ()   ::  f => $ s a -> (a -> f r) -> s -> f () &Traverse over all of the targets of a  (or ), computing an  (or )-based answer,  but unlike # do not construct a new structure.  generalizes  | to work over any . When passed a ,  can work over any , but when passed a ,  requires  an .    1 "a   &forOf_ both ("hello","world") putStrLnhelloworld!The rather specific signature of 6 allows it to be used as if the signature was any of:     l s "a  l s  7     ::  f => $ s a -> s -> (a -> f r) -> f ()   ::  f => & s a -> s -> (a -> f r) -> f ()   ::  f => % s a -> s -> (a -> f r) -> f ()   ::  f => & s a -> s -> (a -> f r) -> f ()   ::  f =>  s a -> s -> (a -> f r) -> f ()   ::  f => $ s a -> s -> (a -> f r) -> f () &Evaluate each action in observed by a : on a structure from left to right, ignoring the results.    2 "a   5sequenceAOf_ both (putStrLn "hello",putStrLn "world")helloworld    ::  f =>  s (f a) -> s -> f ()   ::  f =>  s (f a) -> s -> f ()   ::  f =>  s (f a) -> s -> f ()   ::  f =>  s (f a) -> s -> f ()   ::  f =>  s (f a) -> s -> f ()   ::  f =>  s (f a) -> s -> f () Map each target of a h on a structure to a monadic action, evaluate these actions from left to right, and ignore the results. 'mapMOf_ both putStrLn ("hello","world")helloworld   |j "a       :: k m => $ s a -> (a -> m r) -> s -> m ()   :: k m => & s a -> (a -> m r) -> s -> m ()   :: k m => % s a -> (a -> m r) -> s -> m ()   :: k m => & s a -> (a -> m r) -> s -> m ()   :: k m =>  s a -> (a -> m r) -> s -> m ()   :: k m => $ s a -> (a -> m r) -> s -> m ()  is $ with two of its arguments flipped. 'forMOf_ both ("hello","world") putStrLnhelloworld   | "a       :: k m => $ s a -> s -> (a -> m r) -> m ()   :: k m => & s a -> s -> (a -> m r) -> m ()   :: k m => % s a -> s -> (a -> m r) -> m ()   :: k m => & s a -> s -> (a -> m r) -> m ()   :: k m =>  s a -> s -> (a -> m r) -> m ()   :: k m => $ s a -> s -> (a -> m r) -> m () -Evaluate each monadic action referenced by a > on the structure from left to right, and ignore the results. 4sequenceOf_ both (putStrLn "hello",putStrLn "world")helloworld   | "a       :: k m =>  s (m a) -> s -> m ()   :: k m =>  s (m a) -> s -> m ()   :: k m =>  s (m a) -> s -> m ()   :: k m =>  s (m a) -> s -> m ()   :: k m =>  s (m a) -> s -> m ()   :: k m =>  s (m a) -> s -> m () 1The sum of a collection of actions, generalizing . asumOf both ("hello","world") "helloworld",asumOf each (Nothing, Just "hello", Nothing) Just "hello"   3 "a       :: 4 f =>  s (f a) -> s -> f a   :: 4 f =>  s (f a) -> s -> f a   :: 4 f =>  s (f a) -> s -> f a   :: 4 f =>  s (f a) -> s -> f a   :: 4 f =>  s (f a) -> s -> f a   :: 4 f =>  s (f a) -> s -> f a 1The sum of a collection of actions, generalizing . msumOf both ("hello","world") "helloworld",msumOf each (Nothing, Just "hello", Nothing) Just "hello"   5 "a       :: 6 m =>  s (m a) -> s -> m a   :: 6 m =>  s (m a) -> s -> m a   :: 6 m =>  s (m a) -> s -> m a   :: 6 m =>  s (m a) -> s -> m a   :: 6 m =>  s (m a) -> s -> m a   :: 6 m =>  s (m a) -> s -> m a /Does the element occur anywhere within a given  of the structure? %elemOf both "hello" ("hello","world")True   7 "a       :: # a =>  s a -> a -> s ->    :: # a =>  s a -> a -> s ->    :: # a =>  s a -> a -> s ->    :: # a =>  s a -> a -> s ->    :: # a =>  s a -> a -> s ->    :: # a =>  s a -> a -> s ->  3Does the element not occur anywhere within a given  of the structure?  notElemOf each 'd' ('a','b','c')True notElemOf each 'a' ('a','b','c')False   8 "a       :: # a =>  s a -> a -> s ->    :: # a =>  s a -> a -> s ->    :: # a =>  s a -> a -> s ->    :: # a =>  s a -> a -> s ->    :: # a =>  s a -> a -> s ->    :: # a =>  s a -> a -> s ->  )Map a function over all the targets of a 5 of a container and concatenate the resulting lists. )concatMapOf both (\x -> [x, x + 1]) (1,3) [1,2,3,4]   9 "a       ::  s a -> (a -> [r] ) -> s -> [r]   ::  s a -> (a -> [r] ) -> s -> [r]   ::  s a -> (a -> [r] ) -> s -> [r]   ::  s a -> (a -> [r] ) -> s -> [r]   ::  s a -> (a -> [r] ) -> s -> [r] +Concatenate all of the lists targeted by a  into a longer list. concatOf both ("pan","ama")"panama"   : "a     "a u     ::  s [r] -> s -> [r]   ::  s [r] -> s -> [r]   ::  s [r] -> s -> [r]   ::  s [r] -> s -> [r]   ::  s [r] -> s -> [r] 0Calculate the number of targets there are for a  in a given container. Note:C This can be rather inefficient for large containers and just like ;, - this will not terminate for infinite folds.    ; "a   lengthOf _1 ("hello",())1lengthOf traverse [1..10]100lengthOf (traverse.traverse) [[1,2],[3,4],[5,6]]6    (  ) :: ($ f, $ g) => f (g a) ->      ::  s a -> s ->    ::  s a -> s ->    ::  s a -> s ->    ::  s a -> s ->    ::  s a -> s ->  Perform a safe < of a  or  or retrieve \ the result  from a  or .  When using a  as a partial , or a  as a partial  this can be a convenient $ way to extract the optional value. BNote: if you get stack overflows due to this, you may want to use  instead, which can deal 1 more gracefully with heavily left-biased trees. Left 4 ^?_LeftJust 4Right 4 ^?_LeftNothing"world" ^? ix 3Just 'l'"world" ^? ix 20Nothing   () "a .     ( ) :: s ->  s a -> v a  ( ) :: s ->  s a -> v a  ( ) :: s ->  s a -> v a  ( ) :: s ->  s a -> v a  ( ) :: s ->  s a -> v a Perform an *UNSAFE* < of a  or  assuming that it is there. Left 4 ^?! _Left4"world" ^?! ix 3'l'   ( ) :: s ->  s a -> a  ( ) :: s ->  s a -> a  ( ) :: s ->  s a -> a  ( ) :: s ->  s a -> a  ( ) :: s ->  s a -> a  Retrieve the = entry of a  or  or retrieve \ the result  from a  or . >The answer is computed in a manner that leaks space less than ala =   , and gives you back access to the outermost \. constructor more quickly, but may have worse  constant factors. firstOf traverse [1..10]Just 1firstOf both (1,2)Just 1firstOf ignored ()Nothing    ::  s a -> s -> v a   ::  s a -> s -> v a   ::  s a -> s -> v a   ::  s a -> s -> v a   ::  s a -> s -> v a  Retrieve the > entry of a  or  or retrieve \ the result  from a  or . >The answer is computed in a manner that leaks space less than ala >   , and gives you back access to the outermost \. constructor more quickly, but may have worse  constant factors. lastOf traverse [1..10]Just 10lastOf both (1,2)Just 2lastOf ignored ()Nothing    ::  s a -> s -> v a   ::  s a -> s -> v a   ::  s a -> s -> v a   ::  s a -> s -> v a   ::  s a -> s -> v a Returns  if this  or ( has no targets in the given container. Note:  on a valid ,  or  should always return ?.    @ "a   /This may be rather inefficient compared to the @ check of many containers. nullOf _1 (1,2)FalsenullOf ignored ()TruenullOf traverse []TruenullOf (element 20) [1..10]True    (  _1  ) :: ($ f, $ g) => f (g a, b) ->      ::  s a -> s ->    ::  s a -> s ->    ::  s a -> s ->    ::  s a -> s ->    ::  s a -> s ->  Returns  if this  or ) has any targets in the given container. A more "conversational" alias for this combinator is . Note:  on a valid ,  or  should always return .    @ "a   /This may be rather inefficient compared to the   @ check of many containers. notNullOf _1 (1,2)TruenotNullOf traverse [1..10]TruenotNullOf folded []FalsenotNullOf (element 20) [1..10]False    (  _1  ) :: ($ f, $ g) => f (g a, b) ->      ::  s a -> s ->    ::  s a -> s ->    ::  s a -> s ->    ::  s a -> s ->    ::  s a -> s ->  2Obtain the maximum element (if any) targeted by a  or  safely. Note:  on a valid ,  or  will always return \ a value. maximumOf traverse [1..10]Just 10maximumOf traverse []Nothing0maximumOf (folded.filtered even) [1,4,3,6,7,9,2]Just 6   A "a B (C "empty")    aIn the interest of efficiency, This operation has semantics more strict than strictly necessary.     ( l })- has lazier semantics but could leak memory.    ::   a =>  s a -> s -> v a   ::   a =>  s a -> s -> v a   ::   a =>  s a -> s -> v a   ::   a =>  s a -> s -> v a   ::   a =>  s a -> s -> v a 2Obtain the minimum element (if any) targeted by a  or  safely. Note:  on a valid ,  or  will always return \ a value. minimumOf traverse [1..10]Just 1minimumOf traverse []Nothing0minimumOf (folded.filtered even) [1,4,3,6,7,9,2]Just 2   D "a B (C "empty")    aIn the interest of efficiency, This operation has semantics more strict than strictly necessary.     ( l )- has lazier semantics but could leak memory.    ::   a =>  s a -> s -> v a   ::   a =>  s a -> s -> v a   ::   a =>  s a -> s -> v a   ::   a =>  s a -> s -> v a   ::   a =>  s a -> s -> v a 2Obtain the maximum element (if any) targeted by a , , , ,  or  according to a user supplied E. EmaximumByOf traverse (compare `on` length) ["mustard","relish","ham"]Just "mustard"aIn the interest of efficiency, This operation has semantics more strict than strictly necessary.    | cmp "a B (C "empty")    cmp     ::  s a -> (a -> a -> E ) -> s -> v a   ::  s a -> (a -> a -> E ) -> s -> v a   ::  s a -> (a -> a -> E ) -> s -> v a   ::  s a -> (a -> a -> E ) -> s -> v a   ::  s a -> (a -> a -> E ) -> s -> v a 2Obtain the minimum element (if any) targeted by a , , ,   or  according to a user supplied E. aIn the interest of efficiency, This operation has semantics more strict than strictly necessary. EminimumByOf traverse (compare `on` length) ["mustard","relish","ham"] Just "ham"   F cmp "a B (C "empty")    cmp     ::  s a -> (a -> a -> E ) -> s -> v a   ::  s a -> (a -> a -> E ) -> s -> v a   ::  s a -> (a -> a -> E ) -> s -> v a   ::  s a -> (a -> a -> E ) -> s -> v a   ::  s a -> (a -> a -> E ) -> s -> v a The  function takes a  (or , , , or ), O a predicate and a structure and returns the leftmost element of the structure  matching the predicate, or G if there is no such element. findOf each even (1,3,4,6)Just 4findOf folded even [1,3,5,7]Nothing    ::  s a -> (a ->  ) -> s -> v a   ::  s a -> (a ->  ) -> s -> v a   ::  s a -> (a ->  ) -> s -> v a   ::  s a -> (a ->  ) -> s -> v a   ::  s a -> (a ->  ) -> s -> v a    | "a     l "a  l  7 A simpler version that didn't permit indexing, would be:    :: s (- (v a)) s a -> (a ->  ) -> s -> v a   l p =  l (a y -> if p a then \ a else y) G  A variant of 4 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 H f   l  | "a       :: $ s a -> (a -> a -> a) -> s -> a   :: & s a -> (a -> a -> a) -> s -> a   :: & s a -> (a -> a -> a) -> s -> a   :: % s a -> (a -> a -> a) -> s -> a   ::  s a -> (a -> a -> a) -> s -> a  A variant of R 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 I f   l  | "a       :: $ s a -> (a -> a -> a) -> s -> a   :: & s a -> (a -> a -> a) -> s -> a   :: & s a -> (a -> a -> a) -> s -> a   :: % s a -> (a -> a -> a) -> s -> a   ::  s a -> (a -> a -> a) -> s -> a 6Strictly fold right over the elements of a structure.    | "a       :: ) s a -> (a -> r -> r) -> r -> s -> r   :: + s a -> (a -> r -> r) -> r -> s -> r   :: + s a -> (a -> r -> r) -> r -> s -> r   :: * s a -> (a -> r -> r) -> r -> s -> r   :: % s a -> (a -> r -> r) -> r -> s -> r NFold over the elements of a structure, associating to the left, but strictly.    | "a       :: ) s a -> (r -> a -> r) -> r -> s -> r   :: + s a -> (r -> a -> r) -> r -> s -> r   :: + s a -> (r -> a -> r) -> r -> s -> r   :: * s a -> (r -> a -> r) -> r -> s -> r   :: % s a -> (r -> a -> r) -> r -> s -> r  A variant of 4 that has no base case and thus may only be applied N to folds and structures such that the fold views at least one element of the  structure.     l f "a H f   l     :: $ s a -> (a -> a -> a) -> s -> a   :: & s a -> (a -> a -> a) -> s -> a   :: & s a -> (a -> a -> a) -> s -> a   :: % s a -> (a -> a -> a) -> s -> a   ::  s a -> (a -> a -> a) -> s -> a  A variant of 4 that has no base case and thus may only be applied J to folds and structures such that the fold views at least one element of  the structure.     l f "a  f   l     :: $ s a -> (a -> a -> a) -> s -> a   :: & s a -> (a -> a -> a) -> s -> a   :: & s a -> (a -> a -> a) -> s -> a   :: % s a -> (a -> a -> a) -> s -> a   ::  s a -> (a -> a -> a) -> s -> a IMonadic fold over the elements of a structure, associating to the right,  i.e. from right to left.    | "a       :: k m => - s a -> (a -> r -> m r) -> r -> s -> m r   :: k m => / s a -> (a -> r -> m r) -> r -> s -> m r   :: k m => / s a -> (a -> r -> m r) -> r -> s -> m r   :: k m => . s a -> (a -> r -> m r) -> r -> s -> m r   :: k m => ) s a -> (a -> r -> m r) -> r -> s -> m r HMonadic fold over the elements of a structure, associating to the left,  i.e. from left to right.    | "a       :: k m => - s a -> (r -> a -> m r) -> r -> s -> m r   :: k m => / s a -> (r -> a -> m r) -> r -> s -> m r   :: k m => / s a -> (r -> a -> m r) -> r -> s -> m r   :: k m => . s a -> (r -> a -> m r) -> r -> s -> m r   :: k m => ) s a -> (r -> a -> m r) -> r -> s -> m r Check to see if this  or  matches 1 or more entries. has (element 0) []Falsehas _Left (Left 12)Truehas _Right (Left 12)FalseThis will always return  for a  or . has _1 ("hello","world")True    ::  s a -> s ->    ::  s a -> s ->    ::  s a -> s ->    ::  s a -> s ->    ::  s a -> s ->  Check to see if this  or  has no matches. hasn't _Left (Right 12)Truehasn't _Left (Left 12)FalseThis converts a  to a ' that returns the first element, if it  exists, as a v.    ::  s a ->  s (v a)   ::  s a ->  s (v a)   ::   s a ->  s (v a)   ::   s a ->  s (v a)   ::   s a ->  s (v a)   ::   s a ->  s (v a) This converts an  to an  that returns the first index " and element, if they exist, as a v.    ::  i s a ->  s (v (i, a))   ::  i s a ->  s (v (i, a))   ::  ( i) s a ->  s (v (i, a))   ::  ( i) s a ->  s (v (i, a)) 'Retrieve the first value targeted by a  or  (or \ the result  from a  or  ). See also ().    J  K "a   This is usually applied in the    (->) s.     = u       ::  s a -> s -> v a   ::  s a -> s -> v a   ::  s a -> s -> v a   ::  s a -> s -> v a   ::  s a -> s -> v a LHowever, it may be useful to think of its full generality when working with  a  transformer stack:    ::  s m =>  s a -> m (v a)   ::  s m =>  s a -> m (v a)   ::  s m =>  s a -> m (v a)   ::  s m =>  s a -> m (v a)   ::  s m =>  s a -> m (v a) 1Retrieve the first index and value targeted by a  or  (or \ the result  from a  or  ). See also ().     = u   This is usually applied in the    (->) s.     ::  i s a -> s -> v (i, a)   ::  i s a -> s -> v (i, a)   ::  i s a -> s -> v (i, a)   ::  i s a -> s -> v (i, a) LHowever, it may be useful to think of its full generality when working with  a  transformer stack:    ::  s m =>  s a -> m (v (i, a))   ::  s m =>  s a -> m (v (i, a))   ::  s m =>  s a -> m (v (i, a))   ::  s m =>  s a -> m (v (i, a)) 5Retrieve a function of the first value targeted by a  or   (or \ the result from a  or ). This is usually applied in the    (->) s. @Retrieve a function of the first index and value targeted by an  or   (or \ the result from an  or ).  See also ().     = v   This is usually applied in the    (->) s.     :: $ i s a -> (i -> a -> r) -> s -> v r   :: & i s a -> (i -> a -> r) -> s -> v r   :: % i s a -> (i -> a -> r) -> s -> v r   ::  i s a -> (i -> a -> r) -> s -> v r LHowever, it may be useful to think of its full generality when working with  a  transformer stack:    ::  s m => " i s a -> (i -> a -> r) -> m (v r)   ::  s m => $ i s a -> (i -> a -> r) -> m (v r)   ::  s m => # i s a -> (i -> a -> r) -> m (v r)   ::  s m =>  i s a -> (i -> a -> r) -> m (v r) 'Retrieve the first value targeted by a  or  (or \ the result  from a  or ) into the current state.     = x       ::  s m =>  s a -> m (v a)   ::  s m =>  s a -> m (v a)   ::  s m =>  s a -> m (v a)   ::  s m =>  s a -> m (v a)   ::  s m =>  s a -> m (v a) 2Retrieve the first index and value targeted by an  or  (or \ the index  and result from an  or ) into the current state.     = x       ::  s m =>  i s a -> m (v (i, a))   ::  s m =>  i s a -> m (v (i, a))   ::  s m =>  i s a -> m (v (i, a))   ::  s m =>  i s a -> m (v (i, a)) 5Retrieve a function of the first value targeted by a  or   (or \ the result from a  or ) into the current state.     = y       ::  s m =>  s a -> (a -> r) -> m (v r)   ::  s m =>  s a -> (a -> r) -> m (v r)   ::  s m =>  s a -> (a -> r) -> m (v r)   ::  s m =>  s a -> (a -> r) -> m (v r)   ::  s m =>  s a -> (a -> r) -> m (v r) @Retrieve a function of the first index and value targeted by an  or   (or a function of \ the index and result from an   or ) into the current state.     = y       ::  s m => " i s a -> (i -> a -> r) -> m (v r)   ::  s m => $ i s a -> (i -> a -> r) -> m (v r)   ::  s m => # i s a -> (i -> a -> r) -> m (v r)   ::  s m =>  i s a -> (i -> a -> r) -> m (v r) This allows you to # the elements of a pretty much any % construction in the opposite order. This will preserve indexes on 74 types and will give you the elements of a (finite)  or  in the opposite order. "This has no practical impact on a , ,  or . NB: To write back through an , you want to use . % Similarly, to write back through an , you want to use . Fold an  or / by mapping indices and values to an arbitrary  with access  to the i.  When you don' t need access to the index then & is more flexible in what it accepts.     l "a  l       :: & i s a -> (i -> a -> m) -> s -> m   ::  m => ( i s a -> (i -> a -> m) -> s -> m   :: ' i s a -> (i -> a -> m) -> s -> m   ::  m => " i s a -> (i -> a -> m) -> s -> m JRight-associative fold of parts of a structure that are viewed through an  or  with  access to the i.  When you don' t need access to the index then & is more flexible in what it accepts.     l "a  l       :: 0 i s a -> (i -> a -> r -> r) -> r -> s -> r   :: 2 i s a -> (i -> a -> r -> r) -> r -> s -> r   :: 1 i s a -> (i -> a -> r -> r) -> r -> s -> r   :: , i s a -> (i -> a -> r -> r) -> r -> s -> r MLeft-associative fold of the parts of a structure that are viewed through an  or  with  access to the i.  When you don' t need access to the index then & is more flexible in what it accepts.     l "a  l       :: 0 i s a -> (i -> r -> a -> r) -> r -> s -> r   :: 2 i s a -> (i -> r -> a -> r) -> r -> s -> r   :: 1 i s a -> (i -> r -> a -> r) -> r -> s -> r   :: , i s a -> (i -> r -> a -> r) -> r -> s -> r 4Return whether or not any element viewed through an  or  ) satisfy a predicate, with access to the i.  When you don' t need access to the index then & is more flexible in what it accepts.     l "a  l       ::  i s a -> (i -> a ->  ) -> s ->    ::  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  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       ::  i s a -> (i -> a ->  ) -> s ->    ::  i s a -> (i -> a ->  ) -> s ->    ::  i s a -> (i -> a ->  ) -> s ->    ::  i s a -> (i -> a ->  ) -> s ->  Traverse the targets of an  or  with access to the i, discarding the results.  When you don' t need access to the index then & is more flexible in what it accepts.     l "a  l       ::  f => + i s a -> (i -> a -> f r) -> s -> f ()   ::  f => - i s a -> (i -> a -> f r) -> s -> f ()   ::  f => , i s a -> (i -> a -> f r) -> s -> f ()   ::  f => ' i s a -> (i -> a -> f r) -> s -> f () Traverse the targets of an  or 2 with access to the index, 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.     l a "a  l a       ::  f => + i s a -> s -> (i -> a -> f r) -> f ()   ::  f => - i s a -> s -> (i -> a -> f r) -> f ()   ::  f => , i s a -> s -> (i -> a -> f r) -> f ()   ::  f => ' i s a -> s -> (i -> a -> f r) -> f () *Run monadic actions for each target of an  or  with access to the index,  discarding the results.  When you don' t need access to the index then & is more flexible in what it accepts.     l "a  l       :: k m => + i s a -> (i -> a -> m r) -> s -> m ()   :: k m => - i s a -> (i -> a -> m r) -> s -> m ()   :: k m => , i s a -> (i -> a -> m r) -> s -> m ()   :: k m => ' i s a -> (i -> a -> m r) -> s -> m () *Run monadic actions for each target of an  or  with access to the index, 6 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.     l a "a  l a       :: k m => + i s a -> s -> (i -> a -> m r) -> m ()   :: k m => - i s a -> s -> (i -> a -> m r) -> m ()   :: k m => , i s a -> s -> (i -> a -> m r) -> m ()   :: k m => ' i s a -> s -> (i -> a -> m r) -> m () <Concatenate the results of a function of the elements of an  or   with access to the index.  When you don' t need access to the index then ' is more flexible in what it accepts.     l "a  l     "a      ::  i s a -> (i -> a -> [r] ) -> s -> [r]   ::  i s a -> (i -> a -> [r] ) -> s -> [r]   ::  i s a -> (i -> a -> [r] ) -> s -> [r]   ::  i s a -> (i -> a -> [r] ) -> s -> [r] The  function takes an  or , a predicate that is also T supplied the index, a structure and returns the left-most element of the structure  matching the predicate, or G 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       ::  i s a -> (i -> a ->  ) -> s -> v a   ::  i s a -> (i -> a ->  ) -> s -> v a   ::  i s a -> (i -> a ->  ) -> s -> v a   ::  i s a -> (i -> a ->  ) -> s -> v 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       :: 0 i s a -> (i -> a -> r -> r) -> r -> s -> r   :: 2 i s a -> (i -> a -> r -> r) -> r -> s -> r   :: 1 i s a -> (i -> a -> r -> r) -> r -> s -> r   :: , i s a -> (i -> a -> r -> r) -> r -> s -> r 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       :: 2 i s a -> (i -> r -> a -> r) -> r -> s -> r   :: 4 i s a -> (i -> r -> a -> r) -> r -> s -> r   :: 3 i s a -> (i -> r -> a -> r) -> r -> s -> r   :: . i s a -> (i -> r -> a -> r) -> r -> s -> r CMonadic 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       :: k m => 4 i s a -> (i -> a -> r -> m r) -> r -> s -> m r   :: k m => 6 i s a -> (i -> a -> r -> m r) -> r -> s -> m r   :: k m => 5 i s a -> (i -> a -> r -> m r) -> r -> s -> m r   :: k m => 0 i s a -> (i -> a -> r -> m r) -> r -> s -> m r VMonadic 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       :: k m => 4 i s a -> (i -> r -> a -> m r) -> r -> s -> m r   :: k m => 6 i s a -> (i -> r -> a -> m r) -> r -> s -> m r   :: k m => 5 i s a -> (i -> r -> a -> m r) -> r -> s -> m r   :: k 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'1t need access to the indices in the result, then & is more flexible in what it accepts.     l "a L M   l     ::  i s a -> s -> [(i,a)]   ::  i s a -> s -> [(i,a)]   ::  i s a -> s -> [(i,a)]   ::  i s a -> s -> [(i,a)] An infix version of . Perform a safe < (with index) of an  or  or retrieve \ the index and result  from an  or .  When using a  as a partial , or an  as a partial  this can be a convenient $ way to extract the optional value.   ( ) :: s ->  i s a -> v (i, a)  ( ) :: s ->  i s a -> v (i, a)  ( ) :: s ->  i s a -> v (i, a)  ( ) :: s ->  i s a -> v (i, a) Perform an *UNSAFE* < (with index) of an  or  assuming that it is there.   ( ) :: s ->  i s a -> (i, a)  ( ) :: s ->  i s a -> (i, a)  ( ) :: s ->  i s a -> (i, a)  ( ) :: s ->  i s a -> (i, a)  Filter an  or , obtaining an . 4[0,0,0,5,5,5]^..traversed.ifiltered (\i a -> i <= a) [0,5,5,5] Compose with  to filter another ,  IndexedIso, ,  (or ) with ) access to both the value and the index. Note: As with  , this is not a legal M, unless you are very careful not to invalidate the predicate on the target!  Obtain an ! by taking elements from another  , ,  or  while a predicate holds.    :: (i -> a -> ) ->  i s a ->  i s a   :: (i -> a -> ) ->  i s a ->  i s a   :: (i -> a -> ) ->  i s a ->  i s a   :: (i -> a -> ) ->  i s a ->  i s a   :: (i -> a -> ) ->  i m s a ->  i m s a   :: (i -> a -> ) ->  i m s a ->  i m s a  Obtain an # by dropping elements from another , ,  or  while a predicate holds.     :: (i -> a -> ) ->  i s a ->  i s a   :: (i -> a -> ) ->  i s a ->  i s a -- see notes   :: (i -> a -> ) ->  i s a ->  i s a -- see notes   :: (i -> a -> ) ->  i s a ->  i s a   :: (i -> a -> ) ->  i m s a ->  i m s a   :: (i -> a -> ) ->  i m s a ->  i m s a  Applying  to an  or % will still allow you to use it as a  pseudo-Q, 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. A deprecated alias for . [N`uy`yu[N Rank2Types provisionalEdward Kmett <ekmett@gmail.com> Safe-InferredA  . >When you see this as an argument to a function, it expects an . Provides witness that (s ~ a, b ~ t) holds. Extract a witness of type . Substituting types with .  We can use # to do substitution into anything.  is symmetric. 8This is an adverb that can be used to modify many other " combinators to make them require J simple lenses, simple traversals, simple prisms or simple isos as input.   portable provisionalEdward Kmett <ekmett@gmail.com> Safe-Inferred^Passes the result of the left side to the function on the right side (forward pipe operator).  This is the flipped version of (+), which is more common in languages like F# as (|>) where it is needed e for inference. Here it is supplied for notational convenience and given a precedence that allows it  to be nested inside uses of (). a & ff a"hello" & length & succ68This combinator is commonly used when applying multiple ] operations in sequence. =("hello","world") & _1.element 0 .~ 'j' & _1.element 4 .~ 'y'("jelly","world") This reads somewhat similar to: Nflip execState ("hello","world") $ do _1.element 0 .= 'j'; _1.element 4 .= 'y'("jelly","world")Infix flipped .   () = .  This is convenient to .( argument order of composite functions. %over _2 ?? ("hello","world") $ length ("hello",5)(over ?? length ?? ("hello","world") $ _2 ("hello",5) Rank2Types provisionalEdward Kmett <ekmett@gmail.com> Trustworthy@   type   =  (  i)  >When you see this as an argument to a function, it expects an     type   =     =When you see this as an argument to a function, it expects a . 4This type can also be used when you need to store a  in a container, 3 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.      :: : 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))Build an index-preserving  from a O and a P.    ! :: (s -> a) -> (s -> b -> t) ->  s t a b    sa sbt afb s = sbt s O afb (sa s)  Build an  from a O and  a P. (') can be used in one of two scenarios: When applied to a  , it can edit the target of the  in a , structure, extracting a functorial result. When applied to a , it can edit the E targets of the traversals, extracting an applicative summary of its  actions. 8For all that the definition of this combinator is just:    () "a  DIt may be beneficial to think about it as if it had these even more  restricted types, however:    () ::  f => L) s t a b -> (a -> f b) -> s -> f t  () ::  f => ( s t a b -> (a -> f b) -> s -> f t  () ::  f => Y# s t a b -> (a -> f b) -> s -> f t When applied to a , it can edit the G targets of the traversals, extracting a supplemental monoidal summary  of its actions, by choosing  f = ((,) m)   () :: L/ s t a b -> (a -> (r, b)) -> s -> (r, t)  () :: . s t a b -> (a -> (r, b)) -> s -> (r, t)  () ::  m => Y) 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  Y( 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 (P ) It may be useful to think of ($), instead, as having either of the , following more restricted type signatures:   () ::  s m => L' s s a b -> (a -> (r, b)) -> m r  () ::  s m => & s s a b -> (a -> (r, b)) -> m r  () :: ( s m,  r) => Y! s s a b -> (a -> (r, b)) -> m r Lift a ! so it can run under a function. 9Merge two lenses, getters, setters, folds or traversals.     "a        :: O s a -> O s' a -> O (u s s') a   :: [ s a -> [ s' a -> [ (u s s') a   ::  s a ->  s' a ->  (u s s') a   ::  s a ->  s' a ->  (u s s') a   ::  s a ->  s' a ->  (u s s') a  This is a  that updates either side of an u', where both sides have the same type.     "a    Left a^.chosenaRight a^.chosenaRight "hello"^.chosen"hello"Right a & chosen *~ b Right (a * b)    ::  (u a a) (u b b) a b   f ( a) =  O f a   f ( a) =  O f a  makes a  from two other lenses. *(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') This  lets you view the current pos of any indexed  store comonad and seek) to a new position. This reduces the API ) for working these instances to a single .    O w "a w    R s w "a w    s  S f w "a w    f     ::  (I a s) a   :: < p =>  (E p a s) a   :: < p =>  (A p g a s) a  Cloning a ! is one way to make sure you aren't given  something weaker, such as a Y and can be D 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 IndexedPreservingLens# that just passes through whatever  index is on any , ,  or  it is composed with.  Clone an  as an  with the same index. Modify the target of a  and return the result. 2When you do not need the result of the addition, () is more flexible.   () :: ) s t a b -> (a -> b) -> s -> (b, t)  () :: L* s t a b -> (a -> b) -> s -> (b, t)  () ::  b => Y$ 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. 2When you do not need the result of the division, () 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. 2When you do not need the result of the division, () 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. 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) " 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. 2When you do not need the result of the addition, () is more flexible.   ($) :: ) s t a b -> (a -> b) -> s -> (a, t)  ($) :: L* s t a b -> (a -> b) -> s -> (a, t)  ($) ::  a => Y$ s t a b -> (a -> b) -> s -> (a, t) %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 -> b -> s -> (a, t)  (%) :: L# s t a b -> b -> s -> (a, t)  (%) ::  a => Y s t a b -> b -> s -> (a, t) &Modify the target of a  into your  'Monad'\'s state by a user supplied ! function and return the result. When applied to a YD, it this will return a monoidal summary of all of the intermediate  results. 3When you do not need the result of the operation, () is more flexible.   (&) ::  s m =>  s a -> (a -> a) -> m a  (&) ::  s m =>  s a -> (a -> a) -> m a  (&) :: ( s m,  a) =>  s a -> (a -> a) -> m a '*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'\'s 4 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  0Modify the target of a  into your  'Monad'\'s state by a user supplied  function and return the old value that was replaced. When applied to a YB, 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.    (0) ::  s m =>  s a -> (a -> a) -> m a  (0) ::  s m =>  s a -> (a -> a) -> m a  (0) :: ( s m,  b) =>  s a -> (a -> a) -> m a  (0) ::  s m => " ((,)a) s s a b -> (a -> b) -> m a1Modify the target of a  into your  'Monad'\'s state by a user supplied  function and return the old value that was replaced. When applied to a YB, 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.   (0) ::  s m =>  s a -> (a -> a) -> m a  (0) ::  s m =>  s a -> (a -> a) -> m a  (0) :: ( s m,  t) =>  s a -> (a -> a) -> m a 2,Run a monadic action, and set the target of  to its result.    (2) ::  s m => L s s a b -> m b -> m b  (2) ::  s m =>  s s a b -> m b -> m b (NB: This is limited to taking an actual  than admitting a Y because 5 there are potential loss of state issues otherwise. 32 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. 42 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. 5Adjust the target of an ' returning the intermediate result, or ! adjust all of the targets of an Z and return a monoidal summary  along with the answer.  l  f "a l 5  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 ().   (5) :: 0 i s t a b -> (i -> a -> b) -> s -> (b, t)  (5) ::  b => Z+ i s t a b -> (i -> a -> b) -> s -> (b, t) 6Adjust the target of an  returning the old value, or ! adjust all of the targets of an Z and return a monoidal summary * of the old values along with the answer.   (6) :: 0 i s t a b -> (i -> a -> b) -> s -> (a, t)  (6) ::  a => Z+ i s t a b -> (i -> a -> b) -> s -> (a, t) 7Adjust the target of an & returning a supplementary result, or ! adjust all of the targets of an Z and return a monoidal summary . of the supplementary results and the answer.  (7) "a     (7) ::  f => / i s t a b -> (i -> a -> f b) -> s -> f t  (7) ::  f => Z* i s t a b -> (i -> a -> f b) -> s -> f t ]In particular, it is often useful to think of this function as having one of these even more  restricted type signatures:   (7) :: 5 i s t a b -> (i -> a -> (r, b)) -> s -> (r, t)  (7) ::  r => Z0 i s t a b -> (i -> a -> (r, b)) -> s -> (r, t) 8Adjust the target of an & returning a supplementary result, or ! adjust all of the targets of an Z within the current state, and 9 return a monoidal summary of the supplementary results.  l 8 f "a P (l 7 f)   (8) ::  s m => 2 i s s a b -> (i -> a -> (r, b)) -> s -> m r  (8) :: ( s m,  r) => Z- i s s a b -> (i -> a -> (r, b)) -> s -> m r 9Adjust the target of an ' returning the intermediate result, or ! adjust all of the targets of an Z within the current state, and 8 return a monoidal summary of the intermediate results.   (9) ::  s m => ( i s s a b -> (i -> a -> b) -> m b  (9) :: ( s m,  b) => Z# 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 Z within the current state, and . return a monoidal summary of the old values.   (:) ::  s m => ( i s s a b -> (i -> a -> b) -> m a  (:) :: ( s m,  b) => Z# 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  . AA version of () that works on  . BA version of () that works on  . "("hello","world") & _2 <#%~ length(5,("hello",5))CA version of (&) that works on  . DA version of () that works on  . EA version of () that works on  . "("hello","there") & _2 <#~ "world"("world",("hello","world"))FA version of () that works on  . G'There is a field for every type in the Q . Very zen. [] & mapped.devoid +~ 1[]Nothing & mapped.devoid %~ absNothing   G ::  Q a HWe can always retrieve a () from any type. "hello"^.united()"hello" & united .~ ()"hello"@      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHGIJK      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHG     78596: !"#3$%&'()*+,-./4012<;=>?EB@ADFCGHJKI@      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGH Rank2Types provisionalEdward Kmett <ekmett@gmail.com> Safe-InferredI   type I =  J Deprecated for two reasons. J is now  #, and we no longer use the verbose  SimpleFoo naming , convention, this has since been renamed to   for consistency. J[This is an older alias for a type-restricted form of lens that is able to be passed around  in containers monomorphically. +Deprecated. This has since been renamed to   for consistency. IJ  ;<=>?@ABCDEFIJ  <;=>?EB@ADFCJIIJ non-portable provisionalEdward Kmett <ekmett@gmail.com> TrustworthyK   type APrism' =  L LKIf you see this in a signature for a function, the function is expecting a . RConvert L0 to the pair of functions that characterize it. MClone a 6 so that you can reuse the same monomorphically typed  for different purposes. See  and 0 for examples of why you might want to do this. NBuild a K. u t a is used instead of v a to permit the types of s and t to differ. O This is usually used to build a ), when you have to use an operation like   which already returns a v. PUse a # as a kind of first-class pattern. P ::  s t a b -> $ (t -> r) (s -> r) (b -> r) (a -> r)QUse a # to work over part of a structure. R&Given a pair of prisms, project sums.  Viewing a  as a co-,, this combinator can be seen to be dual to . SCheck to see if this  doesn' t match. isn't _Left (Right 12)Trueisn't _Left (Left 12)FalseTThis  provides a  for tweaking the  half of an u: 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 u:  _Left # 5Left 5 5^.re _LeftLeft 5UThis  provides a  for tweaking the  half of an u: 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 u:  _Right # 5Right 5 5^.re _RightRight 5VThis  provides a ) for tweaking the target of the value of \ in a v. over _Just (+1) (Just 2)Just 3Unlike  this is a +, and so you can use it to inject as well:  _Just # 5Just 5 5^.re _JustJust 5Interestingly,    m ^? V "a m Just x ^? _JustJust xNothing ^? _JustNothingWThis  provides the  of a G in a v. Nothing ^? _NothingJust ()Just () ^? _NothingNothing3But you can turn it around and use it to construct G as well:  _Nothing # ()NothingXQ' is a logically uninhabited data type.  This is a ! that will always fail to match. YThis 1 compares for exact equality with a given value.  only 4 # ()4 5 ^? only 4NothingKLRMNOPQRSTUVWXYKLMNOPQRSTUVWXYLKNOMPQRSTUVWXYKLRMNOPQRSTUVWXY Rank2Types provisionalEdward Kmett <ekmett@gmail.com> Trustworthy5ZAllows $ 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 =  (_ f) _;When you see this as an argument to a function, it expects  to be indexed if p is an instance of 7 i,  to be unindexed if p is (->),  a  if f is ,  a  if f is only Gettable,  a  if p is only a ,  a  if f is Gettable and . `   type ` =  (a i) a>When you see this as an argument to a function, it expects an . b   type b =  c c=When you see this as an argument to a function, it expects a . d.Map each element of a structure targeted by a  or , E evaluate these actions from left to right, and collect the results. 0This function is only provided for consistency, S is strictly more general. traverseOf each print (1,2,3)123 ((),(),())   d "a S   l "a d l T 7 This yields the obvious law:     "a d     d ::  f => ) s t a b -> (a -> f b) -> s -> f t  d ::  f => ( s t a b -> (a -> f b) -> s -> f t  d ::  f => # s t a b -> (a -> f b) -> s -> f t e A version of d( with the arguments flipped, such that: forOf each (1,2,3) print123 ((),(),())0This function is only provided for consistency, . is strictly more general.    e "a .  e "a . . d    U "a e     l s "a U l s T 7    e ::  f => # s t a b -> s -> (a -> f b) -> f t  e ::  f => # s t a b -> s -> (a -> f b) -> f t  e ::  f => # s t a b -> s -> (a -> f b) -> f t fFEvaluate 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)]   V "a f  "a  S  f l "a d l S "a l S    f ::  f =>  s t (f b) b -> s -> f t  f ::  f =>  s t (f b) b -> s -> f t  f ::  f =>  s t (f b) b -> s -> f t g.Map each element of a structure targeted by a  to a monadic action, E 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)]   W "a g    l "a X l T 7    g :: k m => ) s t a b -> (a -> m b) -> s -> m t  g :: k m => ( s t a b -> (a -> m b) -> s -> m t  g :: k m => # s t a b -> (a -> m b) -> s -> m t hh is a flipped version of g$, consistent with the definition of X. $forMOf both (1,3) $ \x -> [x, x + 1][(1,3),(1,4),(2,3),(2,4)]   X "a h   h l "a . (g l)   l s "a X l s T 7    h :: k m => ) s t a b -> s -> (a -> m b) -> m t  h :: k m => ( s t a b -> s -> (a -> m b) -> m t  h :: k m => # s t a b -> s -> (a -> m b) -> m t i-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)]   Y "a i   i l "a g l S  i l "a Z T l [    i :: k m =>  s t (m b) b -> s -> m t  i :: k m =>  s t (m b) b -> s -> m t  i :: k m =>  s t (m b) b -> s -> m t jThis generalizes  to an arbitrary . Note: F 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 j   Since every  is a , we can use this as a form of  monadic strength as well:   j # :: (b, [a] ) -> [(b, a)] kThis generalizes \ to an arbitrary .    \ "a k  k accumulates   from right to left.    k :: A s t a b -> (acc -> a -> (acc, b)) -> acc -> s -> (acc, t)  k :: @ s t a b -> (acc -> a -> (acc, b)) -> acc -> s -> (acc, t)  k :: ; s t a b -> (acc -> a -> (acc, b)) -> acc -> s -> (acc, t)    k ::  (] ( A acc)) s t a b -> (acc -> a -> (acc, b)) -> acc -> s -> (acc, t) lThis generalizes ^ to an arbitrary .    ^ "a l  l accumulates   from left to right.    l :: A s t a b -> (acc -> a -> (acc, b)) -> acc -> s -> (acc, t)  l :: @ s t a b -> (acc -> a -> (acc, b)) -> acc -> s -> (acc, t)  l :: ; s t a b -> (acc -> a -> (acc, b)) -> acc -> s -> (acc, t)    l ::  ( @ acc) s t a b -> (acc -> a -> (acc, b)) -> acc -> s -> (acc, t)  l l f acc0 s = _ (` (l (a -> a (acc -> _ (f acc a))) s) acc0) mThis permits the use of b over an arbitrary  or .    b "a m     m :: * s t a a -> (a -> a -> a) -> s -> t  m :: ) s t a a -> (a -> a -> a) -> s -> t  m :: $ s t a a -> (a -> a -> a) -> s -> t nThis permits the use of c over an arbitrary  or .    c "a n     n :: * s t a a -> (a -> a -> a) -> s -> t  n :: ) s t a a -> (a -> a -> a) -> s -> t  n :: $ s t a a -> (a -> a -> a) -> s -> t oThis  allows you to  the individual stores in a a. pThis  allows you to  the individual stores in  a a with access to their indices. qq turns a  into a ( that resembles an early version of the ' (or ') type. Note:X You should really try to maintain the invariant of the number of children in the list. pAny extras will be lost. If you do not supply enough, then the remainder will come from the original structure. So technically, this is only a 8 if you do not change the number of results it returns. When applied to a  the result is merely a .   q ::  s a ->  s [a]  q ::  s a ->  s [a]  q ::  s a ->  s [a]  q ::  s a ->  s [a]  q ::  s a ->  s [a] rAn indexed version of q8 that receives the entire list of indices as its index. sA type-restricted version of q that can only be used with a . tA type-restricted version of r that can only be used with an . uu turns a  into a ' (or ' ) family.  If you do not need the types of s and t) to be different, it is recommended that  you use q. +It is generally safer to traverse with the a rather than use this 2 combinator. However, it is sometimes convenient. !This is unsafe because if you don't supply at least as many b's as you were  given a's, then the reconstruction of t will result in an error! When applied to a  the result is merely a  (and becomes safe).   u ::  s t a b ->  s t [a] [b]  u ::  s t a b ->  s t [a] [b]  u ::  s t a b ->  s t [a] [b]  u ::  s a ->  s [a]  u ::  s a ->  s [a] vAn indexed version of u8 that receives the entire list of indices as its index. yThe 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 d the original structure.   # propChildren l x = childrenOf l x e L  (y l x)  propId l x = f (e x) [d w | w <- y l x]    y ::  s a -> s -> [E (->) a s]  y ::  s a -> s -> [E (->) a s]  y ::  s a -> s -> [E (->) a s]  y ::  i s a -> s -> [E (7 i) a s]  y ::  i s a -> s -> [E (7 i) a s] zThis converts a  that you "know"' will target one or more elements to a  . It can ' also be used to transform a non-empty  into a  or a non-empty  into an  . The resulting , , or ! will be partial if the supplied  returns  no results.   z ::  s t a a ->  s t a a  z ::  s a ->  s a  z ::  m s a ->  m s a  z ::  i s t a a ->  i s t a a  z ::  i s a ->  i s a  z ::  i m s a ->  i m s a {This converts a  that you "know"# will target only one element to a . It can also be  used to transform a  into a  or a  into an . The resulting , , or  will be partial if the  targets nothing  or more than one element.   { ::  s t a b ->  s t a b  { ::  s a ->  s a  { ::  m s a ->  m s a  { ::  i s t a b ->  i s t a b  { ::  i s a ->  i s a  { ::  i m s a ->  i m s a |4Traverse both parts of a tuple with matching types. both *~ 10 $ (1,2)(10,20)"over both length ("hello","world")(5,5)("hello","world")^.both "helloworld"}Apply a different  or  to each side of a tuple.    } ::  s t a b ->  s' t' a b ->  (s,s') (t,t') a b  } ::  s t a b ->  s' t' a b ->  (s,s') (t,t') a b  } ::  s a ->  s' a ->  (s,s') a  } ::  s a ->  s' a ->  (s,s') a  } ::  m s a ->  m s' a ->  m (s,s') a  } ::  m s a ->  m 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  } ::  i s a ->  i s' a ->  i (s,s') a  } ::  i s a ->  i s' a ->  i (s,s') a  } ::  i m s a ->  i m s' a ->  i m (s,s') a  } ::  i m s a ->  i m s' a ->  i m (s,s') a    } ::  s t a b ->  s' t' a b ->  (s,s') (t,t') a b  } ::  s t a b ->  s' t' a b ->  (s,s') (t,t') a b  } ::  s a ->  s' a ->  (s,s') a  } ::  s a ->  s' a ->  (s,s') a  } ::  m s a ->  m s' a ->  m (s,s') a  } ::  m s a ->  m s' a ->  m (s,s') a .("hello",["world","!!!"])^..beside id traverse["hello","world","!!!"]~Visit the first n targets of a , ,  or . =[("hello","world"),("!!!","!!!")]^.. taking 2 (traverse.both)["hello","world"]'timingOut $ [1..] ^.. taking 3 traverse[1,2,3]+over (taking 5 traverse) succ "hello world" "ifmmp world"   ~ ::  ->  s a ->  s a  ~ ::  ->  s a ->  s a  ~ ::  ->  s a ->  s a  ~ ::  ->  s a ->  s a  ~ ::  ->  s a ->  s a  ~ ::  ->  s a ->  s a  ~ ::  ->  m s a ->  m s a  ~ ::  ->  m s a ->  m s a  ~ ::  ->  i s a ->  i s a  ~ ::  ->  i s a ->  i s a  ~ ::  ->  i s a ->  i s a  ~ ::  ->  i s a ->  i s a  ~ ::  ->  i m s a ->  i m s a  ~ ::  ->  i m s a ->  i m s a Visit all but the first n targets of a , ,  or . $("hello","world") ^? dropping 1 both Just "world"/Dropping works on infinite traversals as well: [1..] ^? dropping 1 foldedJust 2    ::  ->  s a ->  s a   ::  ->  s a ->  s a   ::  ->  s a ->  s a   ::  ->  s a ->  s a   ::  ->  s a ->  s a   ::  ->  s a ->  s a   ::  ->  m s a ->  m s a   ::  ->  m s a ->  m s a   ::  ->  i s a ->  i s a   ::  ->  i s a ->  i s a   ::  ->  i s a ->  i s a   ::  ->  i s a ->  i s a   ::  ->  i m s a ->  i m s a   ::  ->  i m s a ->  i m s a A 2 is completely characterized by its behavior on a a.  Cloning a ! is one way to make sure you aren't given  something weaker, such as a  and can be H 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 P former can execute at full speed, while the latter needs to round trip through  the a. Plet foo l a = (view (coerced (cloneTraversal l)) a, set (cloneTraversal l) 10 a)foo both ("hello","world")("helloworld",(10,10))    ::  (a (->) a b) s t a b ->  s t a b Clone a  yielding an  that passes through % whatever index it is composed with.  Clone an  yielding an  with the same index. Traversal with an index. NB: When you don'8t need access to the index then you can just apply your   directly as a function!     "a    d l =  l T  = S     ::  f => / i s t a b -> (i -> a -> f b) -> s -> f t   ::  f => * i s t a b -> (i -> a -> f b) -> s -> f t 4Traverse with an index (and the arguments flipped).    e l a "a  l a T    "a . T      ::  f => / i s t a b -> s -> (i -> a -> f b) -> f t   ::  f => * i s t a b -> s -> (i -> a -> f b) -> f t .Map each element of a structure targeted by a  to a monadic action, Q evaluate these actions from left to right, and collect the results, with access  its position.  When you don't need access to the index g( is more liberal in what it can accept.    g l "a  l T      :: k m => / i s t a b -> (i -> a -> m b) -> s -> m t   :: k 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, Q evaluate these actions from left to right, and collect the results, with access + its position (and the arguments flipped).    h l a "a  l a T    "a . T      :: k m => / i s t a b -> s -> (i -> a -> m b) -> m t   :: k 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.    k l "a  l T      :: 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 l "a  l T      :: 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. This is the trivial empty .     ::  i s s a b     "a   6 & ignored %~ absurd6 Traverse the nth element  a ,  or   if it exists. 2[[1],[3,4]] & elementOf (traverse.traverse) 1 .~ 5 [[1],[5,4]]*[[1],[3,4]] ^? elementOf (folded.folded) 1Just 3*timingOut $ ['a'..] ^?! elementOf folded 5'f'8timingOut $ take 10 $ elementOf traverse 3 .~ 16 $ [0..][0,1,2,16,4,5,6,7,8,9]    ::  s a ->  ->   s a   ::  s a ->  ->   s a  Traverse the nth element of a  container.    "a   *Traverse (or fold) selected elements of a  (or 3) where their ordinal positions match a predicate.    ::  s a -> ( -> ) ->   s a   ::  s a -> ( -> ) ->   s a Traverse elements of a > container where their ordinal positions matches 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)AZ[\]^_`abcdefghijklmnopqrstuvwxyz{ghijkl|}~mnopA`abcZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~Acba`_^defghijlkmnqsuwyz{|}~\]Z[rtvxabc`op?Z[\]^_`abcdefghijklmnopqrstuvwxyz{ghijkl|}~mnop  Rank2Types provisionalEdward Kmett <ekmett@gmail.com> Trustworthy)A  with an additional index. 2An instance must satisfy a (modified) form of the  laws:    ( ) "a    ( f)   g "a    (\i ->    (f i)  g i) Traverse an indexed container. The  of a  container. <A container that supports folding with an additional index. 2Fold a container by mapping value to an arbitrary  with access to the index i.  When you don' t need access to the index then q& is more flexible in what it accepts.   q "a    The  of a  container. HRight-associative fold of an indexed container with access to the index i.  When you don' t need access to the index then r& is more flexible in what it accepts.   r "a    GLeft-associative fold of an indexed container with access to the index i.  When you don' t need access to the index then s& is more flexible in what it accepts.   s "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 t& is more flexible in what it accepts.   t "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  with an additional index. .Instances must satisfy a modified form of the  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 & is more flexible in what it accepts.  Compose an 7' function with a non-indexed function. Mnemonically, the <- points to the indexing we want to preserve. 'Compose a non-indexed function with an 7 function. Mnemonically, the >- points to the indexing we want to preserve. This is the same as (). f  g (and f  g) gives you the index of g unless g is index-preserving, like a  ,  or , in which case it'll pass through the index of f. Remap the index. Composition of 7 functions. Mnemonically, the < and >: points to the fact that we want to preserve the indices. Composition of 7@ functions with a user supplied function for combining indices. IFold a container with indices returning both the indices and the values. )The result is only valid to compose in a  , if you don' t edit the - index as edits to the index have no effect. When composed with an  or  this yields an  (7)  of the indices. This allows you to filter an , ,  or  based on a predicate  on the indices. 6["hello","the","world","!!!"]^..traversed.indices even["hello","world"]Mover (traversed.indices (>0)) Prelude.reverse $ ["He","was","stressed","o_O"]["He","saw","desserts","O_o"]This allows you to filter an , ,  or  based on an index. 0["hello","the","world","!!!"]^?traversed.index 2 Just "world" Obtain a ( by lifting an operation that returns a $ result. +This can be useful to lift operations from  and elsewhere into a . 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 u& is more flexible in what it accepts.   u "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 v& is more flexible in what it accepts.   v "a    +Traverse elements with access to the index i, discarding the results.  When you don' t need access to the index then w& is more flexible in what it accepts.   w l =    +Traverse elements with access to the index i7, discarding the results (with the arguments flipped).     "a .   When you don' t need access to the index then 1& is more flexible in what it accepts.   1 a "a  a   *Run monadic actions for each target of an  or Z with access to the index,  discarding the results.  When you don' t need access to the index then & is more flexible in what it accepts.   x "a    *Run monadic actions for each target of an  or Z with access to the index, 6 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.    l a "a  l a   hConcatenate 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 9& is more flexible in what it accepts.   9 "a      "a  xSearches a container with a predicate that is also supplied the index, returning the left-most element of the structure  matching the predicate, or G if there is no such element.  When you don' t need access to the index then y& is more flexible in what it accepts.   y "a    CMonadic fold right over the elements of a structure with an index.  When you don' t need access to the index then z& is more flexible in what it accepts.   z "a    VMonadic 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'1t need access to the indices in the result, then K& is more flexible in what it accepts.   K "a  M   4Traverse with an index (and the arguments flipped).   U a "a  a     "a .  5Map each element of a structure to a monadic action, Q evaluate these actions from left to right, and collect the results, with access  the index.  When you don't need access to the index W( is more liberal in what it can accept.   W "a    5Map each element of a structure to a monadic action, Q evaluate these actions from left to right, and collect the results, with access + its position (and the arguments flipped).   X 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.   l "a    |The position in the } is available as the index. ~4The position in the list is available as the index. P|~1789:;<=>?@1:;<=>789?@F|~! Rank2Types provisionalEdward Kmett <ekmett@gmail.com>NoneThis 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 () 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  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 , as it extracts information  in an order that violates the  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 0 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 , as it extracts information  in an order that violates the  laws. " non-portable experimentalEdward Kmett <ekmett@gmail.com> TrustworthyBThe  forms the bulk of a . A * is a recorded path through the (indexed)  chain of a . This enables us to pull the  back up to the . A B is a linked list of the levels above the current one. The length  of a  is known at compile time. ,This is part of the internal structure of a  . You shouldn'$t need to manipulate this directly. This represents the type a  will have when it is fully  back up. Many zippers are indexed by Int keys. This type alias is convenient for reducing syntactic noise for talking about these boring indices. This type family represents a  with the p variable : abstracting over the position and the index, in terms of . You , can visually see it in type signatures as:   h  (a  i) =  h i a CAn empty data type, used to represent the pairing of a position in  a  with an index. See . This is the type of a . It visually resembles a "breadcrumb trail" as Q used in website navigation. Each breadcrumb in the trail represents a level you  can move up to. FThis type operator associates to the left, so you can use a type like    (,)    to represent a  from (,) down to  that has an intermediate  crumb for the  containing the . You can construct a  into *any* data structure with . 'You can repackage up the contents of a  with . rezip $ zipper 4242GThe combinators in this module provide lot of things you can do to the   while you have it open. Note that a value of type h  s  a doesn't actually contain a value  of type h  s6 -- as we descend into a level, the previous level is  unpacked and stored in  form. Only one value of type _  _ exists + at any particular time for any particular . This is used to represent the  of the . Every  starts with . e.g.   a is the type of the trivial . A  into a  that ends at a . Once we' ve updated a 2 we need to put the values back into the original  shape.  is an illegal & that is used to put the values back. A $ is used to store the contents of a  in a way F that we do not have to re-asocciate the elements. This enables us to 0 more gracefully deal with infinite traversals. *Return the number of children in a jacket CThis is an internal function used to check from left-to-right if a  has any  nots or not. CThis is an internal function used to check from right-to-left if a  has any  nots or not. /This is used to extract the maximal key from a . This is used by  and  to a seek specific keys, borrowing the asympotic guarantees of the original structure in many cases!  Construct a  from a a Given a a and a  build from that a with ,  refill the a with its new contents. This is only a valid  if you don't change the shape of the ! 'Calculate the absolute position of the  targeted by a . DThis can be quite expensive for right-biased traversals such as you  receive from a list. +Return the total number of children in the  by walking the   to the root. Reconstruct a  from a . *Walk down the tree to the leftmost child. +Walk down the tree to the rightmost child. Move left one . Move right one . This ! views the current target of the .  Construct a 0 that can explore anything, and start it at the . Return the index of the focus. "Return the index into the current ! within the current level of the .   ( l) l = \'Mnemonically, zippers have a number of " within each level. This is which  you are currently at. wThis is based on ordinal position regardless of the underlying index type. It may be excessively expensive for a list. # may be much cheaper if you have a  indexed by ordinal position!  Move the  @, closing the current level and focusing on the parent element. %NB: Attempts to move upward from the  of the  will fail to typecheck.  Jerk the  one  to the  within the current  or . /Attempts to move past the start of the current  (or trivially, the current )  will return G. &isNothing $ zipper "hello" & rightwardTrue?zipper "hello" & fromWithin traverse & rightward <&> view focus'e'Kzipper "hello" & fromWithin traverse & rightward <&> focus .~ 'u' <&> rezip"hullo"Crezip $ zipper (1,2) & fromWithin both & tug rightward & focus .~ 3(1,3) Jerk the   one  within the current  or . -Attempts to move past the end of the current  (or trivially, the current )  will return G. %isNothing $ zipper "hello" & leftwardTrue-Move to the leftmost position of the current . $This is just a convenient alias for  . Fzipper "hello" & fromWithin traverse & leftmost & focus .~ 'a' & rezip"aello".Move to the rightmost position of the current . $This is just a convenient alias for  . azipper "hello" & fromWithin traverse & rightmost & focus .~ 'y' & leftmost & focus .~ 'j' & rezip"jelly"This allows you to safely   or   on a  A. This will attempt the move, and stay where it was if it fails. KThe more general signature allows its use in other circumstances, however.   f x "a B a (f a)Ofmap rezip $ zipper "hello" & within traverse <&> tug leftward <&> focus .~ 'j'"jello"Pfmap rezip $ zipper "hello" & within traverse <&> tug rightward <&> focus .~ 'u'"hullo"This allows you to safely   or    multiple times on a -, moving multiple steps in a given direction * and stopping at the last place you couldn'"t move from. This lets you safely  move a &, because it will stop at either end. Sfmap rezip $ zipper "stale" & within traverse <&> tugs rightward 2 <&> focus .~ 'y'"style"prezip $ zipper "want" & fromWithin traverse & tugs rightward 2 & focus .~ 'r' & tugs leftward 100 & focus .~ 'c'"cart";Move in a direction as far as you can go, then stop there. 4This repeatedly applies a function until it returns G$, and then returns the last answer. dfmap rezip $ zipper ("hello","world") & downward _1 & within traverse <&> rightmost <&> focus .~ 'a'("hella","world")Xrezip $ zipper ("hello","there") & fromWithin (both.traverse) & rightmost & focus .~ 'm'("hello","therm"))This allows for you to repeatedly pull a 8 in a given direction, failing if it falls off the end. CisNothing $ zipper "hello" & within traverse >>= jerks rightward 10TrueTfmap rezip $ zipper "silly" & within traverse >>= jerks rightward 3 <&> focus .~ 'k'"silky";Returns the number of siblings at the current level in the .   z  1NB: If the current E targets an infinite number of elements then this may not terminate. RThis is also a particularly expensive operation to perform on an unbalanced tree.  zipper ("hello","world") & teeth12zipper ("hello","world") & fromWithin both & teeth2.zipper ("hello","world") & downward _1 & teeth1Dzipper ("hello","world") & downward _1 & fromWithin traverse & teeth5;zipper ("hello","world") & fromWithin (_1.traverse) & teeth5=zipper ("hello","world") & fromWithin (both.traverse) & teeth10 Move the $ horizontally to the element in the nth position in the 6 current level, absolutely indexed, starting with the   as 0.  This returns G if the target element doesn' t exist.   n "a   n   -isNothing $ zipper "not working." & jerkTo 20True Move the $ horizontally to the element in the nth position of the 6 current level, absolutely indexed, starting with the   as 0. %If the element at that position doesn'+t exist, then this will clamp to the range 0  n  .   n "a   n   grezip $ zipper "not working." & fromWithin traverse & tugTo 100 & focus .~ '!' & tugTo 1 & focus .~ 'u'"nut working!"/Move towards a particular index in the current . (Move horizontally to a particular index i in the current  .. In the case of simple zippers, the index is  and / we can move between traversals fairly easily: ;zipper (42, 32) & fromWithin both & moveTo 0 <&> view focus42;zipper (42, 32) & fromWithin both & moveTo 1 <&> view focus32 Construct an  from   where the index is fixed to 0. Step down into a  . This is a constrained form of  for when you know 4 there is precisely one target that can never fail.    ::  s a -> (h  s) -> h  s  a   ::  s a -> (h  s) -> h  s  a Step down into a  . This is a constrained form of  for when you know 4 there is precisely one target that can never fail.    ::  i s a -> (h  s:@j) -> h  s:@j  a:@i Step down into the  entry of a .     ::  s a -> (h  s:@j) -> v (h  s:@j  a)   ::  s a -> (h  s:@j) -> v (h  s:@j  a)   ::  s a -> (h  s:@j) -> v (h  s:@j  a)   ::  s a -> (h  s:@j) -> v (h  s:@j  a)     :: 6 m => b s a -> (h  s:@ j) -> m (h  s:@j  a) Step down into the  entry of an . Note:` The index is assumed to be ordered and must increase monotonically or else you cannot (safely)  or  or use tapes.     ::  i s a -> (h  s:@j) -> v (h  s:@j  a:@i)   ::  i s a -> (h  s:@j) -> v (h  s:@j  a:@i)     :: 6 m => b s a -> (h  s:@ j) -> m (h  s:@j  a)  Step down into every entry of a  simultaneously. zipper ("hello","world") & withins both >>= leftward >>= withins traverse >>= rightward <&> focus %~ toUpper <&> rezip :: [(String,String)]I[("hEllo","world"),("heLlo","world"),("helLo","world"),("hellO","world")]    ::  s a -> (h  s:@ j) -> [h  s:@j  a]   ::  s a -> (h  s:@ j) -> [h  s:@j  a]   ::  s a -> (h  s:@ j) -> [h  s:@j  a] !Step down into every entry of an  simultaneously. Note:` The index is assumed to be ordered and must increase monotonically or else you cannot (safely)  or  or use tapes.    ::  i s a -> (h  s:@ j) -> [h  s:@j  a:@i]   ::  i s a -> (h  s:@ j) -> [h  s:@j  a:@i] Unsafely step down into a  that is assumed to be non-empty. HIf this invariant is not met then this will usually result in an error!     ::  s a -> (h  s:@j) -> h  s:@j  a   ::  s a -> (h  s:@j) -> h  s:@j  a   ::  s a -> (h  s:@j) -> h  s:@j  a =You can reason about this function as if the definition was:    l "a    l Unsafey step down into an  that is assumed to be non-empty HIf this invariant is not met then this will usually result in an error!     ::  i s a -> (h  s:@j) -> h  s:@j  a:@i   ::  i s a -> (h  s:@j) -> h  s:@j  a:@i =You can reason about this function as if the definition was:    l "a    l -Close something back up that you opened as a . Extract the current  from a  as a F$, with access to the current index. Save the current path as as a  we can play back later. ?Restore ourselves to a previously recorded position precisely. +If the position does not exist, then fail. GRestore ourselves to a location near our previously recorded position. $When moving left to right through a , if this will clamp at each  level to the range 0  k  ", so the only failures will occur B when one of the sequence of downward traversals find no targets. 5Restore ourselves to a previously recorded position. rThis *assumes* that nothing has been done in the meantime to affect the existence of anything on the entire path. Motions  or 1 are clamped, but all traversals included on the  are assumed to be non-empty. ,Violate these assumptions at your own risk! 5This is used to peel off the path information from a 8 for use when saving the current path for later replay. ?Restore ourselves to a previously recorded position precisely. +If the position does not exist, then fail. GRestore ourselves to a location near our previously recorded position.  When moving  to  through a 0, if this will clamp at each level to the range 0  k  , b so the only failures will occur when one of the sequence of downward traversals find no targets. 5Restore ourselves to a previously recorded position. lThis *assumes* that nothing has been done in the meantime to affect the existence of anything on the entire . Motions  or 1 are clamped, but all traversals included on the  are assumed to be non-empty. ,Violate these assumptions at your own risk! This is an illegal . This is an illegal . \OOM non-portable experimentalEdward Kmett <ekmett@gmail.com> Safe-Inferred''# Rank2Types provisionalEdward Kmett <ekmett@gmail.com> Trustworthy -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")0This 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'     k ~(a,b) = (\b' -> (a,b'))  k b     k ~(a,b) = (\a' -> (a',b))  k a ?               6     $ non-portable experimentalEdward Kmett <ekmett@gmail.com> TrustworthyDThis class provides a way to attach or detach elements on the right + side of a structure in a flexible manner. Most of the time this is a .     ::  [a] [b] ([a], a) ([b], b)   ::  (} a) (} b) (} a, a) (} b, b)   ::  ( a) ( b) ( a, a) ( b, b)   ::   (, )   ::   (, )   ::   (, ) However, by including p and f7 in the class you can write instances that only permit (  or which only permit ' or where $ and % are lenses and not traversals. CThis class provides a way to attach or detach elements on the left + side of a structure in a flexible manner. Most of the time this is a .     ::  [a] [b] (a, [a]) (b, [b])   ::  (} a) (} b) (a, } a) (b, } b)   ::  ( a) ( b) (a,  a) (b,  b)   ::   (, )   ::   (, )   ::   (, ) However, by including p and f7 in the class you can write instances that only permit !  or which only permit   , or where " and # are lenses and not traversals.   an element onto a container. This is an infix alias for  .    an element onto a container. !pAttempt to extract the left-most element from a container, and a version of the container without that element. "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 }: #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  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""This isn'.t limited to lists. For instance you can also  the tail of a }. 2Seq.fromList [a,b] & _tail .~ Seq.fromList [c,d,e]fromList [a,c,d,e]Seq.fromList [a,b,c] ^? _tailJust (fromList [b,c])Seq.fromList [] ^? _tailNothing   # ::  [a] [a]  # ::  (} a) (} a)  # ::  ( a) ( a) $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 . 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 ^? _lastNothing&Vector.fromList "abcde" & _last .~ 'Q'fromList "abcdQ"   % ::  [a] a  % ::  (} a) a  % ::  ( a) a &') an element onto the end of a container. This is an infix alias for '. '') an element onto the end of a container. (qAttempt to extract the right-most element from a container, and a version of the container without that element. " !"#$%&'( !"#$%&'( !"#&'($%  !"#$%&'(% non-portable experimentalEdward Kmett <ekmett@gmail.com> Trustworthy)A Banker's deque based on Chris Okasaki's "!Purely Functional Data Structures" +O(1). Determine of a ) is .  null emptyTruenull (singleton 1)False,O(1). Generate a singleton )  singleton 1 BD 1 [1] 0 []-O(1). Calculate the size of a ) size (fromList [1,4,6])3.O(n) amortized. Construct a ) from a list of values. fromList [1,2]BD 1 [1] 1 [2] Check that a )8 satisfies the balance invariants and rebalance if not. )*+,-.     )*+,-.)*-.+,)*+,-.     & non-portable experimentalEdward Kmett <ekmett@gmail.com>None/Extract 03 element of a (potentially monomorphic) container. 3Notably, when applied to a tuple, this generalizes |" to arbitrary homogeneous tuples. (1,2,3) & each *~ 10 (10,20,30)3It can also be used on monomorphic containers like  or . -over each Char.toUpper ("hello"^.Text.packed)"HELLO"0 is an 7, so it can be used to access keys in many containers: 7itoListOf each $ Map.fromList [("hello",2),("world",4)][("hello",2),("world",4)]-("hello","world") & each.each %~ Char.toUpper("HELLO","WORLD")1This is a common 1 type shared by /, ), ) and ).  0 ::  i (i -> a) (i -> b) a b 0 :: ( i,   a,   b) =>  i ( i a) ( i b) a b 0 ::  i =>  i ( i a) ( i b) a b 0 ::       0 ::       0 ::   ! !  " 0 ::      # 0 :: ($ a, $ b) =>   (% a) (% b) a b& 0 :: (' a, ' b) =>   (( a) (( b) a b) 0 :: (* a, * b) =>   (+ a) (+ b) a b, 0 ::   ( a) ( b) a b- 0 ::  [] (. a) (. b) a b/ 0 ::   (} a) (} b) a b0 0 ::  () (v a) (v b) a b1 0 ::  () ( a) ( b) a b2 0 ::   [a] [b] a b3 0 ::  c (4 c a) (4 c b) a b5 0 ::  c (6 c a) (6 c b) a b7 0 ::  c (6 c a) (6 c b) a b8 0 :: (9 a, 9 b) =>   (: a) (: b) a b; 0 ::  , (a,a,a,a,a,a,a,a,a) (b,b,b,b,b,b,b,b,b) a b< 0 ::  ( (a,a,a,a,a,a,a,a) (b,b,b,b,b,b,b,b) a b= 0 ::  $ (a,a,a,a,a,a,a) (b,b,b,b,b,b,b) a b> 0 ::   (a,a,a,a,a,a) (b,b,b,b,b,b) a b? 0 ::   (a,a,a,a,a) (b,b,b,b,b) a b@ 0 ::   (a,a,a,a) (b,b,b,b) a bA 0 ::   (a,a,a) (b,b,b) a bB 0 ::   (a,a) (b,b) a b/01 "#&),-/0123578;<=>?@AB/011/0/01 "#&),-/0123578;<=>?@AB' Rank2Types experimentalEdward Kmett <ekmett@gmail.com> Trustworthy 2LA generic applicative transformation that maps over the immediate subterms. 2 is to  what C is to D This really belongs in  Data.Data. 3Nave  using E3. This does not attempt to optimize the traversal. ZThis is primarily useful when the children are immediately obvious, and for benchmarking. 4&Find every occurrence of a given type a recursively that doesn' t require # passing through something of type a using E, while avoiding traversal . of areas that cannot contain a value of type a. This is 5 with a more liberal signature. 5Find descendants of type aU non-transitively, while avoiding computation of areas that cannot contain values of  type a using E. 5$ is a useful default definition for (  66 performs like 4, except when s ~ a&, it returns itself and nothing else. 7 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! nFirst, the user supplied function must access only one field of the specified type. That is to say the target 3 must be a single element that would be visited by  holesOnOf 4 5 CNote: 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 tailNothing7Accessing 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 E 7 :: (E s, E a) => (s -> a) ->  [Int] s a8The design of : doesn'.t allow it to search inside of values of type a for other values of type a.  8% provides this additional recursion. Like :, 8- trusts the user supplied function more than 7 using it directly : as the accessor. This enables reading from the resulting * to be considerably faster at the risk of  generating an illegal lens. (upon' (tail.tail) .~ [10,20] $ [1,2,3,4] [1,2,10,20]9 This automatically constructs a  from a field accessor. The index of the  can be used as an offset into  (? 4) or into the list  returned by y 4. The design of 9 doesn'.t allow it to search inside of values of type a for other values of type a.  7H 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 7 instead. :This more trusting version of 71 uses your function directly as the getter for a . This means that reading from 8 is considerably faster than 7. 0However, you pay for faster access in two ways:  ( When passed an illegal field accessor, 8 will give you a  that quietly violates  the laws, unlike 7, which will give you a legal # that avoids modifying the target. m Modifying with the lens is slightly slower, since it has to go back and calculate the index after the fact. 4When given a legal field accessor, the index of the  can be used as an offset into   (; 4) or into the list returned by y 4. When in doubt, use 8 instead. F inlineable G .HIJKLMNOPQRSTUVWX23Y456Z789:[\]^_F`abcdefghijk 23456789: 4356789:2$HIJKLONMPQRSTUVWX23Y456Z789:[\]^_F`abcdefghijk( Rank2Types provisionalEdward Kmett <ekmett@gmail.com> Trustworthy";A ;O type is one where we know how to extract its immediate self-similar children.  Example 1:    import Control.Applicative  import Control.Lens  import Control.Lens.Plated  import Data.Data  import Data.Data.Lens (5)    data Expr  = Val   | Neg Expr  | Add Expr Expr  deriving (#, ,l,m,E,n)    instance ; Expr where  < f (Neg e) = Neg O f e  < f (Add a b) = Add O f a  f b  < _ a =  a or    instance ; Expr where  < = 5  Example 2:    import Control.Applicative  import Control.Lens  import Control.Lens.Plated  import Data.Data  import Data.Data.Lens (5)    data Tree a  = Bin (Tree a) (Tree a)  | Tip a  deriving (#, ,l,m,E,n)    instance ; (Tree a) where  < f (Bin l r) = Bin O f l  f r  < _ t =  t or    instance E a => ; (Tree a) where  < = 5 <Note the big distinction between these two implementations. JThe former will only treat children directly in this tree as descendents, I 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 6  use the ...OnOf variant with /, though those usecases are much better served % in most cases by using the existing  combinators! e.g.     6 "a I 6  )This same ability to explicitly pass the  in question is why there is no  analogue to uniplate's Biplate. UMoreover, 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. If you'.re using GHC 7.2 or newer and your type has a E instance,  < will default to 5$ and you can choose to not override  it with your own definition. ='Extract the immediate descendants of a ; container.   = "a  < >LRewrite by applying a rule everywhere you can. Ensures that the rule cannot $ be applied anywhere in the result:    propRewrite r x = f (    r) (F (> r x)) Usually J is more appropriate, but > can give better 4 compositionality. Given two single transformations f and g , you can  construct a -> f a mplus g a3 which performs both rewrites until a fixed point. ?LRewrite by applying a rule everywhere you can. Ensures that the rule cannot $ be applied anywhere in the result:    propRewriteOf l r x = f (    r) (G l (? l r x)) Usually L is more appropriate, but ? can give better 4 compositionality. Given two single transformations f and g , you can  construct a -> f a mplus g a3 which performs both rewrites until a fixed point.   ? ::  a a -> (a -> v a) -> a -> a  ? ::  a a -> (a -> v a) -> a -> a  ? ::  a a -> (a -> v a) -> a -> a  ? ::  a a -> (a -> v a) -> a -> a @5Rewrite recursively over part of a larger structure.   @ :: ; a =>  s a -> (a -> v a) -> s -> s  @ :: ; a =>  s a -> (a -> v a) -> s -> s  @ :: ; a =>  s a -> (a -> v a) -> s -> s  @ :: ; a =>  s a -> (a -> v a) -> s -> s AFRewrite recursively over part of a larger structure using a specified .   A :: ; a =>  s a ->  a a -> (a -> v a) -> s -> s  A :: ; a =>  s a ->  a a -> (a -> v a) -> s -> s  A :: ; a =>  s a ->  a a -> (a -> v a) -> s -> s  A :: ; a =>  s a ->  a a -> (a -> v a) -> s -> s BTRewrite by applying a monadic rule everywhere you can. Ensures that the rule cannot $ be applied anywhere in the result. CRRewrite by applying a monadic rule everywhere you recursing with a user-specified . A Ensures that the rule cannot be applied anywhere in the result. D`Rewrite by applying a monadic rule everywhere inside of a structure located by a user-specified . A Ensures that the rule cannot be applied anywhere in the result. E`Rewrite by applying a monadic rule everywhere inside of a structure located by a user-specified ,  using a user-specified P for recursion. Ensures that the rule cannot be applied anywhere in the result. F0Retrieve all of the transitive descendants of a ; container, including itself. GGiven a v that knows how to locate immediate children, retrieve all of the transitive descendants of a node, including itself.   G ::  a a -> a -> [a] HGiven a  that knows how to find ;O parts of a container retrieve them and all of their descendants, recursively. IGiven a ~ that knows how to locate immediate children, retrieve all of the transitive descendants of a node, including itself that lie " in a region indicated by another .    l "a I l  J<Transform every element in the tree, in a bottom-up manner. 8For example, replacing negative literals with literals:   negLits = J $ \x -> case x of  Neg (Lit i) -> Lit (o i)  _ -> x KWTransform every element in the tree in a bottom-up manner over a region indicated by a .   K :: ; a =>  s a -> (a -> a) -> s -> s  K :: ; a =>  s a -> (a -> a) -> s -> s L8Transform every element by recursively applying a given  in a bottom-up manner.   L ::  a a -> (a -> a) -> a -> a  L ::  a a -> (a -> a) -> a -> a M3Transform every element in a region indicated by a ! by recursively applying another   in a bottom-up manner.   M ::  s a ->  a a -> (a -> a) -> s -> s  M ::  s a ->  a a -> (a -> a) -> s -> s NITransform every element in the tree, in a bottom-up manner, monadically. OHTransform every element in the tree in a region indicated by a supplied &, in a bottom-up manner, monadically.   O :: (k m, ; a) =>  s a -> (a -> m a) -> s -> m s P8Transform every element in a tree using a user supplied . in a bottom-up manner with a monadic effect.   P :: k m =>  a a -> (a -> m a) -> a -> m a QPTransform 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.   Q :: k m =>  s a ->  a a -> (a -> m a) -> s -> m s R`Return a list of all of the editable contexts for every location in the structure, recursively.    propUniverse x = F x e L  (R x)  propId x = f (e x) [   w | w <- R x]    R "a S < SwReturn 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 = G l x e L  (S l x)  propId l x = f (e x) [   w | w <- S l x]    S ::  a a -> a -> [J a a a] T{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 <.    T b "a U b <    T :: ; a =>  s a -> s -> [J a a s] U{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.   U ::  s a ->  a a -> s -> [J a a s] VThe one-level version of UG. 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 e L  (V l x)  propId x = f (e x) [   w | w <- V l x]    V = y < W An alias for y7, provided for consistency with the other combinators.    W "a y    W ::  s a -> s -> [F (->) a a s]  W ::  s a -> s -> [F (->) a a s]  W ::  s a -> s -> [F (->) a a s]  W ::  i s a -> s -> [F (   i) a a s]  W ::  i s a -> s -> [F (   i) a a s] XExtract one level of V/ from a container in a region specified by one , using another.    X b l "a y (b  l)    X ::  s a ->  a a -> s -> [F (->) a a s]  X ::  s a ->  a a -> s -> [F (->) a a s]  X ::  s a ->  a a -> s -> [F (->) a a s]  X ::  s a ->  i a a -> s -> [F (   i) a a s]  X ::  s a ->  i a a -> s -> [F (   i) a a s] YKPerform a fold-like computation on each value, technically a paramorphism.   Y ::  a a -> (a -> [r] -> r) -> a -> r ZKPerform a fold-like computation on each value, technically a paramorphism.   Z "a Y < [!Fold the immediate children of a ; container.   [ z c f =  < (c  f) z \ The original uniplate% combinator, implemented in terms of ; as a .    \ "a q < The resulting  is safer to use as it ignores 'over-application'. and deals gracefully with under-application,  but it is only a proper  if you don't change the list ;! *;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\pqrstuvw";<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\";<=>?@ABCDEFGHIJLKMNPOQRSTUVWXZY[\);<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\pqrstuvw) non-portable experimentalEdward Kmett <ekmett@gmail.com> Trustworthy]] provides a  that can be used to read, 6 write or delete the value associated with a key in a 6-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: 65-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 60 or element at an ordinal position in a list or }. ` This simple  lets you  the value at a given  key in a 60 or element at an ordinal position in a list or }. NB: Setting the value of this  will only set the value in the   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 2NothingaLThis provides a common notion of a value at an index that is shared by both _ and ]. bThis class provides a simple  (or ") that lets you view (and modify) ? information about whether or not a container contains a given 1. c'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]dDeprecated aliases for `. eDeprecated aliases for `. fA definition of c for types with an  instance. gA definition of ` for types with an ] instance. This is the default  if you don't specify a definition for c and you are on GHC >= 7.0.2 h Construct a c check based on some notion of ; for the container. i Construct a c' check for a fixed number of elements. j Construct a c$ check that uses an arbitrary test. k Construct a c check that uses an arbitrary x function. lA definition of ` for types with an ] instance. This is the default  if you don't specify a definition for `. mA definition of ` for types with an / instance. y   arr z i "a arr w ` i  arr { [(i,e)] "a ` i  e  arr |   arr z i "a arr w ` i  arr { [(i,e)] "a ` i  e  arr N]^_`abcdefghijklmn}~y|]^_`abcdefghijklmn]^na_`lmbcfghijkdeK]^_`abcdefghijklmn}~y|*TemplateHaskell experimentalEdward Kmett <ekmett@gmail.com> Trustworthy o Provides substitution for types pPerform substitution for types qHProvides for the extraction of free type variables, and alpha renaming. r4When performing substitution into this traversal you're not allowed 8 to substitute in a name that is bound internally or you' ll violate  the . laws, when in doubt generate your names with . sHas a  tExtract (or modify) the  of something u Traverse free type variables v'Substitute using a map of names in for free type variables w Provides a . of the types of each field of a constructor. x of the types of the named fields of a constructor. opqrstuvwx opqrstuvwx stqropuvwxopqrstuvwx+ non-portable experimentalEdward Kmett <ekmett@gmail.com> Trustworthy%{+This configuration describes the options we'll be using to make  isomorphisms or lenses. } Flags for  construction Only Generate valid  lenses. HEnables the generation of partial lenses, generating runtime errors for A every constructor that does not have a valid definition for the . This L occurs when the constructor lacks the field, or has multiple fields mapped  to the same . In the situations that a  would be partial, when  is L used, this flag instead causes traversals to be generated. Only one can be C used, and if neither are, then compile-time errors are generated. )Handle singleton constructors specially. When building a singleton  (or ") for a record constructor, build  both the  (or ,) for the record and the one for the field. Use  for singleton constructors. @Expect a single constructor, single field newtype or data type. 'Create the class if the constructor is  and the  rule matches. *Create the instance if the constructor is  and the  rule matches.  Die if the  fails to match. CIndicate whether or not to supply the signatures for the generated  lenses. KDisabling this can be useful if you want to provide a more restricted type ; signature or if you want to supply hand-written haddocks. C to access the convention for naming top level isomorphisms in our  {. =Defaults to lowercasing the first letter of the constructor. 3 to access the convention for naming fields in our {. MDefaults to stripping the _ off of the field name, lowercasing the name, and  rejecting the field if it doesn't start with an '_'. JRetrieve options such as the name of the class and method to put in it to . build a class around monomorphic data types. JRetrieve options such as the name of the class and method to put in it to . build a class around monomorphic data types. Default {. JRules for making fairly simple partial lenses, ignoring the special cases > for isomorphisms and traversals, and not making any classes. ?Rules for making lenses and traversals that precompose another . 2Rules for making an isomorphism from a data type. EBuild lenses (and traversals) with a sensible default configuration.    =   CMake lenses and traversals for a type, and create a class when the  type has no arguments. e.g.   " data Foo = Foo { _fooX, _fooY ::  }   ''Foo  will create    class HasFoo t where  foo ::   t Foo ! instance HasFoo Foo where foo =   fooX, fooY :: HasFoo t =>   t      =   'Make a top level isomorphism injecting into the type. IThe supplied name is required to be for a type with a single constructor  that has a single argument. e.g.    newtype List a = List [a]   ''List  will create    list ::  [a] [b] (List a) (List b)     =   ;Derive lenses and traversals, specifying explicit pairings  of (fieldName, lensName). KIf 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.  Generate a & for each constructor of a data type.  Transform NewtypeDs declarations to DataDs. KGiven a set of names, build a map from those names to a set of fresh names  based on them. Gets 2[(lens name, (constructor name, field name, type))] from a record constructor. Build  instance for a given newtype #Field rules for fields in the form  _prefix_fieldname  #Field rules for fields in the form  prefixFieldname  Make fields with the specified y.   makeFields =    defaultFieldRules = ]yz{|}~0surrounding cxt driven by the data type context data/newtype constructor name args 0yz{|}~0{|yz}~Byz{|} ~, non-portable experimentalEdward Kmett <ekmett@gmail.com>NoneUsed to evaluate an . Used to evaluate an .  Perform an .    "a . ()  Perform an  and modify the result.    :: k m => % m e s t a b -> (a -> e) -> s -> m e  Perform an . &["hello","world"]^!folded.act putStrLnhelloworld Perform a + and collect all of the results in a list. ["ab","cd","ef"]^!!folded.acts1["ace","acf","ade","adf","bce","bcf","bde","bdf"] Perform a " and collect the leftmost result. Note:1 this still causes all effects for all elements. &[Just 1, Just 2, Just 3]^!?folded.acts Just (Just 1)[Just 1, Nothing]^!?folded.actsNothing Construct an  from a monadic side-effect. 2["hello","world"]^!folded.act (\x -> [x,x ++ "!"])9["helloworld","helloworld!","hello!world","hello!world!"]    :: k m => (s -> m a) ->  m s a   sma afb a =  (sma a    afb) A self-running , analogous to .     "a   (1,"hello")^!_2.acts.to succ"ifmmp"Apply a k transformer to an .  Perform an .    "a . ()  Perform an  and modify the result.  Perform an . *Obtain a list of all of the results of an .  Perform an  and collect the y result. Note:1 this still causes all effects for all elements.  Construct an  from a monadic side-effect.  non-portable experimentalEdward Kmett <ekmett@gmail.com>Noneh     w !"#$%&'()*+,-./0123456789:;=>?@ABCDEF&hw;%1=@EF&$0>ABC596:?D78'() * +  , !-". #/342&- non-portable experimentalEdward Kmett <ekmett@gmail.com> Trustworthy$This permits the construction of an " impossible" * that matches only if some function does.  There was an & caused by abusing the internals of a . Both MonadCatchIO-transformers and Control.Exception provide a  type. WThis 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 K (or any  , really).     ... [  F (s ->   "Assertion Failed\n"  s)  ,  F (s ->   "Error\n"  s)  ] This works ith both the  type provided by Control.Exception:     ::   a -> (a ->  r) ->  r   ::   a -> (a ->  r) ->  r   ::   a -> (a ->  r) ->  r   ::   a -> (a ->  r) ->  r   ::   a -> (a ->  r) ->  r  and with the  type provided by Control.Monad.CatchIO:     ::   a -> (a -> m r) ->  m r   ::   a -> (a -> m r) ->  m r   ::   a -> (a -> m r) ->  m r   ::   a -> (a -> m r) ->  m r   ::   a -> (a -> m r) ->  m r  and with the / type provided by Control.Monad.Error.Lens:    ::  e a -> (a -> m r) -> / e m r   ::  e a -> (a -> m r) -> / e m r   ::  e a -> (a -> m r) -> / e m r   ::  e a -> (a -> m r) -> / e m r   ::  e a -> (a -> m r) -> / e m r This builds a ! for just the targets of a given K (or any  , really). J that ignores its input and just recovers with the stated monadic action.     ... [  F ( "looped")  ,  F ( "overflow")  ] This works with the  type provided by Control.Exception:     ::   a ->  r ->  r   ::   a ->  r ->  r   ::   a ->  r ->  r   ::   a ->  r ->  r   ::   a ->  r ->  r  and with the  type provided by Control.Monad.CatchIO:     ::   a -> m r ->  m r   ::   a -> m r ->  m r   ::   a -> m r ->  m r   ::   a -> m r ->  m r   ::   a -> m r ->  m r  and with the / type provided by Control.Monad.Error.Lens:    ::  e a -> m r -> / e m r   ::  e a -> m r -> / e m r   ::  e a -> m r -> / e m r   ::  e a -> m r -> / e m r   ::  e a -> m r -> / e m r TThis supplies a globally unique set of IDs so we can hack around the default use of  in  L if someone, somehow, somewhere decides to reach in and catch and rethrow a Handling  by existentially  opening a  that uses it.   Rank2Types experimentalEdward Kmett <ekmett@gmail.com> Safe-Inferred  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ non-portable experimentalEdward Kmett <ekmett@gmail.com>None ")*+,-./789:;<=>?@IJK`abcmuy      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'(/01;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnyz{|}~. non-portable experimentalEdward Kmett <ekmett@gmail.com>NoneTraverse a strict ) from left to right in a biased fashion. Traverse a strict ( from left to right in a biased fashion & pretending the bytes are characters. Traverse a strict J in a relatively balanced fashion, as a balanced tree with biased runs of  elements at the leaves. Traverse a strict J in a relatively balanced fashion, as a balanced tree with biased runs of 9 elements at the leaves, pretending the bytes are chars. Unpack a lazy  Bytestring An # of the individual bytes in a lazy  Unpack a lazy ! pretending the bytes are chars. An # of the individual bytes in a lazy ! pretending the bytes are chars.  Conversion between  and . Should compile to a no-op.  Unsafe conversion between  and . 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.  8A way of creating ByteStrings outside the IO monad. The Int 9 argument gives the final size of the ByteString. Unlike   createAndTrim5 the ByteString is not reallocated if the final size " is less than the estimated size.  Create ByteString of size l and use action f to fill it' s contents.            /Control.Monad.Error provisionalEdward Kmett <ekmett@gmail.com>None You need this when using . $Catch exceptions that match a given  (or any  , really).    ::  e m => % e a -> m r -> (a -> m r) -> m r   ::  e m => & e a -> m r -> (a -> m r) -> m r   ::  e m => ! e a -> m r -> (a -> m r) -> m r   ::  e m => ' e a -> m r -> (a -> m r) -> m r   ::  e m => % e a -> m r -> (a -> m r) -> m r   ::  e m => ' e a -> m r -> (a -> m r) -> m r $Catch exceptions that match a given  (or any ), discarding K the information about the match. This is particuarly useful when you have  a  e () where the result of the  or  isn't 7 particularly valuable, just the fact that it matches.    ::  e m =>  e a -> m r -> m r -> m r   ::  e m =>  e a -> m r -> m r -> m r   ::  e m =>  e a -> m r -> m r -> m r   ::  e m =>  e a -> m r -> m r -> m r   ::  e m =>  e a -> m r -> m r -> m r   ::  e m =>  e a -> m r -> m r -> m r  A version of . with the arguments swapped around; useful in 7 situations where the code for the handler is shorter.    ::  e m => % e a -> (a -> m r) -> m r -> m r   ::  e m => & e a -> (a -> m r) -> m r -> m r   ::  e m => ! e a -> (a -> m r) -> m r -> m r   ::  e m => ' e a -> (a -> m r) -> m r -> m r   ::  e m => ' e a -> (a -> m r) -> m r -> m r   ::  e m => % e a -> (a -> m r) -> m r -> m r  A version of . with the arguments swapped around; useful in 7 situations where the code for the handler is shorter.    ::  e m =>  e a -> m r -> m r -> m r   ::  e m =>  e a -> m r -> m r -> m r   ::  e m =>  e a -> m r -> m r -> m r   ::  e m =>  e a -> m r -> m r -> m r   ::  e m =>  e a -> m r -> m r -> m r   ::  e m =>  e a -> m r -> m r -> m r  takes a  (or any )) to select which exceptions are caught  If the  Exception0 does not match the predicate, it is re-thrown.    ::  e m =>  e a -> m r -> m (u a r)   ::  e m =>  e a -> m r -> m (u a r)   ::  e m =>  e a -> m r -> m (u a r)   ::  e m =>  e a -> m r -> m (u a r)   ::  e m =>  e a -> m r -> m (u a r)   ::  e m =>  e a -> m r -> m (u 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 1, which we duplicate here in a form suitable for  working with any  instance. DSometimes you want to catch two different sorts of error. You could  do something like    f =  _Foo handleFoo ( _Bar handleBar expr) IHowever, there are a couple of problems with this approach. The first is F that having two exception handlers is inefficient. However, the more J 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  ]  Throw an  Exception described by a .   l "a  l     ::  e m =>  e t -> t -> a   ::  e m =>  e t -> t -> a 7Helper function to provide conditional catch behavior.   0portable provisionalEdward Kmett <ekmett@gmail.com> TrustworthyEvaluate the targets of a  or  into a data structure  according to the given .     =   =    =      ::  s a ->  a ->  s   ::  s a ->  a ->  s   :: (a ->  a) -> s ->  s) ->  a ->  s Evaluate the targets of a  or  according into a % data structure according to a given  in parallel.   =      ::  s a ->  a ->  s   ::  s a ->  a ->  s   :: ((a ->  a) -> s ->  s) ->  a ->  s  Transform a , , ,  or  to 3 first evaluates its argument according to a given  before proceeding.      ::  t =>  a ->  [a]  Transform a , , ,  or  to , evaluate its argument according to a given  in parallel with evaluating.      ::  t =>  a ->  [a] 1portable provisionalEdward Kmett <ekmett@gmail.com>None$Evaluate the elements targeted by a , , ,   or " according to the given strategy.  =  2&MPTCs, Rank2Types, LiberalTypeSynonyms provisionalEdward Kmett <ekmett@gmail.com>NoneThis setter can be used to derive a new  from an old IAarray by E applying a function to each of the indices to look it up in the old .  This is a  contravariant .    "a      "a      ( b) f arr  i "a arr  f i   ( ( b) f arr) "a b 3LiberalTypeSynonyms experimentalEdward Kmett <ekmett@gmail.com>None Bitwise   the target(s) of a  or . _2 .|.~ 6 $ ("hello",3) ("hello",7)   () :: ! a =>  s t a a -> a -> s -> t  () :: ! a =>  s t a a -> a -> s -> t  () :: ! a =>  s t a a -> a -> s -> t  () :: ( a, ! a) =>  s t a a -> a -> s -> t Bitwise " the target(s) of a  or . _2 .&.~ 7 $ ("hello",254) ("hello",6)   () :: ! a =>  s t a a -> a -> s -> t  () :: ! a =>  s t a a -> a -> s -> t  () :: ! a =>  s t a a -> a -> s -> t  () :: ( a, ! a) =>  s t a a -> a -> s -> t Modify the target(s) of a ,  or  by computing its bitwise " with another value. *execState (do _1 .&.= 15; _2 .&.= 3) (7,7)(7,3)   () :: ( s m, ! a) =>  s a -> a -> m ()  () :: ( s m, ! a) =>  s a -> a -> m ()  () :: ( s m, ! a) =>  s a -> a -> m ()  () :: ( s m, ! a) =>  s a -> a -> m () Modify the target(s) of a ,  or  by computing its bitwise   with another value. *execState (do _1 .|.= 15; _2 .|.= 3) (7,7)(15,7)   () :: ( s m, ! a) =>  s a -> a -> m ()  () :: ( s m, ! a) =>  s a -> a -> m ()  () :: ( s m, ! a) =>  s a -> a -> m ()  () :: ( s m, ! a) =>  s a -> a -> m () Bitwise   the target(s) of a  (or ), returning the result 0 (or a monoidal summary of all of the results). _2 <.|.~ 6 $ ("hello",3)(7,("hello",7))   () :: ! a => # s t a a -> a -> s -> (a, t)  () :: ! a => " s t a a -> a -> s -> (a, t)  () :: (! a,  a) =>  s t a a -> a -> s -> (a, t) Bitwise " the target(s) of a  or , returning the result 0 (or a monoidal summary of all of the results). _2 <.&.~ 7 $ ("hello",254)(6,("hello",6))   () :: ! a => # s t a a -> a -> s -> (a, t)  () :: ! a => " s t a a -> a -> s -> (a, t)  () :: (! a,  a) =>  s t a a -> a -> s -> (a, t) Modify the target(s) of a  (or ) by computing its bitwise " with another value, O returning the result (or a monoidal summary of all of the results traversed). runState (_1 <.&.= 15) (31,0) (15,(15,0))   () :: ( s m, ! a) =>  s a -> a -> m a  () :: ( s m, ! a,  a) =>  s a -> a -> m a Modify the target(s) of a , (or ) by computing its bitwise   with another value, O returning the result (or a monoidal summary of all of the results traversed). runState (_1 <.|.= 7) (28,0) (31,(31,0))   () :: ( s m, ! a) =>  s a -> a -> m a  () :: ( s m, ! a,  a) =>  s a -> a -> m a This = can be used to access the value of the nth bit in a number.  n is only a legal  into b if 0  n  # ($ :: b).  16^.bitAt 4True 15^.bitAt 4False15 & bitAt 4 .~ True3116 & bitAt 4 .~ False0-Get the nth byte, counting from the low end.  n is a legal  into b iff 0  n  % (# ($ :: b)) 8 (0xff00 :: Word16)^.byteAt 00(0xff00 :: Word16)^.byteAt 1255 byteAt 1 .~ 0 $ 0xff00 :: Word160byteAt 0 .~ 0xff $ 0 :: Word16255*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 4 can be productively consumed, but not reassembled.    4 non-portable experimentalEdward Kmett <ekmett@gmail.com>None (or ) a list of bytes into a      "a [    x "a x w    x "a x w [  "[104,101,108,108,111]^.packedBytes"hello" (or ) a  into a list of bytes     "a [    x "a x w    x "a x w [  ""hello"^.packedChars.unpackedBytes[104,101,108,108,111]Traverse each  in a . This  walks the  in a tree-like fashion J enable zippers to seek to locations in logarithmic time and accelerating G many monoidal queries, but up to associativity (and constant factors) & it is equivalent to the much slower:     "a    *anyOf bytes (== 0x80) (Char8.pack "hello")False (or ) a list of characters into a  When writing back to the  it is assumed that every   lies between '\x00' and '\xff'.     "a [    x "a x w    x "a x w [  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  When writing back to the  it is assumed that every   lies between '\x00' and '\xff'.     "a [    x "a x w    x "a x w [  0[104,101,108,108,111]^.packedBytes.unpackedChars"hello"#Traverse the individual bytes in a  as characters. When writing back to the  it is assumed that every   lies between '\x00' and '\xff'. This  walks the  in a tree-like fashion J enable zippers to seek to locations in logarithmic time and accelerating G many monoidal queries, but up to associativity (and constant factors) & it is equivalent to the much slower:     =    anyOf chars (== 'h') "hello"True5 non-portable experimentalEdward Kmett <ekmett@gmail.com>None  (or  ) a list of bytes into a .     "a [    x "a x w    x "a x w [  8[104,101,108,108,111]^.packedBytes == Char8.pack "hello"True  (or  ) a  into a list of bytes     "a [    x "a x w    x "a x w [  ""hello"^.packedChars.unpackedBytes[104,101,108,108,111]#Traverse the individual bytes in a . This  walks each strict  chunk in a tree-like fashion A enable zippers to seek to locations more quickly and accelerate M many monoidal queries, but up to associativity (and constant factors) it is  equivalent to the much slower:     "a    *anyOf bytes (== 0x80) (Char8.pack "hello")False! (or !) a list of characters into a . When writing back to the  it is assumed that every   lies between '\x00' and '\xff'.     "a [    x "a x w    x "a x w [  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  When writing back to the  it is assumed that every   lies between '\x00' and '\xff'.     "a [    x "a x w    x "a x w [  0[104,101,108,108,111]^.packedBytes.unpackedChars"hello"#Traverse the individual bytes in a  as characters. When writing back to the  it is assumed that every   lies between '\x00' and '\xff'. This  walks each strict  chunk in a tree-like fashion A enable zippers to seek to locations more quickly and accelerate M many monoidal queries, but up to associativity (and constant factors) it is  equivalent to:     =    anyOf chars (== 'h') "hello"True6 non-portable experimentalEdward Kmett <ekmett@gmail.com>NoneTraversals for ByteStrings.  (or () a list of bytes into a strict or lazy .    x "a x w    x "a x w [    "a [   (or -) a list of characters into a strict or lazy . When writing back to the  it is assumed that every   lies between '\x00' and '\xff'.    x "a x w    x "a x w [    "a [  Traverse each  in a strict or lazy  This  walks each strict  chunk in a tree-like fashion A enable zippers to seek to locations more quickly and accelerate M many monoidal queries, but up to associativity (and constant factors) it is  equivalent to the much slower:     "a         (e 0x80) ::  ->  2Traverse the individual bytes in a strict or lazy  as characters. When writing back to the  it is assumed that every   lies between '\x00' and '\xff'. This  walks each strict  chunk in a tree-like fashion A enable zippers to seek to locations more quickly and accelerate M many monoidal queries, but up to associativity (and constant factors) it is  equivalent to the much slower:     "a         (e 'c') ::  ->   (or ) a  into a list of bytes     "a [    x "a x w    x "a x w [      ::  " []   ::   " []  (or /) a list of characters into a strict (or lazy)  When writing back to the  it is assumed that every   lies between '\x00' and '\xff'.     "a [    x "a x w    x "a x w [      ::  "    ::   "   &'&'7 non-portable experimentalEdward Kmett <ekmett@gmail.com>None Access the ( of a : number. (a :+ b)^._realPartaa :+ b & _realPart *~ 2 a * 2 :+ b  ::  f => (a -> f a) -> : a -> f (: a) Access the ) of a : number. (a :+ b)^._imagPartba :+ b & _imagPart *~ 2 a :+ b * 2  ::  f => (a -> f a) -> : a -> f (: a)This isn't quite a legal . Notably the  u 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 .  Access the + of a : number.  (10.0 :+ 20.0) & _magnitude *~ 2 20.0 :+ 40.0This isn't quite a legal . Notably the  u 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.  Access the , of a : number. 4(mkPolar 10 (2-pi) & _phase +~ pi & view _phase) "H 2TrueThis isn't quite a legal . Notably the  u l ( l b a) = blaw is violated when you set a , outside the range (--, -]. 7 The phase is always in that range when queried. So don' t do that! )Otherwise, this is a perfectly cromulent .  Access the . of a : number. *(2.0 :+ 3.0) & _conjugate . _imagPart -~ 1 2.0 :+ 4.02(mkPolar 10.0 2.0 ^. _conjugate . _phase) "H (-2.0)True8portable provisionalEdward Kmett <ekmett@gmail.com>None IntSet isn't Foldable, but this ) can be used to access the members of an /. &sumOf members $ setOf folded [1,2,3,4]10This * can be used to change the contents of an / by mapping  the elements to new values. Sadly, you can't create a valid  for a Set, because the number of B elements might change but you can manipulate it by reading using  and  reindexing it via . (over setmapped (+1) (fromList [1,2,3,4])fromList [2,3,4,5] Construct an / from a , , ,  or . setOf folded [1,2,3,4]fromList [1,2,3,4]5setOf (folded._2) [("hello",1),("world",2),("!!!",3)]fromList [1,2,3]    ::  s  -> s -> /   ::  s  -> s -> /   ::  s  -> s -> /   ::  s  -> s -> /   ::  s  -> s -> / 9portable provisionalEdward Kmett <ekmett@gmail.com>NoneA / stripping a prefix from a list when used as a , or , prepending that prefix when run backwards: "preview" ^? prefixed "pre" Just "view""review" ^? prefixed "pre"Nothingprefixed "pre" # "amble" "preamble"A / stripping a suffix from a list when used as a , or , prepending that prefix when run backwards: "review" ^? suffixed "view" Just "re""review" ^? suffixed "tire"Nothingsuffixed ".o" # "hello" "hello.o"This is a deprecated alias for . This is a deprecated alias for . : Rank2Types provisionalEdward Kmett <ekmett@gmail.com>None Obtain a  by splitting another , ,  or , according to the given splitting strategy.    :: 0 a ->  s a ->  s [a]  Obtain a  by splitting another , ,  or  on the given delimiter. Equivalent to   1  2.    :: # a => [a] ->  s a ->  s [a]  Obtain a  by splitting another , ,  or  on any of the given elements. Equivalent to   1  3.    :: # a => [a] ->  s a ->  s [a]  Obtain a  by splitting another , ,  or - on elements satisfying the given predicate. Equivalent to   1  4.    :: (a -> ) ->  s a ->  s [a]  Obtain a  by splitting another , ,  or 0 into chunks terminated by the given delimiter. Equivalent to   1  2.    :: # a => [a] ->  s a ->  s [a]  Obtain a  by splitting another , ,  or 6 into chunks terminated by any of the given elements. Equivalent to   5  1  3.    :: # a => [a] ->  s a ->  s [a]   Obtain a  by splitting another , ,  or  into words9, with word boundaries indicated by the given predicate. Equivalent to   6  1  4.     :: (a -> ) ->  s a ->  s [a]   Obtain a  by splitting another , ,  or  into lines9, with line boundaries indicated by the given predicate. Equivalent to   5  1  4.     :: (a -> ) ->  s a ->  s [a]   Obtain a  by splitting another , ,  or  into length-n pieces.     ::  ->  s a ->  s [a]   Obtain a  by splitting another , ,  or % into chunks of the given lengths, .     ::  n => [n] ->  s a ->  s [a]   Obtain a  by splitting another , ,  or + into chunks of the given lengths. Unlike   , the output = will always be the same length as the first input argument.     ::  n => [n] ->  s a ->  s [a] 0Modify or retrieve the list of delimiters for a 0. )Modify or retrieve the policy for what a 0 to do with delimiters. )Modify or retrieve the policy for what a 0& should about consecutive delimiters. ,Modify or retrieve the policy for whether a 0 should drop an initial blank. ,Modify or retrieve the policy for whether a 0 should drop a final blank.     n  78               78; non-portable experimentalEdward Kmett <ekmett@gmail.com>NoneA } is isomorphic to a 9  : m "a m w Seq.fromList [a,b,c] ^. viewLa :< fromList [b,c]Seq.empty ^. viewLEmptyLEmptyL ^. from viewL fromList []"review viewL $ a :< fromList [b,c]fromList [a,b,c]A } is isomorphic to a ;  < m "a m w Seq.fromList [a,b,c] ^. viewRfromList [a,b] :> cSeq.empty ^. viewREmptyREmptyR ^. from viewR fromList []"review viewR $ fromList [a,b] :> cfromList [a,b,c]Traverse the first n elements of a } #fromList [a,b,c,d,e] ^.. slicedTo 2[a,b]&fromList [a,b,c,d,e] & slicedTo 2 %~ ffromList [f a,f b,c,d,e]'fromList [a,b,c,d,e] & slicedTo 10 .~ xfromList [x,x,x,x,x]Traverse all but the first n elements of a } %fromList [a,b,c,d,e] ^.. slicedFrom 2[c,d,e](fromList [a,b,c,d,e] & slicedFrom 2 %~ ffromList [a,b,f c,f d,f e])fromList [a,b,c,d,e] & slicedFrom 10 .~ xfromList [a,b,c,d,e](Traverse all the elements numbered from i to j of a } &fromList [a,b,c,d,e] & sliced 1 3 %~ ffromList [a,f b,f c,d,e]< non-portable experimentalEdward Kmett <ekmett@gmail.com> Trustworthy This isomorphism can be used to = (or > ) strict . "hello"^.packed -- :: Text"hello"   = x "a x w   > x "a x w [    "a [    "a Z = >  This isomorphism can be used to > (or =) lazy . "hello"^.unpacked -- :: String"hello"This M is provided for notational convenience rather than out of great need, since     "a [     = x "a x w [   > x "a x w    "a Z > = Convert between strict  and ? .   @ x "a x w   A (B x) "a x w [  -Traverse the individual characters in strict . anyOf text (=='o') "hello"True@When the type is unambiguous, you can also use the more general 0.    "a  .    "a 0 = non-portable experimentalEdward Kmett <ekmett@gmail.com> Trustworthy This isomorphism can be used to C (or D) lazy !. "hello"^.packed -- :: Text"hello"   C x "a x w   D x "a x w [    "a [   This isomorphism can be used to D (or C) lazy !. "hello"^.unpacked -- :: String"hello"   C x "a x w [   D x "a x w  This M is provided for notational convenience rather than out of great need, since    "a [  Convert between lazy ! and ? .   E x "a x w   B x "a x w [  (Traverse the individual characters in a !. anyOf text (=='c') "chello"True    =  .  @When the type is unambiguous, you can also use the more general 0.    "a 0 > non-portable experimentalEdward Kmett <ekmett@gmail.com> Trustworthy Traversals for strict or lazy  ! This isomorphism can be used to C (or D) strict or lazy .   C x "a x w !  D x "a x w [ !  ! "a [ $ "Convert between strict or lazy  and a ?.   @ x "a x w " #5Traverse the individual characters in strict or lazy .   # = $ .  $ This isomorphism can be used to D (or C) both strict or lazy .    D x "a x w $  C x "a x w [ $ This M is provided for notational convenience rather than out of great need, since   $ "a [ !  !"#$FG !"#$ !"#$ !"#$FG?MTPCs provisionalEdward Kmett <ekmett@gmail.com>None%A  that focuses on the root of a .. view root $ Node 42 []42&A 3 returning the direct descendants of the root of a . u & "a H%&%&%&%&@ Rank2Types experimentalEdward Kmett <ekmett@gmail.com> Trustworthy'A  for working with a  of a n value. (A  for working with a I of a n value. '('('('(A non-portable provisionalEdward Kmett <ekmett@gmail.com> Trustworthy) sliced i n provides a  that edits the n elements starting  at index i from a . This is only a valid ( if you do not change the length of the  resulting . ?Attempting to return a longer or shorter vector will result in  violations of the  laws. %Vector.fromList [1..10] ^. sliced 2 5fromList [3,4,5,6,7]2Vector.fromList [1..10] & sliced 2 5 . mapped .~ 0fromList [1,2,0,0,0,0,0,8,9,10]* Similar to , but returning a . toVectorOf both (8,15)fromList [8,15]+Convert a list to a  (or back) [1,2,3] ^. vectorfromList [1,2,3][1,2,3] ^. vector . from vector[1,2,3]0Vector.fromList [0,8,15] ^. from vector . vectorfromList [0,8,15], Convert a  to a version that doesn't retain any extra  memory. -This 1 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 index n length *+,-)*+,-*+,)-)*+,-B non-portable provisionalEdward Kmett <ekmett@gmail.com> Trustworthy. sliced i n provides a  that edits the n elements starting  at index i from a . This is only a valid ( if you do not change the length of the  resulting J. ?Attempting to return a longer or shorter vector will result in  violations of the  laws. %Vector.fromList [1..10] ^. sliced 2 5fromList [3,4,5,6,7]2Vector.fromList [1..10] & sliced 2 5 . mapped .~ 0fromList [1,2,0,0,0,0,0,8,9,10]/ Similar to , but returning a J. +toVectorOf both (8,15) :: Vector.Vector IntfromList [8,15]0Convert a list to a J (or back.) &[1,2,3] ^. vector :: Vector.Vector IntfromList [1,2,3]'Vector.fromList [0,8,15] ^. from vector[0,8,15]1 Convert a J to a finite K (or back.) 2 Convert a J to a finite K from right to left (or  back.) 3 Convert a J0 back and forth to an initializer that when run  produces a copy of the J. 4 Convert a J to a version that doesn't retain any extra  memory. 5This 1 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 index n length /012345./012345/40123.5./012345CGHC experimentalEdward Kmett <ekmett@gmail.com>None6Used to traverse L data by M. 7;Convert from the data type to its representation (or back) '"hello"^.generic.from generic :: String"hello"8;Convert from the data type to its representation (or back) 9A #$  that visits every occurrence  of something n anywhere in a container. BallOf tinplate (=="Hello") (1::Int,2::Double,(),"Hello",["Hello"])True:mapMOf_ tinplate putStrLn ("hello",[(2 :: Int, "world!")])helloworld! 6N789OPQRSTU67897896 6N789OPQRSTU%GHC experimentalEdward Kmett <ekmett@gmail.com>None6789D Rank2Types experimentalEdward Kmett <ekmett@gmail.com>None :(Modify the path by adding another path. #both </>~ "bin" $ ("hello","world")("hello/bin","world/bin")   (:) ::  s a V V -> V -> s -> a  (:) ::  s a V V -> V -> s -> a  (:) ::  s a V V -> V -> s -> a  (:) ::  s a V V -> V -> s -> a ;Modify the target(s) of a  , ,  or  by adding a path. -execState (both </>= "bin") ("hello","world")("hello/bin","world/bin")   (;) ::  s m =>  s V -> V -> m ()  (;) ::  s m =>  s V -> V -> m ()  (;) ::  s m =>  s V -> V -> m ()  (;) ::  s m =>  s V -> V -> m () <+Add a path 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. =+Add a path 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. >%Modify the path by adding extension. #both <.>~ "txt" $ ("hello","world")("hello.txt","world.txt")   (>) ::  s a V V ->  -> s -> a  (>) ::  s a V V ->  -> s -> a  (>) ::  s a V V ->  -> s -> a  (>) ::  s a V V ->  -> s -> a ?Modify the target(s) of a  , ,  or  by adding an extension. -execState (both <.>= "txt") ("hello","world")("hello.txt","world.txt")   (?) ::  s m =>  s V ->  -> m ()  (?) ::  s m =>  s V ->  -> m ()  (?) ::  s m =>  s V ->  -> m ()  (?) ::  s m =>  s V ->  -> 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. A1Add an extension onto the end of the target of a  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. BA ) for reading and writing to the basename (basename .~ "filename" $ "path/name.png""path/filename.png"CA * for reading and writing to the directory !"long/path/name.txt" ^. directory "long/path"DA * for reading and writing to the extension %extension .~ ".png" $ "path/name.txt""path/name.png"EA . for reading and writing to the full filename (filename .~ "name.txt" $ "path/name.png""path/name.txt" :;<=>?@ABCDE :;<=>?@ABCDE :<>@;=?ABCDE :;<=>?@ABCDEEportable provisionalEdward Kmett <ekmett@gmail.com>None FThis 3 extracts can be used to model the fact that every   type is a subset of . Embedding through the  only succeeds if the  would pass ' through unmodified when re-extracted. G@A prism that shows and reads integers in base-2 through base-36 "100" ^? base 16Just 256 1767707668033969 ^. re (base 36) "helloworld"WLike &', but handles up to base-36 XLike &(, but handles up to base-36 YA safe variant of X Z,Select digits that fall into the given base [A simpler variant of )* that only prepends a dash and  doesn't know about parentheses \A simpler variant of )+ that supports any base, only % recognizes an initial dash and doesn't know about parentheses H H = G 2I I = G 8J J = G 10K K = G 16 FGWXYZ[\HIJKFGHIJKGFHIJK FGWXYZ[\HIJKFControl.Exception provisionalEdward Kmett <ekmett@gmail.com> Trustworthy9LThis  is thrown by lens* when the user somehow manages to rethrow  an internal . M%There is no information carried in a .   M ::   ()  M ::   () N#This is thrown when the user calls ,. ORetrieve the argument given to ,. ] is isomorphic to a . 0catching _ErrorCall (error "touch down!") return "touch down!"P;A record update was performed on a constructor without the G appropriate field. This can only happen with a datatype with multiple I constructors, where some fields are in one constructor but not another. QDInformation about the source location where the record was updated. RGA record selector was applied to a constructor without the appropriate I field. This can only happen with a datatype with multiple constructors, ; where some fields are in one constructor but not another. SKInformation about the source location where the record selection occurred. T(An uninitialised record field was used. U;Information about the source location where the record was  constructed.   U ::  ^   U ::    VA pattern match failed. W6Information about the source location of the pattern.   W ::  _   W ::    XCA class method without a definition (neither a default definition, ; nor a definition in the appropriate instance) was called. Y-Extract a description of the missing method.   Y ::  `   Y ::    ZAThere are no runnable threads, so the program is deadlocked. The  a $ is raised in the main thread only. [%There is no information carried in a a .   [ ::  a ()  [ ::   () \"The thread is waiting to retry an -. transaction, C but there are no other references to any TVars involved, so it can't ever  continue. ]0There is no additional information carried in a b .   ] ::  b ()  ] ::   () ^The thread is blocked on an /0 , but there  are no other references to the /0 so it can't  ever continue. _0There is no additional information carried in a c .   _ ::  c ()  _ ::   () `>Thrown when the program attempts to call atomically, from the  .- package, inside another call to atomically. a0There is no additional information carried in a d .   a ::  d ()  a ::   () bJThrown when the runtime system detects that the computation is guaranteed K not to terminate. Note that there is no guarantee that the runtime system N will notice whether any given computation is guaranteed to terminate or not. c0There is no additional information carried in a e .   c ::  e ()  c ::   () dAsynchronous exceptions. eThere are several types of f.   e ::  f f  e ::   f fg was applied to 1. gThis B contains provides information about what assertion failed in the . zhandling _AssertionFailed (\ xs -> "caught" <$ guard ("<interactive>" `isInfixOf` xs) ) $ assert False (return "uncaught")"caught"   g ::  h   g ::    h*Exceptions generated by array operations. iExtract information about an i.   i ::  i i  i ::   i jArithmetic exceptions. lExceptions that occur in the  k. An j records a N more specific error type, a descriptive string and maybe the handle that was " used when the error was flagged. GDue to their richer structure relative to other exceptions, these have ( a more carefully overloaded signature. mUnfortunately the name  ioException is taken by base for  throwing IOExceptions.    m ::  j j  m ::   j %Many combinators for working with an j are available  in System.IO.Error.Lens. nTraverse the strongly typed  contained in ) where the type of your function matches  the desired .   n :: ( f,  a)  => (a -> f a) ->  -> f  o$Catch exceptions that match a given  (or any  , really). Ucatching _AssertionFailed (assert False (return "uncaught")) $ \ _ -> return "caught""caught"   o :: k m =>  # a -> m r -> (a -> m r) -> m r  o :: k m =>  $ a -> m r -> (a -> m r) -> m r  o :: k m =>   a -> m r -> (a -> m r) -> m r  o :: k m =>  % a -> m r -> (a -> m r) -> m r  o :: k m =>  # a -> m r -> (a -> m r) -> m r  o :: k m =>  % a -> m r -> (a -> m r) -> m r p$Catch exceptions that match a given  (or any ), discarding K the information about the match. This is particuarly useful when you have  a  e () where the result of the  or  isn't 7 particularly valuable, just the fact that it matches. Ocatching_ _AssertionFailed (assert False (return "uncaught")) $ return "caught""caught"   p :: k m =>   a -> m r -> m r -> m r  p :: k m =>   a -> m r -> m r -> m r  p :: k m =>   a -> m r -> m r -> m r  p :: k m =>   a -> m r -> m r -> m r  p :: k m =>   a -> m r -> m r -> m r  p :: k m =>   a -> m r -> m r -> m r l9A helper function to provide conditional catch behavior. q A version of o. with the arguments swapped around; useful in 7 situations where the code for the handler is shorter. Ihandling _NonTermination (\_ -> return "caught") $ throwIO NonTermination"caught"   q :: k m =>  # a -> (a -> m r) -> m r -> m r  q :: k m =>  $ a -> (a -> m r) -> m r -> m r  q :: k m =>   a -> (a -> m r) -> m r -> m r  q :: k m =>  % a -> (a -> m r) -> m r -> m r  q :: k m =>  % a -> (a -> m r) -> m r -> m r  q :: k m =>  # a -> (a -> m r) -> m r -> m r r A version of p. with the arguments swapped around; useful in 7 situations where the code for the handler is shorter. Dhandling_ _NonTermination (return "caught") $ throwIO NonTermination"caught"   r :: k m =>   a -> m r -> m r -> m r  r :: k m =>   a -> m r -> m r -> m r  r :: k m =>   a -> m r -> m r -> m r  r :: k m =>   a -> m r -> m r -> m r  r :: k m =>   a -> m r -> m r -> m r  r :: k m =>   a -> m r -> m r -> m r s A variant of 2 that takes a  (or any ) to select which  exceptions are caught (c.f. 3, 4 ). If the  0 does not match the predicate, it is re-thrown.   s :: k m =>   a -> m r -> m (u a r)  s :: k m =>   a -> m r -> m (u a r)  s :: k m =>   a -> m r -> m (u a r)  s :: k m =>   a -> m r -> m (u a r)  s :: k m =>   a -> m r -> m (u a r)  s :: k m =>   a -> m r -> m (u a r) mA helper version of 2 that doesn't needlessly require . nA helper version of 3 that doesn't needlessly require . t Throw an  described by a  . Exceptions may be thrown from ; purely functional code, but may only be caught within the  k.    t l "a  l o    t ::   t -> t -> r  t ::   t -> t -> r u A variant of t" that can only be used within the  k  (or any other k instance) to throw an  described  by a .  Although u4 has a type that is a specialization of the type of  t*, the two functions are subtly different:    t l e `seq` x "a t e  u l e `seq` x "a x !The first example will cause the  e to be raised, whereas the  second one won' t. In fact, u will only cause an  to & be raised when it is used within the k instance. The u ) variant should be used in preference to t to raise an   within the k6 because it guarantees ordering with respect to other  monadic operations, whereas t does not.    u l "a  l p    u :: q m =>   t -> t -> m r  u :: q m =>   t -> t -> m r vv raises an  specified by a  in the target thread.    v thread l "a  l (r thread)    v :: s ->   t -> t -> m a  v :: s ->   t -> t -> m a wHandle arithmetic w.    w "a k  w    w ::  t t  w ::   t xHandle arithmetic x.    x "a k  x    x ::  t t  x ::   t y%Handle arithmetic loss of precision.    y "a k  y    y ::  t t  y ::   t zHandle division by zero.    z "a k  z    z ::  t t  z ::   t {1Handle exceptional _Denormalized floating point.    { "a k  {    { ::  t t  { ::   t | Added in base/ 4.6 in response to this libraries discussion:  Mhttp://haskell.1045720.n5.nabble.com/Data-Ratio-and-exceptions-td5711246.html    | "a k  |    | ::  t t  | ::   t }CAn attempt was made to index an array outside its declared bounds.    } "a i  }    } ::  i   } ::    ~VAn attempt was made to evaluate an element of an array that had not been initialized.    ~ "a i  ~    ~ ::  i   ~ ::    The current thread'%s stack exceeded its limit. Since an  has  been raised, the thread'1s stack will certainly be below its limit again, = but the programmer should take remedial action immediately.    ::  f ()   ::   ()  The program'As 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 u exceptions.    ::  f ()   ::   () This % is raised by another thread calling  56,, or by the system if it needs to terminate  the thread for some reason.    ::  f ()   ::   () This = is raised by default in the main thread of the program when G the user requests to terminate the program via the usual mechanism(s)  (e.g. Control-C in the console).    ::  f ()   ::   () ]LMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnoplqrsmntuvwxyz{|}~vwxyz{|}~:LMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~:opqrstuvnlmjkwxyz{|hi}~fgdebc`a^_\]Z[XYVWTURSPQNOLMLLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnoplqrsmntuvwxyz{|}~vwxyz{|}~G non-portable experimentalEdward Kmett <ekmett@gmail.com>NoneAny  can be thrown as an  This 7 allows you to traverse the typed value contained in a  7 where the type required by your function matches that  of the contents of the , or construct a  value = out of whole cloth. It can also be used to catch or throw a   value as .    :: n a =>   a   :: n a =>   a HControl.Exception provisionalEdward Kmett <ekmett@gmail.com>None+Exit codes that a program can return with:     ::      ::    "indicates successful termination;    ::   ()   ::   () indicates 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).    ::      ::    I Rank2Types experimentalEdward Kmett <ekmett@gmail.com>NoneWhere the error happened.    ::  j    ::   SomeException  !Error type specific information.    ::  j    ::   SomeException  3The handle used by the action flagging this error.    ::  j (v )   ::   SomeException (v )  the error is related to.    ::  j (v V)   ::   SomeException (v V)  leading to this error, if any.    ::  j (v V)   ::   SomeException (v V) What type of error it is    ::  j    ::   SomeException  7789:89;<=><=?@AB@AC@AD@EF@EG@EH@EIJKKLMNNOOPQQRSTUVW X X Y T Z [ \ ] ] ^ _ ` R R a b c d e e f g g h   i j X k l m n o p q q r s t t u v w w x y z { | } ~         dd`ab\[_OKLPZY^]      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTU{VWXYZ[\]^_`abcdefghijklmnopqrstunvopwxwxyz{|}~~kfhigQ      !"#$%&'()*+,-./0123456789:;<=>e?@ABCDzEFGHIJK 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"r"t"t"u"v"w"x"w"y"z"{"|"}"}"~""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""##################$x$$$$$$$$$$$$$%%%%%%&&&'''''''''(( (((((((((((((((((((((((((((((((())))) )) ) ) ) ))))))))**********+ + +!+!+"+#+$+%+&+'+(+)+*+++,+-+.+/+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//q0r0s0t0u1v2w3x3y3z3{3|3}3~3333444444555555666666677w777788w8x99999::::::::::::::::;;;;;<<<<====>>>>>??@@AAAAABBBBBBBBCCCCDDDDDDDDDDDDEE7EEEEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFlFmFnFoFpFqFFFFFFFFFFFFFFGGHHHHIIIIIIIII I I I I IIIIIIIIIIIIJJJJJJJ J!"#$%&'()*+,-./071723456789:;<=>?@7AB C D E F G H I J K L M N O P Q7 R S T U V W X Y Z [ \ ] ^ _ ` a b c7Ad7Ae7f g h i j k7lmnop@qr@qs t u v w x y z { | } ~                                        77A77@@     7An77An777no 7!7A"7#7$7%7&7'(n)no*n+,-.7/,01,02,037A4567"8988997:;no<no=no>n?7@A7@BCDEFGHI,J,0K,-LMNOPNQRNSTNUVWXYWZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~@@@UV@v@m@@rNOnWXn7|}77777:n7777A777|7|7|77|77|7|7|7|7777no177|77,7|no7|77777|7A7@7,-7d777777777@77@@U@U77 n77|7|7|NQ7|7|7|7|j7|7|7| N                                        !7"!#!$!%!&7A'n(7)"*"+","-"."/"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#cdef7gh7i$j$k$l$m$n$o$p$q$r$s$t$u$v$w$x$y$z${$|$}7~%%%%%%%%%%%%%%%%%%%%%%&&77&&6"&&5&&ddf&7df&df&&N&&&&&WZ&NQ&&7'7xy&&&&&&&&777'7''''''''''''''''''''''''''''''''''''7777((((((((NQ)WZde))))))))))) ) ) ) ) ))))))))))))))))))) )!)")#)$)%)&)')()))*)+),)-).)/)0)1)2)3)4)5)6)7)8)9:;<:;=*>*?*@*A*B*C*D*E*F*G*H*I+J+K+L+M+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+u7Av-w7xyz{z{7|}7A~77xnoz{7A-7-w--------.....,,/4//////777777667x7x7x7x7x7'7xNS::NNNN555555555>>N7dfd7#$CCCCCCCC7EEEEEE7x7777777777A777z{F4F2F37xz{@777x7FFFF 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 F F F F F F 7  !G "G #7 $H %H &7 ' (7 ) * lens-3.10Control.Lens.TraversalControl.Lens.ReviewControl.Lens.GetterControl.Lens.PrismControl.Lens.IsoControl.Lens.Internal.PrismControl.Lens.Internal.IsoControl.Lens.Internal.LevelControl.Lens.Internal.SetterControl.Lens.Internal.ReviewControl.Lens.Internal.GetterControl.Lens.Internal.IndexedControl.Lens.Internal.ContextControl.Lens.Internal.BazaarControl.Lens.Internal.MagmaControl.Lens.Internal.FoldControl.Lens.Internal.ActionControl.Lens.Internal.ZoomControl.Lens.TypeControl.Lens.SetterControl.Lens.ReifiedControl.Lens.SimpleControl.Lens.WrappedControl.Lens.Zoom Data.Set.LensData.HashSet.LensControl.Lens.FoldControl.Lens.EqualityControl.Lens.CombinatorsControl.Lens.LensControl.Lens.LoupeControl.Lens.IndexedControl.Lens.LevelControl.Lens.Internal.ZipperControl.Lens.TupleControl.Lens.ConsControl.Lens.Internal.DequeControl.Lens.EachData.Data.LensControl.Lens.PlatedControl.Lens.AtLanguage.Haskell.TH.LensControl.Lens.THControl.Lens.ActionControl.Lens.Internal.Exception Control.Lens.Internal.ByteStringControl.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.List.Split.LensData.Sequence.LensData.Text.Strict.LensData.Text.Lazy.LensData.Text.LensData.Tree.LensData.Typeable.LensData.Vector.LensData.Vector.Generic.LensGenerics.Deriving.LensSystem.FilePath.Lens Numeric.LensControl.Exception.LensData.Dynamic.LensSystem.Exit.LensSystem.IO.Error.LensControl.Lens.Internal.InstancesPrismIso Data.IntMapIntMapGetterSetter backwardsAccessorControl.Lens.Setter.InternalSettableControl.Monad.Trans.State.LazyState indexed64indexed TraversalIndexedTraversalFold IndexedFoldLens IndexedLens IndexedGetterLensLike OverloadingActioncloneBazaartakinglastOfpreview maximumOf minimumOfmapM_ traverseOf_Control.Monad.RWSRWSTMagnifyZoomzoomControl.Monad.ErrorErrorTControl.Monad.WriterWriterTControl.Monad.StateStateT _imagPart Data.ComplexComplex traversedGetting Data.FoldableFoldable foldMapOf Data.MonoidMonoidrereview^?Data.TraversabletraverselengthOfNumeric.NaturalNaturalprismoutsideData.Text.InternalTextsetviewover TraversableData.Functor.Compose getComposeComposeData.Functor.IdentityIdentity fmapDefaultuse_2atimap cloneLenscloneTraversalalaalafData.MapMap Control.MonadjoinControl.ApplicativeConstIso' Traversal' ifoldMapOffromControl.Monad.Reader.ClasslocalfoldedPreludeunfoldrfoldMapfoldfoldrfoldltoListandoranyallproductsum_1 traverseOf traverse__LeftforOffor_forM_ sequence_ maximumByfindfoldr1foldl1foldr'foldl' Data.Listfoldl1'foldrMfoldlMMonadControl.TraversableControl.Lens.Isomorphic itraverseOfimapMOfiforMOfSetter'^..~%~+~-~*~//~^~^^~**~||~&&~%=+=-=*=//=**=^^=||=&&=<>~<>=%@~ withIndex.=<.~<#= Data.Typeablecast alongsideifor transposeuniplatebiplate contextsOfControl.Comonad.Store.ClasspospeekReifiedTraversalreflectTraversalDataListControl.Lens.IndexedTraversalmap mapAccumRControl.Lens.ZipperanyOf Data.Functor<$>AtContainsIxed Control.Lens IndexedSetterplate Data.Just isNothingextractIndexedSimpleControl.Lens.OperatorsControl.ExceptionHandler_AssertionFailed _ErrorCallPrism'Lens'_NonTermination_StackOverflowControl.Lens.InternalB BytestringcatchesData.ByteStringpackunpackData.ByteString.Char8Data.ByteString.LazyData.ByteString.Lazy.Char8 ByteString GHC.GenericsGenericGHC.Generics.Lens Data.Char intToDigit digitToIntNumeric showSigned readSignederrorControl.Monad.STMSTMControl.Concurrent.MVarMVarFalsetrytryJust catchJustControl.Concurrent killThreadbasebifunctors-4.1.0.1Data.Bifunctorbimap Bifunctorcontravariant-0.4.4Data.Functor.Contravariant contramap Contravariantprofunctors-4.0.1Data.Profunctorright'left'ChoiceData.Profunctor.Unsafermaplmapdimap ProfunctorMarket'Market Reversing reversingExchangeFlowsrunFlows Deepening runDeepeningLevelZeroOneTwo deepeningMutator runMutator untainted untaintedDot taintedDotReviewed runReviewed Reviewableretagged runAccessorGettablecoercenoEffect Indexing64 runIndexing64Indexing runIndexing runIndexed Indexable Conjoineddistrib conjoinedindexing indexing64 PretextT'PretextT runPretextTPretext'Pretext runPretextContext'ContextSellablesellIndexedComonadStoreiposipeekipeeksiseekiseeks iexperimentcontextIndexedComonadiextract iduplicateiextendIndexedFunctorifmapBazaarT'BazaarT runBazaarTBazaar' runBazaarBizarrebazaar TakingWhileMaficMolten runMoltenMagma MagmaFmap MagmaPureMagmaAprunMagmarunMaficrunTakingWhile RightmostRStepRLeafRPureLeftmostLStepLLeafLPureMaxNoMaxMinNoMin Sequenced getSequenced Traversed getTraversedFolding getFoldinggetMingetMax getLeftmost getRightmostEffect getEffect Effective effective ineffective EffectRWS getEffectRWS Magnified FocusingErr unfocusingErrErrgetErr FocusingMay unfocusingMayMaygetMay FocusingOn unfocusingOn FocusingPlusunfocusingPlus FocusingWithunfocusingWithFocusing unfocusingZoomedOver'OverIndexedLensLike'IndexedLensLike LensLike' Overloaded' Overloaded Overloading'IndexPreservingMonadicFoldIndexedMonadicFold MonadicFoldIndexPreservingAction IndexedActionIndexPreservingFoldIndexPreservingGetter Equality'EqualityIndexPreservingSetter'IndexPreservingSetterIndexedSetter'IndexPreservingTraversal'IndexPreservingTraversalIndexedTraversal'IndexPreservingLens'IndexPreservingLens IndexedLens'Setting'SettingAnIndexedSetter'AnIndexedSetterASetter'ASettermappedlifted contramappedargumentsettingsets cloneSettercloneIndexPreservingSettercloneIndexedSetterset'?~??AnIndexedLens' AnIndexedLensALens'ALenslensiplensilens%%~%%=insidechoosingchosenlocuscloneIndexPreservingLenscloneIndexedLens<%~<+~<-~<*~~<<>=<%@~<<%@~%%@~%%@=<%@=<<%@=^#storing#~#%~#%%~#=#%=<#%~<#%=#%%=<#~devoidunited SimpleLoupeLoupeAPrism'APrism clonePrismprism'asidewithoutisn't_Right_Just_Nothing_Voidonly TraverseMax traverseMax TraverseMin traverseMin Traversing' TraversingAnIndexedTraversal'AnIndexedTraversal ATraversal' ATraversal sequenceAOfmapMOfforMOf sequenceOf transposeOf mapAccumROf mapAccumLOfscanr1Ofscanl1OflociilocipartsOfipartsOfpartsOf' ipartsOf' unsafePartsOfiunsafePartsOfunsafePartsOf'iunsafePartsOf'holesOfsingularunsafeSingularbothbesidedroppingcloneIndexPreservingTraversalcloneIndexedTraversaliforOf imapAccumROf imapAccumLOf traversed64ignored elementOfelement elementsOfelementsfailoverTraversableWithIndex itraverse itraversedFoldableWithIndexifoldMapifoldedifoldrifoldlifoldr'ifoldl'FunctorWithIndeximapped<..> reindexed<.>icomposeasIndexindicesindexifoldingianyiall itraverse_ifor_imapM_iforM_ iconcatMapifindifoldrMifoldlMitoListimapMiforM imapAccumR imapAccumLlevelsilevelsTrackForkTapeZippingrecoilCoilSnocZipped:>>:>:@ZipperTopPathStartApRApLFlowrunFlowJacketPureLeafApsizenullLeft nullRightmaximal jacketIns jacketOutsjacketoffsetpathsize recompressstartlstartrmovelmoverfocuszipper focalPointtoothupward rightwardleftwardleftmost rightmosttugtugsfarthestjerksteethjerkTotugTo moveTowardmoveTolenseddownward idownwardwithiniwithinwithinsiwithins fromWithin ifromWithinrezipfocusedContextsaveTape restoreTaperestoreNearTapeunsafelyRestoreTapepeel restoreTrackrestoreNearTrackunsafelyRestoreTrackField9_9Field8_8Field7_7Field6_6Field5_5Field4_4Field3_3Field2Field1_SnocCons_Cons<|consuncons_head_tail_init_last|>snocunsnocDequeBDnull singletonfromListEacheachIndex gtraversetinplatetemplateuponupon'onceUpon onceUpon'Platedchildrenrewrite rewriteOf rewriteOn rewriteOnOfrewriteM rewriteMOf rewriteMOn rewriteMOnOfuniverse universeOf universeOn universeOnOf transform transformOn transformOf transformOnOf transformM transformMOn transformMOftransformMOnOfcontexts contextsOn contextsOnOfholesholesOn holesOnOfparaOfpara composOpFoldpartsixIxValuecontains_atresultAt containsIx containsAtcontainsLength containsN containsTestcontainsLookupixAtixEachsans SubstType substType HasTypeVars typeVarsExHasNamenametypeVars substTypeVars conFieldsconNamedFields FieldRules LensRulesLensFlagGenerateSignatures ClassRequiredCreateInstance CreateClassSingletonRequiredHandleSingletons SingletonIsoSingletonAndFieldBuildTraversals PartialLenses SimpleLenses simpleLenses partialLensesbuildTraversalshandleSingletonssingletonAndField singletonIsosingletonRequired createClasscreateInstance classRequiredgenerateSignatureslensIso lensField lensClass lensFlags defaultRules lensRules classyRulesisoRules makeLenses makeClassymakeIso makeLensesFor makeClassyFormakeLensesWith makePrisms makeWrappedunderscoreFieldscamelCaseFieldsmakeFieldsWith makeFieldsdefaultFieldRules IndexedActingActingperformperforms^!^!!^!?actactsliftActiperform iperforms^@!^@!!^@!?iactHandlingException Handleablehandlerhandler_traversedStricttraversedStrict8traversedStrictTreetraversedStrictTree8 unpackLazy traversedLazy unpackLazy8traversedLazy8 unpackStrict unpackStrict8catching catching_handling handling_tryingthrowingevalOfparOfafter throughoutseqOfixmapped.|.~.&.~.&.=.|.=<.|.~<.&.~<.&.=<.|.=bitAtbyteAtbits packedBytes unpackedBytesbytes packedChars unpackedCharschars IsByteString _realPart_polar _magnitude_phase _conjugatemembersprefixedsuffixed stripSuffixstrippingPrefixstrippingSuffix splitting splittingOnsplittingOneOf splittingWhenendingBy endingByOneOf wordingByliningBychunkingsplittingPlacessplittingPlacesBlanks delimiters delimiting condensingkeepInitialBlankskeepFinalBlanksviewLviewRslicedTo slicedFromslicedpackedunpackedbuildertextIsTextrootbranches_cast_gcast toVectorOfvectorforcedordinalsasStream asStreamRcloned GTraversalgenericgeneric1~=<~<=<.>~<.>=<<.>~<<.>=basename directory extensionfilenameintegralbinaryoctaldecimalhexAsHandlingException_HandlingException AsErrorCall AsRecUpdError _RecUpdError AsRecSelError _RecSelError AsRecConError _RecConErrorAsPatternMatchFail_PatternMatchFailAsNoMethodError_NoMethodError AsDeadlock _DeadlockAsBlockedIndefinitelyOnSTM_BlockedIndefinitelyOnSTMAsBlockedIndefinitelyOnMVar_BlockedIndefinitelyOnMVarAsNestedAtomically_NestedAtomicallyAsNonTerminationAsAsyncException_AsyncExceptionAsAssertionFailedAsArrayException_ArrayExceptionAsArithException_ArithException AsIOException _IOException exception throwingM throwingTo _Overflow _Underflow_LossOfPrecision _DivideByZero _Denormal_RatioZeroDenominator_IndexOutOfBounds_UndefinedElement _HeapOverflow _ThreadKilled_UserInterrupt AsDynamic_Dynamic AsExitCode _ExitCode _ExitSuccess _ExitFailurelocation descriptionhandlefileNameerrno errorType_AlreadyExists _NoSuchThing _ResourceBusy_ResourceExhausted_EOF_IllegalOperation_PermissionDenied _UserError_UnsatisfiedConstraints _SystemError_ProtocolError _OtherError_InvalidArgument_InappropriateType_HardwareFault_UnsupportedOperation _TimeExpired_ResourceVanished _Interrupted$fTraversableConst$fFoldableConst$fTraversableEither$fFoldableEither$fTraversable1(,)$fTraversable(,)$fFoldable1(,) $fFoldable(,)$fChoiceMarket$fProfunctorMarket$fFunctorMarket$fReversingVector$fReversingVector0$fReversingVector1$fReversingSeq$fReversingVector2$fReversingText$fReversingText0$fReversingByteString$fReversingByteString0 $fReversing[]$fProfunctorExchange$fFunctorExchange Applicativelappendsemigroups-0.11Data.Semigroup Semigrouptrimltrimr$fApplicativeFlows$fMonoidDeepening $fApplyFlows$fFunctorFlows$fSemigroupDeepening$fTraversableLevel$fFoldableLevel$fFunctorLeveltransformers-0.3.0.0GHC.BaseFunctor$fSettableBackwards$fSettableIdentity$fSettableMutator$fTraversableMutator$fFoldableMutator$fDistributiveMutator$fComonadApplyMutator$fComonadMutator$fExtendMutator$fMonadMutator $fBindMutator$fApplicativeMutator$fApplyMutator$fFunctorMutator$fSettableCompose$fCorepresentableReviewed$fChoiceReviewed$fProfunctorReviewed$fDistributiveReviewed$fBitraversableReviewed$fBifoldableReviewed$fBifunctorReviewed$fTraversableReviewed$fFoldableReviewed$fMonadFixReviewed$fMonadReviewed$fBindReviewed$fComonadApplyReviewed$fComonadReviewed$fApplicativeReviewed$fApplyReviewed$fFunctorReviewed $fReviewablepidfmapmempty$fApplicativeAccessor$fApplyAccessor$fContravariantAccessor$fFunctorAccessor $fGettablefGHC.IntInt64ghc-prim GHC.TypesIntData.Profunctor.RepCorepresentable Representable$fContravariantIndexing64$fApplicativeIndexing64$fApplyIndexing64$fFunctorIndexing64$fContravariantIndexing$fApplicativeIndexing$fApplyIndexing$fFunctorIndexing$fIndexableiIndexed$fConjoinedIndexed$fArrowLoopIndexed$fArrowApplyIndexed$fArrowChoiceIndexed$fArrowIndexed$fCategoryIndexed$fStrongIndexed$fChoiceIndexed$fRepresentableIndexed$fCorepresentableIndexed$fProfunctorIndexed$fMonadFixIndexed$fMonadIndexed $fBindIndexed$fApplicativeIndexed$fApplyIndexed$fFunctorIndexed$fIndexablei(->)$fConjoined(->) comonad-4.0 ComonadStorepeeksseekseeks experimentcoarr$fContravariantPretextT$fSellablepPretextT$fComonadStoreaPretextT$fIndexedComonadStorePretextT$fComonadPretextT$fIndexedComonadPretextT$fFunctorPretextT$fIndexedFunctorPretextT$fSellablepPretext$fComonadStoreaPretext$fIndexedComonadStorePretext$fComonadPretext$fIndexedComonadPretext$fFunctorPretext$fIndexedFunctorPretext$fSellable(->)Context$fComonadStoreaContext$fComonadContext$fFunctorContext$fIndexedComonadStoreContext$fIndexedComonadContext$fIndexedFunctorContext$fContravariantBazaarT$fComonadApplyBazaarT$fComonadBazaarT$fApplicativeBazaarT$fApplyBazaarT$fFunctorBazaarT$fBizarrepBazaarT$fSellablepBazaarT$fIndexedComonadBazaarT$fIndexedFunctorBazaarT$fComonadApplyBazaar$fComonadBazaar$fApplicativeBazaar $fApplyBazaar$fFunctorBazaar$fBizarrepBazaar$fSellablepBazaar$fIndexedComonadBazaar$fIndexedFunctorBazaar$fIndexedFunctorTakingWhile$fContravariantTakingWhile$fBizarrepTakingWhile$fApplicativeTakingWhile$fApplyTakingWhile$fFunctorTakingWhile$fIndexedFunctorMafic$fBizarreIndexedMafic$fSellable(->)Mafic$fApplicativeMafic $fApplyMafic$fFunctorMafic$fComonadMolten$fIndexedComonadMolten$fIndexedFunctorMolten$fBizarreIndexedMolten$fSellableIndexedMolten$fApplicativeMolten $fApplyMolten$fFunctorMolten $fShowMagma$fTraversableMagma$fFoldableMagma$fFunctorMagma Data.MaybeJust$fMonoidRightmost$fSemigroupRightmost$fMonoidLeftmost$fSemigroupLeftmost $fMonoidMax$fSemigroupMax $fMonoidMin$fSemigroupMin$fMonoidSequenced$fSemigroupSequenced$fMonoidTraversed$fSemigroupTraversed$fMonoidFolding$fSemigroupFolding$fApplicativeEffect $fApplyEffect$fMonoidEffect$fSemigroupEffect$fEffectivemrEffect$fContravariantEffect$fFunctorEffect$fEffectiveIdentityrAccessor$fEffectivemDualBackwards Data.EitherEitherMaybeControl.Monad.Trans.MaybeMaybeTControl.Monad.Trans.ListListT$fContravariantEffectRWS$fApplicativeEffectRWS$fApplyEffectRWS$fFunctorEffectRWS$fApplicativeFocusingErr$fApplyFocusingErr$fFunctorFocusingErr $fMonoidErr$fSemigroupErr$fApplicativeFocusingMay$fApplyFocusingMay$fFunctorFocusingMay $fMonoidMay$fSemigroupMay$fApplicativeFocusingOn$fApplyFocusingOn$fFunctorFocusingOn$fApplicativeFocusingPlus$fApplyFocusingPlus$fFunctorFocusingPlus$fApplicativeFocusingWith$fApplyFocusingWith$fFunctorFocusingWith$fApplicativeFocusing$fApplyFocusing$fFunctorFocusing. GHC.Classes<= integer-gmpGHC.Integer.TypeIntegerGHC.Real toInteger$<LeftRightGHC.Num fromIntegerCharpure<$liftMNum FractionalIntegral GHC.FloatFloating||Bool&& mtl-2.1.2Control.Monad.State.Class MonadStatemappendControl.Monad.Writer.Classpass MonadWritercensorconst text-0.11.2.3bytestring-0.10.0.2Data.ByteString.InternalfirstsecondGHC.EnumEnumDoubleFloatTruenot Data.Tuplecurryuncurry$fStrictRWSTRWST$fStrictWriterTWriterT$fStrictStateTStateT$fStrictTextText$fStrictByteStringByteString$fSwappedEither $fSwapped(,) MonadReaderlistengets$fWrapped[][]SetSetcontainers-0.5.0.0 Data.Set.Base$fWrapped[][]MapMap Data.Map.Base$fWrapped[][]IntSetIntSetData.IntSet.Base$fWrapped[][]IntMapIntMapData.IntMap.Base$fWrapped[][]HashSetHashSetunordered-containers-0.2.3.3 Data.HashSet$fWrapped[][]HashMapHashMapData.HashMap.Base getErrorCallgetRecUpdErrorgetRecSelErrorgetRecConErrorgetPatternMatchFailgetNoMethodErrorfailedAssertion getArrowMonad$fWrapped[][]ErrorCallErrorCall#$fWrapped[][]RecUpdErrorRecUpdError#$fWrapped[][]RecSelErrorRecSelError#$fWrapped[][]RecConErrorRecConError-$fWrapped[][]PatternMatchFailPatternMatchFail'$fWrapped[][]NoMethodErrorNoMethodError+$fWrapped[][]AssertionFailedAssertionFailed$fWrappedabTaggedTagged$fWrappedff'ComposeCFComposeFC$fWrappedff'ComposeFCComposeFC$fWrappedff'ComposeCompose$fWrapped(->)(->)OpOp'$fWrapped(->)(->)EquivalenceEquivalence%$fWrapped(->)(->)ComparisonComparison#$fWrapped(->)(->)PredicatePredicate$fWrapped[][]SeqSeq$fWrappedww'TracedTTracedT'$fWrappedEitherEitherCoproductCoproduct$fWrappedmm'WriterTWriterT$fWrappedmm'WriterTWriterT0$fWrapped(->)(->)StateTStateT$fWrapped(->)(->)StateTStateT0$fWrapped(->)(->)RWSTRWST$fWrapped(->)(->)RWSTRWST0$fWrappedff'ReverseReverse$fWrapped(->)(->)ReaderTReaderT$fWrappedmm'MaybeTMaybeT$fWrappedmm'ListTListT$fWrappedmm'IdentityTIdentityT$fWrappedaa'IdentityIdentity$fWrappedmm'ErrorTErrorT$fWrapped(->)(->)ContTContT$fWrappedaa'ConstantConstant$fWrappedff'ComposeCompose0$fWrappedff'BackwardsBackwards$fWrappedabReviewedReviewed$fWrappedmnArrowMonadArrowMonad$fWrappedMaybeMaybeLastLast$fWrappedMaybeMaybeFirstFirst$fWrapped(->)(->)EndoEndo$fWrappedabDualDual$fWrappedabConstConst$fWrapped[][]ZipListZipList#$fWrappedauWrappedArrowWrappedArrow#$fWrappedmnWrappedMonadWrappedMonad$fWrapped(->)(->)KleisliKleisli$fWrappedabProductProduct$fWrappedabSumSum$fWrappedBoolBoolAnyAny$fWrappedBoolBoolAllAllControl.Monad.Trans.ReaderReaderControl.Monad.Trans.RWS.LazyRWS Control.Monad.Trans.State.StrictControl.Monad.Trans.RWS.StrictControl.Monad.Trans.ErrorError$fMagnify(->)(->)ba$fMagnifyIdentityTIdentityTba$fMagnifyRWSTRWSTba$fMagnifyRWSTRWSTba0$fMagnifyReaderTReaderTba$fZoomErrorTErrorTst$fZoomMaybeTMaybeTst$fZoomListTListTst$fZoomWriterTWriterTst$fZoomWriterTWriterTst0$fZoomRWSTRWSTst$fZoomRWSTRWSTst0$fZoomIdentityTIdentityTst$fZoomReaderTReaderTst$fZoomStateTStateTst$fZoomStateTStateTst0SetOrdHashSethashable-1.2.1.0Data.Hashable.ClassHashableEqGHC.Listrepeat replicateiterateevensucc/= takeWhile dropWhileEndoflipProductSum sequenceA_asum Alternativemsum MonadPluselemnotElem concatMapconcatlengthheadFirstLastmaximum fromMaybeGHC.ErrminimumOrdering minimumByNothing listToMaybefstskipstate void-0.6.1 Data.VoidVoidrunPrismControl.Categoryfor sequenceAmapMforMsequence unwrapMonad WrapMonadControl.Applicative.Backwards Backwards mapAccumLswaprunStatescanr1scanl1Control.Comonad==inspinsparrouts unsafeOutsunconsWithDefault$fTraverseMaxkMap$fTraverseMaxIntIntMap$fTraverseMinkMap$fTraverseMinIntIntMap$fFunctorWithIndexIntSeq Data.SequenceSeq$fFunctorWithIndexInt[]$fTraversableWithIndexiMagma$fFoldableWithIndexiMagma$fFunctorWithIndexiMagma$fTraversableWithIndexiLevel$fFoldableWithIndexiLevel$fFunctorWithIndexiLevel$fFunctorWithIndexr(->)$fTraversableWithIndexkHashMap$fFoldableWithIndexkHashMap$fFunctorWithIndexkHashMap$fTraversableWithIndexkMap$fFoldableWithIndexkMap$fFunctorWithIndexkMap$fTraversableWithIndexIntIntMap$fFoldableWithIndexIntIntMap$fFunctorWithIndexIntIntMap$fTraversableWithIndexIntVector$fFoldableWithIndexIntVector$fFunctorWithIndexIntVector$fTraversableWithIndexIntSeq$fFoldableWithIndexIntSeq$fTraversableWithIndex()Maybe$fFoldableWithIndex()Maybe$fFunctorWithIndex()Maybe$fTraversableWithIndexInt[]$fFoldableWithIndexInt[]$fTraversableWithIndexk(,)$fFoldableWithIndexk(,)$fFunctorWithIndexk(,) $fTraversableWithIndex()Identity$fFoldableWithIndex()Identity$fFunctorWithIndex()Identity$fTraversableWithIndexiReverse$fFoldableWithIndexiReverse$fFunctorWithIndexiReverse $fTraversableWithIndexiBackwards$fFoldableWithIndexiBackwards$fFunctorWithIndexiBackwards<*>levelIns levelOuts ilevelIns ilevelOutsString>=fromJust$fApplicativeFlow$fMonoidJacket$fZippingZippera $fZippingTopa $fFunctorPath $fApplyFlow $fFunctorFlow$fTraversableWithIndexiJacket$fFoldableWithIndexiJacket$fFunctorWithIndexiJacket$fTraversableJacket$fFoldableJacket$fFunctorJacket$fField2(,)(,)bb'$fField1(,)(,)aa'$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'$fField1(,,,,,,,,)(,,,,,,,,)aa'$fField1(,,,,,,,)(,,,,,,,)aa'$fField1(,,,,,,)(,,,,,,)aa'$fField1(,,,,,)(,,,,,)aa'$fField1(,,,,)(,,,,)aa'$fField1(,,,)(,,,)aa'$fField1(,,)(,,)aa'$fField1IdentityIdentityabvector-0.10.9.1 Data.VectorVectorGHC.WordWord8tail$fSnocpfTextTextCharChar$fSnocpfTextTextCharChar0&$fSnocpfByteStringByteStringWord8Word8'$fSnocpfByteStringByteStringWord8Word80$fSnocpfVectorVectorab$fSnocpfVectorVectorab0$fSnocpfVectorVectorab1$fSnocpfVectorVectorab2$fSnocpfSeqSeqab$fSnocpf[][]ab$fConspfVectorVectorab$fConspfVectorVectorab0$fConspfVectorVectorab1$fConspfVectorVectorab2$fConspfTextTextCharChar$fConspfTextTextCharChar0&$fConspfByteStringByteStringWord8Word8'$fConspfByteStringByteStringWord8Word80$fConspfSeqSeqab$fConspf[][]abemptycheck$fSnocpfDequeDequeab$fConspfDequeDequeab $fMonoidDeque$fSemigroupDeque$fTraversableWithIndexIntDeque$fTraversableDeque$fFoldableWithIndexIntDeque$fFoldableDeque$fMonadPlusDeque $fMonadDeque $fBindDeque$fReversingDeque$fAlternativeDeque $fPlusDeque $fAltDeque$fApplicativeDeque $fApplyDeque$fFunctorWithIndexIntDeque$fFunctorDeque $fOrdDeque $fEqDeque$fEachf(->)(->)ab$fEachfUArrayUArrayabGHC.ArrIx array-0.4.0.1Data.Array.BaseIArrayUArrayArray$fEachfArrayArrayab%$fEachfByteStringByteStringWord8Word8Data.ByteString.Lazy.Internal&$fEachfByteStringByteStringWord8Word80$fEachfTextTextCharCharData.Text.Lazy.Internal$fEachfTextTextCharChar0$fEachfVectorVectorabData.Vector.Unboxed.BaseUnbox$fEachfVectorVectorab0Foreign.StorableStorableData.Vector.Storable$fEachfVectorVectorab1primitive-0.5.1.0Data.Primitive.TypesPrimData.Vector.Primitive$fEachfVectorVectorab2$fEachfTreeTreeab Data.TreeTree$fEachfSeqSeqab$fEachfMaybeMaybeab$fEachfIdentityIdentityab $fEachf[][]ab$fEachfHashMapHashMapabHashMap$fEachfIntMapIntMapab$fEachfMapMapab$fEachfComplexComplexab RealFloat$fEachf(,,,,,,,,)(,,,,,,,,)ab$fEachf(,,,,,,,)(,,,,,,,)ab$fEachf(,,,,,,)(,,,,,,)ab$fEachf(,,,,,)(,,,,,)ab$fEachf(,,,,)(,,,,)ab$fEachf(,,,)(,,,)ab$fEachf(,,)(,,)ab$fEachf(,)(,)ab Data.DatagmapMinlinePerformIOGHC.IOunsafePerformIOFollowerOracle fromOracleAnswerMissFollowHitCacheHitMapDataBox dataBoxKey _dataBoxValFieldExceptionsteplookupondataBox sybChildren emptyHitMap insertHitMapfixEqcachereadCacheFollowerinsert2hitTest biplateData uniplateDatapartfollower$fFunctorOracle$fFunctorAnswer$fExceptionFieldException$fShowFieldExceptionGHC.ShowShowGHC.ReadReadData.Typeable.InternalTypeablenegate $fPlatedPat $fPlatedStmt $fPlatedType $fPlatedCon $fPlatedDec $fPlatedExp $fPlatedTree $fPlated[]lookup $fIxedfUArray!// $fIxedfArray $fAtHashMap$fAtMap $fAtIntMap$fIxedf(,,,,,,,,)$fIxedf(,,,,,,,)$fIxedf(,,,,,,)$fIxedf(,,,,,) $fIxedf(,,,,) $fIxedf(,,,) $fIxedf(,,) $fIxedf(,)$fIxedfComplex $fIxedf(->)$fIxedfByteString$fIxedfByteString0 $fIxedfText $fIxedfText0 $fIxedfVector$fIxedfVector0$fIxedfVector1$fIxedfVector2$fIxedfHashMap $fIxedfMap $fIxedfIntMap $fIxedfSeq $fIxedfTree$fIxedfIdentity $fIxedf[]$fContainsfByteString$fContainsfByteString0$fContainsfText$fContainsfText0$fContainsfVector$fContainsfVector0$fContainsfVector1$fContainsfVector2$fContainsfUArray$fContainsfArray$fContainsfHashMap$fContainsfMap$fContainskIntMap$fContainsk(,,,,,,,,)$fContainsk(,,,,,,,)$fContainsk(,,,,,,)$fContainsk(,,,,,)$fContainsk(,,,,)$fContainsk(,,,)$fContainsk(,,)$fContainsk(,)$fContainskIdentity$fContainsfTree$fContainsfComplex$fContainsfSeq $fContainsf[]$fContainsfHashSet$fContainsfSet$fContainsfIntSet$fContainsf(->)template-haskellLanguage.Haskell.TH.SyntaxnewNameName$fSubstTypePred $fSubstType[]$fSubstTypeType$fHasTypeVars[]$fHasTypeVarsCon$fHasTypeVarsPred$fHasTypeVarsType$fHasTypeVarsName$fHasTypeVarsTyVarBndr $fHasNameCon $fHasNameName$fHasNameTyVarBndr deNewtypefreshMap getLensFieldsField _fieldName_fieldLensPrefix_fieldLensName_fieldClassName_fieldClassLensName _getPrefix_rawLensNaming_niceLensNaming _classNaming_lensIso _lensField _lensClass _lensFlags mLowerNamemakePrismsForConsmakePrismForConctrNameAndFieldTypesreviewerIdClausetoTupleTtoTupleEtoTupleP makeIsoTo makeIsoFrom makeIsoBody makeLensBodyplainappArgsappsappsT makeIsoLensesmakeFieldLensBodymakeFieldLenses unifyTypesmakeWrappedInstance inlinePragmaoverHeadcollectRecords verboseLensesmkFieldshasClassAndInstance>>=Handling GHC.Exception Exception!MonadCatchIO-transformers-0.3.0.0Control.Monad.CatchIO System.IOprint++ SomeExceptionIOreturnsupply handlerIOhandlerCatchIO$fExceptionHandling$fShowHandling$fTypeableHandling$fExceptionHandlingException!$fHandleableSomeExceptionmHandler"$fHandleableSomeExceptionIOHandlerw2cc2w unsafeCreatecreategrainControl.Monad.Error.Class MonadError throwError$fHandleableemHandler$fMonoidHandler $fPlusHandler $fAltHandler$fSemigroupHandler$fFunctorHandlerparallel-3.2.0.3Control.Parallel.StrategiesStrategyevalTraversableEvalparTraversablerdeepseq Control.Seq seqFoldableixmapbounds Data.Bits.|.Bits.&.bitSize undefineddiv$fIsByteStringByteString$fIsByteStringByteString0realPartimagPartpolar magnitudephasepi conjugateIntSet split-0.2.2Data.List.Split.InternalsSplitter dropDelims onSublistoneOfwhenEltdropFinalBlank dropBlanksendkeepsViewLviewlViewRviewr Data.TextData.Text.Lazy.BuilderBuilderfromTextData.Text.LazytoStrict toLazyText fromLazyText $fIsTextText $fIsTextText0 subForestgcastData.Vector.Generic.BaseData.Vector.Fusion.StreamStreamgeneric-deriving-1.6.2Generics.Deriving.Uniplate tinplated maybeArg1Of$fGTraversal:.:$fGTraversalM1$fGTraversal:+:$fGTraversal:*:$fGTraversalU1$fGTraversalK1FilePath intToDigit' digitToInt' digitToIntMayisDigit' showSigned' readSigned' ErrorCallControl.Exception.Base RecConErrorPatternMatchFail NoMethodErrorGHC.IO.ExceptionDeadlockBlockedIndefinitelyOnSTMBlockedIndefinitelyOnMVarNestedAtomicallyNonTerminationAsyncExceptionassertAssertionFailedArrayException IOException MonadCatchIOthrowControl.Monad.IO.ClassMonadIO GHC.Conc.SyncthrowToThreadIdArithException HeapOverflowtrivial$$fAsHandlingExceptionpfSomeException($fAsHandlingExceptionpfHandlingException$fAsErrorCallpfSomeException$fAsErrorCallpfErrorCall$fAsRecUpdErrorpfSomeException$fAsRecUpdErrorpfRecUpdError$fAsRecSelErrorpfSomeException$fAsRecSelErrorpfRecSelError$fAsRecConErrorpfSomeException$fAsRecConErrorpfRecConError#$fAsPatternMatchFailpfSomeException&$fAsPatternMatchFailpfPatternMatchFail $fAsNoMethodErrorpfSomeException $fAsNoMethodErrorpfNoMethodError$fAsDeadlockpfSomeException$fAsDeadlockpfDeadlock+$fAsBlockedIndefinitelyOnSTMpfSomeException6$fAsBlockedIndefinitelyOnSTMpfBlockedIndefinitelyOnSTM,$fAsBlockedIndefinitelyOnMVarpfSomeException8$fAsBlockedIndefinitelyOnMVarpfBlockedIndefinitelyOnMVar#$fAsNestedAtomicallypfSomeException&$fAsNestedAtomicallypfNestedAtomically!$fAsNonTerminationpfSomeException"$fAsNonTerminationpfNonTermination!$fAsAsyncExceptionpfSomeException"$fAsAsyncExceptionpfAsyncException"$fAsAssertionFailedpfSomeException$$fAsAssertionFailedpfAssertionFailed!$fAsArrayExceptionpfSomeException"$fAsArrayExceptionpfArrayException!$fAsArithExceptionpfSomeException"$fAsArithExceptionpfArithException$fAsIOExceptionpfSomeException$fAsIOExceptionpfIOException Data.DynamicDynamic$fAsDynamicSomeException$fAsDynamicDynamicExitCode$fAsExitCodepfSomeException$fAsExitCodepfExitCodeGHC.IO.Handle.TypesHandle IOErrorType