)      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~              !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~    !!!!"""""####$$$$$%&&&''''''''''''(((((((((())**+++,,--...////////////000012 Rank2Types provisionalEdward Kmett <ekmett@gmail.com> Safe-Inferred'A concrete data type for isomorphisms. DThis lets you place an isomorphism inside a container without using ImpredicativeTypes. 7Used to provide overloading of isomorphism application  This is a ) with a canonical mapping to it from the . category of isomorphisms over Haskell types. *Build this morphism out of an isomorphism The intention is that by using #, you can supply both halves of an + isomorphism, but k can be instantiated to (->), so you can freely use * the resulting isomorphism as a function. MMap a morphism in the target category using an isomorphism between morphisms  in Hask. Invert an isomorphism. ENote to compose an isomorphism and receive an isomorphism in turn you'll need to use     ( l) "a lIf you imported  from Control.Category, then:  l   r "a  (r  l)Convert from an  back to any  value. WThis is useful when you need to store an isomoprhism as a data type inside a container 6 and later reconstitute it as an overloaded function.  Rank2Types provisionalEdward Kmett <ekmett@gmail.com> Trustworthy/ A basic non-empty list zipper OAll combinators assume the invariant that the length stored matches the number P of elements in list of items to the left, and the list of items to the left is  stored reversed.   is just a renamed  functor to give better error = messages when someone attempts to use a getter as a setter. 1Most user code will never need to see this type.  Anything  must be isomorphic to the  . A  for a  . An  K ignores its argument and is isomorphic to a monad wrapped around a value. 9That said, the monad is possibly rather unrelated to any  structure. Used instead of  to report  No instance of (2 )#when the user attempts to misuse a 3 as a  4., rather than a monolithic unification error.  Generalizing  so we can apply simple  > transformations to it and so we can get nicer error messages A  4 ignores its argument, which it carries solely as a  phantom type parameter. To ensure this, an instance of  is required to satisfy:  =  f = #Replace the phantom type argument. OWrap a monadic effect with a phantom type argument. Used when magnifying RWST. 4Wrap a monadic effect with a phantom type argument. This is used to characterize a 5. Ta.k.a. indexed Cartesian store comonad, indexed Kleene store comonad, or an indexed FunList.  *http://twanvl.nl/blog/haskell/non-regular1 Mnemonically, a  0 holds many stores and you can easily add more. This is a final encoding of  . #Used to find the nth 6 of a 5. &!The result of trying to find the nth 6 of a 5. * Used for 7 - Used for 8 0Used internally by 9 and the like. 3Used internally by : and the like. 6Applicative composition of ;<  with a , used  by = 9The result of 6 ;0The indexed store can be used to characterize a >  and is used by ? =Used by @ to A into BC @Make a monoid out of  for error handling CUsed by @ to A into BC FMake a monoid out of  for error handling IUsed by @ to A into DE or FG LUsed by @ to A into HI. OUsed by @ to A into JK RUsed by @ to A into LM UObtain the minimum. VObtain the maximum WAGiven an action to run for each matched pair, traverse a bazaar. W ::  Traversal (  a b s) s a bX  is an indexed . Y A trivial  . Z.A convenient antonym that is used internally. [The  equivalent for a   . \*How many entries are there in this level? ].Pull the non-emtpy list zipper left one entry ^LPull the non-empty list zipper left one entry, stopping at the first entry. _8Pull the non-empty list zipper all the way to the left. `8Pul the non-empty list zipper all the way to the right.  NB:6, when given an infinite list this may not terminate. a0Pull the non-empty list zipper right one entry. bLPull the non-empty list zipper right one entry, stopping at the last entry. c This is a Lens# targeting the value that we would ! from the non-empty list zipper.  view c "a  c :: Simple Lens (  a) ad<Zip a non-empty list zipper back up, and return the result. N so you can pass our a 3, into combinators from other lens libraries 0This instance is a lie, but it is a useful lie.  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcd      !"#$%&'()*+,-./01234567\  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcd\;<RSTOPQLMNIJK=>?@ABCDEFGH3450126789:-/.U*,+V#$%&)(' !"WXYZ[ \]^_ab`dch    !"#$%&)('*,+-/.0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcd      !"#$%&'()*+,-./01234567"rank 2 types, MPTCs, TFs, flexible provisionalEdward Kmett <ekmett@gmail.com> Safe-Inferred eYA function with access to a index. This constructor may be useful when you need to store  a h in a container to avoid ImpredicativeTypes. h*Type alias for passing around polymorphic i functions that can be called g or  directly as a function ibPermit overloading of function application for things that also admit a notion of a key or index. Provides overloading for i functions. jBuild a function from an i function k Compose an i' function with a non-indexed function. Mnemonically, the <* points to the index we want to preserve. l'Compose a non-indexed function with an i function. Mnemonically, the >* points to the index we want to preserve. mRemap the index. nComposition of i functions Mnemonically, the < and >: points to the fact that we want to preserve the indices. oComposition of i> functions with a user supplied function for combining indexs pRTransform an Traversal into an IndexedTraversal, a Fold into an IndexedFold, etc.   p :: 5 s t a b ->  O  s t a b  p :: > s t a b ->  P  s t a b  p :: Q s t ->  R  s t  p :: S s t a b ->  P  s t a b  p :: 4 s t -> T  s t a b 8CUsing an equality witness to avoid potential overlapping instances  and aid dispatch. efghijklmnop89 efghijklmnop ijhefgnklomp efghijklmnop89rank 2 types, MPTCs experimentalEdward Kmett <ekmett@gmail.com> Safe-InferredqUseful for storage. tUsed to consume an  R. uEvery u is a valid  R and Getter. qrstuqrstuutqrsqrstuportable provisionalEdward Kmett <ekmett@gmail.com> Safe-InferredvA strict version of (UV) for monads. (+1) <$!> [1,2,3,4] [2,3,4,5]wA strict version of (UW) for monads. () <$! [1,2,3,4] [(),(),(),()]vwvwvwvwMTPCs, FDs, Rank2 experimentalEdward Kmett <ekmett@gmail.com> Safe-Inferred xUsed to evaluate an z. yA y is a Fold enriched with access to a : for side-effects. Every Fold can be used as a y(, that simply ignores the access to the :. You can compose a y with another y using (; ) from the Prelude. zAn z is a Getter enriched with access to a : for side-effects. Every Getter can be used as an z You can compose an z with another z using (; ) from the Prelude. { Perform an z.  perform = flip (^!) | Perform an z and modify the result. } Perform an z &["hello","world"]^!folded.act putStrLnhelloworld~ Construct an z from a monadic side-effect A self-running z, analogous to XY.   = ~ <(1,"hello")^!_2.acts.to succ"ifmmp"Apply a : transformer to an z. xyz{|}~ xyz{|}~ z~{|}yx xyz{|}~ Rank2Types provisionalEdward Kmett <ekmett@gmail.com> Safe-Inferred, type  =  )Useful for storing lenses in containers. type  k f s a =  ( k f) s a type  f s t a b =  (->) f s t a bMany combinators that accept a  can also accept a  5 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  5. type  f =  ( f) type  =  *This is a commonly used infix alias for a  . A  ,  5 , ... can  be used instead of a ,5, ...  whenever the type variables don't change upon setting a value.    #Z ::   ([\ a) a  ] ::  ^5 [a] a .Note: To use this alias in your own code with  f or  3, you may have to turn on LiberalTypeSynonyms. 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 lens laws: !1) You get back what you put in:  _ l (` l b a) "a b"2) Putting back what you got doesn't change anything:  ` l (_ l a) a "a a.3) Setting twice is the same as setting once:  ` l c (` l b a) "a ` l c a=These laws are strong enough that the 4 type parameters of a  cannot C vary fully independently. For more on how they interact, read the "Why is  it a Lens Family?" section of   /http://comonad.com/reader/2012/mirrored-lenses/. Every  can be used directly as a 3 or  5. You can also use a  for a as if it were a  Q or 4. Since every lens is a valid 5, the 7 traversal laws are required of any lenses you create:    l = "a =   (l f) ; l g "a bc ; l (bd ;  f ; g)  type  s t a b = forall f.  f =>  f s t a bBuild a  from a getter and a setter.  :: 9 f => (s -> a) -> (s -> b -> t) -> (a -> f b) -> s -> f t&This is occasionally useful when your  (or 5) Q 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. (') can be used in one of two scenarios: When applied to a  , it can edit the target of the  in a , structure, extracting a functorial result. When applied to a 5, it can edit the  targets of the  Traversals+, extracting an applicative summary of its  actions. 8For all that the definition of this combinator is just:  () "a <   () ::  f => S) s t a b -> (a -> f b) -> s -> f t  () ::  f => ( s t a b -> (a -> f b) -> s -> f t  () ::  f => 5# s t a b -> (a -> f b) -> s -> f t DIt may be beneficial to think about it as if it had these even more  restrictive types, however: When applied to a 5, it can edit the  targets of the  Traversals-, extracting a supplemental monoidal summary  of its actions, by choosing  f = ((,) m)   () :: S/ s t a b -> (a -> (r, b)) -> s -> (r, t)  () :: . s t a b -> (a -> (r, b)) -> s -> (r, t)  () :: Monoid m => 5) s t a b -> (a -> (m, b)) -> s -> (m, t) Modify the target of a + in the current state returning some extra  information of type r or modify all targets of a  5( in the current state, extracting extra  information of type r/ and return a monoidal summary of the changes.  () "a (> ;)It may be useful to think of ($), instead, as having either of the , following more restricted type signatures:   () :: ? s m => S' s s a b -> (a -> (r, b)) -> m r  () :: ? s m => & s s a b -> (a -> (r, b)) -> m r  () :: (? s m, Monoid r) => 5! s s a b -> (a -> (r, b)) -> m r HThis lens can be used to change the result of a function but only where $ the arguments match the key given. 9Merge two lenses, getters, setters, folds or traversals.   "a  < <    :: 4 s a -> 4 s' a -> 4 ( s s') a   :: Q s a -> Q s' a -> Q ( s s') a   ::   s a ->   s' a ->   ( s s') a   ::  5 s a ->  5 s' a ->  5 ( s s') a   ::  3 s a ->  3 s' a ->  3 ( s s') a  This is a  that updates either side of an ', where both sides have the same type.   "a  < <Left 12^.chosen12Right "hello"^.chosen"hello"chosen *~ 10 $ Right 2Right 20 makes a  from two other lenses.  ::  s t a b ->  s' t' a' b' ->  (s,s') (t,t') (a,a') (b,b') Cloning a ! is one way to make sure you aren't given  something weaker, such as a 5 and can be D used as a way to pass around lenses that have to be monomorphic in f. !Note: This only accepts a proper . c\"Costate Comonad Coalgebra is equivalent of Java's member variable update technology for Haskell\" -- @PLT_Borat on Twitter Modify the target of a  and return the result 2When you do not need the result of the addition, (e) is more flexible.   () :: ) s t a b -> (a -> b) -> s -> (b, t)  () :: S* s t a b -> (a -> b) -> s -> (b, t)  () :: Monoid b => 5$ s t a b -> (a -> b) -> s -> (b, t) -Increment the target of a numerically valued  and return the result 2When you do not need the result of the addition, (f) is more flexible.   () :: @ a =>   s a -> a -> s -> (a, s)  () :: @ a =>  S s a -> a -> s -> (a, s) -Decrement the target of a numerically valued  and return the result 5When you do not need the result of the subtraction, (g) is more flexible.   () :: @ a =>   s a -> a -> s -> (a, s)  () :: @ a =>  S s a -> a -> s -> (a, s) ,Multiply the target of a numerically valued  and return the result 8When you do not need the result of the multiplication, (h ) is more  flexible.   () :: @ b =>   s a -> a -> a -> (s, a)  () :: @ b =>  S s a -> a -> a -> (s, a)) +Divide the target of a fractionally valued  and return the result. 2When you do not need the result of the division, (i) is more flexible.   () :: A b =>   s a -> a -> a -> (s, a)  () :: A b =>  S s a -> a -> a -> (s, a)) )Raise the target of a numerically valued  to a non-negative  B power and return the result 2When you do not need the result of the division, (j) is more flexible.   () :: (@ b, B e) =>   s a -> e -> a -> (a, s)  () :: (@ b, B e) =>  S s a -> e -> a -> (a, s) *Raise the target of a fractionally valued  to an B power  and return the result. 2When you do not need the result of the division, (k) is more flexible.   () :: (A b, B e) =>   s a -> e -> a -> (a, s)  () :: (A b, B e) =>  S s a -> e -> a -> (a, s) ,Raise the target of a floating-point valued  to an arbitrary power  and return the result. 2When you do not need the result of the division, (l) is more flexible.   () :: C a =>   s a -> a -> s -> (a, s)  () :: C a =>  S s a -> a -> s -> (a, s)  Logically D a Boolean valued  and return the result 3When you do not need the result of the operation, (m) is more flexible.   () ::   s E -> E -> s -> (E, s)  () ::  S s E -> E -> s -> (E, s)  Logically F a Boolean valued  and return the result 3When you do not need the result of the operation, (n) is more flexible.   () ::   s E -> E -> s -> (E, s)  () ::  S s E -> E -> s -> (E, s) Modify the target of a , but return the old value. 2When you do not need the result of the addition, (e) is more flexible.   () :: ) s t a b -> (a -> b) -> s -> (b, t)  () :: S* s t a b -> (a -> b) -> s -> (b, t)  () :: Monoid b => 5$ s t a b -> (a -> b) -> s -> (b, t) Modify the target of a , but return the old value. %When you do not need the old value, (e) is more flexible.   () :: " s t a b -> b -> s -> (a, t)  () :: S# s t a b -> b -> s -> (a, t)  () :: Monoid b => 5 s t a b -> b -> s -> (a, t) Modify the target of a  into your monad's state by a user supplied ! function and return the result. When applied to a 5D, it this will return a monoidal summary of all of the intermediate  results. 3When you do not need the result of the operation, (o) is more flexible.   () :: ? s m =>   s a -> (a -> a) -> m a  () :: ? s m =>  S s a -> (a -> a) -> m a  () :: (? s m, Monoid a) =>  Traveral 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, (p ) is more  flexible.   () :: (? s m, @ a) =>   s a -> a -> m a  () :: (? s m, @ a) =>  S 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, (q ) is more  flexible.   () :: (? s m, @ a) =>   s a -> a -> m a  () :: (? s m, @ a) =>  S 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, (r ) is more  flexible.   () :: (? s m, @ a) =>   s a -> a -> m a  () :: (? s m, @ a) =>  S 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, (s) is more flexible.   () :: (? s m, A a) =>   s a -> a -> m a  () :: (? s m, A a) =>  S s a -> a -> m a )Raise the target of a numerically valued  into your monad's state  to a non-negative B power and return the result. 3When you do not need the result of the operation, (t) is more flexible.   () :: (? s m, @ a, B e) =>   s a -> e -> m a  () :: (? s m, @ a, B e) =>  S s a -> e -> m a *Raise the target of a fractionally valued  into your monad's state  to an B power and return the result. 3When you do not need the result of the operation, (u) is more flexible.   () :: (? s m, A b, B e) =>   s a -> e -> m a  () :: (? s m, A b, B e) =>  S s a -> e -> m a ,Raise the target of a floating-point valued  into your monad's 4 state to an arbitrary power and return the result. 3When you do not need the result of the operation, (t) is more flexible.   () :: (? s m, C a) =>   s a -> a -> m a  () :: (? s m, C a) =>  S s a -> a -> m a  Logically D a Boolean valued  into your monad's state and return  the result. 3When you do not need the result of the operation, (v) is more flexible.   () :: ? s m =>   s E -> E -> m E  () :: ? s m =>  S s E -> E -> m E  Logically F a Boolean valued  into your monad's state and return  the result. 3When you do not need the result of the operation, (w) is more flexible.   () :: ? s m =>   s E -> E -> m E  () :: ? s m =>  S s E -> E -> m E Modify the target of a  into your monad's state by a user supplied  function and return the old value that was replaced. When applied to a 5B, it this will return a monoidal summary of all of the old values  present. 3When you do not need the result of the operation, (o) is more flexible.   () :: ? s m =>   s a -> (a -> a) -> m a  () :: ? s m =>  S s a -> (a -> a) -> m a  () :: (? s m, Monoid b) =>  Traveral s a -> (a -> a) -> m a Modify the target of a  into your monad's state by a user supplied  function and return the old value that was replaced. When applied to a 5B, it this will return a monoidal summary of all of the old values  present. 3When you do not need the result of the operation, (o) is more flexible.   () :: ? s m =>   s a -> (a -> a) -> m a  () :: ? s m =>  S s a -> (a -> a) -> m a  () :: (? s m, Monoid t) =>  Traveral s a -> (a -> a) -> m a ,Run a monadic action, and set the target of  to its result.    () :: ? s m => S s s a b -> m b -> m b  () :: ? s m =>  s s a b -> m b -> m b (NB: This is limited to taking an actual  than admitting a 5 because 5 there are potential loss of state issues otherwise. ..., "rank 2 types, MPTCs, TFs, flexible provisionalEdward Kmett <ekmett@gmail.com> Trustworthy type  i =  ( i)Useful for storage.  Provides an L that can be used to read, write or delete a member of a set-like container /contains 3 .~ False $ IntSet.fromList [1,2,3,4]fromList [1,2,4] Provides an d that can be used to read, write or delete the value associated with a key in a map-like container. !Map.fromList [(1,"hello")] ^.at 1 Just "hello"at 1 ?~ "hello" $ Map.emptyfromList [(1,"hello")] type  i =  ( i)Every  is a valid  and a valid  O. Adjust the target of an ' returning the intermediate result, or ! adjust all of the targets of an  O and return a monoidal summary  along with the answer.  l  f = l  G f/When you do not need access to the index then ()) is more liberal in what it can accept. 9If you do not need the intermediate result, you can use (x ) or even (e).   () :: + i s t a b -> (i -> a -> b) -> s -> (b, t)  () :: Monoid b =>  O+ i s t a b -> (i -> a -> b) -> s -> (b, t) Adjust the target of an & returning a supplementary result, or ! adjust all of the targets of an  O and return a monoidal summary . of the supplementary results and the answer.  () = g   () ::  f => / i s t a b -> (i -> a -> f b) -> s -> f t  () ::  f =>  O* i s t a b -> (i -> a -> f b) -> s -> f t ]In particular, it is often useful to think of this function as having one of these even more  restrictive type signatures   () :: 5 i s t a b -> (i -> a -> (r, b)) -> s -> (r, t)  () :: Monoid r =>  O0 i s t a b -> (i -> a -> (r, b)) -> s -> (r, t) Adjust the target of an & returning a supplementary result, or ! adjust all of the targets of an  O within the current state, and 9 return a monoidal summary of the supplementary results.  l  f = > (l  f)   () :: ? s m 2 i s s a b -> (i -> a -> (r, b)) -> s -> m r  () :: (? s m, Monoid r) =>  O- i s s a b -> (i -> a -> (r, b)) -> s -> m r Adjust the target of an ' returning the intermediate result, or ! adjust all of the targets of an  O within the current state, and 8 return a monoidal summary of the intermediate results.   () :: ? s m ( i s s a b -> (i -> a -> b) -> m b  () :: (? s m, Monoid b) =>  O# i s s a b -> (i -> a -> b) -> m b HIJKLMHIJKLM "rank 2 types, MPTCs, TFs, flexible provisionalEdward Kmett <ekmett@gmail.com> Safe-InferredUseful for storage. Every  is a valid Q. Fold an  or  O/ by mapping indices and values to an arbitrary  with access  to the index i.  When you don' t need access to the index then y& is more flexible in what it accepts.  y l "a  l ; G    :: u+ i a s -> (i -> s -> m) -> a -> m   ::  m => - i a s -> (i -> s -> m) -> a -> m   ::  z' i a s -> (i -> s -> m) -> a -> m   ::  m =>  {" i a s -> (i -> s -> m) -> a -> m JRight-associative fold of parts of a structure that are viewed through an  or  O with  access to the index i.  When you don' t need access to the index then |& is more flexible in what it accepts.  | l "a  l ; G    :: u5 i s a -> (i -> a -> r -> r) -> r -> s -> r   :: 7 i s a -> (i -> a -> r -> r) -> r -> s -> r   ::  z1 i s a -> (i -> a -> r -> r) -> r -> s -> r   ::  {, i s a -> (i -> a -> r -> r) -> r -> s -> r MLeft-associative fold of the parts of a structure that are viewed through an  or  O with  access to the index i.  When you don' t need access to the index then }& is more flexible in what it accepts.  } l "a  l ; G    :: u5 i s a -> (i -> r -> a -> r) -> r -> s -> r   :: 7 i s a -> (i -> r -> a -> r) -> r -> s -> r   ::  z1 i s a -> (i -> r -> a -> r) -> r -> s -> r   ::  {, i s a -> (i -> r -> a -> r) -> r -> s -> r 4Return whether or not any element viewed through an  or  O / 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.  ~ l "a  l ; G    :: u i s a -> (i -> a -> E ) -> s -> E   ::  i s a -> (i -> a -> E ) -> s -> E   ::  z i s a -> (i -> a -> E ) -> s -> E   ::  { i s a -> (i -> a -> E ) -> s -> E 5Return whether or not all elements viewed through an  or  O / 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.   l "a  l ; G    :: u i s a -> (i -> a -> E ) -> s -> E   ::  i s a -> (i -> a -> E ) -> s -> E   ::  z i s a -> (i -> a -> E ) -> s -> E   ::  { i s a -> (i -> a -> E ) -> s -> E Traverse the targets of an  or  O 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 "a  itraverseOf l ; G    ::  f => u0 i s a -> (i -> a -> f r) -> s -> f ()   ::  f => 2 i s a -> (i -> a -> f r) -> s -> f ()   ::  f =>  z, i s a -> (i -> a -> f r) -> s -> f ()   ::  f =>  {' i s a -> (i -> a -> f r) -> s -> f () Traverse the targets of an  or  O2 with access to the index, discarding the results  (with the arguments flipped).   "a N ;  When you don' t need access to the index then & is more flexible in what it accepts.   l a "a  l a ; G    ::  f => u0 i s a -> s -> (i -> a -> f r) -> f ()   ::  f => 2 i s a -> s -> (i -> a -> f r) -> f ()   ::  f =>  z, i s a -> s -> (i -> a -> f r) -> f ()   ::  f =>  {' i s a -> s -> (i -> a -> f r) -> f () *Run monadic actions for each target of an  or  O 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 imapMOf l ; G    :: : m => u0 i s a -> (i -> a -> m r) -> s -> m ()   :: : m => 2 i s a -> (i -> a -> m r) -> s -> m ()   :: : m =>  z, i s a -> (i -> a -> m r) -> s -> m ()   :: : m =>  {' i s a -> (i -> a -> m r) -> s -> m () *Run monadic actions for each target of an  or  O with access to the index, 6 discarding the results (with the arguments flipped).   "a N ;  When you don' t need access to the index then & is more flexible in what it accepts.   l a "a iforMOf l a ; G    :: : m => u0 i s a -> s -> (i -> a -> m r) -> m ()   :: : m => 2 i s a -> s -> (i -> a -> m r) -> m ()   :: : m =>  z, i s a -> s -> (i -> a -> m r) -> m ()   :: : m =>  {' i s a -> s -> (i -> a -> m r) -> m () <Concatenate the results of a function of the elements of an  or  O  with access to the index.  When you don' t need access to the index then ' is more flexible in what it accepts.     l "a  l ; G   "a      :: u i s a -> (i -> a -> [r] ) -> s -> [r]   :: " i s a -> (i -> a -> [r] ) -> s -> [r]   ::  z i s a -> (i -> a -> [r] ) -> s -> [r]   ::  { i s a -> (i -> a -> [r] ) -> s -> [r] The findOf function takes an  or  O, a predicate that is also T supplied the index, a structure and returns the left-most element of the structure  matching the predicate, or O 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 ; G    :: u s a -> (i -> a -> E ) -> s ->  (i, a)   ::  s a -> (i -> a -> E ) -> s ->  (i, a)   ::  z s a -> (i -> a -> E ) -> s ->  (i, a)   ::  { s a -> (i -> a -> E ) -> s ->  (i, 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 ; G    :: u5 i s a -> (i -> a -> r -> r) -> r -> s -> r   :: 7 i s a -> (i -> a -> r -> r) -> r -> s -> r   ::  z1 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 ; G    :: u7 i s a -> (i -> r -> a -> r) -> r -> s -> r   :: 9 i s a -> (i -> r -> a -> r) -> r -> s -> r   ::  z3 i s a -> (i -> r -> a -> r) -> r -> s -> r   ::  {. i s a -> (i -> r -> a -> r) -> r -> s -> r CMonadic fold right over the elements of a structure with an index.  When you don' t need access to the index then & is more flexible in what it accepts.   l "a  l ; G    :: : m => u7 i s a -> (i -> a -> r -> m r) -> r -> s -> r   :: : m => 9 i s a -> (i -> a -> r -> m r) -> r -> s -> r   :: : m =>  z3 i s a -> (i -> a -> r -> m r) -> r -> s -> r   :: : m =>  {. i s a -> (i -> a -> r -> m r) -> r -> s -> r VMonadic fold over the elements of a structure with an index, associating to the left.  When you don' t need access to the index then & is more flexible in what it accepts.   l "a  l ; G    :: : m => u9 i s a -> (i -> r -> a -> m r) -> r -> s -> r   :: : m => ; i s a -> (i -> r -> a -> m r) -> r -> s -> r   :: : m =>  z5 i s a -> (i -> r -> a -> m r) -> r -> s -> r   :: : m =>  {0 i s a -> (i -> r -> a -> m r) -> r -> s -> r .Extract the key-value pairs from a structure.  When you don'1t need access to the indices in the result, then & is more flexible in what it accepts.   l "a P Q ;  l    :: u i s a -> s -> [(i,a)]   ::  i s a -> s -> [(i,a)]   ::  z i s a -> s -> [(i,a)]   ::  { i s a -> s -> [(i,a)] JTransform an indexed fold into a fold of both the indices and the values.     ::  i s a -> Fold s (i, a)   :: SimpleIndexedLens i s a -> Getter s (i, a)   :: SimpleIndexedTraversal i s a -> Fold s (i, a) All Fold9 operations are safe, and comply with the laws. However, Passing this an IndexedTraversal will still allow many   Traversal9 combinators to type check on the result, but the result K can only be legally traversed by operations that do not edit the indices.     :: IndexedTraversal i s t a b ->  Traversal s t (i, a) (j, b) .Change made to the indices will be discarded. 6Transform an indexed fold into a fold of the indices.    ::  i s a -> Fold s i   :: SimpleIndexedLens i s a -> Getter s i   :: SimpleIndexedTraversal i s a -> Fold s i  Obtain an  by filtering an  P, u, or . When passed an  O, sadly the result is not a legal  O. See filtered for a related counter-example. (Reverse the order of the elements of an  or  O.  This has no effect on an  P, u, or  .  Obtain an ! by taking elements from another ,  P, u or  O while a predicate holds.  Obtain an # by dropping elements from another ,  P, u or  O while a predicate holds. RR "rank 2 types, MPTCs, TFs, flexible provisionalEdward Kmett <ekmett@gmail.com> Trustworthy type  i =  ( i)Useful for storage. Allows $ of the value at the largest index. & of the element at the largest index. Allows " the value at the smallest index. ) of the element with the smallest index. type  i =  ( i)#Every indexed traversal is a valid 5 or  R. The i constraint is used to allow an  to be used directly as a 5. The 5" laws are still required to hold. Traversal with an index. NB: When you don'8t need access to the index then you can just apply your   directly as a function!     "a g   l =  l ; G = <     :: / i s t a b -> (i -> a -> f b) -> s -> f t   :: * 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 ; G   "a N .      :: / i s t a b -> s -> (i -> a -> f b) -> f t   :: * i s t a b -> s -> (i -> a -> f b) -> f t HMap each element of a structure targeted by a lens to a monadic action, Q evaluate these actions from left to right, and collect the results, with access  its position.  When you don't need access to the index mapMOf( is more liberal in what it can accept.   l "a  l ; G    :: : m => / 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 HMap each element of a structure targeted by a lens to a monadic action, Q evaluate these actions from left to right, and collect the results, with access + its position (and the arguments flipped).     l a "a  l a ; G   "a N ;      :: : 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 S to an arbitrary  with access to the index. ' accumulates state from right to left.   l "a  l ; G    :: ? i s t a b -> (i -> s -> a -> (s, b)) -> s -> s -> (s, t)   :: : i s t a b -> (i -> s -> a -> (s, b)) -> s -> s -> (s, t)  Generalizes T to an arbitrary  with access to the index. ' accumulates state from left to right.   l "a  l ; G    :: ? i s t a b -> (i -> s -> a -> (s, b)) -> s -> s -> (s, t)   :: : i s t a b -> (i -> s -> a -> (s, b)) -> s -> s -> (s, t) Access the element of an & where the index matches a predicate. Oover (iwhereOf (indexed traverse) (>0)) reverse $ ["He","was","stressed","o_O"]["He","saw","desserts","O_o"]    ::  IndexedFold i s a -> (i -> E) ->  IndexedFold i s a   ::  IndexedGetter i s a -> (i -> E) ->  IndexedFold i s a   ::  i s a -> (i -> E) ->  i s a   ::  i s a -> (i -> E) ->  i s a   :: SimpleIndexedSetter i s a -> (i -> E) -> SimpleIndexedSetter i s a +Traverse the value at a given key in a map  k =  k k This provides a  Traversal) that checks a predicate on a key before ( allowing you to traverse into a value. UVWXYUVWXY "rank 2 types, MPTCs, TFs, flexible provisionalEdward Kmett <ekmett@gmail.com> Safe-Inferred type  i =  ( i)Useful for storage. type  i =  ( i)Every  is a valid Setter The 3" laws are still required to hold. Map with index. /When you do not need access to the index, then mapOf( is more liberal in what it can accept.   l "a  l ; G    :: ) i s t a b -> (i -> a -> b) -> s -> t   ::  P+ i s t a b -> (i -> a -> b) -> s -> t   ::  O& i s t a b -> (i -> a -> b) -> s -> t %Map with index. This is an alias for . /When you do not need access to the index, then over( is more liberal in what it can accept.   l "a  l ; G    :: ) i s t a b -> (i -> a -> b) -> s -> t   ::  P+ i s t a b -> (i -> a -> b) -> s -> t   ::  O& i s t a b -> (i -> a -> b) -> s -> t  Build an  from an imap-like function. Your supplied function f is required to satisfy:    f < "a <  f g ; f h "a f (g ; h) Equational reasoning:     ;  "a <   ;  "a < Another way to view sets is that it takes a "semantic editor combinator"  and transforms it into a Setter. Adjust every target of an ,  P or  O  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 e f "a l  G f   () :: ) i s t a b -> (i -> a -> b) -> s -> t  () ::  P+ i s t a b -> (i -> a -> b) -> s -> t  () ::  O& i s t a b -> (i -> a -> b) -> s -> t /Adjust every target in the current state of an ,  P or  O  with access to the index. /When you do not need access to the index then (o)) is more liberal in what it can accept.  l o f "a l  G f   () :: ? s m => ' i s s a b -> (i -> a -> b) -> m ()  () :: ? s m =>  P) i s s a b -> (i -> a -> b) -> m ()  () :: ? s m =>  O$ i s t a b -> (i -> a -> b) -> m ()    Rank2Types provisionalEdward Kmett <ekmett@gmail.com> Safe-Inferred,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)   ~  :: (s -> E) -> (a, s) -> E   ;  :: ( Applicative f, . t) => (a -> f b) -> t (s, a) -> f (t (s, b))  y ( ; ) :: ( 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)/This can also be used on larger tuples as well _1 +~ 41 $ (1,2,3,4,5) (42,2,3,4,5)   _1 ::  (a,b) (a',b) a a'  _1 ::  (a,b,c) (a' ,b,c) a a'  _1 ::  (a,b,c,d) (a' ,b,c,d) a a'  ...  _1 ::  (a,c,d,e,f,g,h,i) (a',b,c,d,e,f,g,h,i) a a' >Z[\]^_`abcdefghijklmnopqrstuvwxyz{|}~5Z[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ Rank2Types provisionalEdward Kmett <ekmett@gmail.com> Safe-Inferred) type  =  :Reify a setter so it can be stored safely in a container.  0This is a useful alias for use when consuming a  . 1Most user code will never have to use this type. type   m =    A Simple Setter is just a  that doesn't change the types. IThese are particularly common when talking about monomorphic containers. e.g.   Data.Text.map ::     type   =    Running a % instantiates it to a concrete type. WWhen consuming a setter directly to perform a mapping, you can use this type, but most + user code will not need to use this type.  By choosing   rather than , we get nicer error messages.  The only >-like law that can apply to a  l is that   l y ( l x a) "a  l x aYou can't view a 3 in general, so the other two laws are irrelevant.  However, two  laws apply to a :     l < "a <   l f ;  l g "a  l (f ; g) "These an be stated more directly:    l = "a =  l f .  . l g "a l (f .  . g) You can compose a  with a > or a 5 using (;) from the Prelude ! and the result is always only a  and nothing more. ;This setter can be used to map over all of the values in a .     "a     "a    () "a   over mapped (+1) [1,2,3][2,3,4]set mapped () [1,2,3] [(),(),()]#mapped.mapped %~ (+1) $ [[1,2],[3]] [[2,3],[4]]=over (mapped._2) length [("hello","world"),("leaders","!!!")][("hello",5),("leaders",3)])Build a Setter from a map-like function. Your supplied function f is required to satisfy:    f < "a <  f g ; f h "a f (g ; h) Equational reasoning:     ;  "a <   ;  "a < Another way to view  is that it takes a "semantic editor combinator"  and transforms it into a . Modify the target of a > or all the targets of a  or 5  with a function.     "a     "a     ;  "a <   ;  "a < over mapped (*10) [1,2,3] [10,20,30]over _1 show (10,20) ("10",20)Another way to view " is to say that it transformers a  into a  "semantic editor combinator".  ::  s t a b -> (a -> b) -> s -> tModify the target of a > or all the targets of a  or 5 ' with a function. This is an alias for # that is provided for consistency.     "a    "a     fmapDefault "a  traverse   ;  "a <   ;  "a < mapOf mapped (+1) [1,2,3,4] [2,3,4,5]mapOf _1 (+1) (1,2)(2,2)mapOf both (+1) (1,2)(2,3)    :: $ s t a b -> (a -> b) -> s -> t   :: S' s t a b -> (a -> b) -> s -> t   :: >& s t a b -> (a -> b) -> s -> t   :: 5! s t a b -> (a -> b) -> s -> t Replace the target of a > or all of the targets of a   or 5 with a constant value.  () "a  set _2 "hello" (1,()) (1,"hello")set mapped () [1,2,3,4] [(),(),(),()]Note: Attempting to  a Fold or Getter# will fail at compile time with an  relatively nice error message.    ::  s t a b -> b -> s -> t   :: S s t a b -> b -> s -> t   :: > s t a b -> b -> s -> t   :: 5 s t a b -> b -> s -> t Modifies the target of a > or all of the targets of a  or  5 with a user supplied function. This is an infix version of      f "a   f   f "a traverse  f _2 %~ length $ (1,"hello")(1,5)traverse %~ (+1) $ [1,2,3][2,3,4]_2 %~ (+1) $ (3,4)(3,5)9traverse.traverse %~ length $ [["hello","world"],["!!!"]] [[5,5],[3]]   () :: " s t a b -> (a -> b) -> s -> t  () :: S% s t a b -> (a -> b) -> s -> t  () :: >$ s t a b -> (a -> b) -> s -> t  () :: 5 s t a b -> (a -> b) -> s -> t Replace the target of a > or all of the targets of a   or 5 with a constant value. This is an infix version of !, provided for consistency with (#)  f  a "a   f  a_1 .~ "hello" $ (42,"world")("hello","world")   () ::  s t a b -> b -> s -> t  () :: S s t a b -> b -> s -> t  () :: > s t a b -> b -> s -> t  () :: 5 s t a b -> b -> s -> t Set the target of a >, 5 or  to  a value.  l  t "a  l ( t)   () ::  s t a ( b) -> b -> s -> t  () :: S s t a ( b) -> b -> s -> t  () :: > s t a ( b) -> b -> s -> t  () :: 5 s t a ( b) -> b -> s -> t Set 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  t directly is a good idea. -_3 <.~ "world" $ ("good","morning","vietnam")$("world",("good","morning","world"))import Data.Map as MapK_2.at "hello" <.~ Just "world" $ (42,Map.fromList [("goodnight","gracie")])G(Just "world",(42,fromList [("goodnight","gracie"),("hello","world")]))   () ::  s t a b -> b -> s -> (b, t)  () :: S# s t a b -> b -> s -> (b, t)  () :: >" s t a b -> b -> s -> (b, t)  () :: 5 s t a b -> b -> s -> (b, t) Set 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  d directly is a good idea. import Data.Map as MapF_2.at "hello" <?~ "world" $ (42,Map.fromList [("goodnight","gracie")])B("world",(42,fromList [("goodnight","gracie"),("hello","world")]))   () ::  s t a b -> ( b) -> s -> (b, t)  () :: S s t a ( b) -> b -> s -> (b, t)  () :: > s t a ( b) -> b -> s -> (b, t)  () :: 5 s t a ( b) -> b -> s -> (b, t) 0Increment the target(s) of a numerically valued >,  or 5 _1 +~ 1 $ (1,2)(2,2)both +~ 2 $ (5,6)(7,8)   () :: Num a =>   s a -> a -> s -> s  () :: Num a =>  S s a -> a -> s -> s  () :: Num a =>  > s a -> a -> s -> s  () :: Num a =>  5 s a -> a -> s -> s /Multiply the target(s) of a numerically valued >, S,  or 5 _2 *~ 4 $ (1,2)(1,8)mapped *~ 2 $ Just 24Just 48   () :: @ a =>   s a -> a -> s -> s  () :: @ a =>  S s a -> a -> s -> s  () :: @ a =>  > s a -> a -> s -> s  () :: @ a =>  5 s a -> a -> s -> s 0Decrement the target(s) of a numerically valued >, S,  or 5 _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 s a -> a -> s -> s  () :: @ a =>  > s a -> a -> s -> s  () :: @ a =>  5 s a -> a -> s -> s -Divide the target(s) of a numerically valued >, S,  or 5 _2 //~ 2 $ ("Hawaii",10)("Hawaii",5.0)   () :: A a =>   s a -> a -> s -> s  () :: A a =>  S s a -> a -> s -> s  () :: A a =>  > s a -> a -> s -> s  () :: A a =>  5 s a -> a -> s -> s ,Raise the target(s) of a numerically valued >,  or 5" to a non-negative integral power _2 ^~ 2 $ (1,3)(1,9)   () :: (@ a, B e) =>   s a -> e -> s -> s  () :: (@ a, B e) =>  S s a -> e -> s -> s  () :: (@ a, B e) =>  > s a -> e -> s -> s  () :: (@ a, B e) =>  5 s a -> e -> s -> s -Raise the target(s) of a fractionally valued >,  or 5 to an integral power _2 ^^~ (-1) $ (1,2)(1,0.5)   () :: (A a, B e) =>   s a -> e -> s -> s  () :: (A a, B e) =>  S s a -> e -> s -> s  () :: (A a, B e) =>  > s a -> e -> s -> s  () :: (A a, B e) =>  5 s a -> e -> s -> s /Raise the target(s) of a floating-point valued >,  or 5 to an arbitrary power. _2 **~ pi $ (1,3)(1,31.54428070019754)   () :: C a =>   s a -> a -> s -> s  () :: C a =>  S s a -> a -> s -> s  () :: C a =>  > s a -> a -> s -> s  () :: C a =>  5 s a -> a -> s -> s   Logically D the target(s) of a E-valued > or  both ||~ True $ (False,True) (True,True)both ||~ False $ (False,True) (False,True)   ( ) ::   s E -> E -> s -> s  ( ) ::  S s E -> E -> s -> s  ( ) ::  > s E -> E -> s -> s  ( ) ::  5 s E -> E -> s -> s ! Logically F the target(s) of a E-valued > or  both &&~ True $ (False, True) (False,True)both &&~ False $ (False, True) (False,False)   (!) ::   s E -> E -> s -> s  (!) ::  S s E -> E -> s -> s  (!) ::  > s E -> E -> s -> s  (!) ::  5 s E -> E -> s -> s "Replace the target of a > or all of the targets of a  or 5 in our monadic 2 state with a new value, irrespective of the old. This is an alias for (#).   " :: ? s m =>  S s a -> a -> m ()  " :: ? s m =>  > s a -> a -> m ()  " :: ? s m =>  5 s a -> a -> m ()  " :: ? s m =>   s a -> a -> m () #Replace the target of a > or all of the targets of a  or 5 in our monadic 2 state with a new value, irrespective of the old. This is an infix version of ".    (#) :: ? s m =>  S s a -> a -> m ()  (#) :: ? s m =>  > s a -> a -> m ()  (#) :: ? s m =>  5 s a -> a -> m ()  (#) :: ? s m =>   s a -> a -> m () 9It puts the state in the monad or it gets the hose again. $Map over the target of a > or all of the targets of a  or 5 in our monadic state.   ($) :: ? s m =>  S s a -> (a -> a) -> m ()  ($) :: ? s m =>  > s a -> (a -> a) -> m ()  ($) :: ? s m =>  5 s a -> (a -> a) -> m ()  ($) :: ? s m =>   s a -> (a -> a) -> m () %Replace the target of a > or all of the targets of a  or 5 in our monadic  state with ' a new value, irrespective of the old.   (%) :: ? s m =>  S s ( a) -> a -> m ()  (%) :: ? s m =>  > s ( a) -> a -> m ()  (%) :: ? s m =>  5 s ( a) -> a -> m ()  (%) :: ? s m =>   s ( a) -> a -> m () &Modify the target(s) of a  >, S,  or 5 by adding a value  Example:   $ fresh :: MonadState Int m => m Int  fresh = do  < & 1  use <    (&) :: (? s m, @ a) =>   s a -> a -> m ()  (&) :: (? s m, @ a) =>  S s a -> a -> m ()  (&) :: (? s m, @ a) =>  > s a -> a -> m ()  (&) :: (? s m, @ a) =>  5 s a -> a -> m () 'Modify the target(s) of a  >, S,  or 5 by subtracting a value   (') :: (? s m, @ a) =>   s a -> a -> m ()  (') :: (? s m, @ a) =>  S s a -> a -> m ()  (') :: (? s m, @ a) =>  > s a -> a -> m ()  (') :: (? s m, @ a) =>  5 s a -> a -> m () (Modify the target(s) of a  >, S,  or 5 by multiplying by value.   (() :: (? s m, @ a) =>   s a -> a -> m ()  (() :: (? s m, @ a) =>  S s a -> a -> m ()  (() :: (? s m, @ a) =>  > s a -> a -> m ()  (() :: (? s m, @ a) =>  5 s a -> a -> m () )Modify the target(s) of a  >, S,  or 5 by dividing by a value.   ()) :: (? s m, A a) =>   s a -> a -> m ()  ()) :: (? s m, A a) =>  S s a -> a -> m ()  ()) :: (? s m, A a) =>  > s a -> a -> m ()  ()) :: (? s m, A a) =>  5 s a -> a -> m () *,Raise the target(s) of a numerically valued >,  or 5# to a non-negative integral power.   (*) :: (? s m, @ a, B e) =>   s a -> e -> m ()  (*) :: (? s m, @ a, B e) =>  S s a -> e -> m ()  (*) :: (? s m, @ a, B e) =>  > s a -> e -> m ()  (*) :: (? s m, @ a, B e) =>  5 s a -> e -> m () +,Raise the target(s) of a numerically valued >,  or 5 to an integral power.   (+) :: (? s m, A a, B e) =>   s a -> e -> m ()  (+) :: (? s m, A a, B e) =>  S s a -> e -> m ()  (+) :: (? s m, A a, B e) =>  > s a -> e -> m ()  (+) :: (? s m, A a, B e) =>  5 s a -> e -> m () ,,Raise the target(s) of a numerically valued >,  or 5 to an arbitrary power   (,) :: (? s m, C a) =>   s a -> a -> m ()  (,) :: (? s m, C a) =>  S s a -> a -> m ()  (,) :: (? s m, C a) =>  > s a -> a -> m ()  (,) :: (? s m, C a) =>  5 s a -> a -> m () -Modify the target(s) of a  >, S,  or 5 by taking their logical F with a value   (-) :: ? s m =>   s E -> E -> m ()  (-) :: ? s m =>  S s E -> E -> m ()  (-) :: ? s m =>  > s E -> E -> m ()  (-) :: ? s m =>  5 s E -> E -> m () .Modify the target(s) of a  >, 'Iso,  or 5 by taking their logical D with a value   (.) :: ? s m =>   s E -> E -> m ()  (.) :: ? s m =>  S s E -> E -> m ()  (.) :: ? s m =>  > s E -> E -> m ()  (.) :: ? s m =>  5 s E -> E -> m () /6Run a monadic action, and set all of the targets of a >,  or 5 to its result.    (/) :: ? s m => S s s a b -> m b -> m ()  (/) :: ? s m => > s s a b -> m b -> m ()  (/) :: ? s m => 5 s s a b -> m b -> m ()  (/) :: ? s m =>  s s a b -> m b -> m () cAs a reasonable mnemonic, this lets you store the result of a monadic action in a lens rather than  in a local variable.    do foo <- bar  ... +will store the result in a variable, while    do foo / bar  ... will store the result in a >, , or 5. 0Set with pass-through XThis is useful for chaining assignment without round-tripping through your monad stack.  do x <- _2 <*.= ninety_nine_bottles_of_beer_on_the_wallAIf you do not need a copy of the intermediate result, then using l .= d$ will avoid unused binding warnings   (0) :: ? s m =>  s s a b -> b -> m b  (0) :: ? s m => S s s a b -> b -> m b  (0) :: ? s m => > s s a b -> b -> m b  (0) :: ? s m => 5 s s a b -> b -> m b 1Set  a value with pass-through XThis is useful for chaining assignment without round-tripping through your monad stack.  do x <- at foo <*?= ninety_nine_bottles_of_beer_on_the_wallAIf you do not need a copy of the intermediate result, then using l ?= d$ will avoid unused binding warnings   (1) :: ? s m =>  s s a ( b) -> b -> m b  (1) :: ? s m => S s s a ( b) -> b -> m b  (1) :: ? s m => > s s a ( b) -> b -> m b  (1) :: ? s m => 5 s s a ( b) -> b -> m b +      !"#$%&'()*+,-./01-       !"#$%&'()*+,-./01- !"#$&'()*+,.-0%1/      )      !"#$%&'()*+,-./01 Rank2Types provisionalEdward Kmett <ekmett@gmail.com> Trustworthy2*Useful for storing getters in containers. 5Most 6- combinators are able to be used with both a 6 or a  Q2 in limited situations, to do so, they need to be 2 monomorphic in what we are going to extract with Const. To be compatible  with >, 5 and  S. we also restricted choices of the irrelevant t and  b parameters. If a function accepts a 5 r s t a b , then when r is a Monoid, then  you can pass a Q (or  5&), otherwise you can only pass this a  6 or >. 6A 6? describes how to retrieve a single value in a way that can be . composed with other lens-like constructions.  Unlike a > a 6 is read-only. Since a 6 L cannot be used to write back there are no lens laws that can be applied to = it. In fact, it is isomorphic to an arbitrary function from (a -> s).  Moreover, a 6 can be used directly as a Q,  since it just ignores the  Applicative. 7^Passes the result of the left side to the function on the right side (forward pipe operator).  This is the flipped version of (+), which is more common in languages like F# as (|>) where it is needed e for inference. Here it is supplied for notational convenience and given a precedence that allows it  to be nested inside uses of (). "hello" % length % succ68A version of (=) with much tighter precedence that can be interleaved with (=) "hello"^%length5import Data.List.Lens%("hello","world")^._1^%reverse^._head'o'9Build a 6% from an arbitrary Haskell function.  9 f . 9 g = 9 (g . f) a = 9 f = f a("hello","world")^.to snd"world" 5^.to succ6(0, -5)^._2.to abs5:View the value pointed to by a 6, S or  >4 or the result of folding over all the results of a  Q or 5 that points  at a monoidal values.  : . 9 = <view _2 (1,"hello")"hello"view (to succ) 56&view (_2._1) ("hello",("world","!!!"))"world"It may be useful to think of :) as having one of these more restrictive  signatures:   : :: 6 s a -> s -> a  : :: Monoid m => Q s m -> s -> m  : ::  S s a -> s -> a  : ::  > s a -> s -> a  : :: Monoid m =>  5 s m -> s -> m ;View the value of a 6, S,  >5 or the result of folding over the result of mapping  the targets of a Q or  5. It may be useful to think of ;" as having these more restrictive  signatures:  ; l f = : (l ; 9 f)views _2 length (1,"hello")5   ; :: 6' s a -> (a -> b) -> s -> b  ; :: Monoid m => Q) s a -> (a -> m) -> s -> m  ; ::  S# s a -> (a -> b) -> s -> b  ; ::  >" s a -> (a -> b) -> s -> b  ; :: Monoid m =>  5 s a -> (a -> m) -> s -> m <View the value pointed to by a 6, S or  >4 or the result of folding over all the results of a  Q or 5 that points  at a monoidal values. This is the same operation as :, only infix.  9 f < x = f x_2 ^$ (1, "hello")"hello"   (<) :: 6 s a -> s -> a  (<) :: Monoid m => Q s m -> s -> m  (<) ::  S s a -> s -> a  (<) ::  > s a -> s -> a  (<) :: Monoid m =>  5 s m -> s -> m =View the value pointed to by a 6 or > or the - result of folding over all the results of a Q or  5# that points at a monoidal values. This is the same operation as : with the arguments flipped. HThe fixity and semantics are such that subsequent field accesses can be  performed with (;) ("hello","world")^._2"world"import Data.Complex$((0, 1 :+ 2), 3)^._1._2.to magnitude2.23606797749979   (=) :: s -> 6 s a -> a  (=) :: Monoid m => s -> Q s m -> m  (=) :: s ->  S s a -> a  (=) :: s ->  > s a -> a  (=) :: Monoid m => s ->  5 s m -> m >Use the target of a >, S, or  6- in the current state, or use a summary of a  Q or 5 that points  to a monoidal value.   > :: ? s m => 6 s a -> m a  > :: (? s m, Monoid r) => Q s r -> m r  > :: ? s m =>  S s a -> m a  > :: ? s m =>  > s a -> m a  > :: (? s m, Monoid r) =>  5 s r -> m r ?Use the target of a >, S or  6- in the current state, or use a summary of a  Q or 5 that  points to a monoidal value.   ? :: ? s m => 6" s a -> (a -> e) -> m e  ? :: (? s m, Monoid r) => Q$ s a -> (a -> r) -> m r  ? :: ? s m =>  > s a -> (a -> e) -> m e  ? :: ? s m =>  S s a -> (a -> e) -> m e  ? :: (? s m, Monoid r) =>  5 s a -> (a -> r) -> m r @Query the target of a >, S or  6- in the current state, or use a summary of a  Q or 5 that points  to a monoidal value.   @ ::  s m => 6 s a -> m a  @ :: ( s m, Monoid a) => Q s a -> m a  @ ::  s m =>  S s a -> m a  @ ::  s m =>  > s a -> m a  @ :: ( s m, Monoid a) =>  5 s a -> m a AUse the target of a >, S or  6- in the current state, or use a summary of a  Q or 5 that points  to a monoidal value.   A ::  s m => 6" s a -> (a -> r) -> m r  A :: ( s m, Monoid a) => Q$ s a -> (a -> r) -> m r  A ::  s m =>  S s a -> (a -> r) -> m r  A ::  s m =>  > s a -> (a -> r) -> m r  A :: ( s m, Monoid a) =>  5 s a -> (a -> r) -> m r 23456789:;<=>?@A23456789:;<=>?@A659=<78:;>?@A23423456789:;<=>?@A Rank2Types provisionalEdward Kmett <ekmett@gmail.com> Safe-Inferred B type B =  CC/Useful for storing isomorphisms in containers. F!An commonly used infix alias for  H G type G =  HHDIsomorphim families can be composed with other lenses using either () and  I from the Prelude or from Control.Category. However, if you compose them  with each other using (2) from the Prelude, they will be dumbed down to a  mere .    import Control.Category  import Prelude hiding ((),)  type H s t a b = forall k f. ( k,  f) =>  k f s t a bI@Build an isomorphism family from two pairs of inverse functions    : (I sa as tb bt) "a sa  : ( (I sa as tb bt)) "a as   (I sa as tb bt) ab "a bt  ab  sa   ( (I ac ca bd db' )) ab "a bd  ab  ca   ( (I sa as tb bt' )) s t "a tb  st  as  8isos :: (s -> a) -> (a -> s) -> (t -> b) -> (b -> t) -> H s t a bJ<Build a simple isomorphism from a pair of inverse functions    : (J f g) "a f  : ( (J f g)) "a g   (I f g) h "a g  h  f   ( (J f g' )) h "a f  h  g  iso :: (s -> a) -> (a -> s) ->  H s aK Based on ala from Conor McBride's work on Epigram. #:m + Data.Monoid.Lens Data.Foldableala _sum foldMap [1,2,3,4]10L Based on ala' from Conor McBride's work on Epigram. Mnemonically, the German auf plays a similar role to  la, and the combinator  is K" with an extra function argument. MThe opposite of working  a Setter is working M an Isomorphism.  M =    M :: H s t a b -> (s -> t) -> a -> bN:This isomorphism can be used to wrap or unwrap a value in .   x^.identity "a  x   x =  N "a x O:This isomorphism can be used to wrap or unwrap a value in    x = O "a  x   x =  O "a x BCDEFGHIJKLMNOBCDEFGHIJKLMNOHFJIKLMONCDEGB BCDEFGHIJKLMNOportable provisionalEdward Kmett <ekmett@gmail.com> Safe-InferredPThis % can be used to change the type of a  by mapping  the elements to new values. Sadly, you can't create a valid 5 for a , but you can  manipulate it by reading using  and reindexing it via P. (over setmapped (+1) (fromList [1,2,3,4])fromList [2,3,4,5]QConstruct a set from a 6, Q, 5, > or S. 5setOf (folded._2) [("hello",1),("world",2),("!!!",3)]fromList [1,2,3]   Q :: 6 s a -> s ->  a  Q ::  a => Q s a -> s ->  a  Q ::  S s a -> s ->  a  Q ::  > s a -> s ->  a  Q ::  a =>  5 s a -> s ->  a PQPQPQPQ non-portable provisionalEdward Kmett <ekmett@gmail.com> Safe-Inferred R type R =  WS A concrete WB, suitable for storing in a container or extracting an embedding. U,Used to provide overloading of projections. WA W is a  Traversal% that can also be turned around with Z to obtain a 6 XCompose projections. Y Reflect a W. ZTurn a W around to get an embedding [Build a W \ Convert an H to a W. #Ideally we would be able to use an H directly as a W!, but this opens a can of worms. RSTUVWXYZ[\ RSTUVWXYZ[\ WUVYZST[X\R RSTUVWXYZ[\ RankNTypes provisionalEdward Kmett <ekmett@gmail.com> Safe-Inferred]GSometimes you need to store a path lens into a container, but at least  at this time, ImpredicativePolymorphism in GHC is somewhat lacking. *This type provides a way to, say, store a [] of paths. `Representable Functors. A  f is ` if it is isomorphic to (x -> a) E for some x. Nearly all such functors can be represented by choosing x to be ? the set of lenses that are polymorphic in the contents of the ,  that is to say x = b f is a valid choice of x for (nearly) every  ` . @Note: Some sources refer to covariant representable functors as ) corepresentable functors, and leave the " representable" name to 1 contravariant functors (those are isomorphic to (a -> x) for some x). LAs the covariant case is vastly more common, and both are often referred to = as representable functors, we choose to call these functors `  here. bThe representation of a `  as Lenses cc# is a valid default definition for  for a `  functor.  c f m = a  i -> f (m = i) Usage for a ` Foo:   instance  Foo where   = c dd# is a valid default definition for = and  for a  ` functor.  d = a . G Usage for a ` Foo:    instance  Foo where  = = d  ...    instance : Foo where   = d  ... ee$ is a valid default definition for () for a `  functor.  e mf ma = a  i -> mf = i  ma = i Usage for a ` Foo:   instance  Foo where  = = d  () = e ff+ is a valid default default definition for '(>>=)' for a  representable functor.  f m f = a  i -> f (m = i) = i Usage for a ` Foo:   instance : Foo where   = d  () = f gA default definition for  for a `   g wf = a  i ->  (= i) wf Usage for a ` Foo:   instance  Foo where   = g hA ` - has a fixed shape. This fills each position  in it with a ] i A version of a5 that is an isomorphism. Predicativity requires that  we wrap the b as a Key , however. j Map over a ` functor with access to the  for the  current position j f m = a  i -> f i (m = i)k Traverse a `) functor with access to the current path l Traverse a `) functor with access to the current path  as a , discarding the result m Traverse a `) functor with access to the current path  and a  (and the arguments flipped) n over a `) functor with access to the current path  as a  o over a `) functor with access to the current path  as a , discarding the result p over a `) functor with access to the current path  as a  (with the arguments flipped) q Fold over a `) functor with access to the current path  as a  , yielding a  r Fold over a `) functor with access to the current path  as a . sAn  that walks an `  using a ] for an index. tAn  that walks an  `  using a ] for an index. uAn  for a  ` . NB: The @ requirement on this instance is a consequence of the choice of  as a b, it isn't fundamental. ]^_`abcdefghijklmnopqrstu]^_`abcdefghijklmnopqrstu`abcdefg]^_hijqrklmnopstu]^_`abcdefghijklmnopqrstu Rank2Types provisionalEdward Kmett <ekmett@gmail.com> TrustworthyvThis class allows us to use w? part of the environment, changing the environment supplied by + many different monad transformers. Unlike yG this can change the environment of a deeply nested monad transformer.  Also, unlike y", this can be used with any valid 6, but cannot be used with a  Traversal or Fold. wMRun a monadic action in a larger environment than it was defined in, using a 6. This acts like D, but can in many cases change the type of the environment as well. mThis is commonly used to lift actions in a simpler Reader monad into a monad with a larger environment type. \This can be used to edit pretty much any monad transformer stack with an environment in it:   w :: 6 s a -> (a -> r) -> s -> r  w ::  c => Fold s a -> (a -> r) -> s -> r  w ::  w 6 s t ->  s w st c ->  t w st c  w :: ( w,  c) => Fold s t ->  s w st c ->  t w st c  ... xThis class allows us to use y$ in, changing the State supplied by Y many different monad transformers, potentially quite deep in a monad transformer stack. y?Run a monadic action in a larger state than it was defined in,  using a   or  5. FThis is commonly used to lift actions in a simpler state monad into a ' state monad with a larger state type. When applied to a 'Simple 5 over H multiple values, the actions for each target are executed sequentially ! and the results are aggregated. UThis can be used to edit pretty much any monad transformer stack with a state in it!   y :: : m =>   s t ->  t m a ->  s m a  y :: (: m,  c) =>  5 s t ->  t m c ->  s m c  y :: : m =>   s t ->  r w t m c ->  r w s m c  y :: (: m,  c) =>  5 s t ->  r w t m c ->  r w s m c  y :: : m =>   s t ->  e ( r w t m c) ->  e ( r w s m c)  y :: (: m,  c) =>  5 s t ->  e ( r w t m c) ->  e ( r w s m c)  ...  w = ;vwxyvwxyvwxyvwxyportable provisionalEdward Kmett <ekmett@gmail.com>NonezThis % can be used to change the type of a  by mapping  the elements to new values. Sadly, you can't create a valid 5 for a Set, but you can  manipulate it by reading using folded and reindexing it via z. (over setmapped (+1) (fromList [1,2,3,4])fromList [2,3,4,5]{Construct a set from a 6, Q, 5, > or S. 5setOf (folded._2) [("hello",1),("world",2),("!!!",3)]fromList [1,2,3]   { ::  a => 6 s a -> s ->  a  { :: ( a,  a) => Q s a -> s ->  a  { ::  a =>  S s a -> s ->  a  { ::  a =>  > s a -> s ->  a  { :: ( a,  a) =>  5 s a -> s ->  a z{z{z{z{ Rank2Types provisionalEdward Kmett <ekmett@gmail.com> Safe-Inferred5|(Useful for storing folds in containers. A I describes how to retrieve multiple values in a way that can be composed % with other lens-like 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 6 is a legal  that just ignores the supplied   Unlike a 5 a  is read-only. Since a  cannot be used to write back $ there are no lens laws that apply.  Obtain a 9 by lifting an operation that returns a foldable result. +This can be useful to lift operations from  Data.List and elsewhere into a .  Obtain a  from any . %Fold by repeating the input forever.  "a  !A fold that replicates its input n times.  n "a  ( n)ITransform a fold into a fold that loops over its elements over and over. +take 6 $ toListOf (cycled traverse) [1,2,3] [1,2,3,1,2,3]2Build a fold that unfolds its values from a seed.  "a  . x ^.  f5 Return an infinite fold of repeated applications of f to x.  ( f) a "a  f a Obtain a - that can be composed with to filter another , S, 6,  (or 5) Note: This is not a legal 5M, unless you are very careful not to invalidate the predicate on the target. *As a counter example, consider that given evens =   the second 5 law is violated:  over evens  ; over evens  /= over evens ( ; ),So, in order for this to qualify as a legal  TraversalL you can only use it for actions that preserve the result of the predicate!  :: (a -> E) ->  a a.This allows you to traverse the elements of a 5 or  in the opposite order.  This will demote an  O or  R to a regular 5 or ;  to preserve the indices, use   instead. Note:  should have no impact on a 6 Setter,  or S. To change the direction of an S, use from.  Obtain a ! by taking elements from another , , S, 6 or 5 while a predicate holds.   p "a  ( p ))toListOf (takingWhile (<=3) folded) [1..][1,2,3] Obtain a # by dropping elements from another , , S, 6 or 5 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 ;    :: 6% s a -> (a -> r) -> s -> r   ::  r => ' s a -> (a -> r) -> s -> r   ::   s a -> (a -> r) -> s -> r   ::  S! s a -> (a -> r) -> s -> r   ::  r =>  5 s a -> (a -> r) -> s -> r   =    "a :    :: 6 s m -> s -> m   ::  m =>  s m -> s -> m   ::   s m -> s -> m   ::  S s m -> s -> m   ::  m =>  5 s m -> s -> m IRight-associative fold of parts of a structure that are viewed through a , 6,  or 5.   "a      :: 6/ s a -> (a -> r -> r) -> r -> s -> r   :: 1 s a -> (a -> r -> r) -> r -> s -> r   ::  * s a -> (a -> r -> r) -> r -> s -> r   ::  S+ s a -> (a -> r -> r) -> r -> s -> r   ::  5% s a -> (a -> r -> r) -> r -> s -> r LLeft-associative fold of the parts of a structure that are viewed through a , 6,  or 5.   "a      :: 6/ s a -> (r -> a -> r) -> r -> s -> r   :: 1 s a -> (r -> a -> r) -> r -> s -> r   ::  * s a -> (r -> a -> r) -> r -> s -> r   ::  S+ s a -> (r -> a -> r) -> r -> s -> r   ::  5% s a -> (r -> a -> r) -> r -> s -> r #Extract a list of the targets of a  . See also ().    "a    () "a N  (A convenient infix (flipped) version of . [[1,2],[3]]^..traverse.traverse[1,2,3] (1,2)^..both[1,2]    xs "a xs    () "a N     ( ) :: s -> 6 s a -> [a]  ( ) :: s ->  s a -> [a]  ( ) :: s ->   s a -> [a]  ( ) :: s ->  S s a -> [a]  ( ) :: s ->  5 s a -> [a] Returns  if every target of a  is . andOf both (True,False)FalseandOf both (True,True)True  "a      :: 6 s E -> s -> E   ::  s E -> s -> E   ::   s E -> s -> E   ::  S s E -> s -> E   ::  5 s E -> s -> E Returns  if any target of a  is . orOf both (True,False)TrueorOf both (False,False)False  "a      :: 6 s E -> s -> E   ::  s E -> s -> E   ::   s E -> s -> E   ::  S s E -> s -> E   ::  5 s E -> s -> E Returns  if any target of a  satisfies a predicate. anyOf both (=='x') ('x','y')Trueimport Data.Data.Lens=anyOf biplate (== "world") (((),2::Int),"hello",("world",11))True  "a      :: 6 s a -> (a -> E ) -> s -> E   ::  s a -> (a -> E ) -> s -> E   ::   s a -> (a -> E ) -> s -> E   ::  S s a -> (a -> E ) -> s -> E   ::  5 s a -> (a -> E ) -> s -> E Returns  if every target of a  satisfies a predicate. allOf both (>=3) (4,5)TrueallOf folded (>=2) [1..10]False  "a      :: 6 s a -> (a -> E ) -> s -> E   ::  s a -> (a -> E ) -> s -> E   ::   s a -> (a -> E ) -> s -> E   ::  S s a -> (a -> E ) -> s -> E   ::  5 s a -> (a -> E ) -> s -> E 4Calculate the product of every number targeted by a  productOf both (4,5)20productOf folded [1,2,3,4,5]120  "a      :: 6 s a -> s -> a   :: @ a =>  s a -> s -> a   ::   s a -> s -> a   ::  S s a -> s -> a   :: @ a =>  5 s a -> s -> a 0Calculate the sum of every number targeted by a . sumOf both (5,6)11sumOf folded [1,2,3,4]10!sumOf (folded.both) [(1,2),(3,4)]10import Data.Data.Lens8sumOf biplate [(1::Int,[]),(2,[(3::Int,4::Int)])] :: Int10  "a      _1 :: (a, b) -> a   ( . _1) :: ( f, @ a) => f (a, b) -> a     :: 6 s a -> s -> a   :: @ a =>  s a -> s -> a   ::   s a -> s -> a   ::  S s a -> s -> a   :: @ a =>  5 s a -> s -> a &Traverse over all of the targets of a  (or 6), computing an  (or ) -based answer,  but unlike # do not construct a new structure.  generalizes   to work over any . When passed a 6,  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 () !The rather specific signature of 6 allows it to be used as if the signature was any of:    ::  f => 6* 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& s a -> (a -> f r) -> s -> f ()   ::  f =>  5 s a -> (a -> f r) -> s -> f () &Traverse over all of the targets of a  (or 6), computing an  (or ) -based answer,  but unlike # do not construct a new structure.  generalizes   to work over any . When passed a 6,  can work over any , but when passed a ,  requires  an .   "a  !The rather specific signature of 6 allows it to be used as if the signature was any of:    ::  f => 6* 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& s a -> s -> (a -> f r) -> f ()   ::  f =>  5 s a -> s -> (a -> f r) -> f () &Evaluate each action in observed by a : on a structure from left to right, ignoring the results.   "a      ::  f => 6! s (f ()) -> s -> f ()   ::  f => # s (f ()) -> s -> f ()   ::  f =>   s (f ()) -> s -> f ()   ::  f =>  Iso s (f ()) -> s -> f ()   ::  f =>  5 s (f ()) -> s -> f () Map each target of a h on a structure to a monadic action, evaluate these actions from left to right, and ignore the results.  9 "a      :: : m => 6* 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& s a -> (a -> m r) -> s -> m ()   :: : m =>  5 s a -> (a -> m r) -> s -> m ()  is $ with two of its arguments flipped.   "a      :: : m => 6* 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& s a -> s -> (a -> m r) -> m ()   :: : m =>  5 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.   "a      :: : m => 6 s (m a) -> s -> m ()   :: : m => " s (m a) -> s -> m ()   :: : m =>   s (m a) -> s -> m ()   :: : m =>  S s (m a) -> s -> m ()   :: : m =>  5 s (m a) -> s -> m () 1The sum of a collection of actions, generalizing .   "a      ::  f => 6 s a -> s -> f a   ::  f =>  s a -> s -> f a   ::  f =>   s a -> s -> f a   ::  f =>  S s a -> s -> f a   ::  f =>  5 s a -> s -> f a 1The sum of a collection of actions, generalizing .   "a      ::  m => 6 s a -> s -> m a   ::  m =>  s a -> s -> m a   ::  m =>   s a -> s -> m a   ::  m =>  S s a -> s -> m a   ::  m =>  5 s a -> s -> m a /Does the element occur anywhere within a given  of the structure? %elemOf both "hello" ("hello","world")True  "a      ::  a => 6 s a -> a -> s -> E   ::  a =>  s a -> a -> s -> E   ::  a =>   s a -> a -> s -> E   ::  a =>  S s a -> a -> s -> E   ::  a =>  5 s a -> a -> s -> E 3Does the element not occur anywhere within a given  of the structure?   "a      ::  a => 6 s a -> a -> s -> E   ::  a =>  s a -> a -> s -> E   ::  a =>  S s a -> a -> s -> E   ::  a =>   s a -> a -> s -> E   ::  a =>  5 s a -> a -> s -> E )Map a function over all the targets of a 5 of a container and concatenate the resulting lists.   "a      :: 6 s a -> (a -> [r] ) -> s -> [r]   ::  s a -> (a -> [r] ) -> s -> [r]   ::   s a -> (a -> [r] ) -> s -> [r]   ::  S s a -> (a -> [r] ) -> s -> [r]   ::  5 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 :     :: 6 s [r] -> s -> [r]   ::  s [r] -> s -> [r]   ::  S s [r] -> s -> [r]   ::   s [r] -> s -> [r]   ::  5 s [r] -> s -> [r] ;Note: this can be rather inefficient for large containers.   "a  lengthOf _1 ("hello",())1  ( . ) ::  f => f (g a) ->     :: 6 s a -> s ->    ::  s a -> s ->    ::   s a -> s ->    ::  S s a -> s ->    ::  5 s a -> s ->  Perform a safe  of a  or 5 or retrieve  the result  from a 6 or  . See also ().   ;  "a      :: 6 s a -> s ->  a   ::  s a -> s ->  a   ::   s a -> s ->  a   ::  S s a -> s ->  a   ::  5 s a -> s ->  a Perform a safe  of a  or 5 or retrieve  the result  from a 6 or .  When using a 5 as a partial , or a  as a partial 6 this can be a convenient $ way to extract the optional value.  () "a N    ( ) :: s -> 6 s a ->  a  ( ) :: s ->  s a ->  a  ( ) :: s ->   s a ->  a  ( ) :: s ->  S s a ->  a  ( ) :: s ->  5 s a ->  a Perform a safe  of a  or 5 or retrieve  the result  from a 6 or .    :: 6 s a -> s ->  a   ::  s a -> s ->  a   ::   s a -> s ->  a   ::  S s a -> s ->  a   ::  5 s a -> s ->  a Returns  if this  or 5( has no targets in the given container. Note:  on a valid S,  or 6 should always return    "a  /This may be rather inefficient compared to the  check of many containers. nullOf _1 (1,2)False  ( ; _1 ; ) ::  f => f (g a, b) -> E    :: 6 s a -> s -> E   ::  s a -> s -> E   ::  S s a -> s -> E   ::   s a -> s -> E   ::  5 s a -> s -> E 2Obtain the maximum element (if any) targeted by a  or 5 Note: maximumOf on a valid S,  or 6 will always return  a value.   "a  ( empty) ;      :: 6 s a -> s ->  a   ::  a =>  s a -> s ->  a   ::  S s a -> s ->  a   ::   s a -> s ->  a   ::  a =>  5 s a -> s ->  a 2Obtain the minimum element (if any) targeted by a  or 5 Note: minimumOf on a valid S,  or 6 will always return  a value.   "a  ( empty) ;      :: 6 s a -> s ->  a   ::  a =>  s a -> s ->  a   ::  S s a -> s ->  a   ::   s a -> s ->  a   ::  a =>  5 s a -> s ->  a 2Obtain the maximum element (if any) targeted by a , 5, , S,  or 6( according to a user supplied ordering.   cmp "a  ( empty) ;   cmp    :: 6 s a -> (a -> a ->  ) -> s ->  a   ::  s a -> (a -> a ->  ) -> s ->  a   ::  S s a -> (a -> a ->  ) -> s ->  a   ::   s a -> (a -> a ->  ) -> s ->  a   ::  5 s a -> (a -> a ->  ) -> s ->  a 2Obtain the minimum element (if any) targeted by a , 5, , S  or 6( according to a user supplied ordering.   cmp "a  ( empty) ;   cmp    :: 6 s a -> (a -> a ->  ) -> s ->  a   ::  s a -> (a -> a ->  ) -> s ->  a   ::  S s a -> (a -> a ->  ) -> s ->  a   ::   s a -> (a -> a ->  ) -> s ->  a   ::  5 s a -> (a -> a ->  ) -> s ->  a The  function takes a  (or 6, S, , or 5), O a predicate and a structure and returns the leftmost element of the structure  matching the predicate, or O if there is no such element.    :: 6 s a -> (a -> E ) -> s ->  a   ::  s a -> (a -> E ) -> s ->  a   ::  S s a -> (a -> E ) -> s ->  a   ::   s a -> (a -> E ) -> s ->  a   ::  5 s a -> (a -> E ) -> s ->  a  A variant of 4 that has no base case and thus may only be applied K to lenses and structures such that the lens views at least one element of  the structure.     l f "a  f ;  l   "a       :: 6* s a -> (a -> a -> a) -> s -> a   :: , s a -> (a -> a -> a) -> s -> a   ::  S& s a -> (a -> a -> a) -> s -> a   ::  % s a -> (a -> a -> a) -> s -> a   ::  5 s a -> (a -> a -> a) -> s -> a  A variant of Q that has no base case and thus may only be applied to lenses and strutures such < that the lens views at least one element of the structure.     l f "a  l f .    "a       :: 6* s a -> (a -> a -> a) -> s -> a   :: , s a -> (a -> a -> a) -> s -> a   ::  S& s a -> (a -> a -> a) -> s -> a   ::  % s a -> (a -> a -> a) -> s -> a   ::  5 s a -> (a -> a -> a) -> s -> a 6Strictly fold right over the elements of a structure.   "a      :: 6/ s a -> (a -> r -> r) -> r -> s -> r   :: 1 s a -> (a -> r -> r) -> r -> s -> r   ::  S+ s a -> (a -> r -> r) -> r -> s -> r   ::  * s a -> (a -> r -> r) -> r -> s -> r   ::  5% s a -> (a -> r -> r) -> r -> s -> r NFold over the elements of a structure, associating to the left, but strictly.   "a      :: 6/ s a -> (r -> a -> r) -> r -> s -> r   :: 1 s a -> (r -> a -> r) -> r -> s -> r   ::  S+ s a -> (r -> a -> r) -> r -> s -> r   ::  * s a -> (r -> a -> r) -> r -> s -> r   ::  5% s a -> (r -> a -> r) -> r -> s -> r IMonadic fold over the elements of a structure, associating to the right,  i.e. from right to left.   "a      :: : m => 63 s a -> (a -> r -> m r) -> r -> s -> m r   :: : m => 5 s a -> (a -> r -> m r) -> r -> s -> m r   :: : m =>  S/ s a -> (a -> r -> m r) -> r -> s -> m r   :: : m =>  . s a -> (a -> r -> m r) -> r -> s -> m r   :: : m =>  5) s a -> (a -> r -> m r) -> r -> s -> m r HMonadic fold over the elements of a structure, associating to the left,  i.e. from left to right.   "a      :: : m => 63 s a -> (r -> a -> m r) -> r -> s -> m r   :: : m => 5 s a -> (r -> a -> m r) -> r -> s -> m r   :: : m =>  S/ s a -> (r -> a -> m r) -> r -> s -> m r   :: : m =>  . s a -> (r -> a -> m r) -> r -> s -> m r   :: : m =>  5) s a -> (r -> a -> m r) -> r -> s -> m r 8|}~7|}~7|}~6|}~ Rank2Types provisionalEdward Kmett <ekmett@gmail.com> Safe-Inferred type SimpleReifiedTraversal =   A form of 4 that can be stored monomorphically in a container. *This is a commonly-used infix alias for a  .  type SimpleTraversal =  A  can be used directly as a 3 or a  (but not as a ) and provides V the ability to both read and update multiple fields, subject to some relatively weak  laws. UThese have also been known as multilenses, but they have the signature and spirit of   ::  f =>  (f a) (f b) a b8and 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 S as a , and composition of a  (or  or S ) with a  (or  or S)  using (.) forms a valid . The laws for a Traversal t3 follow from the laws for Traversable as stated in "#The Essence of the Iterator Pattern".    t = "a =   (t f) ; t g "a bc ; t (bd ;  f ; g) .One consequence of this requirement is that a 1 needs to leave the same number of elements as a  candidate for subsequent G that it started with. Another testament to the strength of these laws 4 is that the caveat expressed in section 5.5 of the "Essence of the Iterator Pattern" about exotic   instances that E the same entry multiple times was actually already ruled out by the  second law in that same paper! AMap each element of a structure targeted by a Lens or Traversal, E evaluate these actions from left to right, and collect the results. 0This function is only provided for consistency, < is strictly more general.   "a <This yields the obvious law:   "a      :: S) s t a b -> (a -> f b) -> s -> f t   :: ( s t a b -> (a -> f b) -> s -> f t   :: # s t a b -> (a -> f b) -> s -> f t  A version of ( with the arguments flipped, such that:   l "a N ( l)    "a   0This function is only provided for consistency, N is strictly more general.     "a N     :: S# s t a b -> s -> (a -> f b) -> f t   :: # s t a b -> s -> (a -> f b) -> f t   :: # s t a b -> s -> (a -> f b) -> f t FEvaluate each action in the structure from left to right, and collect  the results.     "a   "a  <   l "a  l id "a l id     :: S s t (f b) b -> s -> f t   ::  s t (f b) b -> s -> f t   ::  f =>  s t (f b) b -> s -> f t HMap each element of a structure targeted by a lens to a monadic action, E evaluate these actions from left to right, and collect the results.   "a      :: S) s t a b -> (a -> m b) -> s -> m t   :: ( 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 .     "a     l "a N ( l)      :: S) s t a b -> s -> (a -> m b) -> m t   :: ( s t a b -> s -> (a -> m b) -> m t   :: : m => # s t a b -> s -> (a -> m b) -> m t USequence the (monadic) effects targeted by a lens in a container from left to right.     "a     l "a  l id   l "a  . l      :: S s t (m b) b -> s -> m t   ::  s t (m b) b -> s -> m t   :: : m =>  s t (m b) b -> s -> m t This generalizes  to an arbitrary . Note: F handles ragged inputs more intelligently, but for non-ragged inputs:   "a  &transposeOf traverse [[1,2,3],[4,5,6]][[1,4],[2,5],[3,6]] Since every  is a , we can use this as a form of  monadic strength as well:  _2 :: (b, [a] ) -> [(b, a)]This generalizes S to an arbitrary .  S "a  ' accumulates state from right to left.    :: SA 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) This generalizes T to an arbitrary .  T "a  ' accumulates state from left to right.    :: SA 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) This permits the use of  over an arbitrary  or .   "a      :: S* 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* 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 A  to 4'Control.Lens.Getter.view'/'Control.Lens.Setter.set' the nth element  a ,  or S. +Attempts to access beyond the range of the  will cause an error. ,[[1],[3,4]]^.elementOf (traverse.traverse) 13 Access the nth element of a  container. +Attempts to access beyond the range of the  will cause an error.  "a  %This is the trivial empty traversal.   ::  f => (a -> f b) -> s -> f s  "a G =4Traverse both parts of a tuple with matching types. both *~ 10 $ (1,2)(10,20)"over both length ("hello","world")(5,5)("hello","world")^.both "helloworld"3A traversal for tweaking the left-hand value of an : over traverseLeft (+1) (Left 2)Left 3 over traverseLeft (+1) (Right 2)Right 2!Right 42 ^.traverseLeft :: String""Left "hello" ^.traverseLeft"hello" traverseLeft ::  f => (a -> f b) ->  a c -> f ( b c)$traverse the right-hand value of an :   "a Unfortunately the instance for   ( c) is still missing from base,  so this can' t just be   over traverseRight (+1) (Left 2)Left 2!over traverseRight (+1) (Right 2)Right 3Right "hello" ^.traverseRight"hello"(Left "hello" ^.traverseRight :: [Double][] traverseRight ::  f => (a -> f b) ->  c a -> f ( c a)Visit the first n targets of a , , Getter or . Visit all but the first n targets of a , , Getter or . A 2 is completely characterized by its behavior on a  .  Cloning a ! is one way to make sure you aren't given  something weaker, such as a Q and can be H used as a way to pass around traversals that have to be monomorphic in f. !Note: This only accepts a proper  (or ). To clone a   as such, use  Note: It is usually better to  and use   than to 2. The former can execute at full speed, while the ( latter needs to round trip through the  . Flet foo l a = (view (cloneTraversal l) a, set (cloneTraversal l) 10 a)foo both ("hello","world")("helloworld",(10,10))  ::  (  a b) s t a b ->  s t a bTemplateHaskell experimentalEdward Kmett <ekmett@gmail.com> Trustworthy  Provides substitution for types Perform substitution for types HProvides for the extraction of free type variables, and alpha renaming. 4When performing substitution into this traversal you're not allowed 8 to substitute in a name that is bound internally or you' ll violate  the . laws, when in doubt generate your names with . 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.    Rank2Types provisionalEdward Kmett <ekmett@gmail.com> Safe-Inferred:A O type is one where we know how to extract its immediate self-similar children.  Example 1:    import Control.Applicative  import Control.Lens  import Control.Plated  import Data.Data  import Data.Data.Lens ($)    data Expr  = Val   | Neg Expr  | Add Expr Expr  deriving (,,,,Data,Typeable)    instance  Expr where   f (Neg e) = Neg  f e   f (Add a b) = Add  f a  f b   _ a = = a or    instance  Expr where   = $  Example 2:    import Control.Applicative  import Control.Lens  import Control.Plated  import Data.Data  import Data.Data.Lens ($)    data Tree a  = Bin (Tree a) (Tree a)  | Tip a  deriving (,,,,Data,Typeable)    instance  (Tree a) where   f (Bin l r) = Bin  f l  f r   _ t = = t or    instance Data a =>  (Tree a) where   = uniplate <Note the big distinction between these two implementations. JThe former will only treat children directly in this tree as descendents, I the latter will treat trees contained in the values under the tips also  as descendants! When in doubt, pick a  and just use the various ...Of combinators  rather than pollute  with orphan instances! >If you want to find something unplated and non-recursive with $  use the ...OnOf variant with /, though those usecases are much better served < in most cases by using the existing lens combinators! e.g.  biplate "a  biplate . )This same ability to explicitly pass the  in question is why there is no  analogue to uniplate's Biplate. UMoreover, since we can allow custom traversals, we implement reasonable defaults for A polymorphic data types, that only traverse into themselves, and not their  polymorphic arguments. . of the immediate children of this structure. *The default definition finds no children. 'Extract the immediate descendants of a  container.  "a   Provided for compatibility with uniplate.   "a   ::  s a -> s -> [a]LRewrite by applying a rule everywhere you can. Ensures that the rule cannot $ be applied anywhere in the result:  propRewrite r x =  ( . r) ( ( r x))Usually  is more appropriate, but  can give better 4 compositionality. Given two single transformations f and g , you can  construct a -> f a mplus g a3 which performs both rewrites until a fixed point. LRewrite by applying a rule everywhere you can. Ensures that the rule cannot $ be applied anywhere in the result:  propRewriteOf l r x =  ( . r) ( l ( l r x))Usually  is more appropriate, but  can give better 4 compositionality. Given two single transformations f and g , you can  construct a -> f a mplus g a3 which performs both rewrites until a fixed point.    ::  S a a -> (a ->  a) -> a -> a   ::   a a -> (a ->  a) -> a -> a   ::   a a -> (a ->  a) -> a -> a   ::   a a -> (a ->  a) -> a -> a 5Rewrite recursively over part of a larger structure.    ::  a =>  S s a -> (a ->  a) -> s -> s   ::  a =>   s a -> (a ->  a) -> s -> s   ::  a =>   s a -> (a ->  a) -> s -> s   ::  a =>    s a -> (a ->  a) -> s -> s NRewrite recursively over part of a larger structure using a specified setter.    ::  a =>  S s a ->  S a a -> (a ->  a) -> s -> s   ::  a =>   s a ->   a a -> (a ->  a) -> s -> s   ::  a =>   s a ->   a a -> (a ->  a) -> s -> s   ::  a =>   s a ->   a a -> (a ->  a) -> s -> s TRewrite by applying a monadic rule everywhere you can. Ensures that the rule cannot $ be applied anywhere in the result. RRewrite by applying a monadic rule everywhere you recursing with a user-specified . A Ensures that the rule cannot be applied anywhere in the result. `Rewrite by applying a monadic rule everywhere inside of a structure located by a user-specified . A Ensures that the rule cannot be applied anywhere in the result. `Rewrite by applying a monadic rule everywhere inside of a structure located by a user-specified ,  using a user-specified P for recursion. Ensures that the rule cannot be applied anywhere in the result. 0Retrieve all of the transitive descendants of a  container, including itself. Given a fold that knows how to locate immediate children, retrieve all of the transitive descendants of a node, including itself.  ::  a a -> a -> [a]Given a  that knows how to find O parts of a container retrieve them and all of their descendants, recursively. Given a ~ that knows how to locate immediate children, retrieve all of the transitive descendants of a node, including itself that lie " in a region indicated by another .  l "a  l <Transform every element in the tree, in a bottom-up manner. 8For example, replacing negative literals with literals:   negLits =  $ x -> case x of  Neg (Lit i) -> Lit ( i)  _ -> x WTransform every element in the tree in a bottom-up manner over a region indicated by a .    ::  a =>   s a -> (a -> a) -> s -> s   ::  a =>   s a -> (a -> a) -> s -> s 8Transform every element by recursively applying a given  in a bottom-up manner.    ::   a a -> (a -> a) -> a -> a   ::   a a -> (a -> a) -> a -> a 3Transform every element in a region indicated by a ! by recursively applying another   in a bottom-up manner.    ::   s a ->   a a -> (a -> a) -> s -> s   ::   s a ->   a a -> (a -> a) -> s -> s ITransform 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,  a) =>   s a -> (a -> m a) -> s -> m s8Transform every element in a tree using a user supplied . in a bottom-up manner with a monadic effect.  :: : m => 'Simple  a a -> (a -> m a) -> a -> m 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.  :: : m =>   s a ->   a a -> (a -> m a) -> s -> m s+Recurse one level into a structure. (a.k.a composOp from Bjrn Bringert's compos)  "a  TRecurse one level into a structure using a user specified recursion scheme. This is , but it is supplied here ( for consistency with the uniplate API.   "a     ::   s a -> (a -> a) -> s -> s   ::   s a -> (a -> a) -> s -> s 2Recurse one level into the parts delimited by one , using another.   b l "a  (b ; l)    ::   s a ->   a a -> (a -> a) -> s -> s   ::   s a ->   a a -> (a -> a) -> s -> s ARecurse one level into the parts of the structure delimited by a .   b "a  (b ; )  ::  a =>  s t -> (t -> t) -> s -> s+Recurse one level into a structure with an  effect, this is , but it is supplied ( for consistency with the uniplate API.  "a ORecurse one level into a structure using a user specified recursion scheme and  effects. This is <, but it is supplied ( for consistency with the uniplate API.   "a <  ::  m =>   s a => (a -> m a) -> s -> m s2Recurse one level into the parts delimited by one , using another with  effects.   "a (;)  ::  f =>   s a ->   a a -> (a -> f a) -> s -> f sARecurse one level into the parts of the structure delimited by a  with  effects.   b "a b ;   :: ( f, Plated' a) =>   s a -> (a -> f a) -> s -> f s  "a traverseOf_' ORecurse one level into a structure using a user specified recursion scheme and ; effects, without reconstructing the structure behind you.  This is just #, but is provided for consistency.   "a   ::  f =>  s a => (a -> f r) -> s -> f ()2Recurse one level into the parts delimited by one , using another with ; effects, without reconstructing the structure behind you.   b l "a  (b ; l)  ::  f =>  s a ->  a a -> (a -> f r) -> s -> f ()ARecurse one level into the parts of the structure delimited by a  with monadic effects.   b "a  (b ; )  :: ( f,  a) =>   s a -> (a -> f r) -> s -> f ()ARecurse one level into a structure with a monadic effect. (a.k.a  composOpM from Bjrn Bringert's compos)  "a  hRecurse one level into a structure using a user specified recursion scheme and monadic effects. This is < , but it is 1 supplied for consistency with the uniplate API.   "a   :: : m =>   s a => (a -> m a) -> s -> m s2Recurse one level into the parts delimited by one &, using another with monadic effects.   b l "a  (b ; l)  :: : m =>   s a ->   a a -> (a -> m a) -> s -> m sARecurse one level into the parts of the structure delimited by a  with monadic effects.   b "a  (b . )  :: (: m,  a) =>   s a -> (a -> m a) -> s -> m s?Descend one level into a structure with monadic effects (a.k.a  composOpM from Bjrn Bringert's compos)  "a mapMOf_' mRecurse one level into a structure using a user specified recursion scheme and monadic effects. This is just #, but is provided for consistency.   "a   :: : m =>  s a => (a -> m a) -> s -> m ()2Recurse one level into the parts delimited by one &, using another with monadic effects.   b l "a  (b ; l)  :: : m =>  s a ->  a a -> (a -> m a) -> s -> m ()ARecurse one level into the parts of the structure delimited by a  with monadic effects.   b "a  (b ; )  :: (: m,  a) =>   s a -> (a -> m r) -> b -> m ()`Return a list of all of the editable contexts for every location in the structure, recursively.    propUniverse x =  x == P pos ( x)  propId x =  ( x) [extract w | w <-  x]   "a  wReturn a list of all of the editable contexts for every location in the structure, recursively, using a user-specified  to walk each layer.    propUniverse l x =  l x == P pos ( l x)  propId l x =  ( x) [extract w | w <-  l x]   ::   a a -> a -> [; a a]{Return a list of all of the editable contexts for every location in the structure in an areas indicated by a user supplied , recursively using .   b "a  b   ::  a =>   s a -> s -> [; a a s]{Return a list of all of the editable contexts for every location in the structure in an areas indicated by a user supplied , recursively using  another user-supplied  to walk each layer.  ::   s a ->   a a -> s -> [; a a s]The one-level version of contextG. This extracts a list of the immediate children as editable contexts. Given a context you can use pos to see the values, peekF at what the structure would be like with an edited result, or simply extract the original structure.    propChildren x =  l x  P pos ( l x)  propId x =  ( x) [extract w | w <-  l x]   =    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 pos to see the values, peekF at what the structure would be like with an edited result, or simply extract the original structure.    propChildren l x =  childrenOf l x  P pos (  l x)  propId l x =  ( x) [extract w | w <-   l x]      ::  Iso s a -> s -> [; a a s]    ::   s a -> s -> [; a a s]    ::   s a -> s -> [; a a s]   An alias for  7, provided for consistency with the other combinators.    "a      ::  Iso s a -> s -> [; a a s]    ::   s a -> s -> [; a a s]    ::   s a -> s -> [; a a s]  IExtract one level of holes from a container in a region specified by one , using another.    b l "a   (b ; l)     ::  Iso s a ->  Iso a a -> s -> [; a a s]    ::   s a ->   a a -> s -> [; a a s]    ::   s a ->   a a -> s -> [; a a s]  KPerform a fold-like computation on each value, technically a paramorphism.   ::  a a -> (a -> [r] -> r) -> a -> r KPerform a fold-like computation on each value, technically a paramorphism.   "a   !Fold the immediate children of a  container.  z c f =   (c ; f) z The original uniplate% combinator, implemented in terms of  as a .   "a  1The resulting lens is safer to use as it ignores 'over-application'. and deals gracefully with under-application, ( but it is only a proper lens if you don't change the list !  turns a 4 into a lens that resembles an early version of the uniplate (or biplate) type. Note:X You should really try to maintain the invariant of the number of children in the list. pAny extras will be lost. If you do not supply enough, then the remainder will come from the original structure. [So technically, this is only a lens if you do not change the number of results it returns.    ::  S s a ->   s [a]   ::   s a ->   s [a]   ::   s a ->   s [a]  turns a  into a uniplate (or biplate ) family.  If you do not need the types of s and t) to be different, it is recommended that  you use  +It is generally safer to traverse with the   rather than use this 2 combinator. However, it is sometimes convenient. !This is unsafe because if you don't supply at least as many b's as you were  given a's, then the reconstruction of t will result in an error!    :: S s t a b ->  s t [a] [b]   ::  s t a b ->  s t [a] [b]   ::  s t a b ->  s t [a] [b] D     :     :     A      non-portable experimentalEdward Kmett <ekmett@gmail.com> Trustworthy A  is a recorded path through the  Traversal chain of a . This enables us to pull the  back up to the . + is used internally in the definition of a . =This represents the type a zipper will have when it is fully  back up. This is the type of a . It visually resembes a 'breadcrumb trail' as Q used in website navigation. Each breadcrumb in the trail represents a level you  can move up to. GThis type operator associates to the right, so you can use a type like    (,)    to represent a zipper from (,) down to  that has an intermediate  crumb for the  containing the . This is used to represent the  of the . Every  starts with . e.g.   a is the trivial zipper. This ! views the current target of the .  Construct a  that can explore anything. "Return the index into the current  Traversal. $ ( l) l = Just' Move the  @, closing the current level and focusing on the parent element.  Pull the   within the current  Traversal. Try to pull the  one entry to the . If the entry to the left doesn't exist, then stay still.  Pull the entry one entry to the  Try to pull the  one entry to the . If the entry doesn't exist, then stay still. Try to pull the  n entries to the  , returning O- if you pull too far and run out of entries. Passing a negative n will move -n entries to the .  Try to pull the  n entries to the  , returning O- if you pull too far and run out of entries. !Try to pull the  n entries to the 9. Stopping at the first entry if you run out of entries. Passing a negative n will move to -nN entries the right, and will return the last entry if you run out of entries. "Try to pull the  n entries to the 8. Stopping at the last entry if you run out of entries. kPassing a negative number will move to the left and will return the first entry if you run out of entries. #;Returns the number of siblings at the current level in the .  # z  1NB: If the current  TraversalE targets an infinite number of elements then this may not terminate. $ Move the $ horizontally to the element in the nIth position in the current level. (absolutely indexed, starting with the & as 0)  This returns O if the target element doesn' t exist. $ n =  n . &% Move the $ horizontally to the element in the nIth position of the current level. (absolutely indexed, starting with the & as 0) %If the element at that position doesn'+t exist, then this will clamp to the range 0 <= n < # z and return the element there. &.Move to the left-most position of the current  Traversal. '/Move to the right-most position of the current  Traversal. (Step down into a  . This is a constrained form of * for when you know  there is precisely one target.   ( ::   b c -> (a :> b) -> a :> b :> c  ( ::  Iso! b c -> (a :> b) -> a :> b :> c )Step down into the & entry of a  Traversal.   ) ::   Traversal( b c -> (a :> b) -> Maybe (a :> b :> c)  ) ::  - b c -> (a :> b) -> Maybe (a :> b :> c)  ) ::  Iso. b c -> (a :> b) -> Maybe (a :> b :> c) *Unsafely step down into a  Traversal that is assumed to be non-empty. HIf this invariant is not met then this will usually result in an error!    * ::   Traversal b c -> (a :> b) -> a :> b :> c  * ::  % b c -> (a :> b) -> a :> b :> c  * ::  Iso& b c -> (a :> b) -> a :> b :> c =You can reason about this function as if the definition was:  * l "a ' fromJust '  ) lMbut it is lazier in such a way that if this invariant is violated, some code I can still succeed if it is lazy enough in the use of the focused value. +-Close something back up that you opened as a . 5This is used to peel off the path information from a 8 for use when saving the current path for later replay. ,Save the current path as as a  we can play back later. -?Restore ourselves to a previously recorded position precisely. +If the position does not exist, then fail. .5Restore ourselves to a previously recorded position. $When moving left to right through a  Traversal0, if this will clamp at each level to the range 0 <= k < width, b so the only failures will occur when one of the sequence of downward traversals find no targets. /5Restore ourselves to a previously recorded position. pThis assumes that nothing has been done in the meantime to affect the existence of anything on the entire path. FMotions left or right are clamped, but all traversals included on the  are assumed to be non-empty. ,Violate these assumptions at your own risk. - !"#$%&'()*+,-./ !"#$%&'()*+,-./()* !&"'$%#+,-./& !"#$%&'()*+,-./ Rank2Types provisionalEdward Kmett <ekmett@gmail.com> Trustworthy#0A  with an additional index. 2An instance must satisfy a (modified) form of the  laws:   1 (G ) "a    (1 f) ; 1 g "a  getCompose ; 1 (i -> Compose ;  (f i) ; g i) 1Traverse an indexed container. 2<A container that supports folding with an additional index. 32Fold 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 3 ; G4HRight-associative fold of an indexed container with access to the index i.  When you don' t need access to the index then & is more flexible in what it accepts.  "a 4 ; G5GLeft-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 5 ; G6StrictlyF 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 6 ; G7RFold 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 ; G    :: T7 i a c -> (i -> e -> c -> e) -> e -> a -> e   :: 9 i a c -> (i -> e -> c -> e) -> e -> a -> e   ::  z3 i a c -> (i -> e -> c -> e) -> e -> a -> e   :: . i a c -> (i -> e -> c -> e) -> e -> a -> e 8A  with an additional index. .Instances must satisfy a modified form of the  laws:   9 f ; 9 g "a 9 (i -> f i . g i)  9 (_ a -> a) "a < 9Map with access to the index. :The  for a 8.  If you don'!t need access to the index, then mapped& is more flexible in what it accepts. ;The  of a 2 container. < Obtain a 9 by lifting an operation that returns a foldable result. +This can be useful to lift operations from  Data.List and elsewhere into a . =aReturn whether or not any element in a container satisfies a predicate, with access to the index i.  When you don' t need access to the index then  & is more flexible in what it accepts.   = = ; G>`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 > ; G?+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 = 1 ; G@+Traverse elements with access to the index i7, discarding the results (with the arguments flipped).  @ "a N ? When you don' t need access to the index then & is more flexible in what it accepts.  a "a @ a ; GA*Run monadic actions for each target of an  or  with access to the index,  discarding the results.  When you don' t need access to the index then & is more flexible in what it accepts.   "a L ; GB*Run monadic actions for each target of an  or  with access to the index, 6 discarding the results (with the arguments flipped).  B "a N A When you don' t need access to the index then & is more flexible in what it accepts.  l a "a  l a ; GChConcatenate 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 C . G  C "a 3 DxSearches a container with a predicate that is also supplied the index, returning the left-most element of the structure  matching the predicate, or O if there is no such element.  When you don' t need access to the index then  & is more flexible in what it accepts.   "a D ; GECMonadic 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 E ; GFVMonadic 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 F ; GG.Extract the key-value pairs from a structure.  When you don'1t need access to the indices in the result, then & is more flexible in what it accepts.  "a  Q ; GHIFold a container with indices returning both the indices and the values. I:Fold a container with indices returning only the indices. JThe  of a 0 container. K3Traverse with an index (and the arguments flipped)    a "a K a ; G  K "a N 1 L5Map each element of a structure to a monadic action, Q evaluate these actions from left to right, and collect the results, with access  the index.  When you don't need access to the index ( is more liberal in what it can accept.  "a L ; GM5Map each element of a structure to a monadic action, Q evaluate these actions from left to right, and collect the results, with access + its position (and the arguments flipped).    a "a M a ; G  M "a N L N Generalizes S to add access to the index. ' accumulates state from right to left.  "a N ; GO Generalizes T to add access to the index. ' accumulates state from left to right.  "a O ; GPPAccess the element of an indexed container where the index matches a predicate. Bover (iwhere (>0)) Prelude.reverse $ ["He","was","stressed","o_O"]["He","saw","desserts","O_o"]8The position in the sequence is available as the index. 4The position in the list is available as the index. 20123456789:;<=>?@ABCDEFGHIJKLMNOP !"!0123456789:;<=>?@ABCDEFGHIJKLMNOP!89:234567;<=>?@ABCDEFGHI01JKLMNOP+0123456789:;<=>?@ABCDEFGHIJKLMNOP !"TemplateHaskell experimentalEdward Kmett <ekmett@gmail.com> TrustworthyQ+This configuration describes the options we',ll be using to make isomorphisms or lenses. SFlags for lens construction _Only Generate valid   lenses. `HEnables the generation of partial lenses, generating runtime errors for L every constructor that does not have a valid definition for the lens. This L occurs when the constructor lacks the field, or has multiple fields mapped  to the same lens. a5In the situations that a lens would be partial, when ` is M used, this flag instead causes traversals to be generated. Only one can be C used, and if neither are, then compile-time errors are generated. b)Handle singleton constructors specially. cWhen building a singleton H (or ') for a record constructor, build both  the H (or ,) for the record and the one for the field. dUse H for singleton constructors. e@Expect a single constructor, single field newtype or data type. f6Create the class if the constructor is simple and the l rule matches. g9Create the instance if the constructor is simple and the l rule matches. h Die if the l fails to match. iKIndicate whether or not to supply the signatures for the generated lenses. UDisabling this can be useful if you want to provide a more restricted type signature 1 or if you want to supply hand-written haddocks. jSLens to access the convention for naming top level isomorphisms in our lens rules. =Defaults to lowercasing the first letter of the constructor. kCLens to access the convention for naming fields in our lens rules. MDefaults to stripping the _ off of the field name, lowercasing the name, and  rejecting the field if it doesn't start with an '_'. lJRetrieve options such as the name of the class and method to put in it to . build a class around monomorphic data types. mJRetrieve options such as the name of the class and method to put in it to . build a class around monomorphic data types. nDefault lens rules oJRules for making fairly simple partial lenses, ignoring the special cases > for isomorphisms and traversals, and not making any classes. pERules for making lenses and traversals that precompose another lens. q1Rules for making an isomorphism from a data type rEBuild lenses (and traversals) with a sensible default configuration. ' makeLenses = makeLensesWith lensRules sZMake lenses and traversals for a type, and create a class when the type has no arguments. e.g.   " data Foo = Foo { _fooX, _fooY ::  }  s ''Foo  will create    class HasFoo t where  foo ::   t Foo ! instance HasFoo Foo where foo = <  fooX, fooY :: HasFoo t =>   t   ) makeClassy = makeLensesWith classyRules t'Make a top level isomorphism injecting into the type. dThe supplied name is required to be for a type with a single constructor that has a single argument e.g.    newtype List a = List [a]  makeIso ''List  will create    list :: Iso [a] [b] (List a) (List b)  # makeIso = makeLensesWith isoRules u>Derive lenses and traversals, specifying explicit pairings of (fieldName, lensName). qIf you map multiple names to the same label, and it is present in the same constructor then this will generate a . e.g. < makeLensesFor [("_foo", "fooLens"), ("baz", "lbaz")] ''Foo 9 makeLensesFor [("_barX", "bar"), ("_barY", "bar)] ''Bar vJDerive lenses and traversals, using a named wrapper class, and specifying  explicit pairings of (fieldName, traversalName). Example usage: K makeClassyFor "HasFoo" "foo" [("_foo", "fooLens"), ("bar", "lbar")] ''Foo w*Build lenses with a custom configuration. #ZGiven a set of names, build a map from those names to a set of fresh names based on them. $Given  8 newtype Cxt b => Foo a b c d = Foo { _baz :: Bar a b } This will generate: N foo :: (Cxt b, Cxt f) => Iso (Foo a b c d) (Foo e f g h) (Bar a b) (Bar e f) : foo = isomorphic (\f a -> (\(Foo b) -> b) <$> f (Foo a)) 1 (\f (Foo a) -> fmap Foo (f a))  {-# INLINE foo #-} %Gets 2[(lens name, (constructor name, field name, type))] from a record constructor 9QR&'()STUVWXYZ[\]^_`abcdefghijklmnopqrstuvw#*+,-./01$230surrounding cxt driven by the data type context data/newtype constructor name args %4'QRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvw'rusvtwnQRopqjklmS^]\[ZYXWVUT_`abdefghci)QR&'()S ^]\[ZYXWVUT_`abcdefghijklmnopqrstuvw#*+,-./01$23%4 Rank2Types provisionalEdward Kmett <ekmett@gmail.com> Safe-Inferred efghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNORSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxy|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwGHC experimentalEdward Kmett <ekmett@gmail.com> Safe-InferredxUsed to traverse 5 data by uniplate. y;Convert from the data type to its representation (or back) '"hello"^.generic.from generic :: String"hello"z;Convert from the data type to its representation (or back) {A 5  that visits every occurence  of something 6 anywhere in a container. BallOf tinplate (=="Hello") (1::Int,2::Double,(),"Hello",["Hello"])True:mapMOf_ tinplate putStrLn ("hello",[(2 :: Int, "world!")])helloworld! x7yz{89:;<=>xyz{yz{x x7yz{89:;<=>Control.Exception provisionalEdward Kmett <ekmett@gmail.com> Safe-Inferred|Traverse the strongly typed ? contained in @) where the type of your function matches  the desired ?.   exception :: ( Applicative f, ? a, ? b)  => (a -> f b) -> @ -> f @ ||||LiberalTypeSynonyms experimentalEdward Kmett <ekmett@gmail.com> Safe-Inferred }Bitwise A the target(s) of a  or  _2 |~ 6 $ ("hello",3) ("hello",7)   (}) :: B a =>  s t a a -> a -> s -> t  (}) :: B a => H s t a a -> a -> s -> t  (}) :: B a =>  s t a a -> a -> s -> t  (}) :: ('Monoid a', B a) =>  s t a a -> a -> s -> t ~Bitwise C the target(s) of a  or  _2 &~ 7 $ ("hello",254) ("hello",6)   (~) :: B a =>  s t a a -> a -> s -> t  (~) :: B a => H s t a a -> a -> s -> t  (~) :: B a =>  s t a a -> a -> s -> t  (~) :: ('Monoid a', B a) =>  s t a a -> a -> s -> t Modify the target(s) of a  ,  or  by computing its bitwise C with another value.   () :: (? s m, B a) =>   s a -> a -> m ()  () :: (? s m, B a) =>  H s a -> a -> m ()  () :: (? s m, B a) =>   s a -> a -> m ()  () :: (? s m, B a) =>   s a -> a -> m () Modify the target(s) of a  ,  or  by computing its bitwise A with another value.   () :: (? s m, B a) =>   s a -> a -> m ()  () :: (? s m, B a) =>  H s a -> a -> m ()  () :: (? s m, B a) =>   s a -> a -> m ()  () :: (? s m, B a) =>   s a -> a -> m () Bitwise A the target(s) of a  (or ), returning the result 0 (or a monoidal summary of all of the results). _2 <|~ 6 $ ("hello",3)(7,("hello",7))   () :: B a => H s t a a -> a -> s -> (a, t)  () :: B a =>  s t a a -> a -> s -> (a, t)  () :: (B a, ' Monoid a) =>  s t a a -> a -> s -> (a, t) Bitwise C the target(s) of a  or , returning the result 0 (or a monoidal summary of all of the results). _2 <&~ 7 $ ("hello",254)(6,("hello",6))   () :: B a => H s t a a -> a -> s -> (a, t)  () :: B a =>  s t a a -> a -> s -> (a, t)  () :: (B a, ' Monoid a) =>  s t a a -> a -> s -> (a, t) Modify the target(s) of a   (or ) by computing its bitwise C with another value, N returning the result (or a monoidal summary of all of the results traversed)   () :: (? s m, B a) =>   s a -> a -> m a  () :: (? s m, B a, Monoid a) =>   s a -> a -> m a Modify the target(s) of a  , (or ) by computing its bitwise A with another value, N returning the result (or a monoidal summary of all of the results traversed)   () :: (? s m, B a) =>   s a -> a -> m a  () :: (? s m, B a, Monoid a) =>   s a -> a -> m a FThis lens can be used to access the value of the nth bit in a number.  n is only a legal  into b if 0 <= n < D (E :: b)  16^.bitAt 4True 15^.bitAt 4False*Traverse over all bits in a numeric type. ,The bit position is available as the index. import Data.Word"toListOf traverseBits (5 :: Word8)/[True,False,True,False,False,False,False,False]If you supply this an F, the result will  be an infinite $ that can be productively consumed. }~ }~ }~ }~portable provisionalEdward Kmett <ekmett@gmail.com> Safe-Inferred,A lens reading and writing to the head of a  non-empty list. .Attempting to read or write to the head of an empty list will result in an . [1,2,3]^._head1,A lens reading and writing to the tail of a  non-empty list .Attempting to read or write to the tail of an empty list will result in an . _tail .~ [3,4,5] $ [1,2] [1,3,4,5]4A lens reading and writing to the last element of a  non-empty list 6Attempting to read or write to the last element of an empty list will result in an .  [1,2]^._last2=A lens reading and replacing all but the a last element of a  non-empty list >Attempting to read or write to all but the last element of an empty list will result in an . [1,2,3,4]^._init[1,2,3]CObtain a version of the list with the supplied value interspersed. "abcde"^.interspersed ',' "a,b,c,d,e" ' xs^.interspersed a = intersperse a xs CObtain a version of the list with the supplied value intercalated. QIndexed traversal of a list. The position in the list is available as the index. :A traversal for reading and writing to the head of a list MThe position of the head in the original list (0) is available as the index. traverseHead +~ 1 $ [1,2,3][2,2,3]  ::  f => (a -> f a) -> [a] -> f [a]+A traversal for editing the tail of a list The position of each element in the original list is available as the index. traverseTail +~ 1 $ [1,2,3][1,3,4]  ::  f => (a -> f a) -> [a] -> f [a]'A traversal the last element in a list QThe position of the last element in the original list is available as the index. traverseLast +~ 1 $ [1,2,3][1,2,4]  ::  f => (a -> f a) -> [a] -> f [a]2A traversal of all but the last element of a list 8The position of each element is available as the index. traverseInit +~ 1 $ [1,2,3][2,3,3]  ::  f => (a -> f a) -> [a] -> f [a]&Cons onto the list(s) referenced by a . 'h' ~: _1 $ ("ello","world")("hello","world")   ( ) :: b ->   s [a] -> s -> s  ( ) :: b ->   s [a] -> s -> s  ( ) :: b ->   s [a] -> s -> s  ( ) :: b ->  H s [a] -> s -> s &Cons onto the list(s) referenced by a  in your monad state   () :: ? s m => a ->   s [a] -> m ()  () :: ? s m => a ->   s [a] -> m ()  () :: ? s m => a ->   s [a] -> m ()  () :: ? s m => a ->  H s [a] -> m () &Cons onto the list(s) referenced by a  (or ), returning the result. If you use this with a 3 you will receive back the concatenation of all of 6 the resulting lists instead of an individual result. 'h' <~: _1 $ ("ello","world")("hello",("hello","world"))   ( ) :: b ->   s [a] -> s -> ([a], s)  ( ) :: b ->  H s [a] -> s -> ([a], s)  ( ) :: b ->   s [a] -> s -> ([a], s) &Cons onto the list(s) referenced by a  (or ) into your monad state,  returning the result. If you use this with a 1, you will receive back the concatenation of all 9 of the resulting lists instead of an individual result.   () :: ? s m =>   s [a] -> a -> m [a]  () :: ? s m =>  H s [a] -> a -> m [a]  () :: ? s m =>   s [a] -> a -> m [a] FAppend to the target of a list-valued setter by appending to it with (G). (-) generalizes this operation to an arbitrary Monoid. :m + Control.Lens"both ++~ "!!!" $ ("hello","world")("hello!!!","world!!!")   () ::   s [a] -> [a] -> s -> s  () ::  H s [a] -> [a] -> s -> s  () ::   s [a] -> [a] -> s -> s  () ::   s [a] -> [a] -> s -> s Append to the target(s) of a  , H,  or  with (G) in the current state. (-) generalizes this operation to an arbitrary Monoid.   () :: ? s m =>   s [a] -> [a] -> m ()  () :: ? s m =>  H s [a] -> [a] -> m ()  () :: ? s m =>   s [a] -> [a] -> m ()  () :: ? s m =>   s [a] -> [a] -> m () .Append onto the end of the list targeted by a  and return the result. (-) generalizes this operation to an arbitrary Monoid.  When using a K, the result returned is actually the concatenation of all of the results. 3When you do not need the result of the operation, () is more flexible. .Append onto the end of the list targeted by a 8 into the current monadic state, and return the result. (-) generalizes this operation to an arbitrary Monoid.  When using a K, the result returned is actually the concatenation of all of the results. 3When you do not need the result of the operation, () is more flexible.  portable provisionalEdward Kmett <ekmett@gmail.com> Safe-Inferred (or ) a list of bytes into a H   x = x =   x = x =  Traverse each I in a H   =   l    ( 0x80) :: H -> E (or ) a list of characters into a H When writing back to the H it is assumed that every   lies between '\x00' and '\xff'.   x = x =   x = x =  #Traverse the individual bytes in a H as characters. When writing back to the H it is assumed that every   lies between '\x00' and '\xff'.   =   .    ( 'c') :: H -> E!portable provisionalEdward Kmett <ekmett@gmail.com> Safe-Inferred (or ) a list of bytes into a J   x = x =   x = x =  #Traverse the individual bytes in a J   =   .    ( 0x80) :: J -> E (or ) a list of characters into a J When writing back to the J it is assumed that every   lies between '\x00' and '\xff'.   x = x =   x = x =  #Traverse the individual bytes in a J as characters. When writing back to the J it is assumed that every   lies between '\x00' and '\xff'.   =   l    ( 'c') :: J -> E"portable provisionalEdward Kmett <ekmett@gmail.com> Safe-InferredTraversals for ByteStrings.  (or () a list of bytes into a strict or lazy H   x = x =   x = x =   (or -) a list of characters into a strict or lazy H When writing back to the H it is assumed that every   lies between '\x00' and '\xff'.   x = x =   x = x =  Traverse each I in a strict or lazy H   =   l  traverseList   ( 0x80) :: H -> E2Traverse the individual bytes in a strict or lazy H as characters. When writing back to the H it is assumed that every   lies between '\x00' and '\xff'.   =   .    ( 'c') :: H -> EKLKL# Rank2Types experimentalEdward Kmett <ekmett@gmail.com> Safe-Inferred Access the M of a N number (1.0 :+ 0.0)^.real1.0  ::  f => (a -> f a) -> N a -> f (N a) Access the  imaginaryPart of a N number (0.0 :+ 1.0)^.imaginary1.0  ::  f => (a -> f a) -> N a -> f (N a)This isn't quite a legal lens. Notably the  : l ( l b a) = blaw is violated when you set a O value with 0 P and non-zero Q  as the Q information is lost. So don' t do that! )Otherwise, this is a perfectly cromulent . 0Traverse both the real and imaginary parts of a N number. N traverseComplex :: Applicative f => (a -> f b) -> Complex a -> f (Complex b) $ Rank2Types experimentalEdward Kmett <ekmett@gmail.com> TrustworthyLA generic applicative transformation that maps over the immediate subterms.  is to  what R is to S This really belongs in  Data.Data. Nave  using T3. This does not attempt to optimize the traversal. ZThis is primarily useful when the children are immediately obvious, and for benchmarking. %Find every occurence of a given type a recursively that doesn' t require # passing through something of type a using T, while avoiding traversal . of areas that cannot contain a value of type a. This is  with a more liberal signature. Find descendants of type aU non-transitively, while avoiding computation of areas that cannot contain values of  type a using T. $ is a useful default definition for   performs like , except when s ~ a&, it returns itself and nothing else. U inlineable V %WXYZ[\]^_`abcdefghijkUlmnopqrstuWXYZ[^]\_`abcdefghijkUlmnopqrstu%portable provisionalEdward Kmett <ekmett@gmail.com> Safe-Inferred(Traverse the typed value contained in a v7 where the type required by your function matches that  of the contents of the v. ()^.by dynamic<<()>>&portable provisionalEdward Kmett <ekmett@gmail.com> Safe-Inferred IntSet isn't Foldable, but this ) can be used to access the members of an w. &sumOf members $ setOf folded [1,2,3,4]10This * can be used to change the contents of an w by mapping  the elements to new values. Sadly, you can't create a valid  for a Set, because the number of B elements might change but you can manipulate it by reading using  and  reindexing it via . (over setmapped (+1) (fromList [1,2,3,4])fromList [2,3,4,5] Construct an w from a 6, , ,  or H. 5setOf (folded._2) [("hello",1),("world",2),("!!!",3)]fromList [1,2,3]    :: 6 s  -> s -> w   ::  s  -> s -> w   ::  H s  -> s -> w   ::   s  -> s -> w   ::   s  -> s -> w ' Rank2Types experimentalEdward Kmett <ekmett@gmail.com> Safe-Inferred ,Modify the target of a monoidally valued by xing another value. :m + Control.Lens"both <>~ "!!!" $ ("hello","world")("hello!!!","world!!!")   () ::  a =>  s t a a -> a -> s -> t  () ::  a => H s t a a -> a -> s -> t  () ::  a =>  s t a a -> a -> s -> t  () ::  a =>  s t a a -> a -> s -> t Modify the target(s) of a  , H,  or  by x ing a value.   () :: (? s m,  a) =>   s a -> a -> m ()  () :: (? s m,  a) =>  H s a -> a -> m ()  () :: (? s m,  a) =>   s a -> a -> m ()  () :: (? s m,  a) =>   s a -> a -> m () x2 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. x2 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. Isomorphism for y Isomorphism for z Isomorphism for { 0:m + Control.Lens Data.Monoid.Lens Data.Foldableala _all foldMap [True,True]True0:m + Control.Lens Data.Monoid.Lens Data.Foldableala _all foldMap [True,False]FalseIsomorphism for | 0:m + Control.Lens Data.Monoid.Lens Data.Foldableala _any foldMap [False,False]False0:m + Control.Lens Data.Monoid.Lens Data.Foldableala _any foldMap [True,False]TrueIsomorphism for } 0:m + Control.Lens Data.Monoid.Lens Data.Foldableala _sum foldMap [1,2,3,4]10Isomorphism for ~ 0:m + Control.Lens Data.Monoid.Lens Data.Foldableala _product foldMap [1,2,3,4]24Isomorphism for  Isomorphism for     (portable provisionalEdward Kmett <ekmett@gmail.com> Safe-Inferred A  that can access the nth element of a . ENote: This is only a legal lens if there is already such an element! A  is isomorphic to a   m = m = A  is isomorphic to a   m = m = Traverse the head of a  Traverse the tail of a  Traverse the last element of a  'Traverse all but the last element of a  Traverse the first n elements of a  Traverse all but the first n elements of a  'Travere all the elements numbered from i to j of a     )portable provisionalEdward Kmett <ekmett@gmail.com>None (or  ) strict .    x = x =    x = x =   -Traverse the individual characters in strict . $anyOf text (=='o') $ "hello"^.packedTrue*portable provisionalEdward Kmett <ekmett@gmail.com>NonePack (or unpack) lazy .    x = x =    x = x =   (Traverse the individual characters in a . $ anyOf text (=='c') :: Text -> Bool +portable provisionalEdward Kmett <ekmett@gmail.com>NoneTraversals for strict or lazy   (or ) strict or lazy .    x = x =    x = x =   5Traverse the individual characters in strict or lazy . ,MTPCs provisionalEdward Kmett <ekmett@gmail.com> Safe-InferredA  that focuses on the root of a . view root $ Node 42 []42A , of the direct descendants of the root of a  1 indexed by its position in the list of children   "a - Rank2Types experimentalEdward Kmett <ekmett@gmail.com>NoneA   for working with a  of a 6 value. A   for working with a  of a 6 value. .&MPTCs, Rank2Types, LiberalTypeSynonyms provisionalEdward Kmett <ekmett@gmail.com> Safe-InferredAccess an element of an array. <Note: The indexed element is assumed to exist in the target .    arr  i "a arr =  i  arr  [(i,e)] "a  i  e  arr :ix 2 .~ 9 $ (listArray (1,5) [4,5,6,7,8] :: Array Int Int)+array (1,5) [(1,4),(2,9),(3,6),(4,7),(5,8)](This setter can be used to derive a new  from an old array by E applying a function to each of the indices to look it up in the old .  This is a  contravariant .    "a  .    "a  .    ( b) f arr  i "a arr  f i   ( ( b) f arr) "a b An  of the elements of an  , using the 5 index into the array as the index of the traversal.  "a  / Rank2Types experimentalEdward Kmett <ekmett@gmail.com> Safe-Inferred (Modify the path by adding another path. :m + Control.Lens#both </>~ "!!!" $ ("hello","world")("hello/!!!","world/!!!")   () ::  s a   ->  -> s -> a  () :: H s a   ->  -> s -> a  () ::  s a   ->  -> s -> a  () ::  s a   ->  -> s -> a Modify the target(s) of a  , H,  or  by adding a path.   () :: ? s m =>   s  ->  -> m ()  () :: ? s m =>  H s  ->  -> m ()  () :: ? s m =>   s  ->  -> m ()  () :: ? s m =>   s  ->  -> m () +Add a path onto the end of the target of a  and return the result 3When you do not need the result of the operation, () is more flexible. +Add a path onto the end of the target of a  into  your monad's state and return the result. 3When you do not need the result of the operation, () is more flexible. %Modify the path by adding extension. :m + Control.Lens#both <.>~ "!!!" $ ("hello","world")("hello.!!!","world.!!!")   () ::  s a   ->  -> s -> a  () :: H s a   ->  -> s -> a  () ::  s a   ->  -> s -> a  () ::  s a   ->  -> s -> a Modify the target(s) of a  , H,  or  by adding an extension.   () :: ? s m =>   s  ->  -> m ()  () :: ? s m =>  H s  ->  -> m ()  () :: ? s m =>   s  ->  -> m ()  () :: ? s m =>   s  ->  -> m () 1Add an extension 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. 1Add an extension 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. ,A lens reading and writing to the basename. (basename .~ "filename" $ "path/name.png""path/filename.png"-A lens reading and writing to the directory. !"long/path/name.txt" ^. directory "long/path"-A lens reading and writing to the extension. %extension .~ ".png" $ "path/name.txt""path/name.png"1A lens reading and writing to the full filename. (filename .~ "name.txt" $ "path/name.png""path/name.txt"    0portable provisionalEdward Kmett <ekmett@gmail.com>NoneEvaluate the targets of a  or  into a data structure  according to the given .     =   =    = <     ::   s a ->  a ->  s   ::   s a ->  a ->  s   :: (a ->  a) -> s ->  s) ->  a ->  s Evaluate the targets of a  or  according into a % data structure according to a given  in parallel.   =      ::   s a ->  a ->  s   ::   s a ->  a ->  s   :: ((a ->  a) -> s ->  s) ->  a ->  s  Transform a , , 6,  or  to 3 first evaluates its argument according to a given  before proceeding.      ::  t =>  a ->  [a]  Transform a , , 6,  or  to , evaluate its argument according to a given  in parallel with evaluating.      ::  t =>  a ->  [a] 1portable provisionalEdward Kmett <ekmett@gmail.com> Safe-Inferred$Evaluate the elements targeted by a , , H,  6 or " according to the given strategy.  =  2         !"##$%&'()*+,=-./0T123456789:;<=>?@ABCDE>FGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefg h i j k l m n o z P p q r s t u v R w x y z { | } ~                      { O                   x                   3`efhgijklmnopqrsutwva4_S  @A   QNy|}~: !"#$%&'(78)*+,-./015234567689:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~]     !!! ! " "" "" # #Z# #$$$$$%&&&''''''''''''((((](((((() )!* *!+"+ +!,#,$-%-&.'.(.)/*/+/,/-/.///0/1/2/3/4/5060708091:;<;=>?@ABCDCE;AFGHIJKLMNOPQNORSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~AAACGGHGA      ALA                                                  GHAWALGACAG@K@M@C         GHCX   !L" #GH$ %&L'()*GH+, -./0C1C2 3 45675689:;<=>?@ABCDEFGUV HGIJJKLMNOPQRSATGHUGVWXYXZ[S\]^_`ab9caadefghijklmnopqrstuvwxyz{|}~(A""[[\[[[X$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$((++lens-3.1Control.Lens.TraversalControl.Lens.IsomorphicControl.Lens.InternalControl.Lens.IndexedControl.Lens.IndexedGetterControl.Lens.CombinatorsControl.Lens.ActionControl.Lens.TypeControl.Lens.IndexedLensControl.Lens.IndexedFoldControl.Lens.IndexedTraversalControl.Lens.IndexedSetterControl.Lens.TupleControl.Lens.SetterControl.Lens.GetterControl.Lens.Iso Data.Set.LensControl.Lens.ProjectionControl.Lens.RepresentableControl.Lens.ZoomData.HashSet.LensControl.Lens.FoldLanguage.Haskell.TH.LensControl.Lens.PlatedControl.Lens.ZipperControl.Lens.WithIndexControl.Lens.THGHC.Generics.LensControl.Exception.LensData.Bits.LensData.List.LensData.ByteString.Strict.LensData.ByteString.Lazy.LensData.ByteString.LensData.Complex.LensData.Data.LensData.Dynamic.LensData.IntSet.LensData.Monoid.LensData.Sequence.LensData.Text.Strict.LensData.Text.Lazy.LensData.Text.LensData.Tree.LensData.Typeable.LensData.Array.LensSystem.FilePath.Lens Control.Parallel.Strategies.LensControl.Seq.LensSettableSetterGetter Traversalelement maximumOf minimumOfmapM_ traverseOf_Control.Monad.Trans.State.LazyStateindexedLenscloneZoomzoomControl.Monad.ErrorErrorTControl.Monad.Trans.MaybeMaybeTControl.Monad.Trans.ListListTControl.Monad.WriterWriterTControl.Monad.RWSRWSTControl.Monad.StateStateT backwardsIndexedTraversal IndexedLensFold IndexedFoldIso IndexedGetter Data.Functor<$><$ Control.Monadjoin imaginary Data.ComplexComplex traverseHeadControl.Lens.LensviewsetGettingData.Functor.Compose getComposeCompose%~+~-~*~//~^~^^~**~||~&&~%=+=-=*=//=**=^^=||=&&=%@~ foldMapOfSimpleIndexedLensSimpleIndexedTraversalfoldrOffoldlOfanyOfallOfforOf_mapMOf_forMOf_ concatMapOffindOffoldrOf'foldlOf'foldrMOffoldlMOftoListOf IndexedSetter traverseOfforOfmapMOfforMOf mapAccumROf mapAccumLOfmapOfoverData.Traversabletraverse Traversable Data.MonoidMonoidSimpleData.Text.InternalTextData.Functor.IdentityIdentity fmapDefault%Prelude.idfoldedData.Distributive distribute DistributiveControl.Monad.Reader.Classlocalunfoldr ibackwards Data.FoldablefoldMapfoldfoldrfoldltoListandoranyallproductsum traverse_Data.Either.Lens traverseLeftfor_forM_ sequence_ maximumByfoldr1foldl1Offoldl1foldr'foldl'foldrMfoldlM Data.List transposeuniplatebiplate Data.Just isNothing mapAccumR Control.Lens<>~<>=<<>~<<>=Data.ByteStringpackunpackData.ByteString.Char8Data.ByteString.LazyData.ByteString.Lazy.Char8Control.Platedplatebase Isomorphism Isomorphic isomorphicisomapfromviaLevelMutator runMutator untaintedFolding getFolding Effective effectiveAccessor runAccessorGettablecoerce EffectRWS getEffectRWSEffect getEffectBazaar _runBazaar ElementOf getElementOfElementOfResultNotFoundFound SearchingMaxNoMaxMinNoMin Sequenced getSequenced Traversed getTraversedIndexing runIndexingIndexingResultContext FocusingErr unfocusingErrErrgetErr FocusingMay unfocusingMayMaygetMay FocusingOn unfocusingOn FocusingPlusunfocusingPlus FocusingWithunfocusingWithFocusing unfocusinggetMingetMaxbazaarduplicateBazaarsell ineffectivenoEffect levelWidth leftLevel left1Level leftmostLevelrightmostLevel rightLevel right1Level focusLevel rezipLevelIndex withIndex IndexableIndexedindex<..>reindex<.>icomposeReifiedIndexedGetterReifyIndexedGetterreflectIndexedGetterIndexedGetting<$!><$!Acting MonadicFoldActionperformperforms^!actactsliftActSimpleReifiedLens ReifiedLens ReifyLens reflectLensSimpleOverloaded OverloadedLensLikeSimpleLensLike SimpleLens:->lenssimple%%~%%=resultAtchoosingchosen alongside cloneLens<%~<+~<-~<*~ SimpleIsoisosisoalaaufunderidentity_const setmappedsetOfSimpleProjectionProject Projective projective Projectionstereoprojectby projectionmirrorPathwalk RepresentablerepRepfmapReppureRepapRepbindRep distributeReppaths tabulatedrmap rtraverse rtraverse_rforrmapMrmapM_rforMrfoldMaprfoldrrmappedrfolded rtraversedMagnifymagnify ReifiedFold ReifyFold reflectFoldfoldingrepeated replicatedcycledunfoldediteratedfiltered takingWhile droppingWhilefoldOf^..andOforOf productOfsumOf sequenceAOf_ sequenceOf_asumOfmsumOfelemOf notElemOfconcatOflengthOfheadOf^?lastOfnullOf maximumByOf minimumByOffoldr1OfSimpleReifiedTraversalReifiedTraversalReifyTraversalreflectTraversal:=>SimpleTraversal sequenceAOf sequenceOf transposeOfscanr1Ofscanl1Of elementOfignoredboth traverseRighttakingdroppingcloneTraversal SubstType substType HasTypeVars typeVarsExHasNamenametypeVars substTypeVars conFieldsconNamedFieldsPlatedchildren childrenOnrewrite rewriteOf rewriteOn rewriteOnOfrewriteM rewriteMOf rewriteMOn rewriteMOnOfuniverse universeOf universeOn universeOnOf transform transformOn transformOf transformOnOf transformM transformMOn transformMOftransformMOnOfdescend descendOf descendOnOf descendOndescendA descendAOf descendAOnOf descendAOn descendA_ descendAOf_ descendAOnOf_ descendAOn_descendM descendMOf descendMOnOf descendMOn descendM_ descendMOf_ descendMOnOf_ descendMOn_contexts contextsOf contextsOn contextsOnOfholesholesOfholesOn holesOnOfparaOfpara composOpFoldpartspartsOf unsafePartsOfTapeZipperZipped:>Topfocuszipper coordinateupleftleft1rightright1rightsleftslefts1rights1widthgotogoto1leftmost rightmostdownwithin fromWithinrezipsaverestorerestore1unsafelyRestoreTraversableWithIndex itraverseFoldableWithIndexifoldMapifoldrifoldlifoldr'ifoldl'FunctorWithIndeximapimappedifoldedifoldingianyiall itraverse_ifor_imapM_iforM_ iconcatMapifindifoldrMifoldlMitoList withIndicesindices itraversediforimapMiforM imapAccumR imapAccumLiwhere LensRulesLensFlagGenerateSignatures ClassRequiredCreateInstance CreateClassSingletonRequiredHandleSingletons SingletonIsoSingletonAndFieldBuildTraversals PartialLenses SimpleLenses simpleLenses partialLensesbuildTraversalshandleSingletonssingletonAndField singletonIsosingletonRequired createClasscreateInstance classRequiredgenerateSignatureslensIso lensField lensClass lensFlags defaultRules lensRules classyRulesisoRules makeLenses makeClassymakeIso makeLensesFor makeClassyFormakeLensesWith GTraversalgenericgeneric1tinplate exception|~&~&=|=<|~<&~<&=<|=bitAt traverseBits_head_tail_last_init interspersed intercalated traverseList traverseTail traverseLast traverseInit~:=:<~:<=:++~++=<++~<++= packedBytesbytes packedCharschars IsByteStringrealpolarizetraverseComplex gtraversetemplatedynamicmembers_dual_endo_all_any_sum_product_firstordinalviewLviewR traverseTo traverseFrom traverseSlicepackedtextIsTextrootbranches_cast_gcastixixmapped traverseArray~=<~<=<.>~<.>=<<.>~<<.>=basename directory extensionfilenameevalOfparOfafter throughoutseqOfControl.CategoryCategory$fIsomorphicIsomorphism$fCategoryIsomorphism$fIsomorphic(->)transformers-0.3.0.0GHC.BaseFunctorControl.Applicative ApplicativeConstfmapghc-prim GHC.TypesInt Data.EitherEither Data.MaybeMaybecomonad-3.0.0.2Control.ComonadComonadmemptyextract$fSettableBackwards$fSettableIdentity$fGettableElementOf$fComonadStoreIntLevel$fComonadLevel$fTraversableLevel$fFoldableLevel$fFunctorLevel$fApplicativeMutator$fFunctorMutator$fSettableMutator$fSettableCompose$fMonoidFolding$fEffectivemrEffect$fEffectivemDualBackwards$fEffectiveIdentityrAccessor$fApplicativeAccessor$fFunctorAccessor$fGettableAccessor$fGettableEffectRWS$fGettableEffect$fGettableCompose$fGettableBackwards$fGettableConst$fApplicativeEffectRWS$fFunctorEffectRWS$fApplicativeEffect$fMonoidEffect$fFunctorEffect$fComonadApplyBazaar$fComonadBazaar$fApplicativeBazaar$fFunctorBazaar$fApplicativeElementOf$fFunctorElementOf$fFunctorElementOfResult $fMonoidMax $fMonoidMin$fMonoidSequenced$fMonoidTraversed$fGettableIndexing$fApplicativeIndexing$fFunctorIndexing$fFunctorIndexingResult$fComonadStoreaContext$fComonadContext$fFunctorContext$fApplicativeFocusingErr$fFunctorFocusingErr $fMonoidErr$fApplicativeFocusingMay$fFunctorFocusingMay $fMonoidMay$fApplicativeFocusingOn$fFunctorFocusingOn$fApplicativeFocusingPlus$fFunctorFocusingPlus$fApplicativeFocusingWith$fFunctorFocusingWith$fApplicativeFocusing$fFunctorFocusing$fIndexediIndex$fIndexedi(->)Monadpure mtl-2.1.2Control.Monad.State.Classstate MonadStateGHC.NumNumGHC.Real FractionalIntegral GHC.FloatFloating GHC.Classes||Bool&&const$fContainskHashSet$fContainskSet$fContainsIntIntSet $fAtkHashMap$fAtkMap $fAtIntIntMapflipNothingmap Data.Tuplefstskip mapAccumLswap$fTraverseMaxkMap$fTraverseMaxIntIntMap$fTraverseMinkMap$fTraverseMinIntIntMap$fField9(,,,,,,,,)(,,,,,,,,)ii'$fField8(,,,,,,,,)(,,,,,,,,)hh'$fField8(,,,,,,,)(,,,,,,,)hh'$fField7(,,,,,,,,)(,,,,,,,,)gg'$fField7(,,,,,,,)(,,,,,,,)gg'$fField7(,,,,,,)(,,,,,,)gg'$fField6(,,,,,,,,)(,,,,,,,,)ff'$fField6(,,,,,,,)(,,,,,,,)ff'$fField6(,,,,,,)(,,,,,,)ff'$fField6(,,,,,)(,,,,,)ff'$fField5(,,,,,,,,)(,,,,,,,,)ee'$fField5(,,,,,,,)(,,,,,,,)ee'$fField5(,,,,,,)(,,,,,,)ee'$fField5(,,,,,)(,,,,,)ee'$fField5(,,,,)(,,,,)ee'$fField4(,,,,,,,,)(,,,,,,,,)dd'$fField4(,,,,,,,)(,,,,,,,)dd'$fField4(,,,,,,)(,,,,,,)dd'$fField4(,,,,,)(,,,,,)dd'$fField4(,,,,)(,,,,)dd'$fField4(,,,)(,,,)dd'$fField3(,,,,,,,,)(,,,,,,,,)cc'$fField3(,,,,,,,)(,,,,,,,)cc'$fField3(,,,,,,)(,,,,,,)cc'$fField3(,,,,,)(,,,,,)cc'$fField3(,,,,)(,,,,)cc'$fField3(,,,)(,,,)cc'$fField3(,,)(,,)cc'$fField2(,,,,,,,,)(,,,,,,,,)bb'$fField2(,,,,,,,)(,,,,,,,)bb'$fField2(,,,,,,)(,,,,,,)bb'$fField2(,,,,,)(,,,,,)bb'$fField2(,,,,)(,,,,)bb'$fField2(,,,)(,,,)bb'$fField2(,,)(,,)bb'$fField2(,)(,)bb'$fField1(,,,,,,,,)(,,,,,,,,)aa'$fField1(,,,,,,,)(,,,,,,,)aa'$fField1(,,,,,,)(,,,,,,)aa'$fField1(,,,,,)(,,,,,)aa'$fField1(,,,,)(,,,,)aa'$fField1(,,,)(,,,)aa'$fField1(,,)(,,)aa'$fField1(,)(,)aa'Char$Just MonadReadercontainers-0.5.0.0 Data.Set.BaseSetOrd$fProjectiveProjects'b'$fProjective(->)adreturn<*>>>=mapMFoldable$fRepresentable(->)Eq$fRepresentableIdentityControl.Monad.Trans.RWS.Strict Control.Monad.Trans.State.StrictControl.Monad.Trans.Error$fMagnify(->)(->)Accessorba$fMagnifyIdentityTIdentityTkba$fMagnifyRWSTRWSTEffectRWSba$fMagnifyRWSTRWSTEffectRWSba0$fMagnifyReaderTReaderTEffectba$fZoomErrorTErrorTFocusingErrst$fZoomMaybeTMaybeTFocusingMayst$fZoomListTListTFocusingOnst"$fZoomWriterTWriterTFocusingPlusst#$fZoomWriterTWriterTFocusingPlusst0$fZoomRWSTRWSTFocusingWithst$fZoomRWSTRWSTFocusingWithst0$fZoomIdentityTIdentityTkst$fZoomReaderTReaderTkst$fZoomStateTStateTFocusingst$fZoomStateTStateTFocusingst0unordered-containers-0.2.2.1 Data.HashSetHashSethashable-1.1.2.5 Data.HashableHashableGHC.Listrepeat replicateiterateevenGHC.Enumsucc takeWhile dropWhileTrue sequenceA_asum Alternativemsum MonadPluselemnotElem concatMapconcatlengthhead listToMaybelastFalsenullmaximum fromMaybeGHC.ErrerrorminimumOrdering minimumByfor sequenceAforMsequence unwrapMonad WrapMonadscanr1scanl1template-haskellLanguage.Haskell.TH.SyntaxnewNameName$fSubstTypePred $fSubstType[]$fSubstTypeType$fHasTypeVars[]$fHasTypeVarsPred$fHasTypeVarsType$fHasTypeVarsName$fHasTypeVarsTyVarBndr $fHasNameCon $fHasNameName$fHasNameTyVarBndrGHC.ShowShowGHC.ReadReadnegate==OutwithOutinsouts unsafeOuts$fApplicativeOut $fFunctorOut $fPlatedTree $fPlated[]CoilStringDouble>=peelTrackForkrecoilSnoc restoreTrack restoreTrack1unsafelyRestoreTrack $fZipper:>c $fZipperTopaData.IntMap.Base Data.Map.Basefind$fFunctorWithIndexIntSeq$fFunctorWithIndexInt[]$fTraversableWithIndexkHashMap$fFoldableWithIndexkHashMap$fFunctorWithIndexkHashMap$fTraversableWithIndexkMap$fFoldableWithIndexkMap$fFunctorWithIndexkMap$fTraversableWithIndexIntIntMap$fFoldableWithIndexIntIntMap$fFunctorWithIndexIntIntMap$fTraversableWithIndexIntSeq$fFoldableWithIndexIntSeq$fTraversableWithIndexInt[]$fFoldableWithIndexInt[]freshMap makeIsoLenses getLensFields_lensIso _lensField _lensClass _lensFlags makeIsoTo makeIsoFrom makeIsoBody makeLensBodyplainappArgsappsappsTmakeFieldLensBodymakeFieldLenses unifyTypes GHC.GenericsGenericData.Typeable.InternalTypeable tinplated maybeArg1Of$fGTraversal:.:$fGTraversalM1$fGTraversal:+:$fGTraversal:*:$fGTraversalU1$fGTraversalK1 GHC.Exception Exception SomeException Data.Bits.|.Bits.&.bitSize undefined integer-gmpGHC.Integer.TypeInteger++bytestring-0.10.0.0Data.ByteString.Internal ByteStringGHC.WordWord8Data.ByteString.Lazy.Internal$fIsByteStringByteString$fIsByteStringByteString0realPartpolar magnitudephase Data.DatagmapMDatainlinePerformIOGHC.IOunsafePerformIOFollowerOracle fromOracleAnswerMissFollowHitCacheHitMapDataBox dataBoxKey _dataBoxValstepdataBox sybChildren emptyHitMap insertHitMapfixEqcachereadCacheFollowerinsert2hitTest biplateData uniplateDatapartfollower$fFunctorOracle$fFunctorAnswer Data.DynamicDynamicData.IntSet.BaseIntSetmappendDualEndoAllAnySumProductFirstLast Data.SequenceSeqViewLviewlViewRviewrunviewlunviewr text-0.11.2.3 Data.TextData.Text.Lazy.InternalData.Text.Lazy $fIsTextText $fIsTextText0 Data.TreeTree subForest Data.Typeablecastgcast array-0.4.0.1Data.Array.BaseIArray!//ixmapboundsamapFilePathparallel-3.2.0.3Control.Parallel.StrategiesStrategyevalTraversableEvalparTraversablerdeepseq Control.Seq seqFoldable