Mx      !"#$%&'()*+,-./0123456789:;<=>? @ 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 lmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ 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"wxyz{|}~###############$$%%&&&&&&&&&&&&&&''''''(((((((((()))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) ) ) ) ) ))))))))))))))))))) )!)")#)$)%)&)')()))*)+),)-).)/)0)1)2)3)4)5)6)7)8)9):);)<)=)>)?)@)A)B)C)D)E)F)G)H)I)J)K)L)M)N)O)P)Q)R)S)T)U)V)W)X)Y)Z)[)\)])^)_)`)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*{*|*}*~********+++,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,-----.//////////000000000122223455555555555555556666667777778888888999999:::;;;;;<<<<<<<<<<<<<<<< = = = = ==>>>>>>??????@@@@@ @!A"A#B$B%C&C'C(C)C*D+D,D-D.D/D0D1D2D3E4E5E6E7F8F9F:F;F<F=F>F?G@GAGBGCGDGEGFGGGHGIGJGKGLGMGNGOHPHQHRHSHTHUHVHWHXHYHZH[H\H]H^H_H`HaHbHcHdHeHfHgHhIiIjIkIlImInIoIpIqIrIsItJuJvJwJxJyJzJ{J|J}J~JJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJKKLLLLSM Safe-InferredN Safe-Inferred  -(C) 2013-2014 Edward Kmett, 2013 Eric Mertens BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> experimental non-portable Trustworthy<Compatibility shim for recent changes to template haskell's %Apply arguments to a type constructorApply arguments to a function-Construct a tuple type given a list of types.4Construct a tuple value given a list of expressions.3Construct a tuple pattern given a list of patterns.&Apply arguments to a type constructor.Return  contained in a .& !"#$%&'()*+,-./0123456789:;<=& !"#$%&'()*+,-./0123456789:;<=& !"#$%&'()*+,-./0123456789:;<=& !"#$%&'()*+,-./0123456789:;<=n2009-2014 Edward Kmett, 2012 Elliott Hird, 2004 Oleg Kiselyov and Chung-chieh ShanBSD3Edward Kmett <ekmett@gmail.com> experimental non-portable Trustworthy +246=HKM>%Reify a value at the type level in a *-compatible fashion, to be recovered with .      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~>      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~>>      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~>      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~O(C) 2012-2014 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> experimental non-portable Safe-Inferred (C) 2012-2014 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> experimental non-portableSafe3=K ?IWrap a monadic effect with a phantom type argument. Used when magnifying PQ.B3Wrap a monadic effect with a phantom type argument.EThis type family is used by R$ to describe the common effect type.FUsed by S to T into UV.IMake a  out of  for error handling.LUsed by S to T into UV.OMake a  out of  for error handling.RUsed by S to T into  or .UUsed by S to T into WX.XUsed by S to T into PQ.[Used by S to T into YZ.^This type family is used by S$ to describe the common effect type.Q?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^            ?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^ ^[\]XYZUVWRSTLMNOPQFGHIJKEBCD?@A=?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^            (C) 2012-2014 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> provisional non-portable Trustworthy_ Anything _ must be isomorphic to the   . [ So you can pass our \, into combinators from other lens libraries._`ab   _`ab_`ab_`ab    (C) 2012-2014 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> provisional non-portable Safe-Inferred 2346=KcrThis class is provided mostly for backwards compatibility with lens 3.8, but it can also shorten type signatures.d2This is a profunctor used internally to implement Review#It plays a role similar to that of ] or Const do for Control.Lens.Gettercd cdcdcd  (C) 2012-2014 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> experimental non-portable Trustworthye type e a s t = f a a s tf$This type is used internally by the ^9 code to provide efficient access to the two parts of a Prism.efg   efgfgeefg    (C) 2012-2014 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> experimental non-portable TrustworthyhWThis class provides a generalized notion of list reversal extended to other containers.jThis is used internally by the _T code to provide efficient access to the two functions that make up an isomorphism.hijk        ! " # $hijkjkhihijk        ! " # $(C) 2012-2014 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> experimental non-portable Safe-Inferred !"246HM lThis is an illegal  %7 used to replace the contents of a list of consecutive rd values representing each layer of a structure into the original shape that they were derived from.Attempting to FlowL something back into a shape other than the one it was taken from will fail.oThis is an illegal  used to construct a single r.rThis data type represents a path-compressed copy of one level of a source data structure. We can safely use path-compression because we know the depth of the tree.+Path compression is performed by viewing a rl as a PATRICIA trie of the paths into the structure to leaves at a given depth, similar in many ways to a `ai, but unlike a regular PATRICIA trie we do not need to store the mask bits merely the depth of the fork.5One invariant of this structure is that underneath a u node you will not find any s nodes, so s can only occur at the root. &Append a pair of r values to get a new r with path compression.As the r< type is user-visible, we do not expose this as an illegal  '' instance, and just use it directly in o as needed.vGenerate the leaf of a given o4 based on whether or not we're at the correct depth. (Walk down one constructor in a r, veering left. )Walk down one constructor in a r, veering right. *This is an illegal  %. +This is an illegal .lmnopqrstu &v ( ) * , - + . / 0 1 lmnopqrstuv rutsopqvlmnlmnopqruts &v ( ) * , - + . / 0 1(C) 2012-2014 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> experimental non-portable Trustworthy 2346=HKM w % composition of bc  2 with a   , used by d.z % composition of bc  3 with a   , used by e.}]A function with access to a index. This constructor may be useful when you need to store an  in a container to avoid ImpredicativeTypes. %index :: Indexed i a b -> i -> a -> bnThis class permits overloading of function application for things that also admit a notion of a key or index.Build a function from an  function. This is a  that is both  4 by f and  5 by g such that f is left adjoint to g^. From this you can derive a lot of structure due to the preservation of limits and colimits.- is strong enough to let us distribute every   over every Haskell  +. This is effectively a generalization of  6.^This permits us to make a decision at an outermost point about whether or not we use an index.Ideally any use of this function should be done in such a way so that you compute the same answer, but this cannot be enforced at the type level. Transform a f into an g or a h into an i, etc.  :: f s t a b -> g  3 s t a b  :: ^ s t a b -> g  3 s t a b  :: j s t a b -> k  3 s t a b  :: _ s t a b -> k  3 s t a b  :: h s a -> i  3 s a  :: l s a -> m  3 s a  ::   3 p => n (z f) s t a b -> o p (->) f s t a b Transform a f into an g or a h into an i, etc.This combinator is like > except that it handles large traversals and folds gracefully.  :: f s t a b -> g  2 s t a b  :: ^ s t a b -> g  2 s t a b  :: j s t a b -> k  2 s t a b  :: _ s t a b -> k  2 s t a b  :: h s a -> i  2 s a  :: l s a -> m  2 s a  ::   2 p => n (w f) s t a b -> p p f s t a b,wxyz{|}~ 7 8 9 : ; < = > ? @ A B C D E F G H I J K L M N O P Q Rwxyz{|}~}~z{|wxy#wxyz{|}~ 7 8 9 : ; < = > ? @ A B C D E F G H I J K L M N O P Q R(C) 2012-2014 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> experimental non-portable Trustworthy 23468=>HKM type  p g a s =  p g a a sThis is a generalized form of o that can be repeatedly cloned with less impact on its performance, and which permits the use of an arbitrary  .The extra phantom  " is used to let us lie and claim l-compatibility under limited circumstances. This is used internally to permit a number of combinators to gracefully degrade when applied to a h or l. type  p a s =  p a a sThis is a generalized form of o that can be repeatedly cloned with less impact on its performance, and which permits the use of an arbitrary   type  a s =  a a s0The indexed store can be used to characterize a j and is used by q. a b t is isomorphic to newtype  a b t =  { runContext :: forall f.   f => (a -> f b) -> f t } , and to exists s. (s, j s t a b).A  is like a j3 that has already been applied to a some structure.'This is used internally to construct a r,  or  from a singleton value.This is an indexed analogue to  S# for when you are working with an .This is the generalization of  T to an indexed comonad store.This is the generalization of  U to an indexed comonad store.This is the generalization of  V to an indexed comonad store.This is the generalization of  W to an indexed comonad store.This is the generalization of  X to an indexed comonad store.This is the generalization of  Y to an indexed comonad store.2We can always forget the rest of the structure of w: and obtain a simpler indexed comonad store model called .6This is a Bob Atkey -style 2-argument indexed comonad.It exists as a superclass for ( and expresses the functoriality of an  in its third argument.mThe notion of indexed monads is covered in more depth in Bob Atkey's "Parameterized Notions of Computation"  'http://bentnib.org/paramnotions-jfp.pdf) and that construction is dualized here.?extract from an indexed comonadic value when the indices match.9duplicate an indexed comonadic value splitting the index.;extend a indexed comonadic computation splitting the index.6This is a Bob Atkey -style 2-argument indexed functor.It exists as a superclass for ( and expresses the functoriality of an  in its third argument. ZWe can convert any  K to a function, possibly losing information about an index in the process.2 Z [ \ ] ^ _ ` a b c d e f g h i j k l m n o p! Z [ \ ] ^ _ ` a b c d e f g h i j k l m n o p(C) 2012-2014 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> experimental non-portable Trustworthy 2468=>HKM NThis alias is helpful when it comes to reducing repetition in type signatures. type  p g a t =  p g a a t  is like ), except that it provides a questionable  J instance To protect this instance it relies on the soundness of another   type, and usage conventions.@For example. This lets us write a suitably polymorphic and lazy s", but there must be a better way!NThis alias is helpful when it comes to reducing repetition in type signatures. type  p a t =  p a a t This is used to characterize a f.Ta.k.a. indexed Cartesian store comonad, indexed Kleene store comonad, or an indexed FunList. *http://twanvl.nl/blog/haskell/non-regular1A  is like a f1 that has already been applied to some structure.Where a  a b t holds an a and a function from b to t, a  a b t holds N as and a function from N bs to t , (where N might be infinite).Mnemonically, a / holds many stores and you can easily add more.This is a final encoding of .NThis alias is helpful when it comes to reducing repetition in type signatures. type  p g a t =  p g a a t  is like ), except that it provides a questionable  J instance To protect this instance it relies on the soundness of another   type, and usage conventions.@For example. This lets us write a suitably polymorphic and lazy s", but there must be a better way!NThis alias is helpful when it comes to reducing repetition in type signatures. type  p a t =  p a a t This is used to characterize a f.Ta.k.a. indexed Cartesian store comonad, indexed Kleene store comonad, or an indexed FunList. *http://twanvl.nl/blog/haskell/non-regular1A  is like a f1 that has already been applied to some structure.Where a  a b t holds an a and a function from b to t, a  a b t holds N as and a function from N bs to t , (where N might be infinite).Mnemonically, a / holds many stores and you can easily add more.This is a final encoding of .&This class is used to run the various  variants used in this library.; q r s t u v w x y z { | } ~  1 q r s t u v w x y z { | } ~  (C) 2012-2014 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> experimental non-portable Trustworthy!"246=>HKMBThis is used to generate an indexed magma from an unindexed sourceLBy constructing it this way we avoid infinite reassociations where possible.In  p g a b t, g has a nominal+ role to avoid exposing an illegal _|_ via  3, while the remaining arguments are degraded to a nominal role by the invariants of BThis is used to generate an indexed magma from an unindexed sourceTBy constructing it this way we avoid infinite reassociations in sums where possible.;This is a a non-reassociating initially encoded version of .<This provides a way to peek at the internal structure of a f or gRun a J where all the individual leaves have been converted to the expected type Generate a  using from a prefix sum. Generate a ? with leaves only while the predicate holds from left to right.'  (C) 2012-2014 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> provisional non-portable Safe-Inferred*246A   you can L ignores its argument, which it carries solely as a phantom type parameter.By the   and  5 laws, an instance of both will necessarily satisfy:   =  6 f =  =   gThe mempty equivalent for a    %  .  (C) 2012-2014 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> experimental non-portable Safe-Inferred3HM  Used for t. Used for u. Used for v. Used for w.Used internally by x and the like. The argument a" of the result should not be used!Used internally by y and the like. The argument a" of the result should not be used!A  for a    %.Obtain the minimum.Obtain the maximum. Extract the @ element. This will fairly eagerly determine that it can return  ( the moment it sees any element at all. Extract the @ element. This will fairly eagerly determine that it can return  ( the moment it sees any element at all.3 "" (C) 2012-14 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> provisional Rank2Types Safe-Inferred !"2346=HM+vThis is a convenient alias for use when you need to consume either indexed or non-indexed lens-likes based on context. type  p f =  ( p f) vThis is a convenient alias for use when you need to consume either indexed or non-indexed lens-likes based on context.FConvenient alias for constructing simple indexed lenses and their ilk.?Convenient alias for constructing indexed lenses and their ilk. 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 f s t a b =  p (->) f s t a b type  p f s t a b =  p p f s t a b type  p q f s a =  ( p q f) s a A valid  l should satisfy the laws: l   "a   l ( Procompose f g) =  Procompose (l f) (l g)  This gives rise to the laws for ,  , , !, , , , , , and 5 as well along with their index-preserving variants. type  f s t a b =  (->) f s t a b A  !,   , ... can be used instead of a !,E, ... whenever the type variables don't change upon setting a value. 9z ::  ! ({| a) a } ::  ( Int) [a] a .Note: To use this alias in your own code with  f or , you may have to turn on LiberalTypeSynonyms.2This is commonly abbreviated as a "prime" marker, e.g.   =  !.A relevant Fold (aka ) has one or more targets.An  can be used as a , but when composed with an , , or  yields an  respectively.Every  is a valid h and can be used for ~.A U describes how to retrieve multiple values in a way that can be composed with other  constructions.A  s aC provides a structure with operations very similar to those of the  typeclass, see  and the other  combinators.!By convention, if there exists a foo method that expects a  (f a), then there should be a fooOf method that takes a  s a and a value of type s.A  is a legal  that just ignores the supplied . Unlike a f 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 i and can be used for ~ like a .A T describes how to retrieve a single value in a way that can be composed with other  constructions. Unlike a ! a  is read-only. Since a , cannot be used to write back there are no !Z laws that can be applied to it. In fact, it is isomorphic to an arbitrary function from (s -> a). Moreover, a  can be used directly as a h, since it just ignores the  %. Composable asTypeOf0. Useful for constraining excess polymorphism, foo . (id :: As Int) . bar.A  .A witness that (a ~ s, b ~ t).Note: Composition with an  is index-preserving.A  .A  l is a & 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 u or use (), I will get it back: u l ( l b) "a Just b #Second, if you can extract a value a using a  l from a value s, then the value s is completely described by l and a:If u l s "a Just a then  l a "a sThese 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  Integer ! allows you to always go from a  to an Integer,, and provide you with tools to check if an Integer is a  and/or to edit one if it is. nat ::  Integer  nat =   toInteger $ \ i -> if i < 0 then Left i else Right ( fromInteger i) Now we can ask if an Integer is a .5^?natJust 5 (-5)^?natNothing We can update the ones that are:(-3,4) & both.nat *~ 2(-3,8)And we can then convert from a  to an Integer.5 ^. re nat -- :: Natural5Similarly we can use a  to  the Left half of an Either:Left "hello" & _Left %~ lengthLeft 5or to construct an Either: 5^.re _LeftLeft 5#such that if you query it with the (, you will get your original input back.5^.re _Left ^? _LeftJust 5&Another interesting way to think of a ! is as the categorical dual of a ! -- a co-!8, so to speak. This is what permits the construction of .Note: Composition with a  is index-preserving. type  =     2Isomorphism families can be composed with another ! using (.) and id.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 ::   Char 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 2 in general, so the other two laws are irrelevant. However, two   laws apply to a :  l id "a id  l f .  l g "a  l (f . g) "These can be stated more directly: l   "a   l f . ` . l g "a l (f . ` . g) You can compose a  with a ! or a  using (. ) from the Prelude" and the result is always only a  and nothing more.over traverse f [a,b,c,d][f a,f b,f c,f d]over _1 f (a,b)(f a,b)"over (traverse._1) f [(a,b),(c,d)][(f a,b),(f c,d)]over both f (a,b) (f a,f b)$over (traverse.both) f [(a,b),(c,d)][(f a,f b),(f c,f d)] type  =   An , leaves any index it is composed with alone. type  i =  ( i) Every  is a valid f or i.The } constraint is used to allow an  to be used directly as a f.The f! laws are still required to hold.In addition, the index iW should satisfy the requirement that it stays unchanged even when modifying the value a, otherwise traversals like indices break the  laws. type  =   A  can be used directly as a \ or a  (but not as a !e) and provides the ability to both read and update multiple fields, subject to some relatively weak  laws.TThese have also been known as multilenses, but they have the signature and spirit of  ::  f =>  (f a) (f b) a b 7and the more evocative name suggests their application.Most of the time the  you will want to use is just , but you can also pass any ! or   as a , and composition of a  (or ! or   ) with a  (or ! or   ) using (.) forms a valid .The laws for a  t follow from the laws for 4 as stated in "The Essence of the Iterator Pattern". t   "a    6 (t f) . t g "a  . t ( .  6 f . g) .One consequence of this requirement is that a K needs to leave the same number of elements as a candidate for subsequent  that it started with. Another testament to the strength of these laws is that the caveat expressed in section 5.5 of the "Essence of the Iterator Pattern" about exotic  instances that d the same entry multiple times was actually already ruled out by the second law in that same paper! type  =   An , leaves any index it is composed with alone. type  i =  ( i) Every  is a valid ! and a valid g. 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 v s) "a v 52) Putting back what you got doesn't change anything:  l ( l s) s "a s -3) Setting twice is the same as setting once:  l v' ( l v s) "a  l v' s =These laws are strong enough that the 4 type parameters of a !s cannot vary fully independently. For more on how they interact, read the "Why is it a Lens Family?" section of  /http://comonad.com/reader/2012/mirrored-lenses/.1There are some emergent properties of these laws:1)  l s must be injective for every s This is a consequence of law #12)  lZ must be surjective, because of law #2, which indicates that it is possible to obtain any v from some s such that  s v = sX3) Given just the first two laws you can prove a weaker form of law #3 where the values v that you are setting match:  l v ( l v s) "a  l v s Every ! can be used directly as a \ or .You can also use a ! for ~ as if it were a  or . Since every ! is a valid , the  laws are required of any ! you create: l   "a    6 (l f) . l g "a  . l ( .  6 f . g) type ! s t a b = forall f.   f =>  f s t a b 3      !3      !3 !     3      !(C) 2012-14 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> provisional Rank2Types Trustworthy2346HM>"RThis is a convenient alias when defining highly polymorphic code that takes both & and $d as appropriate. If a function takes this it is expecting one of those two things based on context.#RThis is a convenient alias when defining highly polymorphic code that takes both ' and %d as appropriate. If a function takes this it is expecting one of those two things based on context.$ type $ i =  (% i) % Running an  $ instantiates it to a concrete type.When consuming a setter directly to perform a mapping, you can use this type, but most user code will not need to use this type.&0This is a useful alias for use when consuming a .0Most user code will never have to use this type. type & =  ' ' Running a $ instantiates it to a concrete type.When consuming a setter directly to perform a mapping, you can use this type, but most user code will not need to use this type.(This 0 can be used to map over all of the values in a  .  6 "a 1 (  "a 1  ( ) "a 2 ( 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 ,  6.)This setter. can be used to modify all of the values in a  .+You sometimes have to use this rather than ( -- due to temporary insanity   is not a superclass of  .   "a 1 ) 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 1 * 8getPredicate (over contramapped (*2) (Predicate even)) 5True,getOp (over contramapped (*5) (Op show)) 100"500"YPrelude.map ($ 1) $ over (mapped . _Unwrapping' Op . contramapped) (*12) [(*2),(+1),(^3)] [24,13,1728]+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) yPMap over the argument of the result of a function -- i.e., its second argument:(mapped.argument %~ f) h x y h x (f y) + ::  (b -> r) (a -> r) a b ,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: ,   1 "a   1   , "a   Another way to view -K is that it takes a "semantic editor combinator" and transforms it into a . , :: ((a -> b) -> s -> t) ->  s t a b -Build a ,   or   depending on your choice of . - :: ((a -> b) -> s -> t) ->  s t a b .Restore ' to a full ./ Build an   from any .0 Clone an  .1Modify the target of a ! or all the targets of a  or  with a function.  6 "a 1 (  "a 1  -   1 "a   1   - "a   Given any valid  l, you can also rely on the law: 1 l f   1 l g = 1 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 1 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) 1 ::  s t a b -> (a -> b) -> s -> t 1 :: ' s t a b -> (a -> b) -> s -> t 2Replace the target of a ! or all of the targets of a  or  with a constant value. ( ) "a 2 ( set _2 "hello" (1,()) (1,"hello")set mapped () [1,2,3,4] [(),(),(),()]Note: Attempting to 2 a  or B will fail at compile time with an relatively nice error message. 2 ::  s t a b -> b -> s -> t 2 ::   s t a b -> b -> s -> t 2 :: ! s t a b -> b -> s -> t 2 ::  s t a b -> b -> s -> t 3Replace the target of a ! or all of the targets of a  or 2 with a constant value, without changing its type.%This is a type restricted version of 2), 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 3 a  or B will fail at compile time with an relatively nice error message. 3 ::  s a -> a -> s -> s 3 ::  s a -> a -> s -> s 3 ::   s a -> a -> s -> s 3 ::  s a -> a -> s -> s 4Modifies the target of a ! or all of the targets of a  or  with a user supplied function.This is an infix version of 1.  6 f "a ( 4 f  f "a  4 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]] (4) :: # s t a b -> (a -> b) -> s -> t (4) ::  & s t a b -> (a -> b) -> s -> t (4) :: !% s t a b -> (a -> b) -> s -> t (4) ::  s t a b -> (a -> b) -> s -> t 5Replace the target of a ! or all of the targets of a  or  with a constant value.This is an infix version of 2!, provided for consistency with (C). f   a "a ( 5 f   a (a,b,c,d) & _4 .~ e (a,b,c,e)(42,"world") & _1 .~ "hello"("hello","world")(a,b) & both .~ c(c,c) (5) ::  s t a b -> b -> s -> t (5) ::   s t a b -> b -> s -> t (5) :: ! s t a b -> b -> s -> t (5) ::  s t a b -> b -> s -> t 6Set the target of a !,  or  to   a value. l 6 t "a 2 l (  t) Nothing & id ?~ aJust aMap.empty & at 3 ?~ xfromList [(3,x)] (6) ::  s t a ( b) -> b -> s -> t (6) ::   s t a ( b) -> b -> s -> t (6) :: ! s t a ( b) -> b -> s -> t (6) ::  s t a ( b) -> b -> s -> t 7Set with pass-through.WThis is mostly present for consistency, but may be useful for for chaining assignments.AIf you do not need a copy of the intermediate result, then using l 5 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")])) (7) :: ! s t a b -> b -> s -> (b, t) (7) ::  $ s t a b -> b -> s -> (b, t) (7) :: !# s t a b -> b -> s -> (b, t) (7) ::  s t a b -> b -> s -> (b, t) 8Set to   a value with pass-through.WThis is mostly present for consistency, but may be useful for for chaining assignments.AIf you do not need a copy of the intermediate result, then using l 6 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")])) (8) ::  s t a ( b) -> b -> s -> (b, t) (8) ::   s t a ( b) -> b -> s -> (b, t) (8) :: ! s t a ( b) -> b -> s -> (b, t) (8) ::  s t a ( b) -> b -> s -> (b, t) 90Increment 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)] (9) ::   a =>  s a -> a -> s -> s (9) ::   a =>  s a -> a -> s -> s (9) ::   a =>   s a -> a -> s -> s (9) ::   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 **~ 10 $ (3,2) (3,1024.0) (?) ::   a =>  s a -> a -> s -> s (?) ::   a =>  s a -> a -> s -> s (?) ::   a =>   s a -> a -> s -> s (?) ::   a =>  s a -> a -> s -> s @ 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 A Logically   the target(s) of a  -valued ! or .both &&~ True $ (False, True) (False,True)both &&~ False $ (False, True) (False,False) (A) ::  s   ->   -> s -> s (A) ::  s   ->   -> s -> s (A) ::   s   ->   -> s -> s (A) ::  s   ->   -> s -> s BReplace the target of a ! or all of the targets of a  or A in our monadic state with a new value, irrespective of the old.This is an alias for (C).-execState (do assign _1 c; assign _2 d) (a,b)(c,d)execState (both .= c) (a,b)(c,c) B ::   s m =>  s a -> a -> m () B ::   s m =>   s a -> a -> m () B ::   s m =>  s a -> a -> m () B ::   s m =>  s a -> a -> m () CReplace the target of a ! or all of the targets of a  or A in our monadic state with a new value, irrespective of the old.This is an infix version of B.%execState (do _1 .= c; _2 .= d) (a,b)(c,d)execState (both .= c) (a,b)(c,c) (C) ::   s m =>  s a -> a -> m () (C) ::   s m =>   s a -> a -> m () (C) ::   s m =>  s a -> a -> m () (C) ::   s m =>  s a -> a -> m () 9It puts the state in the monad or it gets the hose again.DMap 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) (D) ::   s m =>  s a -> (a -> a) -> m () (D) ::   s m =>   s a -> (a -> a) -> m () (D) ::   s m =>  s a -> (a -> a) -> m () (D) ::   s m =>  s a -> (a -> a) -> m () (D) ::   s m => ' s s a b -> (a -> b) -> m () EReplace 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) (E) ::   s m =>  s ( a) -> a -> m () (E) ::   s m =>   s ( a) -> a -> m () (E) ::   s m =>  s ( a) -> a -> m () (E) ::   s m =>  s ( a) -> a -> m () FModify the target(s) of a  ,  ,  or  by adding a value.Example: fresh ::    3 m => m  3 fresh = do   F 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") (F) :: (  s m,   a) =>  s a -> a -> m () (F) :: (  s m,   a) =>  s a -> a -> m () (F) :: (  s m,   a) =>   s a -> a -> m () (F) :: (  s m,   a) =>  s a -> a -> m () GModify the target(s) of a  ,  ,  or  by subtracting a value.%execState (do _1 -= c; _2 -= d) (a,b) (a - c,b - d) (G) :: (  s m,   a) =>  s a -> a -> m () (G) :: (  s m,   a) =>  s a -> a -> m () (G) :: (  s m,   a) =>   s a -> a -> m () (G) :: (  s m,   a) =>  s a -> a -> m () HModify the target(s) of a  ,  ,  or  by multiplying by value.%execState (do _1 *= c; _2 *= d) (a,b) (a * c,b * d) (H) :: (  s m,   a) =>  s a -> a -> m () (H) :: (  s m,   a) =>  s a -> a -> m () (H) :: (  s m,   a) =>   s a -> a -> m () (H) :: (  s m,   a) =>  s a -> a -> m () IModify the target(s) of a  ,  ,  or  by dividing by a value.'execState (do _1 //= c; _2 //= d) (a,b) (a / c,b / d) (I) :: (  s m,   a) =>  s a -> a -> m () (I) :: (  s m,   a) =>  s a -> a -> m () (I) :: (  s m,   a) =>   s a -> a -> m () (I) :: (  s m,   a) =>  s a -> a -> m () J,Raise the target(s) of a numerically valued !,  or " to a non-negative integral power. (J) :: (  s m,   a,   e) =>  s a -> e -> m () (J) :: (  s m,   a,   e) =>  s a -> e -> m () (J) :: (  s m,   a,   e) =>   s a -> e -> m () (J) :: (  s m,   a,   e) =>  s a -> e -> m () K,Raise the target(s) of a numerically valued !,  or  to an integral power. (K) :: (  s m,   a,   e) =>  s a -> e -> m () (K) :: (  s m,   a,   e) =>  s a -> e -> m () (K) :: (  s m,   a,   e) =>   s a -> e -> m () (K) :: (  s m,   a,   e) =>  s a -> e -> m () L,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) (L) :: (  s m,   a) =>  s a -> a -> m () (L) :: (  s m,   a) =>  s a -> a -> m () (L) :: (  s m,   a) =>   s a -> a -> m () (L) :: (  s m,   a) =>  s a -> a -> m () MModify 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) (M) ::   s m =>  s   ->   -> m () (M) ::   s m =>  s   ->   -> m () (M) ::   s m =>   s   ->   -> m () (M) ::   s m =>  s   ->   -> m () NModify 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) (N) ::   s m =>  s   ->   -> m () (N) ::   s m =>  s   ->   -> m () (N) ::   s m =>   s   ->   -> m () (N) ::   s m =>  s   ->   -> m () O6Run a monadic action, and set all of the targets of a !,  or  to its result. (O) ::   s m =>   s s a b -> m b -> m () (O) ::   s m => ! s s a b -> m b -> m () (O) ::   s m =>  s s a b -> m b -> m () (O) ::   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 O bar ... will store the result in a !, , or .PSet with pass-throughKThis is useful for chaining assignment without round-tripping through your   stack. do x <-  P) ninety_nine_bottles_of_beer_on_the_wall AIf you do not need a copy of the intermediate result, then using l C d$ will avoid unused binding warnings. (P) ::   s m =>  s s a b -> b -> m b (P) ::   s m =>   s s a b -> b -> m b (P) ::   s m => ! s s a b -> b -> m b (P) ::   s m =>  s s a b -> b -> m b QSet   a value with pass-throughKThis is useful for chaining assignment without round-tripping through your   stack. do x <- ( "foo" Q) ninety_nine_bottles_of_beer_on_the_wall AIf you do not need a copy of the intermediate result, then using l E d$ will avoid unused binding warnings. (Q) ::   s m =>  s s a ( b) -> b -> m b (Q) ::   s m =>   s s a ( b) -> b -> m b (Q) ::   s m => ! s s a ( b) -> b -> m b (Q) ::   s m =>  s s a ( b) -> b -> m b R,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!!!") (R) ::  a =>  s t a a -> a -> s -> t (R) ::  a =>   s t a a -> a -> s -> t (R) ::  a => ! s t a a -> a -> s -> t (R) ::  a =>  s t a a -> a -> s -> t SModify 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) :: (  s m,  a) =>  s a -> a -> m () (S) :: (  s m,  a) =>  s a -> a -> m () (S) :: (  s m,  a) =>   s a -> a -> m () (S) :: (  s m,  a) =>  s a -> a -> m () T Write to a fragment of a larger Writer format.UThis is a generalization of  ; that alows you to modify just a portion of the resulting  .VThis is a generalization of  ; that alows you to modify just a portion of the resulting  ! with access to the index of an  .WThis is a generalization of   that alows you to  " just a portion of the resulting  .XThis is a generalization of   that alows you to  " just a portion of the resulting  ", with access to the index of an  .Y%Map with index. This is an alias for _./When you do not need access to the index, then 1' is more liberal in what it can accept. 1 l "a Y l     Y l "a 1 l   } Y ::  ) i s t a b -> (i -> a -> b) -> s -> t Y :: + i s t a b -> (i -> a -> b) -> s -> t Y :: & i s t a b -> (i -> a -> b) -> s -> t Z 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: Z   Y "a   Y   Z "a   Another way to view -K 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 4 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 (D() is more liberal in what it can accept. l D 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 () ]ERun an arrow command and use the output to set all the targets of a !,  or  to the result.] can be used very similarly to (ON), except that the type of the object being modified can change; for example: QrunKleisli action ((), (), ()) where action = assignA _1 (Kleisli (const getVal1)) >>> assignA _2 (Kleisli (const getVal2)) >>> assignA _3 (Kleisli (const getVal3)) getVal1 :: Either String Int getVal1 = ... getVal2 :: Either String Bool getVal2 = ... getVal3 :: Either String Char getVal3 = ...  has the type    ( 3,  ,  ) ] ::   p =>  ! s t a b -> p s b -> p s t ] ::   p => ! s t a b -> p s b -> p s t ] ::   p =>  s t a b -> p s b -> p s t ] ::   p =>  s t a b -> p s b -> p s t ^^ is a deprecated alias for 1._&Map with index. (Deprecated alias for Y)./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 >"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_F _  "#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_F  '&%$#"-,./0()*+12549;:<=>?@RA768BCDFGHIJKLNSMPEQOTUVWX3_YZ[\]_ ^>"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_!456789:;<=>?@ACDEFGHIJKLMNOPQRS[\(C) 2012-14 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> provisional Rank2Types Trustworthy !"2346HMY` 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 !.4This type can also be used when you need to store a !D in a container, since it is rank-1. You can turn them back into a ! with r,, or use it directly with combinators like  and ().dBuild a ! from a getter and a setter. d ::  : 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)) d! :: (s -> a) -> (s -> a -> s) ->   s a eBuild an index-preserving ! from a l and a \.f Build an  from a l and a \.g0This can be used to chain lens operations using op= syntax rather than op~+ syntax for simple non-type-changing cases.(10,20) & _1 .~ 30 & _2 .~ 40(30,40) (10,20) &~ do _1 .= 30; _2 .= 40(30,40)0This does not support type-changing assignment, e.g.(10,20) & _1 .~ "hello" ("hello",20)h(h&) can be used in one of two scenarios:When applied to a ! , it can edit the target of the !1 in a structure, extracting a functorial result.When applied to a `, it can edit the targets of the traversals, extracting an applicative summary of its actions.7For all that the definition of this combinator is just: (h) "a   _It may be beneficial to think about it as if it had these even more restricted types, however: (h) ::   f => _* s t a b -> (a -> f b) -> s -> f t (h) ::   f => !) s t a b -> (a -> f b) -> s -> f t (h) ::  % f => f# s t a b -> (a -> f b) -> s -> f t When applied to a v, it can edit the targets of the traversals, extracting a supplemental monoidal summary of its actions, by choosing  f = ((,) m) (h) :: _0 s t a b -> (a -> (r, b)) -> s -> (r, t) (h) :: !/ s t a b -> (a -> (r, b)) -> s -> (r, t) (h) ::  m => f) s t a b -> (a -> (m, b)) -> s -> (m, t) iModify the target of a !@ in the current state returning some extra information of type r or modify all targets of a f= 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)) (i) "a (   ) It may be useful to think of (iO), instead, as having either of the following more restricted type signatures: (i) ::   s m => _( s s a b -> (a -> (r, b)) -> m r (i) ::   s m => !' s s a b -> (a -> (r, b)) -> m r (i) :: (  s m,  r) => f! s s a b -> (a -> (r, b)) -> m r j]Passes the result of the left side to the function on the right side (forward pipe operator). This is the flipped version of ( 1), which is more common in languages like F# as (|>) where it is needed 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")kInfix flipped  6. (k) =    6 lThis is convenient to  ' argument order of composite functions.%over _2 ?? ("hello","world") $ length ("hello",5)(over ?? length ?? ("hello","world") $ _2 ("hello",5)mLift a !F so it can run under a function (or other corepresentable profunctor). m :: ! s t a b -> !% (e -> s) (e -> t) (e -> a) (e -> b) "(\x -> (x-1,x+1)) ^. inside _1 $ 549runState (modify (1:) >> modify (2:)) ^. (inside _2) $ [][2,1]n8Merge two lenses, getters, setters, folds or traversals. o "a n     n :: l s a -> l s' a -> l ( s s') a n :: h s a -> h s' a -> h ( s s') a n ::   s a ->   s' a ->   ( s s') a n ::  s a ->  s' a ->  ( s s') a n ::  s a ->  s' a ->  ( s s') a o This is a ! that updates either side of an &, where both sides have the same type. o "a n     Left a^.chosenaRight a^.chosenaRight "hello"^.chosen"hello"Right a & chosen *~ b Right (a * b) o :: ! ( a a) ( b b) a b o f (  a) =     f a o f (  a) =     f a pp makes a ! from two other lenses or a S from two other getters by executing them on their respective halves of a product.*(Left a, Right b)^.alongside chosen chosen(a,b)4(Left a, Right b) & alongside chosen chosen .~ (c,d)(Left c,Right d) p :: ! s t a b -> ! s' t' a' b' -> ! (s,s') (t,t') (a,a') (b,b') p ::  s t a b ->  s' t' a' b' ->  (s,s') (t,t') (a,a') (b,b') qThis ! lets you view the current pos# of any indexed store comonad and seekR to a new position. This reduces the API for working these instances to a single !.  w "a w  q  s w "a w j q  s  f w "a w j q  f q ::   ( a s) a q ::  p =>   ( p a s) a q ::  p =>   ( p g a s) a r Cloning a !G is one way to make sure you aren't given something weaker, such as a fP and can be used as a way to pass around lenses that have to be monomorphic in f.!Note: This only accepts a proper !.Zlet example l x = set (cloneLens l) (x^.cloneLens l + 1) x in example _2 ("hello",1,"you")("hello",2,"you")sClone a ! as an IndexedPreservingLens4 that just passes through whatever index is on any , ,  or  it is composed with.t Clone an  as an  with the same index.uModify the target of a ! and return the result.2When you do not need the result of the addition, () is more flexible. (u) :: !* s t a b -> (a -> b) -> s -> (b, t) (u) :: _+ s t a b -> (a -> b) -> s -> (b, t) (u) ::  b => f$ s t a b -> (a -> b) -> s -> (b, t) v-Increment the target of a numerically valued ! and return the result.2When you do not need the result of the addition, () is more flexible. (v) ::   a =>   s a -> a -> s -> (a, s) (v) ::   a =>  s a -> a -> s -> (a, s) w-Decrement the target of a numerically valued ! and return the result.5When you do not need the result of the subtraction, () is more flexible. (w) ::   a =>   s a -> a -> s -> (a, s) (w) ::   a =>  s a -> a -> s -> (a, s) x,Multiply the target of a numerically valued ! and return the result.8When you do not need the result of the multiplication, () is more flexible. (x) ::   a =>   s a -> a -> s -> (a, s) (x) ::   a =>  s a -> a -> s -> (a, s) y+Divide the target of a fractionally valued ! and return the result.2When you do not need the result of the division, () is more flexible. (y) ::   a =>   s a -> a -> s -> (a, s) (y) ::   a =>  s a -> a -> s -> (a, s) z)Raise the target of a numerically valued ! to a non-negative   power and return the result.3When you do not need the result of the operation, () is more flexible. (z) :: (  a,   e) =>   s a -> e -> s -> (a, s) (z) :: (  a,   e) =>  s a -> e -> s -> (a, s) {*Raise the target of a fractionally valued ! to an   power and return the result.3When you do not need the result of the operation, () is more flexible. ({) :: (  a,   e) =>   s a -> e -> s -> (a, s) ({) :: (  a,   e) =>  s a -> e -> s -> (a, s) |,Raise the target of a floating-point valued !. to an arbitrary power and return the result.3When you do not need the result of the operation, () is more flexible. (|) ::   a =>   s a -> a -> s -> (a, s) (|) ::   a =>  s a -> a -> s -> (a, s) } Logically   a Boolean valued ! and return the result.3When you do not need the result of the operation, () is more flexible. (}) ::   s   ->   -> s -> ( , s) (}) ::  s   ->   -> s -> ( , s) ~ Logically   a Boolean valued ! and return the result.3When you do not need the result of the operation, () is more flexible. (~) ::   s   ->   -> s -> ( , s) (~) ::  s   ->   -> s -> ( , s) Modify the target of a !, but return the old value.%When you do not need the old value, () is more flexible. () :: !* s t a b -> (a -> b) -> s -> (a, t) () :: _+ s t a b -> (a -> b) -> s -> (a, t) () ::  a => f$ s t a b -> (a -> b) -> s -> (a, t) Replace the target of a !, but return the old value.%When you do not need the old value, () is more flexible. () :: !# s t a b -> b -> s -> (a, t) () :: _$ s t a b -> b -> s -> (a, t) () ::  a => f s t a b -> b -> s -> (a, t) -Increment the target of a numerically valued ! and return the old value.%When you do not need the old value, () is more flexible.(a,b) & _1 <<+~ c (a,(a + c,b))(a,b) & _2 <<+~ c (b,(a,b + c)) () ::   a =>   s a -> a -> s -> (a, s) () ::   a =>  s a -> a -> s -> (a, s) -Decrement the target of a numerically valued ! and return the old value.%When you do not need the old value, () is more flexible.(a,b) & _1 <<-~ c (a,(a - c,b))(a,b) & _2 <<-~ c (b,(a,b - c)) () ::   a =>   s a -> a -> s -> (a, s) () ::   a =>  s a -> a -> s -> (a, s) ,Multiply the target of a numerically valued ! and return the old value.%When you do not need the old value, () is more flexible.(a,b) & _1 <<*~ c (a,(a * c,b))(a,b) & _2 <<*~ c (b,(a,b * c)) () ::   a =>   s a -> a -> s -> (a, s) () ::   a =>  s a -> a -> s -> (a, s) *Divide the target of a numerically valued ! and return the old value.%When you do not need the old value, () is more flexible.(a,b) & _1 <<//~ c (a,(a / c,b))("Hawaii",10) & _2 <<//~ 2(10.0,("Hawaii",5.0)) () :: Fractional a =>   s a -> a -> s -> (a, s) () :: Fractional a =>  s a -> a -> s -> (a, s) )Raise the target of a numerically valued !2 to a non-negative power and return the old value.%When you do not need the old value, () is more flexible. () :: (  a,   e) =>   s a -> e -> s -> (a, s) () :: (  a,   e) =>  s a -> e -> s -> (a, s) *Raise the target of a fractionally valued !/ to an integral power and return the old value.%When you do not need the old value, () is more flexible. () :: (  a,   e) =>   s a -> e -> s -> (a, s) () :: (  a,   e) =>  s a -> e -> S -> (a, s) ,Raise the target of a floating-point valued !0 to an arbitrary power and return the old value.%When you do not need the old value, () is more flexible.(a,b) & _1 <<**~ c (a,(a**c,b))(a,b) & _2 <<**~ c (b,(a,b**c)) () ::   a =>   s a -> a -> s -> (a, s) () ::   a =>  s a -> a -> s -> (a, s)  Logically   the target of a  -valued ! and return the old value.%When you do not need the old value, () is more flexible.(False,6) & _1 <<||~ True(False,(True,6))("hello",True) & _2 <<||~ False(True,("hello",True)) () ::   s   ->   -> s -> ( , s) () ::  s   ->   -> s -> ( , s)  Logically   the target of a  -valued ! and return the old value.%When you do not need the old value, () is more flexible.(False,6) & _1 <<&&~ True(False,(False,6))("hello",True) & _2 <<&&~ False(True,("hello",False)) () ::  # s Bool -> Bool -> s -> (Bool, s) () :: " s Bool -> Bool -> s -> (Bool, s) )Modify the target of a monoidally valued ! by  )ing a new value and return the old value.%When you do not need the old value, () is more flexible.(Sum a,b) & _1 <<<>~ Sum c+(Sum {getSum = a},(Sum {getSum = a + c},b))$_2 <<<>~ ", 007" $ ("James", "Bond")("Bond",("James","Bond, 007")) () ::  r =>   s r -> r -> s -> (r, s) () ::  r =>  s r -> r -> s -> (r, s) Modify the target of a ! into your Monad';s state by a user supplied function and return the result.When applied to a fM, 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'5s state to an arbitrary power and return the result.3When you do not need the result of the operation, () is more flexible. () :: (  s m,   a) =>   s a -> a -> m a () :: (  s m,   a) =>  s a -> a -> m a  Logically   a Boolean valued ! into your Monad's state and return the result.3When you do not need the result of the operation, () is more flexible. () ::   s m =>   s   ->   -> m   () ::   s m =>  s   ->   -> m    Logically   a Boolean valued ! into your Monad's state and return the result.3When you do not need the result of the operation, () is more flexible. () ::   s m =>   s   ->   -> m   () ::   s m =>  s   ->   -> m   Modify the target of a ! into your Monad'4s state by a user supplied function and return the old value that was replaced.When applied to a fK, it this will return a monoidal summary of all of the old values present.3When you do not need the result of the operation, () is more flexible. () ::   s m =>   s a -> (a -> a) -> m a () ::   s m =>  s a -> (a -> a) -> m a () :: (  s m,  b) =>  s a -> (a -> a) -> m a () ::   s m => " ((,)a) s s a b -> (a -> b) -> m aReplace the target of a ! into your Monad'3s state with a user supplied value and return the old value that was replaced.When applied to a fK, it this will return a monoidal summary of all of the old values present.3When you do not need the result of the operation, () is more flexible. () ::   s m =>   s a -> a -> m a () ::   s m =>  s a -> a -> m a () :: (  s m,  t) =>  s a -> a -> m a Modify the target of a ! into your Monad'*s state by adding a value and return the old value that was replaced.3When you do not need the result of the operation, () is more flexible. () :: (  s m,   a) =>   s a -> a -> m a () :: (  s m,   a) =>  s a -> a -> m a Modify the target of a ! into your Monad'/s state by subtracting a value and return the old value that was replaced.3When you do not need the result of the operation, () is more flexible. () :: (  s m,   a) =>   s a -> a -> m a () :: (  s m,   a) =>  s a -> a -> m a Modify the target of a ! into your Monad'.s state by multipling a value and return the old value that was replaced.3When you do not need the result of the operation, () is more flexible. () :: (  s m,   a) =>   s a -> a -> m a () :: (  s m,   a) =>  s a -> a -> m a Modify the target of a ! into your  /s state by dividing by a value and return the old value that was replaced.3When you do not need the result of the operation, () is more flexible. () :: (  s m,   a) =>   s a -> a -> m a () :: (  s m,   a) =>  s a -> a -> m a Modify the target of a ! into your Monad'>s state by raising it by a non-negative power and return the old value that was replaced.3When you do not need the result of the operation, () is more flexible. () :: (  s m,   a,   e) =>   s a -> e -> m a () :: (  s m,   a,   e) =>  s a -> a -> m a Modify the target of a ! into your Monad';s state by raising it by an integral power and return the old value that was replaced.3When you do not need the result of the operation, () is more flexible. () :: (  s m,   a,   e) =>   s a -> e -> m a () :: (  s m,   a,   e) =>  s a -> e -> m a Modify the target of a ! into your Monad'<s state by raising it by an arbitrary power and return the old value that was replaced.3When you do not need the result of the operation, () is more flexible. () :: (  s m,   a) =>   s a -> a -> m a () :: (  s m,   a) =>  s a -> a -> m a Modify the target of a ! into your Monad's state by taking its logical   with a value and return the old value that was replaced.3When you do not need the result of the operation, () is more flexible. () ::   s m =>   s   ->   -> m   () ::   s m =>  s   ->   -> m   Modify the target of a ! into your Monad's state by taking its logical   with a value and return the old value that was replaced.3When you do not need the result of the operation, () is more flexible. () ::   s m =>   s   ->   -> m   () ::   s m =>  s   ->   -> m   Modify the target of a ! into your Monad' s state by  ing a value and return the old value that was replaced.3When you do not need the result of the operation, () is more flexible. () :: (  s m,  r) =>   s r -> r -> m r () :: (  s m,  r) =>  s r -> r -> m r ,Run a monadic action, and set the target of ! to its result. () ::   s m => _ s s a b -> m b -> m b () ::   s m => ! s s a b -> m b -> m b (NB: This is limited to taking an actual ! than admitting a f= because there are potential loss of state issues otherwise. 2 a monoidal value onto the end of the target of a ! and return the result.3When you do not need the result of the operation, () is more flexible. 2 a monoidal value onto the end of the target of a ! into your Monad's state and return the result.3When you do not need the result of the operation, () is more flexible. for Arrows.Unlike ,  can't accept a simple \-, but requires a full lens, or close enough. 6overA :: Arrow ar => Lens s t a b -> ar a b -> ar s t Adjust the target of an H returning the intermediate result, or adjust all of the targets of an g6 and return a monoidal summary along with the answer.l u f "a l '<%~'   f@/When you do not need access to the index then (u() is more liberal in what it can accept.9If you do not need the intermediate result, you can use ( ) or even (). () :: 1 i s t a b -> (i -> a -> b) -> s -> (b, t) () ::  b => g+ i s t a b -> (i -> a -> b) -> s -> (b, t) Adjust the target of an > returning the old value, or adjust all of the targets of an gH and return a monoidal summary of the old values along with the answer. () :: 1 i s t a b -> (i -> a -> b) -> s -> (a, t) () ::  a => g+ i s t a b -> (i -> a -> b) -> s -> (a, t) Adjust the target of an G returning a supplementary result, or adjust all of the targets of an gL and return a monoidal summary of the supplementary results and the answer.('%%~') "a @ () ::   f => 0 i s t a b -> (i -> a -> f b) -> s -> f t () ::  % f => g* i s t a b -> (i -> a -> f b) -> s -> f t yIn particular, it is often useful to think of this function as having one of these even more restricted type signatures: () :: 6 i s t a b -> (i -> a -> (r, b)) -> s -> (r, t) () ::  r => g0 i s t a b -> (i -> a -> (r, b)) -> s -> (r, t) Adjust the target of an G returning a supplementary result, or adjust all of the targets of an gW within the current state, and return a monoidal summary of the supplementary results.l '%%=' f "a   (l  f)@ () ::   s m => 3 i s s a b -> (i -> a -> (r, b)) -> s -> m r () :: (  s m,  r) => g- i s s a b -> (i -> a -> (r, b)) -> s -> m r Adjust the target of an H returning the intermediate result, or adjust all of the targets of an gV within the current state, and return a monoidal summary of the intermediate results. () ::   s m => ) i s s a b -> (i -> a -> b) -> m b () :: (  s m,  b) => g# 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 gL 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) => g# i s s a b -> (i -> a -> b) -> m a A version of () that works on c.("hello","world")^#_2"world" A version of  that works on c.$storing _2 "world" ("hello","there")("hello","world")A version of () that works on c.!("hello","there") & _2 #~ "world"("hello","world")A version of () that works on c.!("hello","world") & _2 #%~ length ("hello",5)A version of (h) that works on c.6("hello","world") & _2 #%%~ \x -> (length x, x ++ "!")(5,("hello","world!"))A version of () that works on c.A version of () that works on c.A version of (u) that works on c."("hello","world") & _2 <#%~ length(5,("hello",5))A version of () that works on c.A version of (i) that works on c.A version of () that works on c."("hello","there") & _2 <#~ "world"("world",("hello","world"))A version of () that works on c.'There is a field for every type in the   . Very zen.[] & mapped.devoid +~ 1[]Nothing & mapped.devoid %~ absNothing  ::     a We can always retrieve a () from any type."hello"^.united()"hello" & united .~ ()"hello"Y`abcdefghijklmnopqrstuvwxyz{|}~` !`abcdefghijklmnopqrstuvwxyz{|}~`! cba`dfehijklgnopmuvwxyz{|}~rstqY`abcdefghijklmnopqrstuvwxyz{|}~Fghijkluvwxyz{|}~(C) 2012-14 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> provisional Rank2Types Safe-Inferred type  =   Deprecated for two reasons.  is now c#, and we no longer use the verbose  SimpleFoo4 naming convention, this has since been renamed to b for consistency.zThis 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 c for consistency.bcrcbr(C) 2012-14 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> provisional Rank2Types Safe-Inferred123468<=HJKM,Provides access to the 9th field of a tuple. Access the 9th field of a tuple.+Provide access to the 8th field of a tuple. Access the 8th field of a tuple.+Provide access to the 7th field of a tuple. Access the 7th field of a tuple..Provides access to the 6th element of a tuple. Access the 6th field of a tuple.,Provides access to the 5th field of a tuple. Access the 5th field of a tuple.+Provide access to the 4th field of a tuple. Access the 4th field of a tuple.,Provides access to the 3rd field of a tuple. Access the 3rd field of a tuple.,Provides access to the 2nd field of a tuple. Access the 2nd field of a tuple._2 .~ "hello" $ (1,(),3,4)(1,"hello",3,4)(1,2,3,4) & _2 *~ 3 (1,6,3,4)_2 print (1,2)2(1,())   :: (s ->  ) -> (a, s) ->       :: ( % f, . t) => (a -> f b) -> t (s, a) -> f (t (s, b))  (   ) :: ( t, ! m) => (s -> m) -> t (b, s) -> m (Provides access to 1st field of a tuple.?Access the 1st field of a tuple (and possibly change its type). (1,2)^._11_1 .~ "hello" $ (1,2) ("hello",2)(1,2) & _1 .~ "hello" ("hello",2)_1 putStrLn ("hello","world")hello ((),"world")/This can also be used on larger tuples as well:(1,2,3,4,5) & _1 +~ 41 (42,2,3,4,5)  :: ! (a,b) (a',b) a a'  :: ! (a,b,c) (a',b,c) a a'  :: ! (a,b,c,d) (a',b,c,d) a a' ...  :: !/ (a,b,c,d,e,f,g,h,i) (a',b,c,d,e,f,g,h,i) a a'  k ~(a,b) = (\b' -> (a,b'))  k b  k ~(a,b) = (\a' -> (a',b))  k a r                           ! " # $ % & ' ( ) * + , - . / 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 Pg                           ! " # $ % & ' ( ) * + , - . / 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(C) 2012-14 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> provisional Rank2Types Trustworthy246HMrThis is a convenient alias used when consuming (indexed) getters and (indexed) folds in a highly general fashion.Used to consume an i.UWhen you see this in a type signature it indicates that you can pass the function a !, , f, h, ^, _I, 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 hd in limited situations, to do so, they need to be monomorphic in what we are going to extract with . To be compatible with !, f and _. we also restricted choices of the irrelevant t and b parameters.If a function accepts a  r s a , then when r is a , then you can pass a h (or f'), otherwise you can only pass this a  or !.Build an (index-preserving) $ from an arbitrary Haskell function.  f    g "a  (g   f)  a   f "a f a a ^.to ff a("hello","world")^.to snd"world" 5^.to succ6(0, -5)^._2.to abs5  :: (s -> a) ->  s a   :: (s -> (i, a)) ->  i s a View the value pointed to by a , _ or !5 or the result of folding over all the results of a h or f" that points at a monoidal value.     "a    view (to f) af aview _2 (1,"hello")"hello"view (to succ) 56&view (_2._1) ("hello",("world","!!!"))"world"As , is commonly used to access the target of a 2 or obtain a monoidal summary of the targets of a U, It may be useful to think of it as having one of these more restricted signatures:  ::  s a -> s -> a  ::  m => h s m -> s -> m  ::  s a -> s -> a  ::   s a -> s -> a  ::  m =>  s m -> s -> m 7In a more general setting, such as when working with a   transformer stack you can use:  ::  Q s m =>  s a -> m a  :: ( Q s m,  a) => h s a -> m a  ::  Q s m =>  s a -> m a  ::  Q s m =>   s a -> m a  :: ( Q s m,  a) =>  s a -> m a -View a function of the value pointed to by a  or !G or the result of folding over the result of mapping the targets of a h or f.  l f "a  (l    f) views (to f) g ag (f a)views _2 length (1,"hello")5As , is commonly used to access the target of a 2 or obtain a monoidal summary of the targets of a U, It may be useful to think of it as having one of these more restricted signatures:  ::  s a -> (a -> r) -> s -> r  ::  m => h! s a -> (a -> m) -> s -> m  :: ! s a -> (a -> r) -> s -> r  ::   s a -> (a -> r) -> s -> r  ::  m =>  s a -> (a -> m) -> s -> m 7In a more general setting, such as when working with a   transformer stack you can use:  ::  Q s m =>  s a -> m a  :: ( Q s m,  a) => h s a -> m a  ::  Q s m =>  s a -> m a  ::  Q s m =>   s a -> m a  :: ( Q s m,  a) =>  s a -> m a  ::  Q s m =>  r s a -> (a -> r) -> m r View the value pointed to by a  or !5 or the result of folding over all the results of a h or f" that points at a monoidal values.This is the same operation as  with the arguments flipped.YThe fixity and semantics are such that subsequent field accesses can be performed with ( ). (a,b)^._2b("hello","world")^._2"world"import Data.Complex$((0, 1 :+ 2), 3)^._1._2.to magnitude2.23606797749979 () :: s ->  s a -> a () ::  m => s -> h s m -> m () :: s ->  s a -> a () :: s ->   s a -> a () ::  m => s ->  s m -> m Use the target of a !, _, or . in the current state, or use a summary of a h or f" that points to a monoidal value.evalState (use _1) (a,b)a$evalState (use _1) ("hello","world")"hello"  ::   s m =>  s a -> m a  :: (  s m,  r) => h s r -> m r  ::   s m =>  s a -> m a  ::   s m =>   s a -> m a  :: (  s m,  r) =>  s r -> m r Use the target of a !, _ or . in the current state, or use a summary of a h or f" that points to a monoidal value.,evalState (uses _1 length) ("hello","world")5  ::   s m =>  s a -> (a -> r) -> m r  :: (  s m,  r) => h s a -> (a -> r) -> m r  ::   s m =>   s a -> (a -> r) -> m r  ::   s m =>  s a -> (a -> r) -> m r  :: (  s m,  r) =>  s a -> (a -> r) -> m r  ::   s m =>  r s t a b -> (a -> r) -> m r This is a generalized form of  RD that only extracts the portion of the log that is focused on by a  . If given a  or a U then a monoidal summary of the parts of the log that are visited will be returned.  ::   w m =>  w u -> m a -> m (a, u)  ::   w m =>   w u -> m a -> m (a, u)  ::   w m =>  w u -> m a -> m (a, u)  :: (  w m,  u) =>  w u -> m a -> m (a, u)  :: (  w m,  u) =>  w u -> m a -> m (a, u)  :: (  w m,  u) =>  w u -> m a -> m (a, u) This is a generalized form of  RD that only extracts the portion of the log that is focused on by a  . If given a  or a U then a monoidal summary of the parts of the log that are visited will be returned.  ::   w m => # i w u -> m a -> m (a, (i, u))  ::   w m => $ i w u -> m a -> m (a, (i, u))  :: (  w m,  u) => % i w u -> m a -> m (a, (i, u))  :: (  w m,  u) =>  i w u -> m a -> m (a, (i, u)) This is a generalized form of  RD that only extracts the portion of the log that is focused on by a  . If given a  or a U then a monoidal summary of the parts of the log that are visited will be returned.  ::   w m => ( w u -> (u -> v) -> m a -> m (a, v)  ::   w m =>  ) w u -> (u -> v) -> m a -> m (a, v)  ::   w m => * w u -> (u -> v) -> m a -> m (a, v)  :: (  w m,  v) => * w u -> (u -> v) -> m a -> m (a, v)  :: (  w m,  v) => $ w u -> (u -> v) -> m a -> m (a, v)  :: (  w m,  v) => ( w u -> (u -> v) -> m a -> m (a, v) This is a generalized form of  RD that only extracts the portion of the log that is focused on by a  . If given a  or a U then a monoidal summary of the parts of the log that are visited will be returned.  ::   w m => - w u -> (i -> u -> v) -> m a -> m (a, v)  ::   w m => . w u -> (i -> u -> v) -> m a -> m (a, v)  :: (  w m,  v) => / w u -> (i -> u -> v) -> m a -> m (a, v)  :: (  w m,  v) => ) w u -> (i -> u -> v) -> m a -> m (a, v) View the index and value of an ( into the current environment as a pair.When applied to an  the result will most likely be a nonsensical monoidal summary of the indices tupled with a monoidal summary of the values and probably not whatever it is you wanted.-View a function of the index and value of an  into the current environment.When applied to an B the result will be a monoidal summary instead of a single answer.  "a  Use the index and value of an " into the current state as a pair.When applied to an  the result will most likely be a nonsensical monoidal summary of the indices tupled with a monoidal summary of the values and probably not whatever it is you wanted.,Use a function of the index and value of an  into the current state.When applied to an B the result will be a monoidal summary instead of a single answer.View the index and value of an  or .This is the same operation as  with the arguments flipped.YThe fixity and semantics are such that subsequent field accesses can be performed with ( ). ( ) :: s ->  i s a -> (i, a) ( ) :: s ->  i s a -> (i, a) AThe result probably doesn't have much meaning when applied to an . Coerce a  -compatible  to a  . This is useful when using a  that is not simple as a  or a .  (C) 2012-14 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> provisional non-portable TrustworthyHM KIf you see this in a signature for a function, the function is expecting a % (in practice, this usually means 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  for .  :: (b -> t) -> Review' t b  =  .  Turn a  around to get a   =  .   =  .  un (to length) # [1,2,3]3Turn a  or _ around to build a .If you have an _, B is a more powerful version of this function that will return an _ instead of a mere . 5 ^.re _LeftLeft 56 ^.re (_Left.unto succ)Left 7  "a      "a      "a      "a      ::  s t a b ->  b t  ::   s t a b ->  b t This can be used to turn an _ or  around and ? a value (or the current environment) through it the other way.  "a      .  "a   review _Left "mustard"Left "mustard"review (unto succ) 56Usually  is used in the (->)   with a  or _h, in which case it may be useful to think of it as having one of these more restricted type signatures:  ::  s a -> a -> s  ::  s a -> a -> s However, when working with a  9 transformer stack, it is sometimes useful to be able to  the current environment, in which case one of these more slightly more liberal type signatures may be beneficial to think of it as having:  ::  Q a m =>  s a -> m s  ::  Q a m =>  s a -> m s An infix alias for .  f # x "a f x l # x "a x   l #This is commonly used when using a  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 _ or  around and U a value (or the current environment) through it the other way, applying a function.  "a      ( f) g "a g   f reviews _Left isRight "mustard"Falsereviews (unto succ) (*2) 38%Usually this function is used in the (->)   with a  or _h, in which case it may be useful to think of it as having one of these more restricted type signatures:  ::  s a -> (s -> r) -> a -> r  ::  s a -> (s -> r) -> a -> r However, when working with a  9 transformer stack, it is sometimes useful to be able to  the current environment, in which case one of these more slightly more liberal type signatures may be beneficial to think of it as having:  ::  Q a m =>  s a -> (s -> r) -> m r  ::  Q a m =>  s a -> (s -> r) -> m r This can be used to turn an _ or  around and ? a value (or the current environment) through it the other way.  "a         "a  S 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 _ or  around and B the current state through it the other way, applying a function.  "a      ( f) g "a  S (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 cddc (C) 2012-14 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> provisional non-portable TrustworthyHM type APrism' =   KIf you see this in a signature for a function, the function is expecting a .Convert / to the pair of functions that characterize it.Clone a 6 so that you can reuse the same monomorphically typed  for different purposes.See r and / for examples of why you might want to do this.Build a ^. t a is used instead of  a to permit the types of s and t to differ. This is usually used to build a *, when you have to use an operation like  which already returns a .Use a " as a kind of first-class pattern.  ::  s t a b -> !$ (t -> r) (s -> r) (b -> r) (a -> r)%Given a pair of prisms, project sums. Viewing a  as a co-!,, this combinator can be seen to be dual to p.Use a " to work over part of a structure.lift a  through a Z functor, giving a Prism that matches only if all the elements of the container match the .Check to see if this  doesn't match.isn't _Left (Right 12)Trueisn't _Left (Left 12)Falseisn't _Empty []False!Retrieve the value targeted by a W or return the original value while allowing the type to change if it does not match.matching _Just (Just 12)Right 12@matching _Just (Nothing :: Maybe Int) :: Either (Maybe Bool) Int Left NothingThis  provides a  for tweaking the   half of an :over _Left (+1) (Left 2)Left 3over _Left (+1) (Right 2)Right 2Right 42 ^._Left :: String""Left "hello" ^._Left"hello">It also can be turned around to obtain the embedding into the   half of an : _Left # 5Left 5 5^.re _LeftLeft 5This  provides a  for tweaking the   half of an :over _Right (+1) (Left 2)Left 2over _Right (+1) (Right 2)Right 3Right "hello" ^._Right"hello"!Left "hello" ^._Right :: [Double][]>It also can be turned around to obtain the embedding into the   half of an : _Right # 5Right 5 5^.re _RightRight 5This  provides a ) for tweaking the target of the value of   in a .over _Just (+1) (Just 2)Just 3Unlike  this is a *, and so you can use it to inject as well: _Just # 5Just 5 5^.re _JustJust 5Interestingly, m ^?  "a m Just x ^? _JustJust xNothing ^? _JustNothingThis  provides the  of a  T in a .Nothing ^? _NothingJust ()Just () ^? _NothingNothing3But you can turn it around and use it to construct  T as well: _Nothing # ()Nothing & is a logically uninhabited data type. This is a  that will always fail to match.This 0 compares for exact equality with a given value. only 4 # ()4 5 ^? only 4NothingThis R compares for approximate equality with a given value and a predicate for testing.To comply with the " laws the arguments you supply to  nearly a p are somewhat constrained. We assume p x holds iff x "a a-. Under that assumption then this is a valid .This is useful when working with a type where you can test equality for only a subset of its values, and the prism selects such a value.7This is an improper prism for text formatting based on  U and  V.This  is "improper" in the sense that it normalizes the text formatting, but round tripping is idempotent given sane 'Read'/'Show' instances. _Show # 2"2""EQ" ^? _Show :: Maybe OrderingJust EQ  "a   W  readMaybe   (C) 2012-14 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> provisional Rank2Types Trustworthy 2468=KThis class allows us to use O part of the environment, changing the environment supplied by many different   transformers. Unlike 4 this can change the environment of a deeply nested   transformer. Also, unlike ", this can be used with any valid , 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 C, but can in many cases change the type of the environment as well.3This is commonly used to lift actions in a simpler  X   into a   with a larger environment type.)This can be used to edit pretty much any  - transformer stack with an environment in it:(1,2) & magnify _2 (+1)33flip Reader.runReader (1,2) $ magnify _1 Reader.ask1Dflip Reader.runReader (1,2,[10..20]) $ magnify (_3._tail) Reader.ask[11,12,13,14,15,16,17,18,19,20]  ::  s a -> (a -> r) -> s -> r  ::  r =>  s a -> (a -> r) -> s -> r  ::  w =>  s t ->  Y t w st c ->  Y s w st c  :: ( w,  c) =>  s a ->  Y a w st c ->  Y s w st c ... This class allows us to use  in, changing the  Z supplied by many different  , transformers, potentially quite deep in a   transformer stack.!Run a monadic action in a larger  Z" than it was defined in, using a   or .3This is commonly used to lift actions in a simpler  Z   into a  Z   with a larger  Z type.When applied to a  fn over multiple values, the actions for each target are executed sequentially and the results are aggregated.)This can be used to edit pretty much any   transformer stack with a  Z in it!-flip State.evalState (a,b) $ zoom _1 $ use ida.flip State.execState (a,b) $ zoom _1 $ id .= c(c,b)<flip State.execState [(a,b),(c,d)] $ zoom traverse $ _2 %= f[(a,f b),(c,f d)]<flip State.runState [(a,b),(c,d)] $ zoom traverse $ _2 <%= f((f b <> f d <> mempty,[(a,f b),(c,f d)])/flip State.evalState (a,b) $ zoom both (use id)a <> b  ::   m =>   s t ->  [ t m a ->  [ s m a  :: (  m,  c) =>  s t ->  [ t m c ->  [ s m c  :: (  m,  w) =>   s t ->  \ r w t m c ->  \ r w s m c  :: (  m,  w,  c) =>  s t ->  \ r w t m c ->  \ r w s m c  :: (  m,  w,  ] e) =>   s t ->  ^ e ( \ r w t m) c ->  ^ e ( \ r w s m) c  :: (  m,  w,  c,  ] e) =>  s t ->  ^ e ( \ r w t m) c ->  ^ e ( \ r w s m) c ... _  =   ` a b _ c d e f g h i j k l m n o ` a b _ c d e f g h i j k l m n o(C) 2012-14 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> provisionalportable Safe-InferredHMThis % can be used to change the type of a  p( by mapping the elements to new values. Sadly, you can't create a valid  for a  p., 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 , h, f, j or _.setOf folded ["hello","world"]fromList ["hello","world"]5setOf (folded._2) [("hello",1),("world",2),("!!!",3)]fromList [1,2,3]  ::  s a -> s ->  p a  ::  q a =>  s a -> s ->  p a  ::  s a -> s ->  p a  ::   s a -> s ->  p a  ::  q a =>  s a -> s ->  p a (C) 2012-14 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> provisionalportable TrustworthyHMThis % can be used to change the type of a  r( 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 , h, f, j or _.  ::  s a =>  s a -> s ->  r a  :: ( t a,  s a) =>  s a -> s ->  r a  ::  s a =>  s a -> s ->  r a  ::  s a =>   s a -> s ->  r a  :: ( t a,  s a) =>  s a -> s ->  r a (C) 2012-14 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> provisional Rank2Types Trustworthy2346HMa Obtain a ( by lifting an operation that returns a  u 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  u indexed by ordinal position.Just 3^..folded[3]Nothing^..folded[][(1,2),(3,4)]^..folded.both [1,2,3,4]  Obtain a  from any  u indexed by ordinal position. Form a  by repeating the input forever.  v "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.  w 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 non-empty  into a , that loops over its elements over and over.0timingOut $ [1,2,3]^..taking 7 (cycled traverse)[1,2,3,1,2,3,1]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   f returns an infinite  of repeated applications of f to x.  ( f) a "a  x f a  Obtain an - that can be composed with to filter another !,  , ,  (or ).Note: This is not a legal L, unless you are very careful not to invalidate the predicate on the target.Note: This is also not a legal O, unless you are very careful not to inject a value that matches the predicate.*As a counter example, consider that given evens =   y the second  law is violated:  evens  z    evens  z  {  evens ( z    z) ,So, in order for this to qualify as a legal K you can only use it for actions that preserve the result of the predicate![1..10]^..folded.filtered even [2,4,6,8,10]-This will preserve an index if it is present. Obtain a ! by taking elements from another , !,  ,  or  while a predicate holds.  | p "a  ( p  ) 5timingOut $ toListOf (takingWhile (<=3) folded) [1..][1,2,3]  :: (a ->  ) ->  s a ->  s a  :: (a ->  ) ->  s a ->  s a  :: (a ->  ) ->  s a ->  s a -- * See note below  :: (a ->  ) ->   s a ->  s a -- * See note below  :: (a ->  ) ->  s a ->  s a -- * See note below  :: (a ->  ) ->  s a ->  s a -- * See note below  :: (a ->  ) ->  i s a ->  i s a -- * See note below  :: (a ->  ) ->  i s a ->  i s a -- * See note below  :: (a ->  ) ->  i s a ->  i s a  :: (a ->  ) ->  i s a ->  i s a Note: When applied to a , 3 yields something that can be used as if it were a , but which is not a w per the laws, unless you are careful to ensure that you do not invalidate the predicate when writing back through it. Obtain a # by dropping elements from another , !,  ,  or  while a predicate holds.  } p "a  ( p  ) ,toListOf (droppingWhile (<=3) folded) [1..6][4,5,6]-toListOf (droppingWhile (<=3) folded) [1,6,1][6,1]  :: (a ->  ) ->  s a ->  s a  :: (a ->  ) ->  s a ->  s a  :: (a ->  ) ->  s a -> ! s a -- see notes  :: (a ->  ) ->   s a -> ! s a -- see notes  :: (a ->  ) ->  s a -> ! s a -- see notes  :: (a ->  ) ->  s a -> ! s a -- see notes   :: (a ->  ) ->  s a ->  s a -- see notes  :: (a ->  ) ->  s a ->  s a -- see notes  :: (a ->  ) ->  s a ->  s a  :: (a ->  ) ->  s a ->  s a   :: (a ->  ) ->  i s a ->  i s a -- see notes  :: (a ->  ) ->  i s a ->  i s a -- see notes  :: (a ->  ) ->  i s a ->  i s a  :: (a ->  ) ->  i s a ->  i s a kNote: Many uses of this combinator will yield something that meets the types, but not the laws of a valid  or . The  and  laws are only satisfied if the new values you assign also pass the predicate! Otherwise subsequent traversals will visit fewer elements and  fusion is not sound.A  over the individual  ~ of a  .  ::       ::        ::   3      ::   3     %Note: This function type-checks as a  but it doesn't satisfy the laws. It's only valid to use it when you don't insert any whitespace characters while traversing, and if your original  u contains only isolated space characters (and no other characters that count as space, such as non-breaking spaces).A  over the individual   of a  .  ::       ::        ::   3      ::   3     %Note: This function type-checks as a  but it doesn't satisfy the laws. It's only valid to use it when you don't insert any newline characters while traversing, and if your original  , contains only isolated newline characters..Map each part of a structure viewed through a !, ,  or % to a monoid and combine the results.:foldMapOf (folded . both . _Just) Sum [(Just 21, Just 21)]Sum {getSum = 42}  =      "a  P l =  l   }   ::  s a -> (a -> r) -> s -> r  ::  r => ! s a -> (a -> r) -> s -> r  ::   s a -> (a -> r) -> s -> r  :: ! s a -> (a -> r) -> s -> r  ::  r =>  s a -> (a -> r) -> s -> r  ::  r =>  s a -> (a -> r) -> s -> r  ::  r s a -> (a -> r) -> s -> r 5Combine the elements of a structure viewed through a !, ,  or  using a monoid.>foldOf (folded.folded) [[Sum 1,Sum 4],[Sum 8, Sum 8],[Sum 21]]Sum {getSum = 42}  =      "a   ::  s m -> s -> m  ::  m =>  s m -> s -> m  ::   s m -> s -> m  ::  s m -> s -> m  ::  m =>  s m -> s -> m  ::  m =>  s m -> s -> m 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  Q l "a  l   }  ::  ( ( 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.LensBanyOf biplate (== "world") (((),2::Int),"hello",("world",11::Int))True  "a     S l "a  l   }  ::  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     T l =  l   }  ::  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   only if no targets of a  satisfy a predicate.2noneOf each (is _Nothing) (Just 3, Just 4, Just 5)True3noneOf (folded.folded) (<10) [[13,99,20],[3,71,42]]False U l =  l   }  ::  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     [This operation may be more strict than you would expect. If you want a lazier version use ala        ::   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 !Calculate the   of every number targeted by a .sumOf both (5,6)11sumOf folded [1,2,3,4]10!sumOf (folded.both) [(1,2),(3,4)]10import Data.Data.Lens8sumOf biplate [(1::Int,[]),(2,[(3::Int,4::Int)])] :: Int10  "a !   [This operation may be more strict than you would expect. If you want a lazier version use ala      ! _1 ::   a => (a, b) -> a ! (    ) :: ( u 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) ->  a c -> f ()  V l "a " l   } !The rather specific signature of "5 allows it to be used as if the signature was any of: " ::   f => $ s a -> (a -> f r) -> s -> f () " ::  % f => & s a -> (a -> f r) -> s -> f () " ::   f =>  % s a -> (a -> f r) -> s -> f () " ::   f => & s a -> (a -> f r) -> s -> f () " ::  % f =>  s a -> (a -> f r) -> s -> f () " ::  % f => $ s a -> (a -> f r) -> s -> f () #&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  %.   "a #   &forOf_ both ("hello","world") putStrLnhelloworld!The rather specific signature of #5 allows it to be used as if the signature was any of: W l s "a # l s   } # ::   f => $ s a -> s -> (a -> f r) -> f () # ::  % f => & s a -> s -> (a -> f r) -> f () # ::   f =>  % s a -> s -> (a -> f r) -> f () # ::   f => & s a -> s -> (a -> f r) -> f () # ::  % f =>  s a -> s -> (a -> f r) -> f () # ::  % f => $ s a -> s -> (a -> f r) -> f () $&Evaluate each action in observed by a 9 on a structure from left to right, ignoring the results.   "a $   5sequenceAOf_ both (putStrLn "hello",putStrLn "world")helloworld $ ::   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 g on a structure to a monadic action, evaluate these actions from left to right, and ignore the results.'mapMOf_ both putStrLn ("hello","world")helloworld x "a %   % ::   m => $ s a -> (a -> m r) -> s -> m () % ::   m => & s a -> (a -> m r) -> s -> m () % ::   m =>  % s a -> (a -> m r) -> s -> m () % ::   m => & s a -> (a -> m r) -> s -> m () % ::   m =>  s a -> (a -> m r) -> s -> m () % ::   m => $ s a -> (a -> m r) -> s -> m () && is %# with two of its arguments flipped.'forMOf_ both ("hello","world") putStrLnhelloworld  "a &   & ::   m => $ s a -> s -> (a -> m r) -> m () & ::   m => & s a -> s -> (a -> m r) -> m () & ::   m =>  % s a -> s -> (a -> m r) -> m () & ::   m => & s a -> s -> (a -> m r) -> m () & ::   m =>  s a -> s -> (a -> m r) -> m () & ::   m => $ s a -> s -> (a -> m r) -> m () '-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 '   ' ::   m =>  s (m a) -> s -> m () ' ::   m =>  s (m a) -> s -> m () ' ::   m =>   s (m a) -> s -> m () ' ::   m =>  s (m a) -> s -> m () ' ::   m =>  s (m a) -> s -> m () ' ::   m =>  s (m a) -> s -> m () (1The sum of a collection of actions, generalizing -.asumOf both ("hello","world") "helloworld",asumOf each (Nothing, Just "hello", Nothing) Just "hello"   "a (   ( ::   f =>  s (f a) -> s -> f a ( ::   f =>  s (f a) -> s -> f a ( ::   f =>   s (f a) -> s -> f a ( ::   f =>  s (f a) -> s -> f a ( ::   f =>  s (f a) -> s -> f a ( ::   f =>  s (f a) -> s -> f a )1The sum of a collection of actions, generalizing -.msumOf both ("hello","world") "helloworld",msumOf each (Nothing, Just "hello", Nothing) Just "hello"   "a )   ) ::   m =>  s (m a) -> s -> m a ) ::   m =>  s (m a) -> s -> m a ) ::   m =>   s (m a) -> s -> m a ) ::   m =>  s (m a) -> s -> m a ) ::   m =>  s (m a) -> s -> m a ) ::   m =>  s (m a) -> s -> m a */Does the element occur anywhere within a given  of the structure?%elemOf both "hello" ("hello","world")True   "a *   * ::  t a =>  s a -> a -> s ->   * ::  t a =>  s a -> a -> s ->   * ::  t a =>   s a -> a -> s ->   * ::  t a =>  s a -> a -> s ->   * ::  t a =>  s a -> a -> s ->   * ::  t 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   "a +   + ::  t a =>  s a -> a -> s ->   + ::  t a =>  s a -> a -> s ->   + ::  t a =>  s a -> a -> s ->   + ::  t a =>   s a -> a -> s ->   + ::  t a =>  s a -> a -> s ->   + ::  t a =>  s a -> a -> s ->   ,)Map a function over all the targets of a 4 of a container and concatenate the resulting lists.)concatMapOf both (\x -> [x, x + 1]) (1,3) [1,2,3,4]   "a ,   , :: # s a -> (a -> [r]) -> s -> [r] , :: % s a -> (a -> [r]) -> s -> [r] , ::  $ s a -> (a -> [r]) -> s -> [r] , :: % s a -> (a -> [r]) -> s -> [r] , ::  s a -> (a -> [r]) -> s -> [r] -+Concatenate all of the lists targeted by a  into a longer list.concatOf both ("pan","ama")"panama"   "a -   - "a  - ::  s [r] -> s -> [r] - ::  s [r] -> s -> [r] - ::  s [r] -> s -> [r] - ::   s [r] -> s -> [r] - ::  s [r] -> s -> [r] .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 . (     ) :: ( u f,  u g) => f (g a) ->  3 . ::  s a -> s ->  3 . ::  s a -> s ->  3 . ::   s a -> s ->  3 . ::  s a -> s ->  3 . ::  s a -> s ->  3 /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 1I instead, which can deal more gracefully with heavily left-biased trees.Left 4 ^?_LeftJust 4Right 4 ^?_LeftNothing"world" ^? ix 3Just 'l'"world" ^? ix 20Nothing (/) "a   G (/ ) :: s ->  s a ->  a (/ ) :: s ->  s a ->  a (/ ) :: s ->   s a ->  a (/ ) :: s ->  s a ->  a (/ ) :: s ->  s a ->  a 0Perform an *UNSAFE*   of a  or  assuming that it is there.Left 4 ^?! _Left4"world" ^?! ix 3'l' (0 ) :: s ->  s a -> a (0 ) :: s ->  s a -> a (0 ) :: s ->   s a -> a (0 ) :: s ->  s a -> a (0 ) :: s ->  s a -> a 1 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 1 ::  s a -> s ->  a 1 ::  s a -> s ->  a 1 ::   s a -> s ->  a 1 ::  s a -> s ->  a 1 ::  s a -> s ->  a 2 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 2 ::  s a -> s ->  a 2 ::  s a -> s ->  a 2 ::   s a -> s ->  a 2 ::  s a -> s ->  a 2 ::  s a -> s ->  a 3Returns   if this  or ' has no targets in the given container.Note: 3 on a valid  , ! or  should always return  .   "a 3   /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 3 (    _1    ) :: ( u f,  u g) => f (g a, b) ->   3 ::  s a -> s ->   3 ::  s a -> s ->   3 ::  s a -> s ->   3 ::   s a -> s ->   3 ::  s a -> s ->   4Returns   if this  or ( has any targets in the given container.5A more "conversational" alias for this combinator is C.Note: 4 on a valid  , ! or  should always return  .   "a 4   /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 4 (    _1    ) :: ( u f,  u g) => f (g a, b) ->   4 ::  s a -> s ->   4 ::  s a -> s ->   4 ::  s a -> s ->   4 ::   s a -> s ->   4 ::  s a -> s ->   52Obtain the maximum element (if any) targeted by a  or  safely.Note: 5 on a valid  , ! or  will always return   a value.maximumOf traverse [1..10]Just 10maximumOf traverse []Nothing0maximumOf (folded.filtered even) [1,4,3,6,7,9,2]Just 6   "a   (  "empty")   5   bIn the interest of efficiency, This operation has semantics more strict than strictly necessary.   ( l ), has lazier semantics but could leak memory. 5 ::  q a =>  s a -> s ->  a 5 ::  q a =>  s a -> s ->  a 5 ::  q a =>  s a -> s ->  a 5 ::  q a =>   s a -> s ->  a 5 ::  q a =>  s a -> s ->  a 62Obtain the minimum element (if any) targeted by a  or  safely.Note: 6 on a valid  , ! or  will always return   a value.minimumOf traverse [1..10]Just 1minimumOf traverse []Nothing0minimumOf (folded.filtered even) [1,4,3,6,7,9,2]Just 2   "a   (  "empty")   6   bIn the interest of efficiency, This operation has semantics more strict than strictly necessary.   ( l ), has lazier semantics but could leak memory. 6 ::  q a =>  s a -> s ->  a 6 ::  q a =>  s a -> s ->  a 6 ::  q a =>  s a -> s ->  a 6 ::  q a =>   s a -> s ->  a 6 ::  q a =>  s a -> s ->  a 72Obtain the maximum element (if any) targeted by a , , !,  , or  according to a user supplied  .EmaximumByOf traverse (compare `on` length) ["mustard","relish","ham"]Just "mustard"`In the interest of efficiency, This operation has semantics more strict than strictly necessary.  cmp "a   (  "empty")   7   cmp 7 ::  s a -> (a -> a ->   ) -> s ->  a 7 ::  s a -> (a -> a ->   ) -> s ->  a 7 ::  s a -> (a -> a ->   ) -> s ->  a 7 ::   s a -> (a -> a ->   ) -> s ->  a 7 ::  s a -> (a -> a ->   ) -> s ->  a 82Obtain the minimum element (if any) targeted by a , , !,   or  according to a user supplied  .`In the interest of efficiency, This operation has semantics more strict than strictly necessary.EminimumByOf traverse (compare `on` length) ["mustard","relish","ham"] Just "ham"   cmp "a   (  "empty")   8   cmp 8 ::  s a -> (a -> a ->   ) -> s ->  a 8 ::  s a -> (a -> a ->   ) -> s ->  a 8 ::  s a -> (a -> a ->   ) -> s ->  a 8 ::   s a -> (a -> a ->   ) -> s ->  a 8 ::  s a -> (a -> a ->   ) -> s ->  a 9The 9 function takes a ! (or ,  , , or n), a predicate and a structure and returns the leftmost element of the structure matching the predicate, or  T if there is no such element.findOf each even (1,3,4,6)Just 4findOf folded even [1,3,5,7]Nothing 9 ::  s a -> (a ->   ) -> s ->  a 9 ::  s a -> (a ->   ) -> s ->  a 9 ::  s a -> (a ->   ) -> s ->  a 9 ::   s a -> (a ->   ) -> s ->  a 9 ::  s a -> (a ->   ) -> s ->  a   "a 9   [ l "a 9 l   } 8A simpler version that didn't permit indexing, would be: 9 ::  (  ( a)) s a -> (a ->   ) -> s ->  a 9 l p =  l (a y -> if p a then   a else y)  T :The : function takes a ! (or ,  , , or ), a monadic predicate and a structure and returns in the monad the leftmost element of the structure matching the predicate, or  T if there is no such element.PfindMOf each ( \x -> print ("Checking " ++ show x) >> return (even x)) (1,3,4,6) "Checking 1" "Checking 3" "Checking 4"Just 4PfindMOf each ( \x -> print ("Checking " ++ show x) >> return (even x)) (1,3,5,7) "Checking 1" "Checking 3" "Checking 5" "Checking 7"Nothing : :: (  m,  s a) -> (a -> m   ) -> s -> m ( a) : :: (  m,  s a) -> (a -> m   ) -> s -> m ( a) : :: (  m,  s a) -> (a -> m   ) -> s -> m ( a) : :: (  m,   s a) -> (a -> m   ) -> s -> m ( a) : :: (  m,  s a) -> (a -> m   ) -> s -> m ( a)  :  A :: (Monad m, Foldable f) => (a -> m Bool) -> f a -> m (Maybe a) \ l "a : l   } 8A simpler version that didn't permit indexing, would be: : :: Monad m =>  (  (m ( a))) s a -> (a -> m   ) -> s -> m ( a) : l p = * l (a y -> p a >>= x -> if x then return (  a) else y) $ return  T ; A variant of \ that has no base case and thus may only be applied to lenses and structures such that the !. views at least one element of the structure.foldr1Of each (+) (1,2,3,4)10 ; l f "a   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 \ that has no base case and thus may only be applied to lenses and structures such that the !- views at least one element of the structure.foldl1Of each (+) (1,2,3,4)10 < l f "a   f    l  "a <   < :: $ 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 =5Strictly 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 >MFold 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 = that has no base case and thus may only be applied to folds and structures such that the fold views at least one element of the structure. ; l f "a   f    l ? :: $ 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 > that has no base case and thus may only be applied to folds and structures such that the fold views at least one element of the structure. @ l f "a  f    l @ :: $ 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 AbMonadic fold over the elements of a structure, associating to the right, i.e. from right to left.  "a A   A ::   m => - s a -> (a -> r -> m r) -> r -> s -> m r A ::   m => / s a -> (a -> r -> m r) -> r -> s -> m r A ::   m => / s a -> (a -> r -> m r) -> r -> s -> m r A ::   m =>  . s a -> (a -> r -> m r) -> r -> s -> m r A ::   m => ) s a -> (a -> r -> m r) -> r -> s -> m r BaMonadic fold over the elements of a structure, associating to the left, i.e. from left to right.  "a B   B ::   m => - s a -> (r -> a -> m r) -> r -> s -> m r B ::   m => / s a -> (r -> a -> m r) -> r -> s -> m r B ::   m => / s a -> (r -> a -> m r) -> r -> s -> m r B ::   m =>  . s a -> (r -> a -> m r) -> r -> s -> m r B ::   m => ) s a -> (r -> a -> m r) -> r -> s -> m r CCheck 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 C ::  s a -> s ->   C ::  s a -> s ->   C ::  s a -> s ->   C ::   s a -> s ->   C ::  s a -> s ->   DCheck to see if this  or  has no matches.hasn't _Left (Right 12)Truehasn't _Left (Left 12)FalseEThis converts a  to a 5 that returns the first element, if it exists, as a . E ::  s a ->  s ( a) E ::  s a ->  s ( a) E ::   s a ->  s ( a) E ::  ! s a ->  s ( a) E ::    s a ->  s ( a) E ::   s a ->  s ( a) FThis converts an  to an @ that returns the first index and element, if they exist, as a . F ::  i s a ->  s ( (i, a)) F ::  i s a ->  s ( (i, a)) F ::  ( i) s a ->  s ( (i, a)) F ::  ( i) s a ->  s ( (i, a)) G'Retrieve the first value targeted by a  or  (or   the result from a  or ! ). See also (/).       "a G   This is usually applied in the  X  (->) s. G =    E  G ::  s a -> s ->  a G ::  s a -> s ->  a G ::   s a -> s ->  a G ::  s a -> s ->  a G ::  s a -> s ->  a OHowever, it may be useful to think of its full generality when working with a  transformer stack: G ::  Q s m =>  s a -> m ( a) G ::  Q s m =>  s a -> m ( a) G ::  Q s m =>   s a -> m ( a) G ::  Q s m =>  s a -> m ( a) G ::  Q s m =>  s a -> m ( a) H1Retrieve the first index and value targeted by a  or  (or   the result from a  or ! ). See also (c). H =    F This is usually applied in the  X  (->) s. H ::  i s a -> s ->  (i, a) H ::  i s a -> s ->  (i, a) H ::  i s a -> s ->  (i, a) H ::  i s a -> s ->  (i, a) OHowever, it may be useful to think of its full generality when working with a  transformer stack: H ::  Q s m =>  s a -> m ( (i, a)) H ::  Q s m =>  s a -> m ( (i, a)) H ::  Q s m =>  s a -> m ( (i, a)) H ::  Q s m =>  s a -> m ( (i, a)) I5Retrieve a function of the first value targeted by a  or  (or   the result from a  or !).This is usually applied in the  X  (->) s.J@Retrieve a function of the first index and value targeted by an  or  (or   the result from an  or ). See also (c). J =    F This is usually applied in the  X  (->) s. J :: $ i s a -> (i -> a -> r) -> s ->  r J :: & i s a -> (i -> a -> r) -> s ->  r J :: % i s a -> (i -> a -> r) -> s ->  r J ::  i s a -> (i -> a -> r) -> s ->  r OHowever, it may be useful to think of its full generality when working with a  transformer stack: J ::  Q s m => " i s a -> (i -> a -> r) -> m ( r) J ::  Q s m => $ i s a -> (i -> a -> r) -> m ( r) J ::  Q s m => # i s a -> (i -> a -> r) -> m ( r) J ::  Q s m =>  i s a -> (i -> a -> r) -> m ( r) K'Retrieve the first value targeted by a  or  (or   the result from a  or !) into the current state. K =    E K ::   s m =>  s a -> m ( a) K ::   s m =>  s a -> m ( a) K ::   s m =>   s a -> m ( a) K ::   s m =>  s a -> m ( a) K ::   s m =>  s a -> m ( a) L2Retrieve the first index and value targeted by an  or  (or   the index and result from an  or ) into the current state. L =    F L ::   s m =>  i s a -> m ( (i, a)) L ::   s m =>  i s a -> m ( (i, a)) L ::   s m =>  i s a -> m ( (i, a)) L ::   s m =>  i s a -> m ( (i, a)) M5Retrieve a function of the first value targeted by a  or  (or   the result from a  or !) into the current state. M =    E M ::   s m =>  s a -> (a -> r) -> m ( r) M ::   s m =>  s a -> (a -> r) -> m ( r) M ::   s m =>   s a -> (a -> r) -> m ( r) M ::   s m =>  s a -> (a -> r) -> m ( r) M ::   s m =>  s a -> (a -> r) -> m ( r) N@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. N =    F N ::   s m => " i s a -> (i -> a -> r) -> m ( r) N ::   s m => $ i s a -> (i -> a -> r) -> m ( r) N ::   s m => # i s a -> (i -> a -> r) -> m ( r) N ::   s m =>  i s a -> (i -> a -> r) -> m ( r) OThis allows you to # the elements of a pretty much any $ construction in the opposite order.This will preserve indexes on }4 types and will give you the elements of a (finite)  or  in the opposite order."This has no practical impact on a , , ! or  .NB: To write back through an  , you want to use '. Similarly, to write back through an , you want to use .PFold 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 P l     P :: & i s a -> (i -> a -> m) -> s -> m P ::  m => ( i s a -> (i -> a -> m) -> s -> m P :: ' i s a -> (i -> a -> m) -> s -> m P ::  m => " i s a -> (i -> a -> m) -> s -> m QJRight-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 Q l     Q :: 0 i s a -> (i -> a -> r -> r) -> r -> s -> r Q :: 2 i s a -> (i -> a -> r -> r) -> r -> s -> r Q :: 1 i s a -> (i -> a -> r -> r) -> r -> s -> r Q :: , i s a -> (i -> a -> r -> r) -> r -> s -> r RMLeft-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 R l     R :: 0 i s a -> (i -> r -> a -> r) -> r -> s -> r R :: 2 i s a -> (i -> r -> a -> r) -> r -> s -> r R :: 1 i s a -> (i -> r -> a -> r) -> r -> s -> r R :: , i s a -> (i -> r -> a -> r) -> r -> s -> r S4Return 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 S l     S ::  i s a -> (i -> a ->   ) -> s ->   S ::  i s a -> (i -> a ->   ) -> s ->   S ::  i s a -> (i -> a ->   ) -> s ->   S ::  i s a -> (i -> a ->   ) -> s ->   T5Return 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 T l     T ::  i s a -> (i -> a ->   ) -> s ->   T ::  i s a -> (i -> a ->   ) -> s ->   T ::  i s a -> (i -> a ->   ) -> s ->   T ::  i s a -> (i -> a ->   ) -> s ->   U=Return whether or not none of the elements viewed through an  or * satisfy a predicate, with access to the i.-When you don't need access to the index then % is more flexible in what it accepts.  l "a U l     U ::  i s a -> (i -> a ->   ) -> s ->   U ::  i s a -> (i -> a ->   ) -> s ->   U ::  i s a -> (i -> a ->   ) -> s ->   U ::  i s a -> (i -> a ->   ) -> s ->   VTraverse 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     V ::   f => + i s a -> (i -> a -> f r) -> s -> f () V ::  % f => - i s a -> (i -> a -> f r) -> s -> f () V ::   f => , i s a -> (i -> a -> f r) -> s -> f () V ::  % f => ' i s a -> (i -> a -> f r) -> s -> f () WTraverse the targets of an  or P with access to the index, discarding the results (with the arguments flipped). W "a     V -When you don't need access to the index then #% is more flexible in what it accepts. # l a "a W l a     W ::   f => + i s a -> s -> (i -> a -> f r) -> f () W ::  % f => - i s a -> s -> (i -> a -> f r) -> f () W ::   f => , i s a -> s -> (i -> a -> f r) -> f () W ::  % f => ' i s a -> s -> (i -> a -> f r) -> f () X*Run monadic actions for each target of an  or 3 with access to the index, discarding the results.-When you don't need access to the index then %% is more flexible in what it accepts. % l "a  l     X ::   m => + i s a -> (i -> a -> m r) -> s -> m () X ::   m => - i s a -> (i -> a -> m r) -> s -> m () X ::   m => , i s a -> (i -> a -> m r) -> s -> m () X ::   m => ' i s a -> (i -> a -> m r) -> s -> m () Y*Run monadic actions for each target of an  or P with access to the index, discarding the results (with the arguments flipped). Y "a     X -When you don't need access to the index then &% is more flexible in what it accepts. & l a "a  l a     Y ::   m => + i s a -> s -> (i -> a -> m r) -> m () Y ::   m => - i s a -> s -> (i -> a -> m r) -> m () Y ::   m => , i s a -> s -> (i -> a -> m r) -> m () Y ::   m => ' i s a -> s -> (i -> a -> m r) -> m () Z<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 Z l     Z "a P Z :: * i s a -> (i -> a -> [r]) -> s -> [r] Z :: , i s a -> (i -> a -> [r]) -> s -> [r] Z :: + i s a -> (i -> a -> [r]) -> s -> [r] Z :: & i s a -> (i -> a -> [r]) -> s -> [r] [The [ function takes an  or , a predicate that is also supplied the index, a structure and returns the left-most element of the structure matching the predicate, or  T if there is no such element.-When you don't need access to the index then 9% is more flexible in what it accepts. 9 l "a [ l     [ ::  i s a -> (i -> a ->   ) -> s ->  a [ ::  i s a -> (i -> a ->   ) -> s ->  a [ ::  i s a -> (i -> a ->   ) -> s ->  a [ ::  i s a -> (i -> a ->   ) -> s ->  a \The \ function takes an  or , a monadic predicate that is also supplied the index, a structure and returns in the monad the left-most element of the structure matching the predicate, or  T if there is no such element.-When you don't need access to the index then :% is more flexible in what it accepts. : l "a \ l     \ ::   m =>  i s a -> (i -> a -> m   ) -> s -> m ( a) \ ::   m =>  i s a -> (i -> a -> m   ) -> s -> m ( a) \ ::   m =>  i s a -> (i -> a -> m   ) -> s -> m ( a) \ ::   m =>  i s a -> (i -> a -> m   ) -> s -> m ( a) ]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 _BMonadic fold right over the elements of a structure with an index.-When you don't need access to the index then A% is more flexible in what it accepts. A l "a _ l     _ ::   m => 4 i s a -> (i -> a -> r -> m r) -> r -> s -> m r _ ::   m => 6 i s a -> (i -> a -> r -> m r) -> r -> s -> m r _ ::   m => 5 i s a -> (i -> a -> r -> m r) -> r -> s -> m r _ ::   m => 0 i s a -> (i -> a -> r -> m r) -> r -> s -> m r `UMonadic fold over the elements of a structure with an index, associating to the left.-When you don't need access to the index then B% is more flexible in what it accepts. B l "a ` l     ` ::   m => 4 i s a -> (i -> r -> a -> m r) -> r -> s -> m r ` ::   m => 6 i s a -> (i -> r -> a -> m r) -> r -> s -> m r ` ::   m => 5 i s a -> (i -> r -> a -> m r) -> r -> s -> m r ` ::   m => 0 i s a -> (i -> r -> a -> m r) -> r -> s -> m r a-Extract the key-value pairs from a structure.>When you don't need access to the indices in the result, then % is more flexible in what it accepts.  l "a       a l a ::  i s a -> s -> [(i,a)] a ::  i s a -> s -> [(i,a)] a ::  i s a -> s -> [(i,a)] a ::  i s a -> s -> [(i,a)] bAn infix version of a.cPerform 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. (c ) :: s ->  i s a ->  (i, a) (c ) :: s ->  i s a ->  (i, a) (c ) :: s ->  i s a ->  (i, a) (c ) :: s ->  i s a ->  (i, a) dPerform an *UNSAFE*   (with index) of an  or  assuming that it is there. (d ) :: s ->  i s a -> (i, a) (d ) :: s ->  i s a -> (i, a) (d ) :: s ->  i s a -> (i, a) (d ) :: s ->  i s a -> (i, a) e 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 L, unless you are very careful not to invalidate the predicate on the target!f Obtain an " by taking elements from another , ,  or  while a predicate holds. f :: (i -> a ->  ) ->  i s a ->  i s a f :: (i -> a ->  ) ->  i s a ->  i s a f :: (i -> a ->  ) ->  i s a ->  i s a f :: (i -> a ->  ) ->  i s a ->  i s a g Obtain an # by dropping elements from another , ,  or  while a predicate holds. g :: (i -> a ->  ) ->  i s a ->  i s a g :: (i -> a ->  ) ->  i s a ->  i s a -- see notes g :: (i -> a ->  ) ->  i s a ->  i s a -- see notes g :: (i -> a ->  ) ->  i s a ->  i s a  Applying g to an  or - will still allow you to use it as a pseudo-R, but if you change the value of the targets to ones where the predicate returns  , then you will break the  laws and  fusion will no longer be sound.hA deprecated alias for 1.h      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefgh ijkll      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijkll/0EFGIHJKMLNCD  O    !"#$%&'(),-*+.341256789:=>;<?@ABbcdPQRSTUVWXYZ[\]^_`aefghijklh      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefgh ijkl/0bcd(C) 2012-14 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> provisional Rank2Types Trustworthy !"23468HM@mAllows # of the value at the largest index.n% of the element at the largest index.oAllows ! the value at the smallest index.p( of the element with the smallest index.r type r f =  (t f) t:When you see this as an argument to a function, it expectsto be indexed if p is an instance of } i,to be unindexed if p is (->),a  if f is  %,a  if f is only a   and  Contravariant,a ! if p is only a  ,a  if f is  ,  Contravariant and  %.u type u =  (w i) v type v =  (x i) w>When you see this as an argument to a function, it expects an .x>When you see this as an argument to a function, it expects an .y type y =  z z=When you see this as an argument to a function, it expects a .{ type { =  | |=When you see this as an argument to a function, it expects a .}.Map each element of a structure targeted by a ! or F, evaluate these actions from left to right, and collect the results.0This function is only provided for consistency,   is strictly more general.traverseOf each print (1,2,3)123 ((),(),()) } "a    l "a } l   }   itraversed "a  itraverse This yields the obvious law:  "a }  } ::   f =>  ) s t a b -> (a -> f b) -> s -> f t } ::   f => !( s t a b -> (a -> f b) -> s -> f t } ::  % f => # s t a b -> (a -> f b) -> s -> f t ~ A version of }' with the arguments flipped, such that:forOf each (1,2,3) print123 ((),(),())0This function is only provided for consistency,   is strictly more general. ~ "a   ~ "a   . }    "a ~   l s "a   l s   } ~ ::   f =>  # s t a b -> s -> (a -> f b) -> f t ~ ::   f => !# s t a b -> s -> (a -> f b) -> f t ~ ::  % f => # s t a b -> s -> (a -> f b) -> f t SEvaluate each action in the structure from left to right, and collect the results.sequenceAOf both ([1,2],[3,4])[(1,3),(1,4),(2,3),(2,4)]   "a   "a     l "a } l   "a l    ::   f =>   s t (f b) b -> s -> f t  ::   f => ! s t (f b) b -> s -> f t  ::  % f =>  s t (f b) b -> s -> f t .Map each element of a structure targeted by a !Z to a monadic action, evaluate these actions from left to right, and collect the results.$mapMOf both (\x -> [x, x + 1]) (1,3)[(1,3),(1,4),(2,3),(2,4)]   "a    l "a   l   }  ::   m =>  ) s t a b -> (a -> m b) -> s -> m t  ::   m => !( s t a b -> (a -> m b) -> s -> m t  ::   m => # s t a b -> (a -> m b) -> s -> m t  is a flipped version of $, consistent with the definition of  .$forMOf both (1,3) $ \x -> [x, x + 1][(1,3),(1,4),(2,3),(2,4)]   "a    l "a   ( l)  l s "a   l s   }  ::   m =>  ) s t a b -> s -> (a -> m b) -> m t  ::   m => !( s t a b -> s -> (a -> m b) -> m t  ::   m => # s t a b -> s -> (a -> m b) -> m t -Sequence the (monadic) effects targeted by a !# in a container from left to right.#sequenceOf each ([1,2],[3,4],[5,6])A[(1,3,5),(1,3,6),(1,4,5),(1,4,6),(2,3,5),(2,3,6),(2,4,5),(2,4,6)]   "a    l "a  l    l "a     l    ::   m =>   s t (m b) b -> s -> m t  ::   m => ! s t (m b) b -> s -> m t  ::   m =>  s t (m b) b -> s -> m t This generalizes  to an arbitrary .Note: E handles ragged inputs more intelligently, but for non-ragged inputs:&transposeOf traverse [[1,2,3],[4,5,6]][[1,4],[2,5],[3,6]]  "a    Since every ! is a 9, we can use this as a form of monadic strength as well:   :: (b, [a]) -> [(b, a)] This generalizes   to an arbitrary .   "a    accumulates  Z from right to left.  ::  A s t a b -> (acc -> a -> (acc, b)) -> acc -> s -> (acc, t)  :: !@ s t a b -> (acc -> a -> (acc, b)) -> acc -> s -> (acc, t)  :: ; s t a b -> (acc -> a -> (acc, b)) -> acc -> s -> (acc, t)  ::  (  ( ZA acc)) s t a b -> (acc -> a -> (acc, b)) -> acc -> s -> (acc, t) This generalizes   to an arbitrary .   "a    accumulates  Z from left to right.  ::  A s t a b -> (acc -> a -> (acc, b)) -> acc -> s -> (acc, t)  :: !@ s t a b -> (acc -> a -> (acc, b)) -> acc -> s -> (acc, t)  :: ; s t a b -> (acc -> a -> (acc, b)) -> acc -> s -> (acc, t)  ::  ( Z@ acc) s t a b -> (acc -> a -> (acc, b)) -> acc -> s -> (acc, t)  l f acc0 s =   (  (l (a ->   (acc ->   (f acc a))) s) acc0) This permits the use of   over an arbitrary  or !.   "a    ::  * s t a a -> (a -> a -> a) -> s -> t  :: !) s t a a -> (a -> a -> a) -> s -> t  :: $ s t a a -> (a -> a -> a) -> s -> t This permits the use of   over an arbitrary  or !.   "a    ::  * s t a a -> (a -> a -> a) -> s -> t  :: !) s t a a -> (a -> a -> a) -> s -> t  :: $ s t a a -> (a -> a -> a) -> s -> t This  allows you to  the individual stores in a .This  allows you to  the individual stores in a  with access to their indices. turns a  into a !( that resembles an early version of the   (or  ) type.Note:W You should really try to maintain the invariant of the number of children in the list.!(a,b,c) & partsOf each .~ [x,y,z](x,y,z)oAny extras will be lost. If you do not supply enough, then the remainder will come from the original structure.#(a,b,c) & partsOf each .~ [w,x,y,z](w,x,y)(a,b,c) & partsOf each .~ [x,y](x,y,c)So technically, this is only a !7 if you do not change the number of results it returns.When applied to a  the result is merely a .  ::  s a ->   s [a]  ::   s a ->   s [a]  ::  s a ->   s [a]  ::  s a ->  s [a]  ::  s a ->  s [a] An indexed version of 7 that receives the entire list of indices as its index.A type-restricted version of  that can only be used with a .A type-restricted version of  that can only be used with an . turns a  into a   (or   ) family. If you do not need the types of s and t2 to be different, it is recommended that you use .+It is generally safer to traverse with the G rather than use this combinator. However, it is sometimes convenient.<This is unsafe because if you don't supply at least as many b's as you were given a's, then the reconstruction of t will result in an error!When applied to a  the result is merely a  (and becomes safe).  ::   s t a b -> ! s t [a] [b]  :: ! s t a b -> ! s t [a] [b]  ::  s t a b -> ! s t [a] [b]  ::  s a ->  s [a]  ::  s a ->  s [a] An indexed version of 7 that receives the entire list of indices as its index.The one-level version of !F. This extracts a list of the immediate children according to a given  as editable contexts.Given a context you can use  to see the values, F at what the structure would be like with an edited result, or simply   the original structure. "propChildren l x = childrenOf l x      ( l x) propId l x =   (  x) [  w | w <-  l x]  ::  s a -> s -> [ (->) a s]  ::   s a -> s -> [ (->) a s]  ::  s a -> s -> [ (->) a s]  ::  i s a -> s -> [ (} i) a s]  ::  i s a -> s -> [ (} i) a s] This converts a 7 that you "know" will target one or more elements to a !0. It can also be used to transform a non-empty  into a .The resulting ! or ! will be partial if the supplied  returns no results.[1,2,3] ^. singular _head1[] ^. singular _head(*** Exception: singular: empty traversalLeft 4 ^. singular _Left4[1..10] ^. singular (ix 7)8  ::  s t a a -> ! s t a a  ::  s a ->  s a  ::  i s t a a ->  i s t a a  ::  i s a ->  i s a This converts a 3 that you "know" will target only one element to a !&. It can also be used to transform a  into a .The resulting ! or  will be partial if the + targets nothing or more than one element.  ::  s t a b -> ! s t a b  ::  s a ->  s a  ::  i s t a b ->  i s t a b  ::  i s a ->  i s a Traverse both parts of a   container with matching types.!Usually that type will be a pair.(1,2) & both *~ 10(10,20)"over both length ("hello","world")(5,5)("hello","world")^.both "helloworld"  ::  (a, a) (b, b) a b  ::  ( a a) ( b b) a b Apply a different  or  to each side of a   container.  ::  s t a b ->  s' t' a b ->  (r s s') (r t t') a b  ::  i s t a b ->  i s' t' a b ->  i (r s s') (r t t') a b  ::  s t a b ->  s' t' a b ->  (r s s') (r t t') a b   ::  s t a b ->  s' t' a b ->  (s,s') (t,t') a b  :: ! s t a b -> !" s' t' a b ->  (s,s') (t,t') a b  ::  s a -> " s' a ->  (s,s') a  ::  s a ->  s' a ->  (s,s') a   ::  i s t a b ->  i s' t' a b ->  i (s,s') (t,t') a b  ::  i s t a b ->  i s' t' a b ->  i (s,s') (t,t') a b  ::  i s a ->  i s' a ->  i (s,s') a  ::  i s a ->  i s' a ->  i (s,s') a   ::  s t a b ->  s' t' a b ->  (s,s') (t,t') a b  ::  s t a b ->  s' t' a b ->  (s,s') (t,t') a b  ::  s a ->  s' a ->  (s,s') a  ::  s a ->  s' a ->  (s,s') a .("hello",["world","!!!"])^..beside id traverse["hello","world","!!!"]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"  ::  3 ->  s a ->  s a  ::  3 ->   s a ->  s a  ::  3 ->  s a ->  s a  ::  3 ->  s a ->  s a  ::  3 ->  s a ->  s a  ::  3 ->  s a ->  s a  ::  3 ->  i s a ->  i s a  ::  3 ->  i s a ->  i s a  ::  3 ->  i s a ->  i s a  ::  3 ->  i s a ->  i 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  ::  3 ->  s a ->  s a  ::  3 ->   s a ->  s a  ::  3 ->  s a ->  s a  ::  3 ->  s a ->  s a  ::  3 ->  s a ->  s a  ::  3 ->  s a ->  s a  ::  3 ->  i s a ->  i s a  ::  3 ->  i s a ->  i s a  ::  3 ->  i s a ->  i s a  ::  3 ->  i s a ->  i s a A 2 is completely characterized by its behavior on a . Cloning a G is one way to make sure you aren't given something weaker, such as a T and can be used as a way to pass around traversals that have to be monomorphic in f.!Note: This only accepts a proper  (or !). To clone a ! as such, use r."Note: It is usually better to use  and  than to [. The former can execute at full speed, while the latter needs to round trip through the .Plet foo l a = (view (coerced (cloneTraversal l)) a, set (cloneTraversal l) 10 a)foo both ("hello","world")("helloworld",(10,10))  ::  ( (->) a b) s t a b ->  s t a b Clone a  yielding an 9 that passes through whatever index it is composed with. Clone an  yielding an  with the same index.A 2 is completely characterized by its behavior on a .Clone a  yielding an 9 that passes through whatever index it is composed with. Clone an  yielding an  with the same index.Traversal with an index.NB:F When you don't need access to the index then you can just apply your  directly as a function!  "a  } l =  l     =    ::   f => 0 i s t a b -> (i -> a -> f b) -> s -> f t  ::  % f => + i s t a b -> (i -> a -> f b) -> s -> f t  :: Apply f => * i s t a b -> (i -> a -> f b) -> s -> f t 3Traverse with an index (and the arguments flipped). ~ l a "a  l a      "a       ::   f => 0 i s t a b -> s -> (i -> a -> f b) -> f t  ::  % f => + i s t a b -> s -> (i -> a -> f b) -> f t  :: Apply f => * i s t a b -> s -> (i -> a -> f b) -> f t .Map each element of a structure targeted by a !u to a monadic action, evaluate these actions from left to right, and collect the results, with access its position.(When you don't need access to the index ' is more liberal in what it can accept.  l "a  l      ::   m => 0 i s t a b -> (i -> a -> m b) -> s -> m t  ::   m => + i s t a b -> (i -> a -> m b) -> s -> m t  :: Bind m => * i s t a b -> (i -> a -> m b) -> s -> m t .Map each element of a structure targeted by a ! to a monadic action, evaluate these actions from left to right, and collect the results, with access its position (and the arguments flipped).  l a "a  l a      "a       ::   m => / i s t a b -> s -> (i -> a -> m b) -> m t  ::   m => * i s t a b -> s -> (i -> a -> m b) -> m t  Generalizes   to an arbitrary  with access to the index.& accumulates state from right to left.  l "a  l      :: G i s t a b -> (i -> acc -> a -> (acc, b)) -> acc -> s -> (acc, t)  :: B i s t a b -> (i -> acc -> a -> (acc, b)) -> acc -> s -> (acc, t)  Generalizes   to an arbitrary  with access to the index.& accumulates state from left to right.  l "a  l      :: G i s t a b -> (i -> acc -> a -> (acc, b)) -> acc -> s -> (acc, t)  :: B i s t a b -> (i -> acc -> a -> (acc, b)) -> acc -> s -> (acc, t)  Traverse any  container. This is an % that is indexed by ordinal position. Traverse any  container. This is an % that is indexed by ordinal position. Traverse any  container. This is an % that is indexed by ordinal position.This is the trivial empty .  ::  i s s a b   "a     6 & ignored %~ absurd6 Traverse the nth  a , ! or   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 ->  3 ->   3 s a  ::  s a ->  3 ->   3 s a  Traverse the nth element of a  container.  "a   *Traverse (or fold) selected elements of a  (or 2) where their ordinal positions match a predicate.  ::  s a -> ( 3 ->  ) ->   3 s a  ::  s a -> ( 3 ->  ) ->   3 s a Traverse elements of a ; container where their ordinal positions match a predicate.  "a    Try to map a function over this , failing if the  has no targets..failover (element 3) (*2) [1,2] :: Maybe [Int]Nothing7failover _Left (*2) (Right 4) :: Maybe (Either Int Int)Nothing8failover _Right (*2) (Right 4) :: Maybe (Either Int Int)Just (Right 8) ? :: Alternative m => Traversal s t a b -> (a -> b) -> s -> m t 5Try to map a function which uses the index over this , failing if the  has no targets. M :: Alternative m => IndexedTraversal i s t a b -> (i -> a -> b) -> s -> m t Try the first  (or ), falling back on the second  (or ) if it returns no entries.This is only a valid  if the second  is disjoint from the result of the first or returns exactly the same results. These conditions are trivially met when given a !,  , , 6 or "affine" Traversal -- one that has 0 or 1 target.Mutatis mutandis for ."[0,1,2,3] ^? failing (ix 1) (ix 2)Just 1#[0,1,2,3] ^? failing (ix 42) (ix 2)Just 2  ::  s t a b ->  s t a b ->  s t a b  ::  s t a b ->  s t a b ->  s t a b  ::  s a ->  s a ->  s a fThese cases are also supported, trivially, but are boring, because the left hand side always succeeds.  :: ! s t a b ->  s t a b ->  s t a b  ::   s t a b ->  s t a b ->  s t a b  ::  s t a b ->  s t a b ->  s t a b  ::  s a ->  s a ->  s a If both of the inputs are indexed, the result is also indexed, so you can apply this to a pair of indexed traversals or indexed folds, obtaining an indexed traversal or indexed fold.  ::  i s t a b ->  i s t a b ->  i s t a b  ::  i s a ->  i s a ->  i s a fThese cases are also supported, trivially, but are boring, because the left hand side always succeeds.  ::  i s t a b ->  i s t a b ->  i s t a b  ::  i s a ->  i s a ->  i s a uTry the second traversal. If it returns no entries, try again with all entries from the first traversal, recursively.  ::  s s ->  s a ->  s a  ::  s s ->  s a ->  s a  ::  s t s t ->  s t a b ->  s t a b  ::  s s ->  i s a ->  i s a  ::  s t s t ->  i s t a b ->  i s t a b Omnopqrstuvwxyz{|}~  Xmnopqrstuvwxyz{|}~X|{zyxvwutrsq}~opmnMmnopqrstuvwxyz{|}~  (C) 2012-14 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> provisional Rank2Types Trustworthy !"123468HM+A  with an additional index.2An instance must satisfy a (modified) form of the  laws:  (  ) "a   6 ( f)    g "a     (\i ->     6 (f i)   g i) Traverse an indexed container.  "a   The  of a  container.;A container that supports folding with an additional index.2Fold a container by mapping value to an arbitrary  with access to the index i.-When you don't need access to the index then  % is more flexible in what it accepts.   "a      The  of a  container.1'ifolded'.'asIndex' is a fold over the keys of a .@Data.Map.fromList [(2, "hello"), (1, "world")]^..ifolded.asIndex[1,2]HRight-associative fold of an indexed container with access to the index i.-When you don't need access to the index then  % is more flexible in what it accepts.   "a      GLeft-associative fold of an indexed container with access to the index i.-When you don't need access to the index then  % is more flexible in what it accepts.   "a      StrictlyF fold right over the elements of a structure with access to the index i.-When you don't need access to the index then  % is more flexible in what it accepts.   "a      RFold over the elements of a structure with an index, associating to the left, but strictly.-When you don't need access to the index then >% is more flexible in what it accepts. > l "a ^ l     A   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 }& function with a non-indexed function.Mnemonically, the <, points to the indexing we want to preserve.let nestedMap = (fmap Map.fromList . Map.fromList) [(1, [(10, "one,ten"), (20, "one,twenty")]), (2, [(30, "two,thirty"), (40,"two,forty")])].nestedMap^..(itraversed<.itraversed).withIndexA[(1,"one,ten"),(1,"one,twenty"),(2,"two,thirty"),(2,"two,forty")]'Compose a non-indexed function with an } function.Mnemonically, the >, points to the indexing we want to preserve.This is the same as ( ).f   g (and f  g) gives you the index of g unless g is index-preserving, like a ,   or 0, in which case it'll pass through the index of f.let nestedMap = (fmap Map.fromList . Map.fromList) [(1, [(10, "one,ten"), (20, "one,twenty")]), (2, [(30, "two,thirty"), (40,"two,forty")])].nestedMap^..(itraversed.>itraversed).withIndexE[(10,"one,ten"),(20,"one,twenty"),(30,"two,thirty"),(40,"two,forty")]OUse a value itself as its own index. This is essentially an indexed version of  .VNote: When used to modify the value, this can break the index requirements assumed by + and similar, so this is only properly an , but it can be used as more.  :: a a b Remap the index.Composition of } functions.Mnemonically, the < and >9 points to the fact that we want to preserve the indices.let nestedMap = (fmap Map.fromList . Map.fromList) [(1, [(10, "one,ten"), (20, "one,twenty")]), (2, [(30, "two,thirty"), (40,"two,forty")])]/nestedMap^..(itraversed<.>itraversed).withIndexU[((1,10),"one,ten"),((1,20),"one,twenty"),((2,30),"two,thirty"),((2,40),"two,forty")]Composition of }? functions with a user supplied function for combining indices.HFold a container with indices returning both the indices and the values.)The result is only valid to compose in a D, if you don't edit the index as edits to the index have no effect.When composed with an  or  this yields an (})  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"aReturn whether or not any element in a container satisfies a predicate, with access to the index i.-When you don't need access to the index then  % is more flexible in what it accepts.   "a      `Return whether or not all elements in a container satisfy a predicate, with access to the index i.-When you don't need access to the index then  % is more flexible in what it accepts.   "a      hReturn whether or not none of the elements in a container satisfy a predicate, with access to the index i.-When you don't need access to the index then % is more flexible in what it accepts.  "a       f "a      f FDetermines whether no elements of the structure satisfy the predicate.  f "a       f +Traverse elements with access to the index i, discarding the results.-When you don't need access to the index then  % is more flexible in what it accepts.   l =      +Traverse elements with access to the index i6, discarding the results (with the arguments flipped).  "a    -When you don't need access to the index then  % is more flexible in what it accepts.   a "a  a     *Run monadic actions for each target of an  or g3 with access to the index, discarding the results.-When you don't need access to the index then %% is more flexible in what it accepts.   "a      *Run monadic actions for each target of an  or gP 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     gConcatenate the results of a function of the elements of an indexed container with access to the index.-When you don't need access to the index then  % is more flexible in what it accepts.   "a       "a  Searches a container with a predicate that is also supplied the index, returning the left-most element of the structure matching the predicate, or  T if there is no such element.-When you don't need access to the index then  % is more flexible in what it accepts.   "a      BMonadic fold right over the elements of a structure with an index.-When you don't need access to the index then  % is more flexible in what it accepts.   "a      UMonadic fold over the elements of a structure with an index, associating to the left.-When you don't need access to the index then  % is more flexible in what it accepts.   "a      -Extract the key-value pairs from a structure.>When you don't need access to the indices in the result, then  % is more flexible in what it accepts.   "a       3Traverse with an index (and the arguments flipped).   a "a  a      "a    Map each element of a structure to a monadic action, evaluate these actions from left to right, and collect the results, with access the index.(When you don't need access to the index  ' is more liberal in what it can accept.   "a      Map each element of a structure to a monadic action, evaluate these actions from left to right, and collect the results, with access its position (and the arguments flipped).   a "a  a      "a     Generalizes   to add access to the index.& accumulates state from right to left.  "a       Generalizes   to add access to the index.& accumulates state from left to right.  "a      The position in the   is available as the index. 3The position in the list is available as the index.Z  5}~5}~P     (C) 2012-14 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> provisional Rank2Types Trustworthy3HMThis 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 3 regardless of the depth at which they were found.M["hello","world"] & taking 4 (levels (traverse.traverse).traverse) %~ toUpper["HELlo","World"]The resulting  of the ' which is indexed by the depth of each r.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 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 r.=["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.   rr   (C) 2012-14 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> provisional Rank2Types Safe-Inferred 246=HKM 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.;This can also be useful for creatively combining folds as  s is isomorphic to  ReaderT s []! and provides similar instances.;("hello","world")^..runFold ((,) <$> Fold _2 <*> Fold both)%[("world","hello"),("world","world")] Reify an + so it can be stored safely in a container.Reify a + so it can be stored safely in a container.BThis can also be useful when combining getters in novel ways, as 8 is isomorphic to '(->)' and provides similar instances.P("hello","world","!!!")^.runGetter ((,) <$> Getter _2 <*> Getter (_1.to length)) ("world",5) type  =    A form of 3 that can be stored monomorphically in a container. type  i =  ( i)  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.b      !"#$%&'()*+,-./0123456789:;<=>?, b ?>=<;:9876543210/.-,+*)('&%$#"!     J      !"#$%&'()*+,-./0123456789:;<=>? 7(C) 2012-2014 Edward Kmett, (C) 2006-2012 Neil Mitchell BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> experimental Rank2Types Trustworthy !"+3:;FHM @KA generic applicative transformation that maps over the immediate subterms.@ is to  what   is to  This really belongs in  Data.Data.ANave  using  2. This does not attempt to optimize the traversal.YThis is primarily useful when the children are immediately obvious, and for benchmarking.B&Find every occurrence of a given type aE recursively that doesn't require passing through something of type a using  I, while avoiding traversal of areas that cannot contain a value of type a.This is C with a more liberal signature.CFind descendants of type a[ non-transitively, while avoiding computation of areas that cannot contain values of type a using  .C$ is a useful default definition for !DD performs like B, except when s ~ a%, it returns itself and nothing else.E This automatically constructs a  from an function.(2,4) & upon fst *~ 5(10,4)<There are however, caveats on how this function can be used!First, the user supplied function must access only one field of the specified type. That is to say the target must be a single element that would be visited by  holesOnOf B CBNote: this even permits a number of functions to be used directly.[1,2,3,4] & upon head .~ 0 [0,2,3,4][1,2,3,4] & upon last .~ 5 [1,2,3,5][1,2,3,4] ^? upon tail Just [2,3,4]"" ^? upon tailNothing6Accessing parents on the way down to children is okay:'[1,2,3,4] & upon (tail.tail) .~ [10,20] [1,2,10,20]iSecond, the structure must not contain strict or unboxed fields of the same type that will be visited by   E :: (  s,   a) => (s -> a) ->  [Int] s aFThe design of H5 doesn't allow it to search inside of values of type a for other values of type a. F$ provides this additional recursion.Like H, F- trusts the user supplied function more than EM using it directly as the accessor. This enables reading from the resulting !F to be considerably faster at the risk of generating an illegal lens.(upon' (tail.tail) .~ [10,20] $ [1,2,3,4] [1,2,10,20]G This automatically constructs a  from a field accessor.The index of the  can be used as an offset into  ( B) or into the list returned by  B.The design of G5 doesn't allow it to search inside of values of type a for other values of type a. EG 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 E instead.HThis more trusting version of E1 uses your function directly as the getter for a !.This means that reading from F is considerably faster than E./However, you pay for faster access in two ways: 'When passed an illegal field accessor, F will give you a !, that quietly violates the laws, unlike E, which will give you a legal " that avoids modifying the target.kModifying with the lens is slightly slower, since it has to go back and calculate the index after the fact.4When given a legal field accessor, the index of the ! can be used as an offset into  ( B) or into the list returned by  B.When in doubt, use F instead.  inlineable  /              @A BCD EFGH    ! "  # $ % & ' ( ) * + , @ABCDEFGH BACDEFGH@$                @A BCD EFGH    ! "  # $ % & ' ( ) * + ,!(C) 2012-13 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> provisional Rank2Types Trustworthy12346HM$IA IN type is one where we know how to extract its immediate self-similar children. Example 1: rimport Control.Applicative import Control.Lens import Control.Lens.Plated import Data.Data import Data.Data.Lens (C)  data Expr = Val  3, | Neg Expr | Add Expr Expr deriving ( t, q, V, U, ,)   instance I Expr where J f (Neg e) = Neg   f e J f (Add a b) = Add   f a   f b J _ a =   a or  instance I Expr where J = C  Example 2: rimport Control.Applicative import Control.Lens import Control.Lens.Plated import Data.Data import Data.Data.Lens (C)  <data Tree a = Bin (Tree a) (Tree a) | Tip a deriving ( t, q, V, U, ,)   instance I (Tree a) where J f (Bin l r) = Bin   f l   f r J _ t =   t or  instance   a => I (Tree a) where J = C ;Note the big distinction between these two implementations.The former will only treat children directly in this tree as descendents, the latter will treat trees contained in the values under the tips also as descendants!When in doubt, pick a  and just use the various ...Of" combinators rather than pollute I with orphan instances!>If you want to find something unplated and non-recursive with D use the ...OnOf variant with T, though those usecases are much better served in most cases by using the existing ! combinators! e.g.  D "a Y D  )This same ability to explicitly pass the 8 in question is why there is no analogue to uniplate's Biplate.xMoreover, since we can allow custom traversals, we implement reasonable defaults for polymorphic data types, that only  into themselves, and not their polymorphic arguments.J- of the immediate children of this structure.5If you're using GHC 7.2 or newer and your type has a   instance, J will default to CA and you can choose to not override it with your own definition.KCompose through a plateL<Try to apply a traversal to all transitive descendants of a I= container, but do not recurse through matching descendants. L :: I s =>  s a ->  s a L :: I s =>  s a ->  s a L :: I s =>  s s a b ->  s s a b L :: I s =>  s s a b ->  s s a b M'Extract the immediate descendants of a I container. M "a  J NoRewrite by applying a rule everywhere you can. Ensures that the rule cannot be applied anywhere in the result: propRewrite r x =   (   r) (V (N r x)) Usually Z is more appropriate, but NE can give better compositionality. Given two single transformations f and g, you can construct  a -> f a mplus g a2 which performs both rewrites until a fixed point.OoRewrite by applying a rule everywhere you can. Ensures that the rule cannot be applied anywhere in the result: propRewriteOf l r x =   (   r) (W l (O l r x)) Usually \ is more appropriate, but OE can give better compositionality. Given two single transformations f and g, you can construct  a -> f a mplus g a2 which performs both rewrites until a fixed point. O ::  a a -> (a ->  a) -> a -> a O ::   a a -> (a ->  a) -> a -> a O ::  a a -> (a ->  a) -> a -> a O ::  a a -> (a ->  a) -> a -> a P4Rewrite recursively over part of a larger structure. P :: I a =>  s a -> (a ->  a) -> s -> s P :: I a =>   s a -> (a ->  a) -> s -> s P :: I a =>  s a -> (a ->  a) -> s -> s P :: I a => & s a -> (a ->  a) -> s -> s QFRewrite recursively over part of a larger structure using a specified . Q :: I a =>  s a ->  a a -> (a ->  a) -> s -> s Q :: I a =>   s a ->   a a -> (a ->  a) -> s -> s Q :: I a =>  s a ->  a a -> (a ->  a) -> s -> s Q :: I a =>  s a ->  a a -> (a ->  a) -> s -> s RwRewrite by applying a monadic rule everywhere you can. Ensures that the rule cannot be applied anywhere in the result.SRRewrite by applying a monadic rule everywhere you recursing with a user-specified B. Ensures that the rule cannot be applied anywhere in the result.T`Rewrite by applying a monadic rule everywhere inside of a structure located by a user-specified B. Ensures that the rule cannot be applied anywhere in the result.U`Rewrite by applying a monadic rule everywhere inside of a structure located by a user-specified , using a user-specified O for recursion. Ensures that the rule cannot be applied anywhere in the result.V0Retrieve all of the transitive descendants of a I container, including itself.WGiven a u that knows how to locate immediate children, retrieve all of the transitive descendants of a node, including itself. W ::  a a -> a -> [a] XGiven a  that knows how to find IN parts of a container retrieve them and all of their descendants, recursively.YGiven 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 Y l  Z;Transform every element in the tree, in a bottom-up manner.7For example, replacing negative literals with literals:  negLits = Z) $ \x -> case x of Neg (Lit i) -> Lit ( - i) _ -> x [WTransform every element in the tree in a bottom-up manner over a region indicated by a . [ :: I a =>  s a -> (a -> a) -> s -> s [ :: I a =>  s a -> (a -> a) -> s -> s \8Transform every element by recursively applying a given  in a bottom-up manner. \ ::  a a -> (a -> a) -> a -> a \ ::  a a -> (a -> a) -> a -> a ]3Transform every element in a region indicated by a ! by recursively applying another  in a bottom-up manner. ] ::  s a ->  a a -> (a -> a) -> s -> s ] ::  s a ->  a a -> (a -> a) -> s -> s ^HTransform every element in the tree, in a bottom-up manner, monadically._HTransform every element in the tree in a region indicated by a supplied %, in a bottom-up manner, monadically. _ :: (  m, I a) =>  s a -> (a -> m a) -> s -> m s `8Transform every element in a tree using a user supplied - in a bottom-up manner with a monadic effect. ` ::   m =>  a a -> (a -> m a) -> a -> m a aPTransform 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. a ::   m =>  s a ->  a a -> (a -> m a) -> s -> m s b_Return a list of all of the editable contexts for every location in the structure, recursively. propUniverse x = V x      (b x) propId x =   (  x) [ w | w <- b x] b "a c J cwReturn 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 = W l x      (c l x) propId l x =   (  x) [ w | w <- c l x] c ::  a a -> a -> [ a a a] d{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 J. d b "a e b J d :: I a =>  s a -> s -> [ a a s] e{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. e ::  s a ->  a a -> s -> [ a a s] fThe one-level version of F. This extracts a list of the immediate children as editable contexts.Given a context you can use  to see the values, F at what the structure would be like with an edited result, or simply  the original structure. propChildren x = M l x      (f l x) propId x =   (  x) [ w | w <- f l x] f =  J g An alias for 6, provided for consistency with the other combinators. g "a  g ::  s a -> s -> [ (->) a a s] g ::   s a -> s -> [ (->) a a s] g ::  s a -> s -> [ (->) a a s] g ::  i s a -> s -> [ ( i) a a s] g ::  i s a -> s -> [ ( i) a a s] hExtract one level of f/ from a container in a region specified by one , using another. h b l "a  (b   l) h ::  s a ->  a a -> s -> [ (->) a a s] h ::   s a ->   a a -> s -> [ (->) a a s] h ::  s a ->  a a -> s -> [ (->) a a s] h ::   s a ->  i a a -> s -> [ ( i) a a s] h ::  s a ->  i a a -> s -> [ ( i) a a s] iJPerform a fold-like computation on each value, technically a paramorphism. i :: " a a -> (a -> [r] -> r) -> a -> r jJPerform a fold-like computation on each value, technically a paramorphism. j "a i J k!Fold the immediate children of a I container. k z c f =  J (c   f) z l The original uniplate% combinator, implemented in terms of I as a !. l "a  J The resulting !x 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  !0IJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijkl . / 0 1 2 3 4 5 6 7 8 9$IJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijkl$IJMNOPQRSTUVWXYZ\[]^`_abcdefghjiKLkl/IJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijkl . / 0 1 2 3 4 5 6 7 8 9K "(C) 2012-14 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> provisional Rank2Types Safe-Inferred !"=HKM mA  n.n>When you see this as an argument to a function, it expects an .oProvides witness that (s ~ a, b ~ t) holds.qExtract a witness of type .rSubstituting types with .s We can use " to do substitution into anything.t is symmetric.u8This is an adverb that can be used to modify many other !k combinators to make them require simple lenses, simple traversals, simple prisms or simple isos as input.vCComposition with this isomorphism is occasionally useful when your !, f or  u has a constraint on an unused argument to force that argument to agree with the type of a used argument and avoid ScopedTypeVariables or other ugliness. mnopqrstuv mnopqrstuv nmqrstuvop mnopqrstuv(C) 2012-14 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> provisional Rank2Types Trustworthy68HMwPAd hoc conversion between "strict" and "lazy" versions of a structure, such as  : or  ;.y-This class provides for symmetric bifunctors.z z   z "a   first f   z = z   second f second g   z = z   first g  f g   z = z    g f (1,2)^.swapped(2,1){A  |.|>When you see this as an argument to a function, it expects an  .}<Build a simple isomorphism from a pair of inverse functions.  (} f g) "a f  (~ (} f g)) "a g  (} f g) h "a g   h   f  (~ (} 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 | back to any  .This is useful when you need to store an isomorphism as a data type inside a container and later reconstitute it as an overloaded function.See  or 7 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.Gauf (_Unwrapping Sum) (foldMapOf both) Prelude.length ("hello","world")10The opposite of working  a  is working  an isomorphism.  "a    ~  ::   s t a b -> (t -> s) -> b -> a BThis isomorphism can be used to convert to or from an instance of  <. LT^.from enum097^.enum :: Char'a'Note: this is only an isomorphism from the numeric range actually used and it is a bit of a pleasant fiction, since there are questionable  < instances for  =, and  > that exist solely for  [1.0 .. 4.0]' sugar and the instances for those and  ?( don't cover all values in their range.This can be used to lift any   into an arbitrary  .If v is an element of a type a, and a' is a sans the element v, then  v is an isomorphism from  a' to a.  "a     NKeep in mind this is only a real isomorphism if you treat the domain as being  (a sans v).9This is practically quite useful when you want to have a 3 where all the entries should have non-zero values.4Map.fromList [("hello",1)] & at "hello" . non 0 +~ 2fromList [("hello",3)]4Map.fromList [("hello",1)] & at "hello" . non 0 -~ 1 fromList []0Map.fromList [("hello",1)] ^. at "hello" . non 01%Map.fromList [] ^. at "hello" . non 00JThis combinator is also particularly useful when working with nested maps.e.g.$ When you want to create the nested  when it is missing:<Map.empty & at "hello" . non Map.empty . at "world" ?~ "!!!"/fromList [("hello",fromList [("world","!!!")])]6and when have deleting the last entry from the nested @ mean that we should delete its entry from the surrounding one:dfromList [("hello",fromList [("world","!!!")])] & at "hello" . non Map.empty . at "world" .~ Nothing fromList []8It can also be used in reverse to exclude a given value:non 0 # rem 10 4Just 2non 0 # rem 10 5Nothing p generalizes  (p # ()) to take any unit /This function generates an isomorphism between  (a |  p a) and a.PMap.singleton "hello" Map.empty & at "hello" . non' _Empty . at "world" ?~ "!!!"/fromList [("hello",fromList [("world","!!!")])]bfromList [("hello",fromList [("world","!!!")])] & at "hello" . non' _Empty . at "world" .~ Nothing fromList [] a p generalizes  a# to take any value and a predicate.This function assumes that p a holds  & and generates an isomorphism between  (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 []AThe canonical isomorphism for currying and uncurrying a function.  = }  @  A (fst^.curried) 3 43view curried fst 3 43AThe canonical isomorphism for uncurrying and currying a function.  = }  A  @   = ~  ((+)^.uncurried) (1,2)3(The isomorphism for flipping a function.((,)^.flipped) 1 2(2,1)An  E between the strict variant of a structure and its lazy counterpart.  = ~ x See  4http://hackage.haskell.org/package/strict-base-types for an example use.An   between a list,  ;,  :! fragment, etc. and its reversal."live" ^. reversed"evil""live" & reversed %~ ('d':)"lived"<Given a function that is its own inverse, this gives you an   using it in both directions.  "a  } "live" ^. involuted reverse"evil"$"live" & involuted reverse %~ ('d':)"lived"*This isomorphism can be used to inspect a M to see how it associates the structure and it can also be used to bake the  into a 2 so that you can traverse over it multiple times.+This isomorphism can be used to inspect an M to see how it associates the structure and it can also be used to bake the  into a V so that you can traverse over it multiple times with access to the original indices.Lift an   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)  Lift two  s into both arguments of a  simultaneously.  dimapping ::  p =>   s t a b ->   s' t' a' b' ->  2 (p a s') (p b t') (p s a') (p t b') dimapping ::  p =>  s a ->  s' a' ->  (p a s') (p s a') Lift 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) Lift 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)  Lift two  s into both arguments of a .  bimapping ::  p =>   s t a b ->   s' t' a' b' ->  2 (p s s') (p t t') (p a a') (p b b') bimapping ::  p =>  s a ->  s' a' ->  (p s s') (p a a') &wxyz{|}~ B C D E F G H)hi vwxyz{|}~) |{}~vyzwxhi$wxyz{|}~ B C D E F G H#'(C) 2012-14 Edward Kmett, Michael Sloan BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> experimentalRank2, MPTCs, fundeps Trustworthy '246=HKMW provides isomorphisms to wrap and unwrap newtypes or data types with one constructor.An isomorphism between s and a.Work under a newtype wrapper.5Const "hello" & _Wrapped %~ Prelude.length & getConst5  "a ~   "a ~  Given the constructor for a 3 type, return a deconstructor that is its inverse. Assuming the $ instance is legal, these laws hold:  f   f "a   f    f "a   op Identity (Identity 4)4op Const (Const "hello")"hello" This is a convenient version of ! with an argument that's ignored.The user supplied function is ignored, merely its type is used. This is a convenient version of ! with an argument that's ignored.The user supplied function is ignored, merely its type is used. This is a convenient version of ! with an argument that's ignored.The user supplied function is ignored, merely its types are used. This is a convenient version of ! with an argument that's ignored.The user supplied function is ignored, merely its types are used.This combinator is based on ala& from Conor McBride's work on Epigram.As with 0, the user supplied function for the newtype is ignored.ala Sum foldMap [1,2,3,4]10ala All foldMap [True,True]Trueala All foldMap [True,False]Falseala Any foldMap [False,False]Falseala Any foldMap [True,False]Trueala 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.1alaf Sum foldMap Prelude.length ["hello","world"]10 IUse wrapping  J. unwrapping returns a sorted list. KUse wrapping  L. unwrapping returns a sorted list. MUse wrapping  N. unwrapping returns a sorted list. OUse wrapping  P. unwrapping returns a sorted list. QUse wrapping  R2. Unwrapping returns some permutation of the list. SUse wrapping  T2. Unwrapping returns some permutation of the list. 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 { | } ~  I K M O Q S  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 { | } ~  I K M O Q S $(C) 2012-14 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> provisional non-portable Trustworthy1;isn't _Empty [1,2,3]True  %(C) 2012-14 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> experimental non-portable Trustworthy!"123468=KExtract 2 element of a (potentially monomorphic) container.3Notably, when applied to a tuple, this generalizes ! to arbitrary homogeneous tuples.(1,2,3) & each *~ 10 (10,20,30)3It can also be used on monomorphic containers like  : or  ;.-over each Char.toUpper ("hello"^.Text.packed)"HELLO"-("hello","world") & each.each %~ Char.toUpper("HELLO","WORLD")  :: (  i,     a,     b) =>  (  i a) (  i b) a b  ::   i =>  (  i a) (  i b) a b  ::          ::   ;  ;     ::           ::   :  :      :: (  a,   b) =>  (  a) (  b) a b   :: (  a,   b) =>  (  a) (  b) a b  :: (  a,   b) =>  (  a) (  b) a b  ::  (  a) (  b) a b   ::  (  a) (  b) a b   ::  (  a) (  b) a b   ::  ( a) ( b) a b   ::  ( a) ( b) a b   ::  (NonEmpty a) (NonEmpty b) a b   ::  [a] [b] a b   ::  (  c a) (  c b) a b   ::  (  c a) (  c b) a b   ::  (  c a) (  c b) a b   :: (  a,   b) =>  (  a) (  b) a b   :: , (a,a,a,a,a,a,a,a,a) (b,b,b,b,b,b,b,b,b) a b   :: ( (a,a,a,a,a,a,a,a) (b,b,b,b,b,b,b,b) a b   :: $ (a,a,a,a,a,a,a) (b,b,b,b,b,b,b) a b  ::  (a,a,a,a,a,a) (b,b,b,b,b,b) a b !  ::  (a,a,a,a,a) (b,b,b,b,b) a b "  ::  (a,a,a,a) (b,b,b,b) a b #  ::  (a,a,a) (b,b,b) a b $  ::  (a,a) (b,b) a b                 ! " # $                 ! " # $&(C) 2012-14 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> experimental non-portable Trustworthy23468nThis class provides a way to attach or detach elements on the right side of a structure in a flexible manner.  ::  [a] [b] ([a], a) ([b], b)  ::  (  a) (  b) (  a, a) (  b, b)  ::  (  a) (  b) (  a, a) (  b, b)  ::    ( ,  )  ::   : ( :,  )  ::   ; ( ;,  ) mThis class provides a way to attach or detach elements on the left side of a structure in a flexible manner.  ::  [a] [b] (a, [a]) (b, [b])  ::  (  a) (  b) (a,   a) (b,   b)  ::  (  a) (  b) (a,   a) (b,   b)  ::    ( ,  )  ::   : ( ,  :)  ::   ; ( ,  ;)  an element onto a container.This is an infix alias for .a <| [][a] a <| [b, c][a,b,c]a <| Seq.fromList [] fromList [a]a <| Seq.fromList [b, c]fromList [a,b,c] an element onto a container. cons a [][a] cons a [b, c][a,b,c]cons a (Seq.fromList []) fromList [a]cons a (Seq.fromList [b, c])fromList [a,b,c]oAttempt to extract the left-most element from a container, and a version of the container without that element. uncons []Nothinguncons [a, b, c]Just (a,[b,c])A  reading and writing to the   of a  non-empty container.[a,b,c]^? _headJust a[a,b,c] & _head .~ d[d,b,c][a,b,c] & _head %~ f [f a,b,c][] & _head %~ f[][1,2,3]^?!_head1 []^?_headNothing [1,2]^?_headJust 1[] & _head .~ 1[][0] & _head .~ 2[2][0,1] & _head .~ 2[2,1]This isn't limited to lists.For instance you can also  the head of a  :#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""7This isn't limited to lists. For instance you can also  the tail of a  .2Seq.fromList [a,b] & _tail .~ Seq.fromList [c,d,e]fromList [a,c,d,e]Seq.fromList [a,b,c] ^? _tailJust (fromList [b,c])Seq.fromList [] ^? _tailNothing  ::  [a] [a]  ::  (  a) (  a)  ::  (  a) (  a) 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 .Seq.fromList [] |> a fromList [a]Seq.fromList [b, c] |> afromList [b,c,a]LazyT.pack "hello" |> '!'"hello!"( an element onto the end of a container.snoc (Seq.fromList []) a fromList [a]snoc (Seq.fromList [b, c]) afromList [b,c,a]snoc (LazyT.pack "hello") '!'"hello!"pAttempt to extract the right-most element from a container, and a version of the container without that element.unsnoc (LazyT.pack "hello!")Just ("hello",'!')unsnoc (LazyT.pack "")Nothingunsnoc (Seq.fromList [b,c,a])Just (fromList [b,c],a)unsnoc (Seq.fromList [])Nothing" & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9  & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9'(C) 2012-14 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> experimental non-portable Trustworthy246FMA Banker's deque based on Chris Okasaki's "Purely Functional Data Structures"O(1). Determine if a  is  :. null emptyTruenull (singleton 1)FalseO(1). Generate a singleton  singleton 1 BD 1 [1] 0 []O(1). Calculate the size of a size (fromList [1,4,6])3O(n) amortized. Construct a  from a list of values.fromList [1,2]BD 1 [1] 1 [2] ; Check that a 7 satisfies the balance invariants and rebalance if not. ; < = > ? @ A B C D E F G H I J K L M N O P ; < = > ? @ A B C D E F G H I J K L M N O P((C) 2012-14 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> experimental non-portable Trustworthy!"12346=HJKM provides a !Q that can be used to read, write or delete the value associated with a key in a  $-like container on an ad hoc basis.An instance of  should satisfy:  k "a  k    !Map.fromList [(1,"world")] ^.at 1 Just "world"at 1 ?~ "hello" $ Map.emptyfromList [(1,"hello")]Note:  5-like containers form a reasonable instance, but not  *-like ones, where you cannot satisfy the ! laws. This simple  lets you  the value at a given key in a  0 or element at an ordinal position in a list or  . This simple  lets you  the value at a given key in a  0 or element at an ordinal position in a list or  .NB: Setting the value of this  will only set the value in  if it is already present.!If you want to be able to insert missing values, you want ."Seq.fromList [a,b,c,d] & ix 2 %~ ffromList [a,b,f c,d]"Seq.fromList [a,b,c,d] & ix 2 .~ efromList [a,b,e,d]Seq.fromList [a,b,c,d] ^? ix 2Just cSeq.fromList [] ^? ix 2NothingLThis provides a common notion of a value at an index that is shared by both  and .This class provides a simple  IndexedFold (or a) that lets you view (and modify) information about whether or not a container contains a given .'IntSet.fromList [1,2,3,4] ^. contains 3True'IntSet.fromList [1,2,3,4] ^. contains 5False/IntSet.fromList [1,2,3,4] & contains 3 .~ FalsefromList [1,2,4]A definition of  for types with an F instance. This is the default if you don't specify a definition for .,Delete the value associated with a key in a  -like container  k =  k .~ Nothing Q  ::  3 ->  (a,a,a,a,a,a,a,a,a) a R  ::  3 ->  (a,a,a,a,a,a,a,a) a S  ::  3 ->  (a,a,a,a,a,a,a) a T  ::  3 ->  (a,a,a,a,a,a) a U  ::  3 ->  (a,a,a,a,a) a V  ::  3 ->  (a,a,a,a) a W  ::  3 ->  (a,a,a) a X  ::  3 ->  (a,a) a Y arr  Z i "a arr   i arr  [ [(i,e)] "a  i 5 e   arr \ arr  Z i "a arr   i arr  [ [(i,e)] "a  i 5 e   arr r ] Q ^ R _ S ` T a U b V c W d X e f g h i j k l m n o p q r s t u v w x y z { Y | \ } ~   o ] Q ^ R _ S ` T a U b V c W d X e f g h i j k l m n o p q r s t u v w x y z { Y | \ } ~  )(C) 2012-2014 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> experimentalTemplateHaskell TrustworthyHM Provides substitution for typesPerform substitution for typesGProvides for the extraction of free type variables, and alpha renaming.When performing substitution into this traversal you're not allowed to substitute in a name that is bound internally or you'll violate the . laws, when in doubt generate your names with  .Has a Extract (or modify) the  of something Traverse free type variables'Substitute using a map of names in for free type variables Provides a - of the types of each field of a constructor. of the types of the named fields of a constructor.      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvw       !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvw !     "#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvw      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvw *,(C) 2014 Edward Kmett, (C) 2014 Eric Mertens BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> experimental non-portable TrustworthyFx'Name to give to generated field optics.y+makeFields-style class name and method namezSimple top-level definiton name Allow LensTraversal (otherwise GetterFold)AType Name -> Field Names -> Target Field Name -> Definition NamesCompute the field optics for the type identified by the given type name. Lenses will be computed when possible, Traversals otherwise. qCompute the field optics for a deconstructed Dec When possible build an Iso otherwise build one optic per field. Normalized the Con type into a uniform positional representation, eliminating the variance between records, infix constructors, and normal constructors. Compute the positional location of the fields involved in each constructor for a given optic definition as well as the type of clauses to generate and the type to annotate the declaration with. /Compute the s t a b types given the outer type s} and the categorized field types. Left for fixed and Right for visited. These types are "raw" and will be packaged into an   shortly after creation. Build the signature and definition for a single field optic. In the case of a singleton constructor irrefutable matches are used to enable the resulting lenses to be used on a bottom value. Construct an optic clause that returns an unmodified value given a constructor name and the number of fields on that constructor. vConstruct an optic clause suitable for a Getter or Fold by visited the fields identified by their 0 indexed positions JBuild a clause that updates the field at the given indexes When irref is  m the value with me matched with an irrefutable pattern. This is suitable for Lens and Traversal construction %Build a clause that constructs an Iso Unify the given list of types, if possible, and return the substitution used to unify the types for unifying the outer type when building a definition's type signature. =Attempt to unify two given types using a running substitution Perform a limited substitution on type variables. This is used when unifying rank-2 fields when trying to achieve a Getter or Fold. cApply a substitution to a type. This is used after unifying the types of the fields in unifyTypes. Template Haskell wants type variables declared in a forall, so we find all free type variables in a given type and declare them. This function works like  J except that it takes a list of variables to exclude from quantification.0xyz{|}~  (constructor name, field name, field type !outer type !normalized constructors !target definition 8optic type, definition type, field count, target fields Outer s type Outer s type Outer s type xyz{|}~{|}~xzy!xzy{|}~    +,(C) 2014 Edward Kmett, (C) 2014 Eric Mertens BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> experimental non-portable Trustworthy Normalized constructor Generate a Prism for each constructor of a data type. Isos generated when possible. Reviews are created for constructors with existentially quantified constructors and GADTs.e.g. Odata FooBarBaz a = Foo Int | Bar a | Baz Int Char makePrisms ''FooBarBaz  will create x_Foo :: Prism' (FooBarBaz a) Int _Bar :: Prism (FooBarBaz a) (FooBarBaz b) a b _Baz :: Prism' (FooBarBaz a) (Int, Char)  Generate a Prism for each constructor of a data type and combine them into a single class. No Isos are created. Reviews are created for constructors with existentially quantified constructors and GADTs.e.g. Udata FooBarBaz a = Foo Int | Bar a | Baz Int Char makeClassyPrisms ''FooBarBaz  will create class AsFooBarBaz s a | s -> a where _FooBarBaz :: Prism' s (FooBarBaz a) _Foo :: Prism' s Int _Bar :: Prism' s a _Baz :: Prism' s (Int,Char) _Foo = _FooBarBaz . _Foo _Bar = _FooBarBaz . _Bar _Baz = _FooBarBaz . _Baz instance AsFooBarBaz (FooBarBaz a) a  Generate an As class of prisms. Names are selected by prefixing the constructor name with an underscore. Constructors with multiple fields will construct Prisms to tuples of those fields. IMain entry point into Prism generation for a given type constructor name.Generate prisms for the given  Generate prisms for the given type, normalized constructors, and an optional name to be used for generating a prism class. This function dispatches between Iso generation, normal top-level prisms, and classy prisms. Compute the full type-changing Prism type given an outer type, list of constructors, and target constructor name. Additionally return  + if the resulting type is a "simple" prism. 1Construct either a Review or Prism as appropriate Construct an iso declaration Construct prism expressionprism  reviewer remitter Construct an Iso expressioniso  reviewer remitter Construct a Review expressionunto ((x,y,z) -> Con x y z) (Construct the review portion of a prism. ((x,y,z) -> Con x y z) :: b -> t `Construct the remit portion of a prism. Pattern match only target constructor, no type changingh(x -> case s of Con x y z -> Right (x,y,z) _ -> Left x ) :: s -> Either s a 6Pattern match all constructors to enable type-changingt(x -> case s of Con x y z -> Right (x,y,z) Other_n w -> Left (Other_n w) ) :: s -> Either t a .Construct the remitter suitable for use in an Iso"((Con x y z) -> (x,y,z)) :: s -> a DConstruct the classy prisms class for a given type and constructors.class ClassName r  varsin type | r ->  varsin Type where topMethodName :: Prism' r Type conMethodName_n :: Prism' r conTypes_n conMethodName_n = topMethodName . conMethodName_n GConstruct the classy prisms instance for a given type and constructors.Ninstance Classname OuterType where topMethodName = id conMethodName_n = prism  Normalize  ) to its constructor name and field types. dCompute a prism's name by prefixing an underscore for normal constructors and period for operators. *Quantify all the free variables in a type.)         Type constructor name Type constructor name generate top-level definitions    constructors target constructor    "                 ,'(C) 2012-14 Edward Kmett, Michael Sloan BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> experimental non-portable TrustworthyF( ;Monad for emitting top-level declarations as a side effect. ?A data, newtype, data instance or newtype instance declaration. Datatype context. =Type constructor name, or Nothing for a data family instance. List of type parameters 7Create a concrete record type given a substitution to detaParameters. ;Constructors , derivings :: [Name] -- currently not neededMGenerate "simple" optics even when type-changing optics are possible. (e.g.   instead of !)KIndicate whether or not to supply the signatures for the generated lenses.Disabling this can be useful if you want to provide a more restricted type signature or if you want to supply hand-written haddocks."Generate "updateable" optics when  . When  ,  s will be generated instead of s and  s will be generated instead of !qes. This mode is intended to be used for types with invariants which must be maintained by "smart" constructors.'Create the class if the constructor is  and the  rule matches. 3 to access the convention for naming fields in our {.LDefaults to stripping the _ off of the field name, lowercasing the name, and skipping the field if it doesn't start with an '_'. The field naming rule provides the names of all fields in the type as well as the current field. This extra generality enables field naming conventions that depend on the full set of names in a type.The field naming rule has access to the type name, the names of all the field of that type (including the field being named), and the name of the field being named.6TypeName -> FieldNames -> FieldName -> DefinitionNamesxRetrieve options such as the name of the class and method to put in it to build a class around monomorphic data types. Classyn lenses are generated when this naming convention is provided. TypeName -> Maybe (ClassName, MainMethodName)Rules for making fairly simple partial lenses, ignoring the special cases for isomorphisms and traversals, and not making any classes. Construct a {f value for generating top-level definitions using the given map from field names to definition names.?Rules for making lenses and traversals that precompose another !. ?Rules for making lenses and traversals that precompose another !w using a custom function for naming the class, main class method, and a mapping from field names to definition names.DBuild lenses (and traversals) with a sensible default configuration.e.g.  data FooBar = Foo { _x, _y ::  3 } | Bar { _x ::  3 }  ''FooBar  will create x ::   FooBar  3L x f (Foo a b) = (\a' -> Foo a' b) <$> f a x f (Bar a) = Bar <$> f a y ::  FooBar  3C y f (Foo a b) = (\b' -> Foo a b') <$> f b y _ c@(Bar _) = pure c  =   ZMake lenses and traversals for a type, and create a class when the type has no arguments.e.g. !data Foo = Foo { _fooX, _fooY ::  3 }  ''Foo  will create class HasFoo t where foo ::   t Foo fooX ::   t  3N fooX = foo . go where go f (Foo x y) = (\x' -> Foo x' y) <$> f x fooY ::   t  3i fooY = foo . go where go f (Foo x y) = (\y' -> Foo x y') <$> f y instance HasFoo Foo where foo = id  =   nMake lenses and traversals for a type, and create a class when the type has no arguments. Works the same as  except that (a) it expects that record field names do not begin with an underscore, (b) all record fields are made into lenses, and (c) the resulting lens is prefixed with an underscore.?Derive lenses and traversals, specifying explicit pairings of (fieldName, lensName).rIf you map multiple names to the same label, and it is present in the same constructor then this will generate a .e.g. . [("_foo", "fooLens"), ("baz", "lbaz")] ''Foo , [("_barX", "bar"), ("_barY", "bar")] ''Bar `Derive lenses and traversals, using a named wrapper class, and specifying explicit pairings of (fieldName, traversalName).Example usage: = "HasFoo" "foo" [("_foo", "fooLens"), ("bar", "lbar")] ''Foo )Build lenses with a custom configuration.qMake lenses for all records in the given declaration quote. All record syntax in the input will be stripped off.e.g. 3declareLenses [d| data Foo = Foo { fooX, fooY ::  3 } deriving  V |]  will create data Foo = Foo  3  3 deriving  V fooX, fooY ::   Foo Int  Similar to  , but takes a declaration quote.For each record in the declaration quote, make lenses and traversals for it, and create a class when the type has no arguments. All record syntax in the input will be stripped off.e.g. 3declareClassy [d| data Foo = Foo { fooX, fooY ::  3 } deriving  V |]  will create data Foo = Foo  3  3 deriving  V class HasFoo t where foo ::  ' t Foo instance HasFoo Foo where foo =   fooX, fooY :: HasFoo t =>   t  3  Similar to  , but takes a declaration quote. Generate a Prism( for each constructor of each data type.e.g. ^declarePrisms [d| data Exp = Lit Int | Var String | Lambda{ bound::String, body::Exp } |]  will create Ndata Exp = Lit Int | Var String | Lambda { bound::String, body::Exp } _Lit :: Prism' Exp Int _Var :: Prism' Exp String _Lambda :: Prism' Exp (String, Exp) Build Wrapped instance for each newtype.  declareFields =  PDeclare lenses for each records in the given declarations, using the specified {7. Any record syntax in the input will be stripped off.  Transform NewtypeDs declarations to DataDs and  NewtypeInstDs to  DataInstDs. ZGiven a set of names, build a map from those names to a set of fresh names based on them.Build Wrapped instance for a given newtype#Field rules for fields in the form  _prefix_fieldname #Field rules for fields in the form % prefixFieldname or _prefixFieldname I If you want all fields to be lensed, then there is no reason to use an _? before the prefix. If any of the record fields leads with an _& then it is assume a field without an _ should not have a lens created.Note: The prefix must be the same as the typename (with the first letter lowercased). This is a change from lens versions before lens 4.5. If you want the old behaviour, use  Field rules fields in the form % prefixFieldname or _prefixFieldname I If you want all fields to be lensed, then there is no reason to use an _? before the prefix. If any of the record fields leads with an _& then it is assume a field without an _ should not have a lens created. Note that prefix may be any string of characters that are not uppercase letters. (In particular, it may be arbitrary string of lowercase letters and numbers) This is the behavior that  had in lens 4.4 and earlier.$Generate overloaded field accessors.e.g data Foo a = Foo { _fooX ::  3+, _fooY : a } newtype Bar = Bar { _barX ::  % } makeFields ''Foo makeFields ''Bar  will create I_fooXLens :: Lens' (Foo a) Int _fooYLens :: Lens (Foo a) (Foo b) a b class HasX s a | s -> a where x :: Lens' s a instance HasX (Foo a) Int where x = _fooXLens class HasY s a | s -> a where y :: Lens' s a instance HasY (Foo a) a where y = _fooYLens _barXLens :: Iso' Bar Char instance HasX Bar Char where x = _barXLens For details, see .  makeFields =   Deprecated alias for  LTraverse each data, newtype, data instance or newtype instance declaration.:        (Field Name, Definition Name) ! -Type Name -> Maybe (Class Name, Method Name)  (Field Name, Method Name)   " # $ % & ' ( ) * + , -  . /%xyz{%{xzy4        !    " # $ % & ' ( ) * + , -  . /-(C) 2013-2014 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> experimental non-portable Safe-Inferred&'+23468=>M 01This permits the construction of an "impossible" ) that matches only if some function does. There was an  1& caused by abusing the internals of a  2.Both  exceptions and Control.Exception provide a  2 type.pThis lets us write combinators to build handlers that are agnostic about the choice of which of these they use.This builds a  2! for just the targets of a given ^ (or any  , really).  3 ... [  J (s ->  4   "Assertion Failed\n"  5 s) ,  J  (s ->  4   "Error\n"  5 s) ] This works ith both the  6 type provided by Control.Exception:  ::   7 a -> (a ->  8 r) ->  6 r  ::   7 a -> (a ->  8 r) ->  6 r  ::    7 a -> (a ->  8 r) ->  6 r  ::    7 a -> (a ->  8 r) ->  6 r  ::   7 a -> (a ->  8 r) ->  6 r  and with the  9 type provided by Control.Monad.Catch:  ::   7 a -> (a -> m r) ->  9 m r  ::   7 a -> (a -> m r) ->  9 m r  ::    7 a -> (a -> m r) ->  9 m r  ::    7 a -> (a -> m r) ->  9 m r  ::   7 a -> (a -> m r) ->  9 m r  and with the 0 type provided by Control.Monad.Error.Lens:  ::  e a -> (a -> m r) -> 0 e m r  ::  e a -> (a -> m r) -> 0 e m r  ::   e a -> (a -> m r) -> 0 e m r  ::   e a -> (a -> m r) -> 0 e m r  ::  e a -> (a -> m r) -> 0 e m r This builds a  2! for just the targets of a given ^ (or any T, really). that ignores its input and just recovers with the stated monadic action.  3 ... [  J  ( : "looped") ,  J  ( : "overflow") ] This works with the  6 type provided by Control.Exception:  ::   7 a ->  8 r ->  6 r  ::   7 a ->  8 r ->  6 r  ::    7 a ->  8 r ->  6 r  ::    7 a ->  8 r ->  6 r  ::   7 a ->  8 r ->  6 r  and with the  9 type provided by Control.Monad.Catch:  ::   7 a -> m r ->  9 m r  ::   7 a -> m r ->  9 m r  ::    7 a -> m r ->  9 m r  ::    7 a -> m r ->  9 m r  ::   7 a -> m r ->  9 m r  and with the 0 type provided by Control.Monad.Error.Lens:  ::  e a -> m r -> 0 e m r  ::  e a -> m r -> 0 e m r  ::   e a -> m r -> 0 e m r  ::   e a -> m r -> 0 e m r  ::  e a -> m r -> 0 e m r  0 ; < = > ? @ A B 0 ; < = > ? @ A B(C) 2012-14 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> experimental Rank2Types Safe-Inferred?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~(C) 2012-14 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> experimental non-portable Safe-Inferred _cdhir}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ IJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~xyz{(C) 2013-14 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> experimental non-portable Safe-Inferredu _cdhir}~      !"#$%&'()*+,-./0123BTUVWXYZ]^_`abcdefmnopqrst      !"#$%&'()*+,-.123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`aefghijklmnopqrstuvwxyz{|}~ IJLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~xyz{.(C) 2012-14 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> provisionalportable Safe-InferredCheck to see if this  matches.is _Left (Right 12)False is hex "3f79"True @ABCDEFGH/(C) 2012-2014 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> experimental non-portable Trustworthy3FHMTraverse a strict  ;( from left to right in a biased fashion.Traverse a strict  ;M from left to right in a biased fashion pretending the bytes are characters.Traverse a strict  ;b in a relatively balanced fashion, as a balanced tree with biased runs of elements at the leaves.Traverse a strict  ; in a relatively balanced fashion, as a balanced tree with biased runs of elements at the leaves, pretending the bytes are chars.Unpack a lazy  BytestringAn # of the individual bytes in a lazy  Unpack a lazy   pretending the bytes are chars.An # of the individual bytes in a lazy   pretending the bytes are chars. CConversion between   and  . Should compile to a no-op. DUnsafe 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. E8A way of creating ByteStrings outside the IO monad. The Int; argument gives the final size of the ByteString. Unlike  createAndTrimV the ByteString is not reallocated if the final size is less than the estimated size. FCreate ByteString of size l and use action f to fill it's contents. G C D E F   G C D E F(C) 2012-14 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> experimental non-portable Safe-Inferredv456789:;<=>?@ACDEFGHIJKLMNOPQRS[\ghijkluvwxyz{|}~/0bcdKv/0bcdhijgkluvwxyz{|}~K456789:;<=>?@ACDEFGHIJKLMNOPQRS[\0(C) 2014 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> provisionalControl.Monad.Error Safe-Inferred246:M You need this when using .$Catch exceptions that match a given  (or any  , really).  ::  H e m => % e a -> m r -> (a -> m r) -> m r  ::  H e m =>  & e a -> m r -> (a -> m r) -> m r  ::  H e m => ! e a -> m r -> (a -> m r) -> m r  ::  H e m => ' e a -> m r -> (a -> m r) -> m r  ::  H e m => % e a -> m r -> (a -> m r) -> m r  ::  H e m => ' e a -> m r -> (a -> m r) -> m r $Catch exceptions that match a given  (or any \), discarding the information about the match. This is particuarly useful when you have a  e () where the result of the  or = isn't particularly valuable, just the fact that it matches.  ::  H e m =>  e a -> m r -> m r -> m r  ::  H e m =>   e a -> m r -> m r -> m r  ::  H e m =>  e a -> m r -> m r -> m r  ::  H e m =>  e a -> m r -> m r -> m r  ::  H e m =>  e a -> m r -> m r -> m r  ::  H e m =>  e a -> m r -> m r -> m r  A version of d with the arguments swapped around; useful in situations where the code for the handler is shorter.  ::  H e m => % e a -> (a -> m r) -> m r -> m r  ::  H e m =>  & e a -> (a -> m r) -> m r -> m r  ::  H e m => ! e a -> (a -> m r) -> m r -> m r  ::  H e m => ' e a -> (a -> m r) -> m r -> m r  ::  H e m => ' e a -> (a -> m r) -> m r -> m r  ::  H e m => % e a -> (a -> m r) -> m r -> m r  A version of d with the arguments swapped around; useful in situations where the code for the handler is shorter.  ::  H e m =>  e a -> m r -> m r -> m r  ::  H e m =>   e a -> m r -> m r -> m r  ::  H e m =>  e a -> m r -> m r -> m r  ::  H e m =>  e a -> m r -> m r -> m r  ::  H e m =>  e a -> m r -> m r -> m r  ::  H e m =>  e a -> m r -> m r -> m r  takes a  (or any 0) to select which exceptions are caught If the  Exception/ does not match the predicate, it is re-thrown.  ::  H e m =>  e a -> m r -> m ( a r)  ::  H e m =>   e a -> m r -> m ( a r)  ::  H e m =>  e a -> m r -> m ( a r)  ::  H e m =>  e a -> m r -> m ( a r)  ::  H e m =>  e a -> m r -> m ( a r)  ::  H e m =>  e a -> m r -> m ( a r) BThis function exists to remedy a gap between the functionality of Control.Exception and Control.Monad.Error. Control.Exception supplies  and a notion of C, which we duplicate here in a form suitable for working with any  H instance.VSometimes you want to catch two different sorts of error. You could do something like f =  _Foo handleFoo ( _Bar handleBar expr) However, there are a couple of problems with this approach. The first is that having two exception handlers is inefficient. However, the more serious issue is that the second exception handler will catch exceptions in the first, e.g. in the example above, if  handleFoo uses  I2 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  I  ::  H e m =>  e t -> t -> a  ::  H e m =>  e t -> t -> a J6Helper function to provide conditional catch behavior. J K L M N O P   J K L M N O P1(C) 2014 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> provisionalControl.Monad.PrimitiveNone;=K2(C) 2012-2014 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> provisionalportable TrustworthyEvaluate the targets of a ! or / into a data structure according to the given  Q.  R =   =   =    ::   s a ->  Q a ->  Q s  ::  s a ->  Q a ->  Q s  :: (a ->  S a) -> s ->  S s) ->  Q a ->  Q s Evaluate the targets of a ! or 7 according into a data structure according to a given  Q in parallel.  T =    ::   s a ->  Q a ->  Q s  ::  s a ->  Q a ->  Q s  :: ((a ->  S a) -> s ->  S s) ->  Q a ->  Q s  Transform a !, , ,  or 7 to first evaluates its argument according to a given  Q before proceeding.   U  ::  t =>  Q a ->  Q [a]  Transform a !, , ,  or 0 to evaluate its argument according to a given  Q in parallel with evaluating.   U  ::  t =>  Q a ->  Q [a] 3(C) 2012-14 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> provisionalportable Safe-Inferred$Evaluate the elements targeted by a !, ,  ,  or ! according to the given strategy.  V =   4(C) 2012-14 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> provisional&MPTCs, Rank2Types, LiberalTypeSynonyms Safe-InferredHMThis setter can be used to derive a new   from an old IAarrayI by applying a function to each of the indices to look it up in the old  . This is a  contravariant .  W "a 1     "a ,    W 1 ( b) f arr  X i "a arr  X f i  Y (1 ( b) f arr) "a b 5(C) 2012-14 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> experimentalLiberalTypeSynonyms Safe-Inferred3HM Bitwise  Z 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  Z 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  Z the target(s) of a ! (or G), returning the result (or a monoidal summary of all of the results)._2 <.|.~ 6 $ ("hello",3)(7,("hello",7)) () ::  [ a =>  $ 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 F, returning the result (or a monoidal summary of all of the results)._2 <.&.~ 7 $ ("hello",254)(6,("hello",6)) () ::  [ a =>  $ s t a a -> a -> s -> (a, t) () ::  [ a => !# s t a a -> a -> s -> (a, t) () :: ( [ a,  a) =>  s t a a -> a -> s -> (a, t) Modify the target(s) of a   (or ) by computing its bitwise  \c with another value, returning the result (or a monoidal summary of all of the results traversed).runState (_1 <.&.= 15) (31,0) (15,(15,0)) () :: (  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  Zc with another value, returning the result (or a monoidal summary of all of the results traversed).runState (_1 <.|.= 7) (28,0) (31,(31,0)) () :: (  s m,  [ a) =>   s a -> a -> m a () :: (  s m,  [ a,  a) =>  s a -> a -> m a 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  ^  a ( _ ( ` :: 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 can be productively consumed, but not reassembled.BTraverse over all the bytes in an integral type, from the low end.,The byte position is available as the index.(toListOf bytewise (1312301580 :: Word32) [12,34,56,78]If you supply this an  ?!, the result will be an infinite ;, which can be productively consumed, but not reassembled.Why is'nt this function called bytes to match 5? Alas, there is already a function by that name in Data.ByteString.Lens. 6(C) 2012-2014 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> experimental non-portable Safe-Inferred3 (or ) a list of bytes into a  ;  "a ~   x "a x    x "a x  ~  "[104,101,108,108,111]^.packedBytes"hello" (or ) a  ; into a list of bytes  "a ~   x "a x    x "a x  ~  ""hello"^.packedChars.unpackedBytes[104,101,108,108,111]Traverse each   in a  ;.This  walks the  ; in a tree-like fashion enable zippers to seek to locations in logarithmic time and accelerating many monoidal queries, but up to associativity (and constant factors) it is equivalent to the much slower:  "a     *anyOf bytes (== 0x80) (Char8.pack "hello")False$Note that when just using this as a , ,  can be more efficient. (or ) a list of characters into a  ;When writing back to the  ; it is assumed that every   lies between '\x00' and '\xff'.  "a ~   x "a x    x "a x  ~  c"hello"^.packedChars.each.re (base 16 . enum).to (\x -> if Prelude.length x == 1 then '0':x else x) "68656c6c6f" (or ) a list of characters into a  ;When writing back to the  ; it is assumed that every   lies between '\x00' and '\xff'.  "a ~   x "a x    x "a x  ~  0[104,101,108,108,111]^.packedBytes.unpackedChars"hello"#Traverse the individual bytes in a  ; as characters.When writing back to the  ; it is assumed that every   lies between '\x00' and '\xff'.This  walks the  ; in a tree-like fashion enable zippers to seek to locations in logarithmic time and accelerating many monoidal queries, but up to associativity (and constant factors) it is equivalent to the much slower:  =     anyOf chars (== 'h') "hello"True7(C) 2012-2014 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> experimental non-portable Safe-Inferred3 (or ) a list of bytes into a  .  "a ~   x "a x    x "a x  ~  8[104,101,108,108,111]^.packedBytes == Char8.pack "hello"True (or ) a   into a list of bytes  "a ~   x "a x    x "a x  ~  ""hello"^.packedChars.unpackedBytes[104,101,108,108,111]#Traverse the individual bytes in a  .This  walks each strict   chunk in a tree-like fashion enable zippers to seek to locations more quickly and accelerate many monoidal queries, but up to associativity (and constant factors) it is equivalent to the much slower:  "a     *anyOf bytes (== 0x80) (Char8.pack "hello")False$Note that when just using this as a , ,  can be more efficient. (or ) a list of characters into a  .When writing back to the   it is assumed that every   lies between '\x00' and '\xff'.  "a ~   x "a x    x "a x  ~  c"hello"^.packedChars.each.re (base 16 . enum).to (\x -> if Prelude.length x == 1 then '0':x else x) "68656c6c6f" (or ) a list of characters into a  When writing back to the   it is assumed that every   lies between '\x00' and '\xff'.  "a ~   x "a x    x "a x  ~  0[104,101,108,108,111]^.packedBytes.unpackedChars"hello"#Traverse the individual bytes in a   as characters.When writing back to the   it is assumed that every   lies between '\x00' and '\xff'.This  walks each strict   chunk in a tree-like fashion enable zippers to seek to locations more quickly and accelerate many monoidal queries, but up to associativity (and constant factors) it is equivalent to:  =     anyOf chars (== 'h') "hello"True8(C) 2012-14 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> experimental non-portable Safe-Inferred3Traversals for ByteStrings. (or () a list of bytes into a strict or lazy  ;.  x "a x    x "a x  ~   "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    x "a x  ~   "a ~  Traverse each   in a strict or lazy  ;This  walks each strict  ; chunk in a tree-like fashion enable zippers to seek to locations more quickly and accelerate many monoidal queries, but up to associativity (and constant factors) it is equivalent to the much slower:  "a       (  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 enable zippers to seek to locations more quickly and accelerate many monoidal queries, but up to associativity (and constant factors) it is equivalent to the much slower:  "a       (  'c') ::  ; ->    (or ) a  ; into a list of bytes  "a ~   x "a x    x "a x  ~   ::   [ ]  ::   [ ]  (or /) a list of characters into a strict (or lazy)  ;When writing back to the  ; it is assumed that every   lies between '\x00' and '\xff'.  "a ~   x "a x    x "a x  ~   ::      ::      b c b c9(C) 2012-14 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> experimental non-portable Safe-Inferred3 Access the  d of a   number.(a :+ b)^._realPartaa :+ b & _realPart *~ 2 a * 2 :+ b  ::   f => (a -> f a) ->   a -> f (  a) Access the  e 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  l (2 l b a) = blaw is violated when you set a  f value with 0  g and non-zero  h as the  h) information is lost, or with a negative  g which flips the  h and retains a positive  g. So don't do that!)Otherwise, this is a perfectly cromulent !. Access the  g of a   number. (10.0 :+ 20.0) & _magnitude *~ 2 20.0 :+ 40.0 This isn't quite a legal ! . Notably the  l (2 l b a) = b(law is violated when you set a negative  g. This flips the  h and retains a positive  g. So don't do that!)Otherwise, this is a perfectly cromulent !. Setting the  g of a zero   number assumes the  h is 0. Access the  h of a   number.4(mkPolar 10 (2-pi) & _phase +~ pi & view _phase) "H 2True This isn't quite a legal ! . Notably the  l (2 l b a) = blaw is violated when you set a  h outside the range (- i,  i]D. The phase is always in that range when queried. So don't do that!)Otherwise, this is a perfectly cromulent !. Access the  j of a   number.*(2.0 :+ 3.0) & _conjugate . _imagPart -~ 1 2.0 :+ 4.02(mkPolar 10.0 2.0 ^. _conjugate . _phase) "H (-2.0)True:(C) 2012-14 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> provisionalportable Safe-InferredHM IntSet isn't Foldable, but this ) can be used to access the members of an  k.&sumOf members $ setOf folded [1,2,3,4]10This * can be used to change the contents of an  k( by mapping the elements to new values. Sadly, you can't create a valid  for a SetZ, because the number of elements might change but you can manipulate it by reading using   and reindexing it via .(over setmapped (+1) (fromList [1,2,3,4])fromList [2,3,4,5] Construct an  k 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  3 -> s ->  k  ::  s  3 -> s ->  k  ::  s  3 -> s ->  k  ::   s  3 -> s ->  k  ::  s  3 -> s ->  k ;(C) 2012-14 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> provisionalportable Safe-Inferred3HMA / stripping a prefix from a list when used as a 0, or prepending that prefix when run backwards:"preview" ^? prefixed "pre" Just "view""review" ^? prefixed "pre"Nothingprefixed "pre" # "amble" "preamble"A / stripping a suffix from a list when used as a /, or appending that suffix when run backwards:"review" ^? suffixed "view" Just "re""review" ^? suffixed "tire"Nothingsuffixed ".o" # "hello" "hello.o"This is a deprecated alias for .This is a deprecated alias for .<,(C) 2012-2014 Edward Kmett, Alexander Altman BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> provisional Rank2Types Safe-InferredHM Obtain a  by splitting another , !,  or + according to the given splitting strategy.  ::  l a ->  s a ->  s [a]  Obtain a  by splitting another , !,  or  on the given delimiter.Equivalent to     m    n.  ::  t a => [a] ->  s a ->  s [a]  Obtain a  by splitting another , !,  or  on any of the given elements.Equivalent to     m    o.  ::  t a => [a] ->  s a ->  s [a]  Obtain a  by splitting another , !,  or , on elements satisfying the given predicate.Equivalent to     m    p.  :: (a ->  ) ->  s a ->  s [a]  Obtain a  by splitting another , !,  or / into chunks terminated by the given delimiter.Equivalent to     m    n.  ::  t a => [a] ->  s a ->  s [a]  Obtain a  by splitting another , !,  or 5 into chunks terminated by any of the given elements.Equivalent to     q    m    o.  ::  t a => [a] ->  s a ->  s [a]  Obtain a  by splitting another , !,  or E into "words", with word boundaries indicated by the given predicate.Equivalent to     r    m    p.  :: (a ->  ) ->  s a ->  s [a]  Obtain a  by splitting another , !,  or E into "lines", with line boundaries indicated by the given predicate.Equivalent to     q    m    p.  :: (a ->  ) ->  s a ->  s [a]  Obtain a  by splitting another , !,  or  into length-n pieces.7"48656c6c6f20776f726c64"^..chunking 2 folded.hex.to chr "Hello world"  ::  3 ->  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  l.)Modify or retrieve the policy for what a  l should do with delimiters.)Modify or retrieve the policy for what a  l( should do about consecutive delimiters.,Modify or retrieve the policy for whether a  l should drop an initial blank.,Modify or retrieve the policy for whether a  l should drop a final blank. n s t s t=(C) 2012-14 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> experimental non-portable Safe-Inferred3HM A   is isomorphic to a  u  v m "a m   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  w  x m "a m   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] Construct a   from a , h, f, j or _.seqOf folded ["hello","world"]fromList ["hello","world"]5seqOf (folded._2) [("hello",1),("world",2),("!!!",3)]fromList [1,2,3]  ::  s a -> s ->   a  ::  s a -> s ->   a  ::  s a -> s ->   a  ::   s a -> s ->   a  ::  s a -> s ->   a                     >(C) 2012-2014 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> experimental non-portable Safe-Inferred3 This isomorphism can be used to  y (or  z ) strict  :."hello"^.packed -- :: Text"hello"  y x "a x    z x "a x  ~   "a ~   "a }  y  z  This isomorphism can be used to  z (or  y) lazy  :."hello"^.unpacked -- :: String"hello"This  L is provided for notational convenience rather than out of great need, since  "a ~   y x "a x  ~   z x "a x    "a }  z  y This is an alias for 2 that makes it more obvious how to use it with '#' > _Text # "hello" -- :: Text"hello"Convert between strict  : and  { .  | x "a x    } ( ~ x) "a x  ~  -Traverse the individual characters in strict  :.anyOf text (=='o') "hello"True@When the type is unambiguous, you can also use the more general .  "a  .   "a  $Note that when just using this as a , ,   can be more efficient.EncodeDecode a strict  : to from strict  ; , via UTF-8. utf8 # "&""\226\152\131"?(C) 2012-2014 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> experimental non-portable Safe-Inferred234 This isomorphism can be used to   (or  ) lazy  ."hello"^.packed -- :: Text"hello"   x "a x     x "a x  ~   "a ~   This isomorphism can be used to   (or  ) lazy  ."hello"^.unpacked -- :: String"hello"   x "a x  ~    x "a x   This  L is provided for notational convenience rather than out of great need, since  "a ~  This is an alias for * that makes it clearer how to use it with ('#').  = ~  _Text # "hello" -- :: Text"hello"Convert between lazy   and  { .   x "a x    ~ x "a x  ~  (Traverse the individual characters in a  .anyOf text (=='c') "chello"True  =  .  @When the type is unambiguous, you can also use the more general .  "a  $Note that when just using this as a , ,  can be more efficient.EncodeDecode a lazy   to from lazy   , via UTF-8.yNote: This function does not decode lazily, as it must consume the entire input before deciding whether or not it fails.ByteString.unpack (utf8 # "&") [226,152,131]@(C) 2012-14 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> experimental non-portable Safe-Inferred234Traversals for strict or lazy  : This isomorphism can be used to   (or  ) strict or lazy  :.   x "a x     x "a x  ~   "a ~  Convert between strict or lazy  : and a  {.  | x "a x   5Traverse the individual characters in strict or lazy  :.  =  .   This isomorphism can be used to   (or  ) both strict or lazy  :.   x "a x     x "a x  ~  This  L is provided for notational convenience rather than out of great need, since  "a ~   This is an alias for * that makes it clearer how to use it with ('#').   = ~  _Text # "hello" :: Strict.Text"hello"     A(C) 2012-14 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> provisionalMTPCs Safe-Inferred3!A ! that focuses on the root of a  .view root $ Node 42 []42"A !3 returning the direct descendants of the root of a    " "a  !"!"!"!"B(C) 2012-14 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> experimental Rank2Types Safe-InferredHM#A  for working with a   of a  value.$A  for working with a   of a  value.#$#$#$#$C(C) 2012-14 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> provisional non-portable Trustworthy36HM% sliced i n provides a ! that edits the n elements starting at index i from a !.This is only a valid !3 if you do not change the length of the resulting  .RAttempting to return a longer or shorter vector will result in violations of the ! laws.%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  4 to a version that doesn't retain any extra memory.)This = will ignore any duplicates in the supplied list of indices.>toListOf (ordinals [1,3,2,5,9,10]) $ Vector.fromList [2,4..40][4,8,6,12,20,22]%i starting indexn length&'()%&'()&'(%)%&'()D(C) 2012-2014 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> provisional non-portable Trustworthy3HM * sliced i n provides a ! that edits the n elements starting at index i from a !.This is only a valid !3 if you do not change the length of the resulting  .RAttempting to return a longer or shorter vector will result in violations of the ! laws.%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) :: Vector.Vector IntfromList [8,15],Convert a list to a   (or back.)&[1,2,3] ^. vector :: Vector.Vector IntfromList [1,2,3]'Vector.fromList [0,8,15] ^. from vector[0,8,15]- Convert a   to a finite   (or back.). Convert a   to a finite   from right to left (or back.)/ Convert a  H back and forth to an initializer that when run produces a copy of the  .0 Convert a  4 to a version that doesn't retain any extra memory.1This = 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]2Like $ but polymorphic in the vector type. *i starting indexn length+,-./012 *+,-./012 +0,-./*12 *+,-./012E(C) 2012-14 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> experimentalGHC Safe-Inferred3HJKM3Used to traverse   data by uniplate.4:Convert from the data type to its representation (or back)'"hello"^.generic.from generic :: String"hello"5:Convert from the data type to its representation (or back)6A   , that visits every occurrence of something  anywhere in a container.BallOf tinplate (=="Hello") (1::Int,2::Double,(),"Hello",["Hello"])True:mapMOf_ tinplate putStrLn ("hello",[(2 :: Int, "world!")])helloworld! 3 456 34564563 3 456 F(C) 2012-14 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> experimentalGHC Safe-Inferred3HJKM789:;<=> 3456789:;<=>789:;<=>789:;<=>G(C) 2012-14 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> experimental Rank2Types Safe-Inferred ?'Modify the path by adding another path.#both </>~ "bin" $ ("hello","world")("hello/bin","world/bin") (?) ::  s a     ->   -> s -> a (?) ::   s a     ->   -> s -> a (?) :: ! s a     ->   -> s -> a (?) ::  s a     ->   -> 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   ->   -> m () (@) ::   s m =>  s   ->   -> m () (@) ::   s m =>   s   ->   -> m () (@) ::   s m =>  s   ->   -> m () A+Add a path onto the end of the target of a ! and return the result3When you do not need the result of the operation, (?) is more flexible.B+Add a path onto the end of the target of a !0 into your monad's state and return the result.3When you do not need the result of the operation, (@) is more flexible.E'Modify the path by adding an extension.#both <.>~ "txt" $ ("hello","world")("hello.txt","world.txt") (E) ::  s a     ->   -> s -> a (E) ::   s a     ->   -> s -> a (E) :: ! s a     ->   -> s -> a (E) ::  s a     ->   -> s -> a FModify the target(s) of a  !,  ,  or  by adding an extension.-execState (both <.>= "txt") ("hello","world")("hello.txt","world.txt") (F) ::   s m =>  s   ->   -> m () (F) ::   s m =>  s   ->   -> m () (F) ::   s m =>   s   ->   -> m () (F) ::   s m =>  s   ->   -> m () G1Add 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, (E) is more flexible.H1Add an extension onto the end of the target of a !0 into your monad's state and return the result.,evalState (_1 <<.>= "txt") ("hello","world") "hello.txt"3When you do not need the result of the operation, (F) is more flexible.I1Add an extension onto the end of the target of a ! but return the old value#_1 <<<.>~ "txt" $ ("hello","world")("hello",("hello.txt","world"))%When you do not need the old value, (E) is more flexible.KA !( for reading and writing to the basenameNote: This is   a legal ! unless the outer  | has both a directory and filename component and the generated basenames are not null and contain no directory separators.(basename .~ "filename" $ "path/name.png""path/filename.png"LA !) for reading and writing to the directoryNote: this is not a legal ! unless the outer  L already has a directory component, and generated directories are not null.!"long/path/name.txt" ^. directory "long/path"MA !) for reading and writing to the extensionNote: This is not a legal !=, unless you are careful to ensure that generated extension  * components are either null or start with " and do not contain any internal s.%extension .~ ".png" $ "path/name.txt""path/name.png"NA !- for reading and writing to the full filenameNote: This is not a legal !<, unless you are careful to ensure that generated filename  = components are not null and do not contain any elements of s.(filename .~ "name.txt" $ "path/name.png""path/name.txt"?@ABCDEFGHIJKLMN?@ABCDEFGHIJKLMN?ACEGI@BDFHJKLMN?@ABCDEFGHIJKLMN ?@ABCDEFGHIJH(C) 2012-2014 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> experimental Rank2Types Safe-Inferred2346OWhere the error happened.P Error type specific information.Q2The handle used by the action flagging this error.RR the error is related to.SS leading to this error, if any.TWhat type of error it isOPQRSTUVWXYZ[\]^_`abcdefgOPQRSTUVWXYZ[\]^_`abcdefgOPQRSTUVWXYZ[\]^_`abcdefgOPQRSTUVWXYZ[\]^_`abcdefgI(C) 2012-14 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> provisionalportable Safe-InferredHMhThis * can be used to model the fact that every   type is a subset of  ?.Embedding through the  only succeeds if the  ?2 would pass through unmodified when re-extracted.i?A prism that shows and reads integers in base-2 through base-36LNote: This is an improper prism, since leading 0s are stripped when reading."100" ^? base 16Just 256 1767707668033969 ^. re (base 36) "helloworld" Like  !, but handles up to base-36 Like  ", but handles up to base-36 A safe variant of  +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 parenthesesj j = i 2k k = i 8l l = i 10m m = i 16n n n = } (+n) (subtract n)[1..3]^..traverse.adding 1000[1001,1002,1003]o o n = } (subtract n) ((+n) o n = ~ (n n) p p n = iso (*n) (/n)Note: This errors for n = 05 & multiplying 1000 +~ 35.003Dlet fahrenheit = multiplying (9/5).adding 32 in 230^.from fahrenheit110.0q  q n = } (/n) (*n) q n = ~ (p n)Note: This errors for n = 0r r n = } (**n) (**recip n)Note: This errors for n = 0Hau (_Wrapping Sum . from (exponentiating 2)) (foldMapOf each) (3,4) == 5Trues s = }  -  -8au (_Wrapping Sum . negated) (foldMapOf each) (3,4) == 7True9au (_Wrapping Sum) (foldMapOf (each.negated)) (3,4) == -7Truehi jklmnopqrs hijklmnopqrs ihjklmnopqrshi jklmnopqrsJ(C) 2012-14 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> provisionalControl.Exception Trustworthy246HM9tThis  1 is thrown by lens7 when the user somehow manages to rethrow an internal .u%There is no information carried in a . u ::   () u ::   7 () v#This is thrown when the user calls &.wRetrieve the argument given to &.  is isomorphic to a  .0catching _ErrorCall (error "touch down!") return "touch down!"xA record update was performed on a constructor without the appropriate field. This can only happen with a datatype with multiple constructors, where some fields are in one constructor but not another.yCInformation about the source location where the record was updated.zA record selector was applied to a constructor without the appropriate field. This can only happen with a datatype with multiple constructors, where some fields are in one constructor but not another.{JInformation about the source location where the record selection occurred.|'An uninitialised record field was used.}HInformation about the source location where the record was constructed. } ::      } ::   7   ~A pattern match failed.5Information about the source location of the pattern.  ::       ::   7   }A class method without a definition (neither a default definition, nor a definition in the appropriate instance) was called.,Extract a description of the missing method.  ::       ::   7   BThere are no runnable threads, so the program is deadlocked. The    1# is raised in the main thread only.%There is no information carried in a    1.  ::    ()  ::   7 () "The thread is waiting to retry an '(c transaction, but there are no other references to any TVars involved, so it can't ever continue.0There is no additional information carried in a    1.  ::    ()  ::   7 () The thread is blocked on an )*,, but there are no other references to the )* so it can't ever continue.0There is no additional information carried in a    1.  ::    ()  ::   7 () ?Thrown when the program attempts to call atomically, from the (, package, inside another call to atomically.0There is no additional information carried in a    1.  ::    ()  ::   7 () Thrown when the runtime system detects that the computation is guaranteed not to terminate. Note that there is no guarantee that the runtime system will notice whether any given computation is guaranteed to terminate or not.0There is no additional information carried in a    1.  ::    ()  ::   7 () Asynchronous exceptions.There are several types of  .  ::       ::   7     was applied to +.This  1B contains provides information about what assertion failed in the  .zhandling _AssertionFailed (\ xs -> "caught" <$ guard ("<interactive>" `isInfixOf` xs) ) $ assert False (return "uncaught")"caught"  ::       ::   7   )Exceptions generated by array operations.Extract information about an  .  ::       ::   7   Arithmetic exceptions.Exceptions that occur in the IO  . An  z records a more specific error type, a descriptive string and maybe the handle that was used when the error was flagged.nDue to their richer structure relative to other exceptions, these have a more carefully overloaded signature.Unfortunately the name  ioException is taken by base for throwing IOExceptions.  ::       ::   7   %Many combinators for working with an   are available in System.IO.Error.Lens.Traverse the strongly typed  1 contained in  76 where the type of your function matches the desired  1.  :: ( % f,  1 a) => (a -> f a) ->  7 -> f  7 $Catch exceptions that match a given  (or any  , really).Ucatching _AssertionFailed (assert False (return "uncaught")) $ \ _ -> return "caught""caught"  ::   m =>   7# a -> m r -> (a -> m r) -> m r  ::   m =>    7$ a -> m r -> (a -> m r) -> m r  ::   m =>   7 a -> m r -> (a -> m r) -> m r  ::   m =>   7% a -> m r -> (a -> m r) -> m r  ::   m =>   7# a -> m r -> (a -> m r) -> m r  ::   m =>   7% a -> m r -> (a -> m r) -> m r $Catch exceptions that match a given  (or any \), discarding the information about the match. This is particuarly useful when you have a  e () where the result of the  or = isn't particularly valuable, just the fact that it matches.Ocatching_ _AssertionFailed (assert False (return "uncaught")) $ return "caught""caught"  ::   m =>   7 a -> m r -> m r -> m r  ::   m =>    7 a -> m r -> m r -> m r  ::   m =>   7 a -> m r -> m r -> m r  ::   m =>   7 a -> m r -> m r -> m r  ::   m =>   7 a -> m r -> m r -> m r  ::   m =>   7 a -> m r -> m r -> m r  A version of d with the arguments swapped around; useful in situations where the code for the handler is shorter.Ihandling _NonTermination (\_ -> return "caught") $ throwIO NonTermination"caught"  ::   m =>   7# a -> (a -> m r) -> m r -> m r  ::   m =>    7$ a -> (a -> m r) -> m r -> m r  ::   m =>   7 a -> (a -> m r) -> m r -> m r  ::   m =>   7% a -> (a -> m r) -> m r -> m r  ::   m =>   7% a -> (a -> m r) -> m r -> m r  ::   m =>   7# a -> (a -> m r) -> m r -> m r  A version of d with the arguments swapped around; useful in situations where the code for the handler is shorter.Dhandling_ _NonTermination (return "caught") $ throwIO NonTermination"caught"  ::   m =>   7 a -> m r -> m r -> m r  ::   m =>    7 a -> m r -> m r -> m r  ::   m =>   7 a -> m r -> m r -> m r  ::   m =>   7 a -> m r -> m r -> m r  ::   m =>   7 a -> m r -> m r -> m r  ::   m =>   7 a -> m r -> m r -> m r  A variant of , that takes a  (or any /) to select which exceptions are caught (c.f. -, . ). If the  1/ does not match the predicate, it is re-thrown.  ::   m =>   7 a -> m r -> m ( a r)  ::   m =>    7 a -> m r -> m ( a r)  ::   m =>   7 a -> m r -> m ( a r)  ::   m =>   7 a -> m r -> m ( a r)  ::   m =>   7 a -> m r -> m ( a r)  ::   m =>   7 a -> m r -> m ( a r)  A version of - that discards the specific exception thrown.  ::   m =>   7 a -> m r -> m (Maybe r)  ::   m =>    7 a -> m r -> m (Maybe r)  ::   m =>   7 a -> m r -> m (Maybe r)  ::   m =>   7 a -> m r -> m (Maybe r)  ::   m =>   7 a -> m r -> m (Maybe r)  ::   m =>   7 a -> m r -> m (Maybe r)  Throw an  1 described by a [. Exceptions may be thrown from purely functional code, but may only be caught within the IO  .  l "a  l    ::   7 t -> t -> r  ::   7 t -> t -> r  A variant of " that can only be used within the IO   (or any other   instance) to throw an  1 described by a . Although 5 has a type that is a specialization of the type of ), the two functions are subtly different:  l e `seq` x "a  e  l e `seq` x "a x !The first example will cause the  1 e7 to be raised, whereas the second one won't. In fact,  will only cause an  1* to be raised when it is used within the   instance. The * variant should be used in preference to  to raise an  1 within the  S because it guarantees ordering with respect to other monadic operations, whereas  does not.  l "a  l /0  ::   m =>   7 t -> t -> m r  ::   m =>   7 t -> t -> m r  raises an  1 specified by a  in the target thread.  thread l "a  l (  thread)  ::   ->   7 t -> t -> m a  ::   ->   7 t -> t -> m a This $ can be used to purely map over the  1;s an arbitrary expression might throw; it is a variant of   in the same way that ( is a variant of  6. )'mapException' "a 'over' 'mappedException'NThis view that every Haskell expression can be regarded as carrying a bag of  1[s is detailed in A Semantics for Imprecise Exceptions  by Peyton Jones & al. at PLDI 99.<The following maps failed assertions to arithmetic overflow:handling _Overflow (\_ -> return "caught") $ assert False (return "uncaught") & mappedException %~ \ (AssertionFailed _) -> Overflow"caught"%This is a type restricted version of 0, which avoids the type ambiguity in the input  1 when using 2.8The following maps any exception to arithmetic overflow:lhandling _Overflow (\_ -> return "caught") $ assert False (return "uncaught") & mappedException' .~ Overflow"caught"Handle arithmetic .  "a      ::       ::   7   Handle arithmetic .  "a      ::       ::   7   $Handle arithmetic loss of precision.  "a      ::       ::   7   Handle division by zero.  "a      ::       ::   7   /Handle exceptional _Denormalized floating pure.  "a      ::       ::   7    Added in base. 4.6 in response to this libraries discussion: Mhttp://haskell.1045720.n5.nabble.com/Data-Ratio-and-exceptions-td5711246.html  "a      ::       ::   7   BAn attempt was made to index an array outside its declared bounds.  "a      ::       ::   7   UAn attempt was made to evaluate an element of an array that had not been initialized.  "a      ::       ::   7   8The current thread's stack exceeded its limit. Since an  1 has been raised, the thread's stack will certainly be below its limit again, but the programmer should take remedial action immediately.  ::    ()  ::   7 () wThe program's heap is reaching its limit, and the program should take action to reduce the amount of live data it has.Notes:+It is undefined which thread receives this  1.GHC currently does not throw   exceptions.  ::    ()  ::   7 () This  1& is raised by another thread calling 12H, or by the system if it needs to terminate the thread for some reason.  ::    ()  ::   7 () This  1 is raised by default in the main thread of the program when the user requests to terminate the program via the usual mechanism(s) (e.g. Control-C in the console).  ::    ()  ::   7 () ]tuvwxyz{|}~ =tuvwxyz{|}~=~|}z{xyvwtuLtuvwxyz{|}~ K(C) 2012-2014 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> experimental non-portable Safe-Inferred36Any   can be thrown as an  1This 8 allows you to traverse the typed value contained in a  O where the type required by your function matches that of the contents of the  , or construct a  D value out of whole cloth. It can also be used to catch or throw a   value as  7.  ::  a =>    a  ::  a =>   7 a   L(C) 2013-14 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> provisionalControl.Exception Safe-Inferred246*Exit codes that a program can return with:  ::       ::   7   !indicates successful termination;  ::    ()  ::   7 () 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).  ::     3  ::   7  3   3334534634678978:;<=;<=;<>?@A?@B?@CDEFDEGDEHDIJDIKDILDIMNOPNOQRSTRSUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{| } } ~                                          errpn o    ihml ^_\g f!"#k j$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~~RSTytvw     u[ !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\s]^_`abcde}fghijklmnopqrstuvwxyz{|}~^_\ihmlfgkj       !!!!!!!!!!!!!!!!!!!! ! ! ! ! !!!!!!!!!!!!""""""""" "!"#$%&'()*+,-./0123456789:;<=>?#@#A#B#C#D#E#F#G#H#I#J#K#L##$M$N%O%P&Q&R&S&T&U&V&W&X&Y&Z&[&\&]&^'_'`'a'b'c'd(e((f(g(h(i(j(k(l(m)n)o)p)q)r)s)t)u)v)w)x)y)z){)|)})~))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) ) ) ) ) )))))))))))))))))** *!*"*"*#*$*%*&*'*(*)***++,+-+.,/,0,1,2,3,4,5,6,7,8,9,:,;,<,=,>,?,@,A,B,C,D,E,F,G,H,I,J,K,L,M-N-N-O-P-Q.R/S/T/U/V/W/X/Y/Z/[/\000]0^0_0`0a00b1c2d2e2f2g3h4i5j5k5l5m5n5o5p5q5r5s5t5u5v5w5x5y6z6{6|6}6~67z7{7|7}7~788z8}8|88{8~99z9999:::;;;;;<<<<<<<<<<<<<<<<======h>>>>>>??????@@@@@@AABBCCCCCDDDDDDDDDEEEEFFFFFFFFGGGGGGGGGGGGGGGGHHHHHHHHHHHHHHHHHHHHHHHHHII3IIIIIIIIIIJJJJ JJJJJJJJJJJJJJJJJJJJ J J J JJ J JJJJJJ]J^J_J`JaJJbJJJJJJJJJJJJJ J J!J"K#K$L%L&L'L(N)N*N+N,N-N.N/N0N1N2N3N4N567869:69;3<=>>??@@AABBCCDDEEFFGGHHIIJJKKLLMMNNOOPPQQRRSSTTUUVVWWXXYYZZ[[\\]]^^__``aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~            !!""##$$%%&&''(())**++,,--..//00112233445566778899::;;<<==>>??@ABCDEFGHIJKLM-NOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNO33PQ3RS;TU;VW X Y Z [ \ ] ^ _ ` a b c d e f g h i j k l m n o p q r s t u v w x y z { | } ~          3                   343DD3                                  ! " # $ % & ' ( ) * + , -3 . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @3R A B C D E F G H I J K L M N O P Q R34 S3 T33 U3 V3 W3 X Y3 Z [3 Z \3 ] ^ _ ` a _ b c d e3 f c g h c g i c g j3 k3 l m3 n o c d p3 q3P r33P s t u v w x y z { | } ~               g                                                                        c c g c d 3R 3  3  3 ;  ;  ;bc; Z; Q;  ; V                   _    _ 33  3  3  3 Z 3   _ 3  3  3 3 3  3 3 33 3 34 3 3 3  3  3  3  3  3  3 3 +3 a _ 3 !3R "3 #&3 $ %3 &3 33R '333 ( ) * +3 , .3 , V3 -3 .3 /3 03 134 234 33; 4 53 63 ( 7;b 8;b p3  93  : ; _ <3 7 = > ? @ A B C D E F G H I333 J3 33x3333 ( K3 / 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 {34 | } ~  3 3  3                 3 X ! ! ! ! ! ! ! ! ! ! ! !  3     3 ( 3 (        # d# Jd# d# d# d# d# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # !# "# ## $# %# &# '# (# )# *# +# ,# -# .# /# 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% q3 r s t u v t u w3 r x% y% z {3 | }% ~%  % %   % 3   %   %  %  % % % % % %  % J% % 3 ] 3{|% % % % % % % % 3  & & & & & & & & & & & & & & & & & & & & 34 ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( !( "( #( $( %( &( '( (( )( *( +( ,( -( .( /( 0( 1( 2( 3( 4( 5( 6( 7( 8( 9( :( ;( <( =69 >) ?) @) 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* [* \* ]* ^* R* _* `* a* b* c* d* e* f* g* h* i* j* k* l* m* n+ o+ p69 q+ r+ s+ t+ u+ v+ w+ x+ y+ z+ {+ |+ }+ ~+ 69 + + + o+ + + + + + _+ + + + + c+ + + + + + + + , , , , , , , , , , , , , , , , , , , , , , , , , , , - 3   3 3 33   3 - - - - - - - - / / / / / c  c 0.0 0 0 0 0 0   t u t u t u 3 3  3  _  _ 3 3 # 3 Z 8 8 3{ 3{ 3{ 3{ 3{ 3 ] 3{   < < M M M M       @ @ @  33    3  E E E E E E E E 3  I I I I I I 3  3  3  3  3  3  !3  "3  #3  $3  %3 &3  '3  (3  )  *3 0  +3 , -3 , .3  /3  03  1J 2J 3J 4J 5J 6J 7J 8J 9J :J ;J <J =J >J ?J @J AJ BJ CJ DJ EJ FJ GJ HJ IJ JJ KJ LJ MJ NJ OJ PJ QJ RJ SJ T3 U VK WK X3  YL ZL [ \lens-4.7Control.Lens.TraversalControl.Lens.GetterControl.Lens.ReviewControl.Lens.SetterControl.Lens.PrismControl.Lens.Iso Control.Lens.Internal.ReflectionControl.Lens.Internal.THControl.Lens.Internal.ZoomControl.Lens.Internal.SetterControl.Lens.Internal.ReviewControl.Lens.Internal.PrismControl.Lens.Internal.IsoControl.Lens.Internal.LevelControl.Lens.Internal.IndexedControl.Lens.Internal.ContextControl.Lens.Internal.BazaarControl.Lens.Internal.MagmaControl.Lens.Internal.GetterControl.Lens.Internal.FoldControl.Lens.TypeControl.Lens.LensControl.Lens.LoupeControl.Lens.TupleControl.Lens.Zoom Data.Set.LensData.HashSet.LensControl.Lens.FoldControl.Lens.IndexedControl.Lens.LevelControl.Lens.ReifiedData.Data.LensControl.Lens.PlatedControl.Lens.EqualityControl.Lens.WrappedControl.Lens.EmptyControl.Lens.EachControl.Lens.ConsControl.Lens.Internal.DequeControl.Lens.AtLanguage.Haskell.TH.LensControl.Lens.Internal.FieldTHControl.Lens.Internal.PrismTHControl.Lens.THControl.Lens.Internal.ExceptionControl.Lens.Extras Control.Lens.Internal.ByteStringControl.Monad.Error.LensControl.Monad.Primitive.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.LensGHC.Generics.LensSystem.FilePath.LensSystem.IO.Error.Lens Numeric.LensControl.Exception.LensData.Dynamic.LensSystem.Exit.Lens Data.Map.Lens Paths_lensControl.Lens.Internal.InstancesControl.Monad.RWSRWSTMagnifyZoomzoomControl.Monad.ErrorErrorTControl.Monad.WriterWriterTControl.Monad.StateStateT backwardsSetterAccessorPrismIso Data.IntMapIntMapControl.Monad.Trans.State.LazyState indexed64indexed TraversalIndexedTraversalFold IndexedFoldLens IndexedLensGetter IndexedGetterLensLikeOpticalOvercloneBazaartakinglastOfpreview maximumOf minimumOfmapM_ traverseOf_ _imagPart Data.ComplexComplex traversedGetting Data.FoldableFoldable foldMapOf Data.MonoidMonoidrereview^?Data.TraversabletraverselengthOfNumeric.NaturalNaturalprismoutsideData.Text.InternalTextsetviewover TraversableData.Functor.Compose getComposeCompose fmapDefaultuse_2atimap Traversal'Setter'^..~%~+~Iso'-~*~//~^~^^~**~||~&&~<>~%=+=-=*=//=^=^^=**=||=&&=.=<>=%@~ withIndex<.~<.=anyOf Data.Functor<$> ifoldMapOffromcloneTraversal Data.TypeablecastControl.Monad.Reader.ClasslocalfoldedPreludeunfoldrfoldMapfoldfoldrfoldltoListandoranyallproductsum_1 traverseOf traverse__LeftforOffor_forM_ sequence_ maximumByfindfoldr1foldl1foldr'foldl' Data.Listfoldl1'foldrMfoldlM Control.MonadMonadControl.TraversableControl.Lens.Isomorphic itraverseOfimapMOfiforMOfifor transposeuniplatebiplate contextsOfControl.Comonad.Store.ClasspospeekReifiedTraversalreflectTraversalControl.Lens.IndexedTraversalmap mapAccumRplate Data.Just isNothingextractIndexed cloneLensalaalafData.MapMapjoinSimpleControl.ExceptionHandler_AssertionFailed _ErrorCallPrism'Lens'_NonTermination_StackOverflowControl.Lens.Internal Control.LensControl.Lens.CombinatorsB BytestringControl.Lens.OperatorscatchesData.ByteStringpackunpackData.ByteString.Char8Data.ByteString.LazyData.ByteString.Lazy.Char8 ByteStringData.Text.LazySystem.FilePath extSeparatorpathSeparators Data.Char intToDigit digitToIntNumeric showSigned readSignederrorControl.Monad.STMSTMControl.Concurrent.MVarMVarFalsetrytryJust catchJustCatchIOthrowControl.Concurrent killThreadbaseControl.ApplicativegetConstConstbifunctors-4.2Data.Bifunctorbimap Bifunctortransformers-0.4.2.0Data.Functor.IdentityIdentity runIdentitycontravariant-1.2Data.Functor.Contravariant>$ contramap Contravariantprofunctors-4.3.2Data.Profunctorright'left'ChoiceData.Profunctor.Unsafermaplmapdimap Profunctorreflection-1.5.1Data.ReflectionreflectReifiessemigroupoids-4.2Data.Semigroup.Traversable traverse1 Traversable1 tySynInstD'appsTappsE1toTupleTtoTupleEtoTuplePconAppsTbndrNamefromSetlensPackageKey mkLensName_tc mkLensName_vtraversalTypeNametraversal'TypeName lensTypeName lens'TypeName isoTypeName iso'TypeNamegetterTypeName foldTypeName prismTypeNameprism'TypeNamereviewTypeNamewrappedTypeNameunwrappedTypeNamerewrappedTypeName_wrapped'ValName isoValName prismValName untoValName coerceValNamecomposeValName idValName fmapValName pureValName apValName rightDataName leftDataName reifyTypeable EffectRWS getEffectRWSEffect getEffect Magnified FocusingErr unfocusingErrErrgetErr FocusingMay unfocusingMayMaygetMay FocusingOn unfocusingOn FocusingPlusunfocusingPlus FocusingWithunfocusingWithFocusing unfocusingZoomedSettable untainted untaintedDot taintedDot ReviewableretaggedMarket'Market Reversing reversingExchangeFlowsrunFlows Deepening runDeepeningLevelZeroOneTwo deepening Indexing64 runIndexing64Indexing runIndexing runIndexed Indexable Conjoineddistrib conjoinedindexing indexing64 PretextT'PretextT runPretextTPretext'Pretext runPretextContext'ContextSellablesellIndexedComonadStoreiposipeekipeeksiseekiseeks iexperimentcontextIndexedComonadiextract iduplicateiextendIndexedFunctorifmap BazaarT1'BazaarT1 runBazaarT1Bazaar1'Bazaar1 runBazaar1Bizarre1bazaar1BazaarT'BazaarT runBazaarTBazaar' runBazaarBizarrebazaar TakingWhileMaficMolten runMoltenMagma MagmaFmap MagmaPureMagmaAprunMagmarunMaficrunTakingWhileAlongsideRightgetAlongsideRight AlongsideLeftgetAlongsideLeftcoercenoEffectM ReifiedMonoidreifiedMappend reifiedMempty RightmostRStepRLeafRPureLeftmostLStepLLeafLPureMaxNoMaxMinNoMin Sequenced getSequenced Traversed getTraversedFolding getFoldinggetMingetMax getLeftmost getRightmost reifyFoldOver'IndexedLensLike'IndexedLensLike LensLike'Optical'Optic'OpticIndexPreservingFold1 IndexedFold1Fold1IndexPreservingFoldIndexPreservingGetterAs Equality'EqualityIndexPreservingSetter'IndexPreservingSetterIndexedSetter' IndexedSetterIndexPreservingTraversal1'IndexPreservingTraversal1IndexPreservingTraversal'IndexPreservingTraversalIndexedTraversal1'IndexedTraversal1IndexedTraversal' Traversal1' Traversal1IndexPreservingLens'IndexPreservingLens IndexedLens'Setting'SettingAnIndexedSetter'AnIndexedSetterASetter'ASettermappedlifted contramappedargumentsettingsets cloneSettercloneIndexPreservingSettercloneIndexedSetterset'?~??insidechoosingchosen alongsidelocuscloneIndexPreservingLenscloneIndexedLens<%~<+~<-~<*~~<%=<+=<-=<*==<<~<<>~<<>=overA<%@~<<%@~%%@~%%@=<%@=<<%@=^#storing#~#%~#%%~#=#%=<#%~<#%=#%%=<#~<#=devoidunited SimpleLoupeLoupeField9_9Field8_8Field7_7Field6_6Field5_5Field4_4Field3_3Field2Field1 AccessingIndexedGettingtoitoviewsuses listening ilistening listenings ilisteningsiviewiviewsiuseiuses^@.coercedAReviewReviewuntoun#reviewsreusereusesAPrism'APrism withPrism clonePrismprism'withoutasidebelowisn'tmatching_Right_Just_Nothing_Voidonlynearly_Showmagnify setmappedsetOffoldingifoldingfolded64repeated replicatedcycledunfoldediteratedfiltered takingWhile droppingWhilewordedlinedfoldOffoldrOffoldlOftoListOf^..andOforOfallOfnoneOf productOfsumOfforOf_ sequenceAOf_mapMOf_forMOf_ sequenceOf_asumOfmsumOfelemOf notElemOf concatMapOfconcatOf^?!firstOfnullOf notNullOf maximumByOf minimumByOffindOffindMOffoldr1Offoldl1OffoldrOf'foldlOf' foldr1Of' foldl1Of'foldrMOffoldlMOfhashasn'tpreipreipreviewpreviews ipreviewspreuseipreusepreusesipreusesifoldrOfifoldlOfianyOfiallOfinoneOf itraverseOf_iforOf_imapMOf_iforMOf_ iconcatMapOfifindOfifindMOf ifoldrOf' ifoldlOf' ifoldrMOf ifoldlMOf itoListOf^@..^@?^@?! ifiltered itakingWhileidroppingWhileheadOffoldByfoldByOf foldMapBy foldMapByOf TraverseMax traverseMax TraverseMin traverseMin Traversing1' Traversing' Traversing1 TraversingAnIndexedTraversal1'AnIndexedTraversal'AnIndexedTraversal1AnIndexedTraversal ATraversal1' ATraversal1 ATraversal' ATraversal sequenceAOfmapMOfforMOf sequenceOf transposeOf mapAccumROf mapAccumLOfscanr1Ofscanl1OflociilocipartsOfipartsOfpartsOf' ipartsOf' unsafePartsOfiunsafePartsOfunsafePartsOf'iunsafePartsOf'holesOfsingularunsafeSingularbothbesidedroppingcloneIndexPreservingTraversalcloneIndexedTraversalcloneTraversal1cloneIndexPreservingTraversal1cloneIndexedTraversal1iforOf imapAccumROf imapAccumLOf traversed1 traversed64ignored elementOfelement elementsOfelementsfailover ifailoverfailingdeepOfTraversableWithIndex itraverse itraversedFoldableWithIndexifoldMapifoldedifoldrifoldlifoldr'ifoldl'FunctorWithIndeximapped<..> selfIndex reindexed<.>icomposeasIndexindicesindexianyiallinonenone itraverse_ifor_imapM_iforM_ iconcatMapifindifoldrMifoldlMitoListimapMiforM imapAccumR imapAccumL ifoldMapBy ifoldMapByOflevelsilevels ReifiedPrism' ReifiedPrismrunPrism ReifiedIso' ReifiedIsorunIsoReifiedIndexedSetter'ReifiedIndexedSetterrunIndexedSetterReifiedSetter' ReifiedSetter runSetterReifiedIndexedFoldrunIndexedFold ReifiedFoldrunFoldReifiedIndexedGetterrunIndexedGetter ReifiedGetter runGetterReifiedTraversal' runTraversalReifiedIndexedTraversal'ReifiedIndexedTraversalrunIndexedTraversalReifiedIndexedLens'ReifiedIndexedLensrunIndexedLens ReifiedLens' ReifiedLensrunLens$fStrongReifiedIndexedFold!$fRepresentableReifiedIndexedFold$fProfunctorReifiedIndexedFold$fFunctorReifiedIndexedFold$fPlusReifiedIndexedFold$fAltReifiedIndexedFold$fMonoidReifiedIndexedFold$fSemigroupReifiedIndexedFold$fPlusReifiedFold$fAltReifiedFold$fMonoidReifiedFold$fSemigroupReifiedFold$fMonadReadersReifiedFold$fMonadPlusReifiedFold$fMonadReifiedFold$fBindReifiedFold$fAlternativeReifiedFold$fApplicativeReifiedFold$fApplyReifiedFold$fFunctorReifiedFold$fArrowApplyReifiedFold$fArrowChoiceReifiedFold$fArrowReifiedFold$fCategory*ReifiedFold$fChoiceReifiedFold$fStrongReifiedFold$fRepresentableReifiedFold$fProfunctorReifiedFold$fApplyReifiedIndexedGetter$fFunctorReifiedIndexedGetter$fStrongReifiedIndexedGetter#$fRepresentableReifiedIndexedGetter $fProfunctorReifiedIndexedGetter$fArrowLoopReifiedGetter$fArrowChoiceReifiedGetter$fArrowApplyReifiedGetter$fArrowReifiedGetter$fCategory*ReifiedGetter$fChoiceReifiedGetter$fStrongReifiedGetter$fConjoinedReifiedGetter$fRepresentableReifiedGetter$fCorepresentableReifiedGetter$fProfunctorReifiedGetter$fMonadReadersReifiedGetter$fMonadReifiedGetter$fBindReifiedGetter$fApplicativeReifiedGetter$fApplyReifiedGetter$fComonadApplyReifiedGetter$fComonadReifiedGetter$fExtendReifiedGetter$fFunctorReifiedGetter$fDistributiveReifiedGetter gtraversetinplatetemplateuponupon'onceUpon onceUpon'Plated...deepchildrenrewrite rewriteOf rewriteOn rewriteOnOfrewriteM rewriteMOf rewriteMOn rewriteMOnOfuniverse universeOf universeOn universeOnOf transform transformOn transformOf transformOnOf transformM transformMOn transformMOftransformMOnOfcontexts contextsOn contextsOnOfholesholesOn holesOnOfparaOfpara composOpFoldparts AnEquality' AnEquality IdenticalrunEqsubstEqmapEqfromEqsimplysimpleStrictstrictSwappedswappedAnIso'AnIsoisowithIsocloneIsoauaufunderenummappingnonnon'anoncurried uncurriedflippedlazyreversed involutedmagmaimagma contramapping dimappinglmappingrmapping bimapping Rewrapping RewrappedWrapped Unwrapped _Wrapped' _Unwrapped'_Wrapped _Unwrappedop _Wrapping' _Unwrapping' _Wrapping _UnwrappingAsEmpty_EmptyEacheachSnoc_SnocCons_Cons<|consuncons_head_tail_init_last|>snocunsnocDequeBDnull singletonsizefromListAtIxedixIxValueContainscontainsIndexixAtsans SubstType substType HasTypeVars typeVarsExHasNamenametypeVars substTypeVars conFieldsconNamedFields locFileName locPackage locModulelocStartlocEnd funDepInputs funDepOutputs fieldExpNamefieldExpExpression fieldPatNamefieldPatPattern matchPattern matchBodymatchDeclarationsfixityPrecedencefixityDirection clausePattern clauseBody clauseDecs_ClassI _ClassOpI_TyConI_FamilyI _PrimTyConI _DataConI_VarI_TyVarI_FunD_ValD_DataD _NewtypeD_TySynD_ClassD _InstanceD_SigD _ForeignD_InfixD_PragmaD_FamilyD _DataInstD _NewtypeInstD _TySynInstD_ClosedTypeFamilyD _RoleAnnotD_NormalC_RecC_InfixC_ForallC _IsStrict _NotStrict _Unpacked_ImportF_ExportF_CCall_StdCall_Unsafe_Safe_Interruptible_InlineP _SpecialiseP_SpecialiseInstP_RuleP_AnnP _NoInline_Inline _Inlinable_ConLike_FunLike _AllPhases _FromPhase _BeforePhase_RuleVar _TypedRuleVar_ModuleAnnotation_TypeAnnotation_ValueAnnotation_FunDep_TypeFam_DataFamtySynEqnPatternstySynEqnResult_InfixL_InfixR_InfixN_VarE_ConE_LitE_AppE_InfixE_UInfixE_ParensE_LamE _LamCaseE_TupE _UnboxedTupE_CondE _MultiIfE_LetE_CaseE_DoE_CompE _ArithSeqE_ListE_SigE_RecConE_RecUpdE _GuardedB_NormalB_NormalG_PatG_BindS_LetS_NoBindS_ParS_FromR _FromThenR_FromToR _FromThenToR_CharL_StringL _IntegerL _RationalL _IntPrimL _WordPrimL _FloatPrimL _DoublePrimL _StringPrimL_LitP_VarP_TupP _UnboxedTupP_ConP_InfixP_UInfixP_ParensP_TildeP_BangP_AsP_WildP_RecP_ListP_SigP_ViewP_ForallT_AppT_SigT_VarT_ConT _PromotedT_TupleT_UnboxedTupleT_ArrowT_ListT_PromotedTupleT _PromotedNilT_PromotedConsT_StarT _ConstraintT_LitT_PlainTV _KindedTV _NumTyLit _StrTyLit_ClassP_EqualP _NominalR_RepresentationalRDefName MethodNameTopName LensRules _simpleLenses _generateSigs_generateClasses _allowIsos _allowUpdates _fieldToDef _classyLensesmakeFieldOpticsmakeFieldOpticsForDec makePrismsmakeClassyPrisms makeDecPrisms simpleLensesgenerateSignaturesgenerateUpdateableOptics createClass lensField lensClass lensRules lensRulesFor classyRules classyRules_ makeLenses makeClassy makeClassy_ makeLensesFor makeClassyFormakeLensesWith declareLensesdeclareLensesFor declareClassydeclareClassyFor declarePrismsdeclareWrapped declareFieldsdeclareLensesWith makeWrappedunderscoreFieldscamelCaseFieldsabbreviatedFields makeFieldsmakeFieldsWithdefaultFieldRulesHandlingException Handleablehandlerhandler_istraversedStricttraversedStrict8traversedStrictTreetraversedStrictTree8 unpackLazy traversedLazy unpackLazy8traversedLazy8 unpackStrict unpackStrict8catching catching_handling handling_tryingthrowingprimevalOfparOfafter throughoutseqOfixmapped.|.~.&.~.&.=.|.=<.|.~<.&.~<.&.=<.|.=<<.&.~<<.|.~<<.&.=<<.|.=bitAtbyteAtbitsbytewise packedBytes unpackedBytesbytes packedChars unpackedCharschars IsByteString _realPart_polar _magnitude_phase _conjugatemembersprefixedsuffixed stripSuffixstrippingPrefixstrippingSuffix splitting splittingOnsplittingOneOf splittingWhenendingBy endingByOneOf wordingByliningBychunkingsplittingPlacessplittingPlacesBlanks delimiters delimiting condensingkeepInitialBlankskeepFinalBlanksviewLviewRslicedTo slicedFromslicedpackedunpacked_Textbuildertextutf8IsTextrootbranches_cast_gcast toVectorOfvectorforcedordinalsasStream asStreamRclonedvectorIx GTraversalgenericgeneric1_V1_U1_Par1_Rec1_K1_M1_L1_R1~=<~<=<<~<<=<.>~<.>=<<.>~<<.>=<<<.>~<<<.>=basename directory extensionfilenamelocation descriptionhandlefileNameerrno errorType_AlreadyExists _NoSuchThing _ResourceBusy_ResourceExhausted_EOF_IllegalOperation_PermissionDenied _UserError_UnsatisfiedConstraints _SystemError_ProtocolError _OtherError_InvalidArgument_InappropriateType_HardwareFault_UnsupportedOperation _TimeExpired_ResourceVanished _Interruptedintegralbinaryoctaldecimalhexadding subtracting multiplyingdividingexponentiatingnegatedAsHandlingException_HandlingException AsErrorCall AsRecUpdError _RecUpdError AsRecSelError _RecSelError AsRecConError _RecConErrorAsPatternMatchFail_PatternMatchFailAsNoMethodError_NoMethodError AsDeadlock _DeadlockAsBlockedIndefinitelyOnSTM_BlockedIndefinitelyOnSTMAsBlockedIndefinitelyOnMVar_BlockedIndefinitelyOnMVarAsNestedAtomically_NestedAtomicallyAsNonTerminationAsAsyncException_AsyncExceptionAsAssertionFailedAsArrayException_ArrayExceptionAsArithException_ArithException AsIOException _IOException exceptiontrying_ throwingM throwingTomappedExceptionmappedException' _Overflow _Underflow_LossOfPrecision _DivideByZero _Denormal_RatioZeroDenominator_IndexOutOfBounds_UndefinedElement _HeapOverflow _ThreadKilled_UserInterrupt AsDynamic_Dynamic AsExitCode _ExitCode _ExitSuccess _ExitFailurecatchIOversionbindirlibdirdatadir libexecdir sysconfdir getBinDir getLibDir getDataDir getLibexecDir getSysconfDirgetDataFileNametemplate-haskellLanguage.Haskell.TH.Lib tySynInstDLanguage.Haskell.TH.SyntaxName TyVarBndrData.Typeable.InternalTypeableStableWT255T254T253T252T251T250T249T248T247T246T245T244T243T242T241T240T239T238T237T236T235T234T233T232T231T230T229T228T227T226T225T224T223T222T221T220T219T218T217T216T215T214T213T212T211T210T209T208T207T206T205T204T203T202T201T200T199T198T197T196T195T194T193T192T191T190T189T188T187T186T185T184T183T182T181T180T179T178T177T176T175T174T173T172T171T170T169T168T167T166T165T164T163T162T161T160T159T158T157T156T155T154T153T152T151T150T149T148T147T146T145T144T143T142T141T140T139T138T137T136T135T134T133T132T131T130T129T128T127T126T125T124T123T122T121T120T119T118T117T116T115T114T113T112T111T110T109T108T107T106T105T104T103T102T101T100T99T98T97T96T95T94T93T92T91T90T89T88T87T86T85T84T83T82T81T80T79T78T77T76T75T74T73T72T71T70T69T68T67T66T65T64T63T62T61T60T59T58T57T56T55T54T53T52T51T50T49T48T47T46T45T44T43T42T41T40T39T38T37T36T35T34T33T32T31T30T29T28T27T26T25T24T23T22T21T20T19T18T17T16T15T14T13T12T11T10T9T8T7T6T5T4T3T2T1T0 reflectByte impossible reifyBytestablestablePtrToIntPtrintPtrToStablePtrbyte0byte1byte2byte3byte4byte5byte6byte7 reflectBefore$fReifies*Stablea$fBT255$fBT254$fBT253$fBT252$fBT251$fBT250$fBT249$fBT248$fBT247$fBT246$fBT245$fBT244$fBT243$fBT242$fBT241$fBT240$fBT239$fBT238$fBT237$fBT236$fBT235$fBT234$fBT233$fBT232$fBT231$fBT230$fBT229$fBT228$fBT227$fBT226$fBT225$fBT224$fBT223$fBT222$fBT221$fBT220$fBT219$fBT218$fBT217$fBT216$fBT215$fBT214$fBT213$fBT212$fBT211$fBT210$fBT209$fBT208$fBT207$fBT206$fBT205$fBT204$fBT203$fBT202$fBT201$fBT200$fBT199$fBT198$fBT197$fBT196$fBT195$fBT194$fBT193$fBT192$fBT191$fBT190$fBT189$fBT188$fBT187$fBT186$fBT185$fBT184$fBT183$fBT182$fBT181$fBT180$fBT179$fBT178$fBT177$fBT176$fBT175$fBT174$fBT173$fBT172$fBT171$fBT170$fBT169$fBT168$fBT167$fBT166$fBT165$fBT164$fBT163$fBT162$fBT161$fBT160$fBT159$fBT158$fBT157$fBT156$fBT155$fBT154$fBT153$fBT152$fBT151$fBT150$fBT149$fBT148$fBT147$fBT146$fBT145$fBT144$fBT143$fBT142$fBT141$fBT140$fBT139$fBT138$fBT137$fBT136$fBT135$fBT134$fBT133$fBT132$fBT131$fBT130$fBT129$fBT128$fBT127$fBT126$fBT125$fBT124$fBT123$fBT122$fBT121$fBT120$fBT119$fBT118$fBT117$fBT116$fBT115$fBT114$fBT113$fBT112$fBT111$fBT110$fBT109$fBT108$fBT107$fBT106$fBT105$fBT104$fBT103$fBT102$fBT101$fBT100$fBT99$fBT98$fBT97$fBT96$fBT95$fBT94$fBT93$fBT92$fBT91$fBT90$fBT89$fBT88$fBT87$fBT86$fBT85$fBT84$fBT83$fBT82$fBT81$fBT80$fBT79$fBT78$fBT77$fBT76$fBT75$fBT74$fBT73$fBT72$fBT71$fBT70$fBT69$fBT68$fBT67$fBT66$fBT65$fBT64$fBT63$fBT62$fBT61$fBT60$fBT59$fBT58$fBT57$fBT56$fBT55$fBT54$fBT53$fBT52$fBT51$fBT50$fBT49$fBT48$fBT47$fBT46$fBT45$fBT44$fBT43$fBT42$fBT41$fBT40$fBT39$fBT38$fBT37$fBT36$fBT35$fBT34$fBT33$fBT32$fBT31$fBT30$fBT29$fBT28$fBT27$fBT26$fBT25$fBT24$fBT23$fBT22$fBT21$fBT20$fBT19$fBT18$fBT17$fBT16$fBT15$fBT14$fBT13$fBT12$fBT11$fBT10$fBT9$fBT8$fBT7$fBT6$fBT5$fBT4$fBT3$fBT2$fBT1$fBT0 Data.EitherEither Data.MaybeMaybeControl.Monad.Trans.MaybeMaybeTControl.Monad.Trans.ListListT$fContravariantEffectRWS$fApplicativeEffectRWS$fApplyEffectRWS$fFunctorEffectRWS$fApplicativeEffect $fApplyEffect$fMonoidEffect$fSemigroupEffect$fContravariantEffect$fFunctorEffectTFCo:R:MagnifiedIdentityTTFCo:R:MagnifiedRWSTTFCo:R:MagnifiedRWST0TFCo:R:Magnified(->)TFCo:R:MagnifiedReaderT$fApplicativeFocusingErr$fApplyFocusingErr$fFunctorFocusingErr $fMonoidErr$fSemigroupErr$fApplicativeFocusingMay$fApplyFocusingMay$fFunctorFocusingMay $fMonoidMay$fSemigroupMay$fApplicativeFocusingOn$fApplyFocusingOn$fFunctorFocusingOn$fApplicativeFocusingPlus$fApplyFocusingPlus$fFunctorFocusingPlus$fApplicativeFocusingWith$fApplyFocusingWith$fFunctorFocusingWith$fApplicativeFocusing$fApplyFocusing$fFunctorFocusingTFCo:R:ZoomedExceptTTFCo:R:ZoomedErrorTTFCo:R:ZoomedMaybeTTFCo:R:ZoomedListTTFCo:R:ZoomedWriterTTFCo:R:ZoomedWriterT0TFCo:R:ZoomedRWSTTFCo:R:ZoomedRWST0TFCo:R:ZoomedIdentityTTFCo:R:ZoomedReaderTTFCo:R:ZoomedStateTTFCo:R:ZoomedStateT0GHC.BaseFunctor$fSettableBackwards$fSettableIdentity$fSettableCompose $fReviewablep$fChoiceMarket$fProfunctorMarket$fFunctorMarket$fReversingVector$fReversingVector0$fReversingVector1$fReversingSeq$fReversingVector2$fReversingText$fReversingText0$fReversingByteString$fReversingByteString0 $fReversing[]$fProfunctorExchange$fFunctorExchange Applicativelappendsemigroups-0.16.0.1Data.Semigroup Semigrouptrimltrimr$fApplicativeFlows$fMonoidDeepening $fApplyFlows$fFunctorFlows$fSemigroupDeepening$fTraversableLevel$fFoldableLevel$fFunctorLevelGHC.IntInt64ghc-prim GHC.TypesIntData.Profunctor.RepCorepresentable Representablefmap$fContravariantIndexing64$fApplicativeIndexing64$fApplyIndexing64$fFunctorIndexing64$fContravariantIndexing$fApplicativeIndexing$fApplyIndexing$fFunctorIndexing$fIndexableiIndexed$fConjoinedIndexed$fArrowLoopIndexed$fArrowApplyIndexed$fArrowChoiceIndexed$fArrowIndexed$fCategory*Indexed$fStrongIndexed$fChoiceIndexed$fRepresentableIndexed$fCorepresentableIndexed$fProfunctorIndexed$fMonadFixIndexed$fMonadIndexed $fBindIndexed$fApplicativeIndexed$fApplyIndexed$fFunctorIndexed$fIndexablei(->)$fConjoined(->) comonad-4.2.2 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$fSemigroupBazaarT1$fContravariantBazaarT1$fComonadApplyBazaarT1$fComonadBazaarT1$fApplyBazaarT1$fFunctorBazaarT1$fBizarre1pBazaarT1$fSellablepBazaarT1$fIndexedComonadBazaarT1$fIndexedFunctorBazaarT1$fComonadApplyBazaar1$fComonadBazaar1$fApplyBazaar1$fFunctorBazaar1$fBizarre1pBazaar1$fSellablepBazaar1$fIndexedComonadBazaar1$fIndexedFunctorBazaar1$fMonoidBazaarT$fSemigroupBazaarT$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$fFunctorMagmaid$fBitraversableAlongsideRight$fBifoldableAlongsideRight$fBifunctorAlongsideRight$fTraversable1AlongsideRight$fFoldable1AlongsideRight$fTraversableAlongsideRight$fFoldableAlongsideRight$fContravariantAlongsideRight$fFunctorAlongsideRight$fBitraversableAlongsideLeft$fBifoldableAlongsideLeft$fBifunctorAlongsideLeft$fTraversable1AlongsideLeft$fFoldable1AlongsideLeft$fTraversableAlongsideLeft$fFoldableAlongsideLeft$fContravariantAlongsideLeft$fFunctorAlongsideLeftJust reflectResultunM $fMonoidM$fMonoidRightmost$fSemigroupRightmost$fMonoidLeftmost$fSemigroupLeftmost $fMonoidMax$fSemigroupMax $fMonoidMin$fSemigroupMin$fMonoidSequenced$fSemigroupSequenced$fMonoidTraversed$fSemigroupTraversed$fMonoidFolding$fSemigroupFoldingpure<$liftM.$GHC.NumNumGHC.Real FractionalIntegral GHC.FloatFloating GHC.Classes||Bool&& mtl-2.2.1Control.Monad.State.Class MonadStatemappendControl.Monad.Writer.Classpass MonadWritercensorconstStringChar Control.ArrowArrowstateflipLeftRightvoid-0.7 Data.VoidVoid$fField2(,)(,)bb'$fField1(,)(,)aa'N8N7N6N5N4N3N2N1N0GTSubtractAddFTSZGIxed'gix'GIxedgixGSizeproxyN0proxyN1proxyN2proxyN3proxyN4proxyN5proxyN6proxyN7proxyN8 TFCo:R:GTSS TFCo:R:GTSZ TFCo:R:GTZxTFCo:R:SubtractSSTFCo:R:SubtractZx TFCo:R:AddSy TFCo:R:AddZy$fGIxed'Fnss'st'ab$fGIxed'Tnss'ts'ab$fGIxedn:*::*:ab$fGIxednM1M1ab$fGIxedZK1K1abTFCo:R:GSize:*:TFCo:R:GSizeM1TFCo:R:GSizeK1TFCo:R:GSizeU1$fField9(,,,,,,,,)(,,,,,,,,)ii'$fField8(,,,,,,,,)(,,,,,,,,)hh'$fField8(,,,,,,,)(,,,,,,,)hh'$fField7(,,,,,,,,)(,,,,,,,,)gg'$fField7(,,,,,,,)(,,,,,,,)gg'$fField7(,,,,,,)(,,,,,,)gg'$fField6(,,,,,,,,)(,,,,,,,,)ff'$fField6(,,,,,,,)(,,,,,,,)ff'$fField6(,,,,,,)(,,,,,,)ff'$fField6(,,,,,)(,,,,,)ff'$fField5(,,,,,,,,)(,,,,,,,,)ee'$fField5(,,,,,,,)(,,,,,,,)ee'$fField5(,,,,,,)(,,,,,,)ee'$fField5(,,,,,)(,,,,,)ee'$fField5(,,,,)(,,,,)ee'$fField4(,,,,,,,,)(,,,,,,,,)dd'$fField4(,,,,,,,)(,,,,,,,)dd'$fField4(,,,,,,)(,,,,,,)dd'$fField4(,,,,,)(,,,,,)dd'$fField4(,,,,)(,,,,)dd'$fField4(,,,)(,,,)dd'$fField3(,,,,,,,,)(,,,,,,,,)cc'$fField3(,,,,,,,)(,,,,,,,)cc'$fField3(,,,,,,)(,,,,,,)cc'$fField3(,,,,,)(,,,,,)cc'$fField3(,,,,)(,,,,)cc'$fField3(,,,)(,,,)cc'$fField3(,,)(,,)cc'$fField2(,,,,,,,,)(,,,,,,,,)bb'$fField2(,,,,,,,)(,,,,,,,)bb'$fField2(,,,,,,)(,,,,,,)bb'$fField2(,,,,,)(,,,,,)bb'$fField2(,,,,)(,,,,)bb'$fField2(,,,)(,,,)bb'$fField2(,,)(,,)bb'$fField2:*::*:gg'$fField2ProductProductgg'$fField1(,,,,,,,,)(,,,,,,,,)aa'$fField1(,,,,,,,)(,,,,,,,)aa'$fField1(,,,,,,)(,,,,,,)aa'$fField1(,,,,,)(,,,,,)aa'$fField1(,,,,)(,,,,)aa'$fField1(,,,)(,,,)aa'$fField1(,,)(,,)aa'$fField1:*::*:ff'$fField1ProductProductff'$fField1IdentityIdentityab MonadReaderlistengetsNothingGHC.ReadReadGHC.ShowShowshowControl.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$fZoomExceptTExceptTst$fZoomErrorTErrorTst$fZoomMaybeTMaybeTst$fZoomListTListTst$fZoomWriterTWriterTst$fZoomWriterTWriterTst0$fZoomRWSTRWSTst$fZoomRWSTRWSTst0$fZoomIdentityTIdentityTst$fZoomReaderTReaderTst$fZoomStateTStateTst$fZoomStateTStateTst0containers-0.5.5.1 Data.Set.BaseSetOrdunordered-containers-0.2.5.1 Data.HashSetHashSethashable-1.2.3.1Data.Hashable.ClassHashableEqGHC.Listrepeat replicateiterateevenGHC.Enumsucc/= takeWhile dropWhilewordslinesEndoTrueProductSum sequenceA_asum Alternativemsum MonadPluselemnotElem concatMapconcatlengthheadFirstLastnotmaximum fromMaybeGHC.ErrminimumOrdering minimumBy listToMaybe Data.Tuplefstfolded'skipControl.Categoryfor sequenceAmapMforMsequence unwrapMonad WrapMonadControl.Applicative.Backwards Backwards mapAccumLswaprunStatescanr1scanl1Control.Comonad==Data.Bitraversable Bitraversableinswinspinsparrouts unsafeOutsunconsWithDefault$fTraverseMaxkMap$fTraverseMaxIntIntMap$fTraverseMinkMap$fTraverseMinIntIntMap Data.Map.Basesnd$fFunctorWithIndexIntSeq Data.SequenceSeq$fFunctorWithIndexInt[]$fTraversableWithIndex[]Free$fFoldableWithIndex[]Free$fFunctorWithIndex[]Free$fTraversableWithIndexiMagma$fFoldableWithIndexiMagma$fFunctorWithIndexiMagma$fTraversableWithIndexiLevel$fFoldableWithIndexiLevel$fFunctorWithIndexiLevel$fFunctorWithIndexr(->)$fTraversableWithIndexkHashMap$fFoldableWithIndexkHashMap$fFunctorWithIndexkHashMap$fTraversableWithIndexkMap$fFoldableWithIndexkMap$fFunctorWithIndexkMap$fTraversableWithIndexIntIntMap$fFoldableWithIndexIntIntMap$fFunctorWithIndexIntIntMap$fTraversableWithIndexIntVector$fFoldableWithIndexIntVector$fFunctorWithIndexIntVector$fTraversableWithIndexIntSeq$fFoldableWithIndexIntSeq$fTraversableWithIndex()Maybe$fFoldableWithIndex()Maybe$fFunctorWithIndex()Maybe!$fTraversableWithIndexIntNonEmpty$fFoldableWithIndexIntNonEmpty$fFunctorWithIndexIntNonEmpty$fTraversableWithIndexInt[]$fFoldableWithIndexInt[]$fTraversableWithIndexk(,)$fFoldableWithIndexk(,)$fFunctorWithIndexk(,) $fTraversableWithIndex()Identity$fFoldableWithIndex()Identity$fFunctorWithIndex()Identity$fTraversableWithIndexiReverse$fFoldableWithIndexiReverse$fFunctorWithIndexiReverse $fTraversableWithIndexiBackwards$fFoldableWithIndexiBackwards$fFunctorWithIndexiBackwards<*>levelIns levelOuts ilevelIns ilevelOuts Data.DatagmapMDatainlinePerformIOGHC.IOunsafePerformIOFollowerOracle fromOracleAnswerMissFollowHitCacheHitMapDataBox dataBoxKey _dataBoxValIsReflFieldExceptionsteplookuponmightBedataBox sybChildren emptyHitMap insertHitMapfixEqcachereadCacheFollowerinsert2hitTest biplateData uniplateDatapartfollower$fExceptionFieldException$fShowFieldExceptionnegate $fPlatedPat $fPlatedStmt $fPlatedType $fPlatedCon $fPlatedDec $fPlatedExp $fPlatedTree$fPlatedCofree $fPlatedF $fPlatedFreeT $fPlatedFree $fPlated[] text-1.2.0.3bytestring-0.10.4.0Data.ByteString.InternalEnumDoubleFloat integer-gmpGHC.Integer.TypeIntegercurryuncurry$fStrictRWSTRWST$fStrictWriterTWriterT$fStrictStateTStateT$fStrictTextText$fStrictByteStringByteString$fSwappedEither $fSwapped(,)$fRewrappedSett$fRewrappedMapt$fRewrappedIntSettData.IntSet.Base$fRewrappedIntMaptData.IntMap.Base$fRewrappedHashSett$fRewrappedHashMaptData.HashMap.Base getErrorCallgetRecUpdErrorgetRecSelErrorgetRecConErrorgetPatternMatchFailgetNoMethodErrorfailedAssertion getArrowMonad$fWrappedErrorCall$fRewrappedErrorCallt$fWrappedRecUpdError$fRewrappedRecUpdErrort$fWrappedRecSelError$fRewrappedRecSelErrort$fWrappedRecConError$fRewrappedRecConErrort$fWrappedPatternMatchFail$fRewrappedPatternMatchFailt$fWrappedNoMethodError$fRewrappedNoMethodErrort$fWrappedAssertionFailed$fRewrappedAssertionFailedt$fWrappedTagged$fRewrappedTaggedt$fWrappedComposeCF$fRewrappedComposeCFt$fWrappedComposeFC$fRewrappedComposeFCt$fWrappedCompose$fRewrappedComposet $fWrappedOp$fRewrappedOpt$fWrappedEquivalence$fRewrappedEquivalencet$fWrappedComparison$fRewrappedComparisont$fWrappedPredicate$fRewrappedPredicatet$fWrappedOption$fRewrappedOptiont$fWrappedWrappedMonoid$fRewrappedWrappedMonoidt $fWrappedLast$fRewrappedLastt$fWrappedFirst$fRewrappedFirstt $fWrappedMax$fRewrappedMaxt $fWrappedMin$fRewrappedMint$fWrappedVector$fRewrappedVectort$fWrappedVector0$fRewrappedVectort0$fWrappedVector1$fRewrappedVectort1$fWrappedVector2$fRewrappedVectort2 $fWrappedSeq$fRewrappedSeqt $fWrappedSet $fWrappedMap$fWrappedIntSet$fWrappedIntMap$fWrappedHashSet$fWrappedHashMap$fWrappedTracedT$fRewrappedTracedTt$fWrappedCoproduct$fRewrappedCoproductt$fWrappedWriterT$fRewrappedWriterTt$fWrappedWriterT0$fRewrappedWriterTt0$fWrappedStateT$fRewrappedStateTt$fWrappedStateT0$fRewrappedStateTt0 $fWrappedRWST$fRewrappedRWSTt$fWrappedRWST0$fRewrappedRWSTt0$fWrappedReverse$fRewrappedReverset$fWrappedReaderT$fRewrappedReaderTt$fWrappedMaybeT$fRewrappedMaybeTt$fWrappedListT$fRewrappedListTt$fWrappedIdentityT$fRewrappedIdentityTt$fWrappedIdentity$fRewrappedIdentityt$fWrappedErrorT$fRewrappedErrorTt$fWrappedContT$fRewrappedContTt$fWrappedConstant$fRewrappedConstantt$fWrappedCompose0$fRewrappedComposet0$fWrappedBackwards$fRewrappedBackwardst$fWrappedArrowMonad$fRewrappedArrowMonadt$fWrappedLast0$fRewrappedLastt0$fWrappedFirst0$fRewrappedFirstt0 $fWrappedEndo$fRewrappedEndot $fWrappedDual$fRewrappedDualt$fWrappedConst$fRewrappedConstt$fWrappedZipList$fRewrappedZipListt$fWrappedWrappedArrow$fRewrappedWrappedArrowt$fWrappedWrappedMonad$fRewrappedWrappedMonadt$fWrappedKleisli$fRewrappedKleislit$fWrappedProduct$fRewrappedProductt $fWrappedSum$fRewrappedSumt $fWrappedAny$fRewrappedAnyt $fWrappedAll$fRewrappedAllt$fRewrappingst $fAsEmptyText$fAsEmptyText0$fAsEmptyByteString$fAsEmptyByteString0 $fAsEmptySeq$fAsEmptyVector$fAsEmptyVector0$fAsEmptyVector1$fAsEmptyIntSet$fAsEmptyHashSet $fAsEmptySet$fAsEmptyIntMap$fAsEmptyHashMap $fAsEmptyMap $fAsEmpty[] $fAsEmpty(,,) $fAsEmpty(,) $fAsEmptyDual$fAsEmptyFirst $fAsEmptyLast$fAsEmptyMaybe $fAsEmptySum$fAsEmptyProduct$fAsEmptyEvent $fAsEmptyAll $fAsEmptyAny $fAsEmpty()$fAsEmptyOrdering$fEachUArrayUArrayabGHC.ArrIx array-0.5.0.0Data.Array.BaseIArrayUArrayArray$fEachArrayArrayab$fEachByteStringByteStringabData.ByteString.Lazy.InternalGHC.WordWord8$fEachByteStringByteStringab0$fEachTextTextabData.Text.Internal.Lazy$fEachTextTextab0$fEachVectorVectorabvector-0.10.12.2Data.Vector.Unboxed.BaseUnboxVector$fEachVectorVectorab0Foreign.StorableStorableData.Vector.Storable$fEachVectorVectorab1primitive-0.5.4.0Data.Primitive.TypesPrimData.Vector.Primitive$fEachVectorVectorab2 Data.Vector$fEachTreeTreeab Data.TreeTree$fEachSeqSeqab$fEachMaybeMaybeab$fEachIdentityIdentityab$fEachNonEmptyNonEmptyab $fEach[][]ab$fEachHashMapHashMapabHashMap$fEachIntMapIntMapab$fEachMapMapab$fEachComplexComplexab RealFloat$fEach(,,,,,,,,)(,,,,,,,,)ab$fEach(,,,,,,,)(,,,,,,,)ab$fEach(,,,,,,)(,,,,,,)ab$fEach(,,,,,)(,,,,,)ab$fEach(,,,,)(,,,,)ab$fEach(,,,)(,,,)ab$fEach(,,)(,,)ab$fEach(,)(,)abtail$fSnocTextTextCharChar$fSnocTextTextCharChar0$$fSnocByteStringByteStringWord8Word8%$fSnocByteStringByteStringWord8Word80$fSnocVectorVectorab$fSnocVectorVectorab0$fSnocVectorVectorab1$fSnocVectorVectorab2$fSnocSeqSeqab $fSnoc[][]ab$fConsVectorVectorab$fConsVectorVectorab0$fConsVectorVectorab1$fConsVectorVectorab2$fConsTextTextCharChar$fConsTextTextCharChar0$$fConsByteStringByteStringWord8Word8%$fConsByteStringByteStringWord8Word80$fConsSeqSeqab $fCons[][]abemptycheck$fSnocDequeDequeab$fConsDequeDequeab $fMonoidDeque$fSemigroupDeque$fTraversableWithIndexIntDeque$fTraversableDeque$fFoldableWithIndexIntDeque$fFoldableDeque$fMonadPlusDeque $fMonadDeque $fBindDeque$fReversingDeque$fAlternativeDeque $fPlusDeque $fAltDeque$fApplicativeDeque $fApplyDeque$fFunctorWithIndexIntDeque$fFunctorDeque $fOrdDeque $fEqDequeTFCo:R:IxValue(,,,,,,,,)TFCo:R:IxValue(,,,,,,,)TFCo:R:IxValue(,,,,,,)TFCo:R:IxValue(,,,,,)TFCo:R:IxValue(,,,,)TFCo:R:IxValue(,,,)TFCo:R:IxValue(,,)TFCo:R:IxValue(,) $fIxedUArray!// $fIxedArray$fIxed(,,,,,,,,)$fIxed(,,,,,,,)$fIxed(,,,,,,) $fIxed(,,,,,) $fIxed(,,,,) $fIxed(,,,) $fIxed(,,) $fIxed(,) $fAtHashSet$fAtSet $fAtIntSet $fAtHashMap$fAtMap $fAtIntMap $fAtMaybe$fIxedByteStringTFCo:R:IxValueByteString$fIxedByteString0TFCo:R:IxValueByteString0 $fIxedTextTFCo:R:IxValueText $fIxedText0TFCo:R:IxValueText0 $fIxedVectorTFCo:R:IxValueVector $fIxedVector0TFCo:R:IxValueVector0 $fIxedVector1TFCo:R:IxValueVector1 $fIxedVector2TFCo:R:IxValueVector2TFCo:R:IxValueUArrayTFCo:R:IxValueArray $fIxedHashSetTFCo:R:IxValueHashSet $fIxedIntSetTFCo:R:IxValueIntSet $fIxedSetTFCo:R:IxValueSet $fIxedHashMapTFCo:R:IxValueHashMap $fIxedMapTFCo:R:IxValueMap $fIxedIntMapTFCo:R:IxValueIntMap $fIxedSeqTFCo:R:IxValueSeq $fIxedTreeTFCo:R:IxValueTree$fIxedIdentityTFCo:R:IxValueIdentity$fIxedNonEmptyTFCo:R:IxValueNonEmpty$fIxed[]TFCo:R:IxValue[] $fIxedMaybeTFCo:R:IxValueMaybe $fIxed(->)TFCo:R:IxValue(->)$fContainsHashSet $fContainsSet$fContainsIntSetTFCo:R:IndexByteStringTFCo:R:IndexByteString0TFCo:R:IndexTextTFCo:R:IndexText0TFCo:R:IndexTreeTFCo:R:IndexMaybeTFCo:R:IndexIdentityTFCo:R:IndexComplexTFCo:R:IndexVectorTFCo:R:IndexVector0TFCo:R:IndexVector1TFCo:R:IndexVector2TFCo:R:IndexUArrayTFCo:R:IndexArrayTFCo:R:IndexHashMapTFCo:R:IndexMapTFCo:R:IndexIntMapTFCo:R:Index(,,,,,,,,)TFCo:R:Index(,,,,,,,)TFCo:R:Index(,,,,,,)TFCo:R:Index(,,,,,)TFCo:R:Index(,,,,)TFCo:R:Index(,,,)TFCo:R:Index(,,)TFCo:R:Index(,)TFCo:R:IndexSeqTFCo:R:IndexNonEmptyTFCo:R:Index[]TFCo:R:IndexHashSetTFCo:R:IndexSetTFCo:R:IndexIntSetTFCo:R:Index(->)newName _PhantomR_InferR$fSubstTypePred $fSubstType[]$fSubstTypeType$fHasTypeVarsMaybe$fHasTypeVars[]$fHasTypeVarsCon$fHasTypeVarsPred$fHasTypeVarsType$fHasTypeVarsName$fHasTypeVarsTyVarBndr $fHasNameCon $fHasNameName$fHasNameTyVarBndrmakeFieldOpticsForDec'normalizeConstructor buildScaffold buildStab OpticStabmakeFieldOpticmakePureClausemakeGetterClausemakeFieldOpticClause makeIsoClause unifyTypesunify1 limitedSubstapplyTypeSubst quantifyType quantifyType'OpticSa OpticTypeIsoTypeLensType GetterType stabToType stabToContext stabToOpticstabToSstabToAmakeClassyDrivermakeClassyClassmakeClassyInstancemakeFieldClassmakeFieldInstancemakeFieldClauses inlinePragmaNCon makePrisms'DecmakeConsPrismscomputePrismTypemakeConOpticExp makeConIsomakeConPrismExp makeConIsoExpmakeConReviewExp makeReviewermakeSimpleRemittermakeFullRemittermakeIsoRemittermakeClassyPrismClassmakeClassyPrismInstance normalizeConCon prismNameclose _nconName_nconCxt _nconTypesStab ReviewType PrismType simplifyStab stabSimplestabTypecomputeOpticTypecomputeReviewTypecomputeIsoTypenconNamenconCxt nconTypes$fHasTypeVarsNConDeclareDataDecl dataContext tyConNamedataParametersfullType constructorsclassyRulesFor deNewtypefreshMaptraverseDataAndNewtype mkNameLookupapps makeDataDeclmakeWrappedForDecmakeRewrappedInstancemakeWrappedInstanceoverHeadunderscoreNamercamelCaseNamerabbreviatedNamer declareWith runDeclareemit stripFieldsdeRecordHandling GHC.Exception Exceptionexceptions-0.6.1Control.Monad.Catch System.IOprint++ SomeExceptionIOreturn handlerIOhandlerCatchIO$fExceptionHandling$fShowHandling$fExceptionHandlingException!$fHandleableSomeExceptionmHandler"$fHandleableSomeExceptionIOHandlerw2cc2w unsafeCreatecreategrainControl.Monad.Error.Class MonadError throwError$fHandleableemHandler$fMonoidHandler $fPlusHandler $fAltHandler$fSemigroupHandler$fFunctorHandlerparallel-3.2.0.6Control.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.Internal.BuilderBuilderfromTexttoStrict toLazyText fromLazyText $fIsTextText $fIsTextText0 $fIsText[] subForestgcastData.Vector.Generic.BaseData.Vector.Fusion.StreamStream GHC.GenericsGeneric tinplated maybeArg1Of$fGTraversalM1$fGTraversal:+:$fGTraversal:*:$fGTraversalV1$fGTraversalU1$fGTraversalK1FilePath intToDigit' digitToInt' digitToIntMayisDigit' showSigned' readSigned' ErrorCallControl.Exception.Base RecConErrorPatternMatchFail NoMethodErrorGHC.IO.ExceptionDeadlockBlockedIndefinitelyOnSTMBlockedIndefinitelyOnMVarNestedAtomicallyNonTerminationAsyncExceptionassertAssertionFailedArrayException IOException MonadCatch MonadThrow GHC.Conc.SyncthrowToThreadId mapExceptionArithException HeapOverflowtrivial"$fAsHandlingExceptionSomeException&$fAsHandlingExceptionHandlingException$fAsErrorCallSomeException$fAsErrorCallErrorCall$fAsRecUpdErrorSomeException$fAsRecUpdErrorRecUpdError$fAsRecSelErrorSomeException$fAsRecSelErrorRecSelError$fAsRecConErrorSomeException$fAsRecConErrorRecConError!$fAsPatternMatchFailSomeException$$fAsPatternMatchFailPatternMatchFail$fAsNoMethodErrorSomeException$fAsNoMethodErrorNoMethodError$fAsDeadlockSomeException$fAsDeadlockDeadlock)$fAsBlockedIndefinitelyOnSTMSomeException4$fAsBlockedIndefinitelyOnSTMBlockedIndefinitelyOnSTM*$fAsBlockedIndefinitelyOnMVarSomeException6$fAsBlockedIndefinitelyOnMVarBlockedIndefinitelyOnMVar!$fAsNestedAtomicallySomeException$$fAsNestedAtomicallyNestedAtomically$fAsNonTerminationSomeException $fAsNonTerminationNonTermination$fAsAsyncExceptionSomeException $fAsAsyncExceptionAsyncException $fAsAssertionFailedSomeException"$fAsAssertionFailedAssertionFailed$fAsArrayExceptionSomeException $fAsArrayExceptionArrayException$fAsArithExceptionSomeException $fAsArithExceptionArithException$fAsIOExceptionSomeException$fAsIOExceptionIOException Data.DynamicDynamic$fAsDynamicSomeException$fAsDynamicDynamicExitCode$fAsExitCodepfSomeException$fAsExitCodepfExitCode