[,      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~                             !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789: ; < = >!?!@!A!B!C"D#E#F$G$H$I%J%K%L%M%N%O%P%Q%R%S%T%U&V&W&X&Y&Z&[&\&]&^&_'`'a(b(c)d)e)f*g*h+i+j,k,l,m-n-o-p-q-r-s-t-u-v-w-x-y.z.{.|.}/~00001 Rank2Types provisionalEdward Kmett <ekmett@gmail.com> Safe-Infered'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     from (from l) = l If you imported  from Control.Category, then:  from l . from r = from (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> Safe-Infered#   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  . 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 (1 )#when the user attempts to misuse a 2 as a  Getter., 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 3. 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 4 of a 3. !!The result of trying to find the nth 4 of a 3. % Used for  5 ( Used for  6 +Used internally by 7 and the like. .Used internally by 8 and the like. 1Applicative composition of 9:  with a , used  by ; 4The result of 1 60The indexed store can be used to characterize a  <  and is used by  = 8Used by  > to  ? into @A ;Make a monoid out of  for error handling >Used by  > to  ? into @A AMake a monoid out of  for error handling DUsed by  > to  ? into BC or DE GUsed by  > to  ? into FG. JUsed by  > to  ? into HI MUsed by  > to  ? into JK PObtain the minimum. QObtain the maximum RAGiven an action to run for each matched pair, traverse a bazaar. S is an indexed . T A trivial . U.A convenient antonym that is used internally.  L so you can pass our a Setter, into combinators from other lens libraries 0This instance is a lie, but it is a useful lie.  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUM  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUM67MNOJKLGHIDEF89:;<=>?@ABC./0+,-12345(*)P%'&Q !$#"RSTU V    !$#"%'&(*)+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTU"rank 2 types, MPTCs, TFs, flexible provisionalEdward Kmett <ekmett@gmail.com> Safe-Infered VYA function with access to a index. This constructor may be useful when you need to store  a Y in a container to avoid ImpredicativeTypes. Y*Type alias for passing around polymorphic Z functions that can be called X or  directly as a function ZbPermit overloading of function application for things that also admit a notion of a key or index. Provides overloading for Z functions. [Build a function from an Z function \ Compose an Z' function with a non-indexed function. Mnemonically, the <* points to the index we want to preserve. ]'Compose a non-indexed function with an Z function. Mnemonically, the >* points to the index we want to preserve. ^Remap the index. _Composition of Z functions Mnemonically, the  @ and @: points to the fact that we want to preserve the indices. `Composition of Z> functions with a user supplied function for combining indexs aRTransform an Traversal into an IndexedTraversal, a Fold into an IndexedFold, etc.   a ::  Traversal a b c d -> IndexedTraversal  a b c d  a :: Lens a b c d ->  IndexedLens  a b c d  a :: Fold a b ->  IndexedFold  a b  a :: Iso a b c d ->  IndexedLens  a b c d  a :: Getter a b ->  IndexedGetter  a b c d CUsing an equality witness to avoid potential overlapping instances  and aid dispatch. VWXYZ[\]^_`a VWXYZ[\]^_`a Z[YVWX_\]`^a VWXYZ[\]^_`arank 2 types, MPTCs experimentalEdward Kmett <ekmett@gmail.com> Safe-InferedbUseful for storage. eUsed to consume an M. fEvery f is a valid M and Getter. bcdefbcdeffebcdbcdef"rank 2 types, MPTCs, TFs, flexible provisionalEdward Kmett <ekmett@gmail.com> Safe-InferedgUseful for storage. jEvery j is a valid  N. kFold an j 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  P& is more flexible in what it accepts.   P l = k l .    k :: f+ i a c -> (i -> c -> m) -> a -> m  k ::  m => j- i a c -> (i -> c -> m) -> a -> m  k :: Q' i a c -> (i -> c -> m) -> a -> m  k ::  m => R" i a c -> (i -> c -> m) -> a -> m lJRight-associative fold of parts of a structure that are viewed through an j or O with  access to the index i.  When you don' t need access to the index then  S& is more flexible in what it accepts.   S l = l l .    l :: f5 i a c -> (i -> c -> e -> e) -> e -> a -> e  l :: j7 i a c -> (i -> c -> e -> e) -> e -> a -> e  l :: Q1 i a c -> (i -> c -> e -> e) -> e -> a -> e  l :: R, i a c -> (i -> c -> e -> e) -> e -> a -> e mMLeft-associative fold of the parts of a structure that are viewed through an j or O with  access to the index i.  When you don' t need access to the index then  T& is more flexible in what it accepts.   T l = m l .    m :: f5 i a c -> (i -> e -> c -> e) -> e -> a -> e  m :: j7 i a c -> (i -> e -> c -> e) -> e -> a -> e  m :: Q1 i a c -> (i -> e -> c -> e) -> e -> a -> e  m :: R, i a c -> (i -> e -> c -> e) -> e -> a -> e n4Return whether or not any element viewed through an j or O / satisfy a predicate, with access to the index i.  When you don' t need access to the index then  U& is more flexible in what it accepts.   U l = n l .    n :: f i a c -> (i -> c ->  ) -> a ->   n :: j i a c -> (i -> c ->  ) -> a ->   n :: Q i a c -> (i -> c ->  ) -> a ->   n :: R i a c -> (i -> c ->  ) -> a ->  o5Return whether or not all elements viewed through an j or O / satisfy a predicate, with access to the index i.  When you don' t need access to the index then  V& is more flexible in what it accepts.   V l = o l .    o :: f i a c -> (i -> c ->  ) -> a ->   o :: j i a c -> (i -> c ->  ) -> a ->   o :: Q i a c -> (i -> c ->  ) -> a ->   o :: R i a c -> (i -> c ->  ) -> a ->  pTraverse the targets of an j or O with access to the index i, discarding the results.  When you don' t need access to the index then  8& is more flexible in what it accepts.   8 l =  itraverseOf l .    p ::  f => f0 i a c -> (i -> c -> f e) -> a -> f ()  p ::  f => j2 i a c -> (i -> c -> f e) -> a -> f ()  p ::  f => Q, i a c -> (i -> c -> f e) -> a -> f ()  p ::  f => R' i a c -> (i -> c -> f e) -> a -> f () qTraverse the targets of an j or O2 with access to the index, discarding the results  (with the arguments flipped).  q =  . p When you don' t need access to the index then  W& is more flexible in what it accepts.   W l a = q l a .    q ::  f => f0 i a c -> a -> (i -> c -> f e) -> f ()  q ::  f => j2 i a c -> a -> (i -> c -> f e) -> f ()  q ::  f => Q, i a c -> a -> (i -> c -> f e) -> f ()  q ::  f => R' i a c -> a -> (i -> c -> f e) -> f () r*Run monadic actions for each target of an j or O with access to the index,  discarding the results.  When you don' t need access to the index then  X& is more flexible in what it accepts.   X l = imapMOf l .    r ::  m => f0 i a c -> (i -> c -> m e) -> a -> m ()  r ::  m => j2 i a c -> (i -> c -> m e) -> a -> m ()  r ::  m => Q, i a c -> (i -> c -> m e) -> a -> m ()  r ::  m => R' i a c -> (i -> c -> m e) -> a -> m () s*Run monadic actions for each target of an j or O with access to the index, 6 discarding the results (with the arguments flipped).  s =  . r When you don' t need access to the index then  Y& is more flexible in what it accepts.   Y l a = iforMOf l a .    s ::  m => f0 i a c -> a -> (i -> c -> m e) -> m ()  s ::  m => j2 i a c -> a -> (i -> c -> m e) -> m ()  s ::  m => Q, i a c -> a -> (i -> c -> m e) -> m ()  s ::  m => R' i a c -> a -> (i -> c -> m e) -> m () t<Concatenate the results of a function of the elements of an j or O  with access to the index.  When you don' t need access to the index then  Z' is more flexible in what it accepts.     Z l = t l .   t = k    t :: f i a c -> (i -> c -> [e] ) -> a -> [e]  t :: j" i a c -> (i -> c -> [e] ) -> a -> [e]  t :: Q i a c -> (i -> c -> [e] ) -> a -> [e]  t :: R i a c -> (i -> c -> [e] ) -> a -> [e] uThe findOf function takes an j 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  if there is no such element.  When you don' t need access to the index then  [& is more flexible in what it accepts.   [ l = u l .    u :: f a c -> (i -> c ->  ) -> a ->  (i, c)  u :: j a c -> (i -> c ->  ) -> a ->  (i, c)  u :: Q a c -> (i -> c ->  ) -> a ->  (i, c)  u :: R a c -> (i -> c ->  ) -> a ->  (i, c) vStrictly< 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 = v l .    v :: f5 i a c -> (i -> c -> e -> e) -> e -> a -> e  v :: j7 i a c -> (i -> c -> e -> e) -> e -> a -> e  v :: Q1 i a c -> (i -> c -> e -> e) -> e -> a -> e  v :: R, i a c -> (i -> c -> e -> e) -> e -> a -> e wRFold 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 = w l .    w :: f7 i a c -> (i -> e -> c -> e) -> e -> a -> e  w :: j9 i a c -> (i -> e -> c -> e) -> e -> a -> e  w :: Q3 i a c -> (i -> e -> c -> e) -> e -> a -> e  w :: R. i a c -> (i -> e -> c -> e) -> e -> a -> e xCMonadic 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 = x l .    x ::  m => f7 i a c -> (i -> c -> e -> m e) -> e -> a -> e  x ::  m => j9 i a c -> (i -> c -> e -> m e) -> e -> a -> e  x ::  m => Q3 i a c -> (i -> c -> e -> m e) -> e -> a -> e  x ::  m => R. i a c -> (i -> c -> e -> m e) -> e -> a -> e yVMonadic 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 = y l .    w ::  m => f9 i a c -> (i -> e -> c -> m e) -> e -> a -> e  w ::  m => j; i a c -> (i -> e -> c -> m e) -> e -> a -> e  w ::  m => Q5 i a c -> (i -> e -> c -> m e) -> e -> a -> e  w ::  m => R0 i a c -> (i -> e -> c -> m e) -> e -> a -> e z.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 =   . z l   z :: f i a c -> a -> [(i,c)]  z :: j i a c -> a -> [(i,c)]  z :: Q i a c -> a -> [(i,c)]  z :: R i a c -> a -> [(i,c)] { Obtain an j by filtering a a, f, j or O. | Obtain an j! by taking elements from another j, a, f or O while a predicate holds. } Obtain an j# by dropping elements from another j, a, f or O while a predicate holds. ghijklmnopqrstuvwxyz{|}ghijklmnopqrstuvwxyz{|}jklmnopqrstuvwxyz{|}ghighijklmnopqrstuvwxyz{|}MTPCs, FDs, Rank2 experimentalEdward Kmett <ekmett@gmail.com> Safe-Infered~Used to evaluate an . A  is a Fold enriched with access to a  for side-effects. Every Fold can be used as a (, that simply ignores the access to the . You can compose a  with another  using ( ) from the Prelude. An  is a Getter enriched with access to a  for side-effects. Every Getter can be used as an  You can compose an  with another  using ( ) from the Prelude.  Perform an .  perform = flip (^!)  Perform an  import Control.Lens&["hello","world"]^!folded.act putStrLnhelloworld Construct an  from a monadic side-effect A self-running , analogous to bc.   =  import Control.Lens(1,"hello")^!_2.acts.to succ"ifmmp"Apply a  transformer to an . ~~~~ Rank2Types provisionalEdward Kmett <ekmett@gmail.com> Safe-Infered$ type  =  d :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 =  d A Simple Setter is just a  that doesn't change the types. NThese are particularly common when talking about monomorphic containers. e.g.   Data.Text.map ::  ef  type  =  d  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 Identity, we get nicer error messages.  The only  <-like law that can apply to a  l is that   l c ( l b a) =  l c aYou can't view a 3 in general, so the other two laws are irrelevant.  However, two  laws apply to a :     l  =    l f .  l g =  l (f . g) "These an be stated more directly:    l  =   l f .   . l g = l (f .   . g) You can compose a  with a  < or a 3 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 .    =    gh =  gi  () =   )Build a Setter from a map-like function. Your supplied function f is required to satisfy:    f  =   f g  f h = f (g  h) Equational reasoning:     .  =    .  =  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 3  with a function.     =    gh =  gi   .  =    .  =  Another way to view " is to say that it transformers a  into a  "semantic editor combinator".  ::  a b c d -> (c -> d) -> a -> bModify the target of a  < or all the targets of a  or 3 ' with a function. This is an alias for # that is provided for consistency.     =    =     fmapDefault =  traverse   .  =    .  =      :: $ a b c d -> (c -> d) -> a -> b   :: j' a b c d -> (c -> d) -> a -> b   ::  <& a b c d -> (c -> d) -> a -> b   :: 3! a b c d -> (c -> d) -> a -> b Replace the target of a  < or all of the targets of a   or 3 with a constant value.  () =  import Control.Lensset _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.    ::  a b c d -> d -> a -> b   :: j a b c d -> d -> a -> b   ::  < a b c d -> d -> a -> b   :: 3 a b c d -> d -> a -> b Modifies the target of a  < or all of the targets of a  or  3 with a user supplied function. This is an infix version of      f =   f  gh f = traverse  f import Control.Lens_2 %~ length $ (1,"hello")(1,5)   () :: " a b c d -> (c -> d) -> a -> b  () :: j% a b c d -> (c -> d) -> a -> b  () ::  <$ a b c d -> (c -> d) -> a -> b  () :: 3 a b c d -> (c -> d) -> a -> b Replace the target of a  < or all of the targets of a   or 3 with a constant value. This is an infix version of !, provided for consistency with ()  f  a =   f  aimport Control.Lens_1 .~ "hello" $ (42,"world")("hello","world")   () ::  a b c d -> d -> a -> b  () :: j a b c d -> d -> a -> b  () ::  < a b c d -> d -> a -> b  () :: 3 a b c d -> d -> a -> b 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  d directly is a good idea.   (\<.~) ::  a b c d -> d -> a -> (d, b)  (\<.~) :: j# a b c d -> d -> a -> (d, b)  (\<.~) ::  <" a b c d -> d -> a -> (d, b)  (\<.~) :: 3 a b c d -> d -> a -> (d, b) 0Increment the target(s) of a numerically valued  <,  or 3 import Control.Lens_1 +~ 1 $ (1,2)(2,2)   () :: Num c =>  a b c c -> c -> a -> b  () :: Num c => j a b c c -> c -> a -> b  () :: Num c =>  < a b c c -> c -> a -> b  () :: Num c => 3 a b c c -> c -> a -> b /Multiply the target(s) of a numerically valued  <, j,  or 3 import Control.Lens_2 *~ 4 $ (1,2)(1,8)   () ::  c =>  a b c c -> c -> a -> b  () ::  c => j a b c c -> c -> a -> b  () ::  c =>  < a b c c -> c -> a -> b  () ::  c => 3 a b c c -> c -> a -> b 0Decrement the target(s) of a numerically valued  <, j,  or 3 import Control.Lens_1 -~ 2 $ (1,2)(-1,2)   (-~) ::  c =>  a b c c -> c -> a -> b  (-~) ::  c => j a b c c -> c -> a -> b  (-~) ::  c =>  < a b c c -> c -> a -> b  (-~) ::  c => 3 a b c c -> c -> a -> b -Divide the target(s) of a numerically valued  <, j,  or 3   (\/\/~) ::  c =>  a b c c -> c -> a -> b  (\/\/~) ::  c => j a b c c -> c -> a -> b  (\/\/~) ::  c =>  < a b c c -> c -> a -> b  (\/\/~) ::  c => 3 a b c c -> c -> a -> b ,Raise the target(s) of a numerically valued  <,  or 3" to a non-negative integral power import Control.Lens_2 ^~ 2 $ (1,3)(1,9)-Raise the target(s) of a fractionally valued  <,  or 3 to an integral power import Control.Lens_2 ^^~ (-1) $ (1,2)(1,0.5)   () :: ( c,  e) =>  a b c c -> e -> a -> b  () :: ( c,  e) => j a b c c -> e -> a -> b  () :: ( c,  e) =>  < a b c c -> e -> a -> b  () :: ( c,  e) => 3 a b c c -> e -> a -> b /Raise the target(s) of a floating-point valued  <,  or 3 to an arbitrary power. import Control.Lens_2 **~ pi $ (1,3)(1,31.54428070019754)   () ::  c =>  a b c c -> c -> a -> b  () ::  c => j a b c c -> c -> a -> b  () ::  c =>  < a b c c -> c -> a -> b  () ::  c => 3 a b c c -> c -> a -> b  Logically  the target(s) of a -valued  < or  :m + Control.Lensboth ||~ True $ (False,True) (True,True)both ||~ False $ (False,True) (False,True)   (||~)::  a b   ->  -> a -> b  (||~):: j a b   ->  -> a -> b  (||~)::  < a b   ->  -> a -> b  (||~):: 3 a b   ->  -> a -> b  Logically  the target(s) of a -valued  < or  :m + Control.Lensboth &&~ True $ (False, True) (False,True)both &&~ False $ (False, True) (False,False)   (&&~)::  a b   ->  -> a -> b  (&&~):: j a b   ->  -> a -> b  (&&~)::  < a b   ->  -> a -> b  (&&~):: 3 a b   ->  -> a -> b Replace the target of a  < or all of the targets of a  or 3 in our monadic 2 state with a new value, irrespective of the old.    () ::  a m => j" a a c d -> d -> m ()  () ::  a m =>  <! a a c d -> d -> m ()  () ::  a m => 3 a a c d -> d -> m ()  () ::  a m =>  a a c d -> d -> 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 3 in our monadic state.   () ::  a m => j) a a c d -> (c -> d) -> m ()  () ::  a m =>  <( a a c d -> (c -> d) -> m ()  () ::  a m => 3# a a c d -> (c -> d) -> m ()  () ::  a m => & a a c d -> (c -> d) -> m () Modify the target(s) of a  d  <, j,  or 3 by adding a value  Example:   $ fresh :: MonadState Int m => m Int  fresh = do    1  use     () :: ( a m,  b) =>  d  a b -> b -> m ()  () :: ( a m,  b) =>  d j a b -> b -> m ()  () :: ( a m,  b) =>  d  < a b -> b -> m ()  () :: ( a m,  b) =>  d 3 a b -> b -> m () Modify the target(s) of a  d  <, j,  or 3 by subtracting a value   (-=) :: ( a m,  b) =>  d  a b -> b -> m ()  (-=) :: ( a m,  b) =>  d j a b -> b -> m ()  (-=) :: ( a m,  b) =>  d  < a b -> b -> m ()  (-=) :: ( a m,  b) =>  d 3 a b -> b -> m () Modify the target(s) of a  d  <, j,  or 3 by multiplying by value.   ballSpeed  k  speedMultiplier   () :: ( a m,  b) =>  d  a b -> b -> m ()  () :: ( a m,  b) =>  d j a b -> b -> m ()  () :: ( a m,  b) =>  d  < a b -> b -> m ()  () :: ( a m,  b) =>  d 3 a b -> b -> m () Modify the target(s) of a  d  <, j,  or 3 by dividing by a value.   () :: ( a m,  b) =>  d  a b -> b -> m ()  () :: ( a m,  b) =>  d j a b -> b -> m ()  () :: ( a m,  b) =>  d  < a b -> b -> m ()  () :: ( a m,  b) =>  d 3 a b -> b -> m () ,Raise the target(s) of a numerically valued  <,  or 3# to a non-negative integral power.   () :: ( a m,  b,  c) =>  d  a b -> c -> m ()  () :: ( a m,  b,  c) =>  d j a b -> c -> m ()  () :: ( a m,  b,  c) =>  d  < a b -> c -> m ()  () :: ( a m,  b,  c) =>  d 3 a b -> c -> m () ,Raise the target(s) of a numerically valued  <,  or 3 to an integral power.   () :: ( a m,  b,  c) =>  d  a b -> c -> m ()  () :: ( a m,  b,  c) =>  d j a b -> c -> m ()  () :: ( a m,  b,  c) =>  d  < a b -> c -> m ()  () :: ( a m,  b,  c) =>  d 3 a b -> c -> m () ,Raise the target(s) of a numerically valued  <,  or 3 to an arbitrary power   () :: ( a m,  b) =>  d  a b -> b -> m ()  () :: ( a m,  b) =>  d j a b -> b -> m ()  () :: ( a m,  b) =>  d  < a b -> b -> m ()  () :: ( a m,  b) =>  d 3 a b -> b -> m () Modify the target(s) of a  d  <, j,  or 3 by taking their logical  with a value   (&&=)::  a m =>  d  a  ->  -> m ()  (&&=)::  a m =>  d j a  ->  -> m ()  (&&=)::  a m =>  d  < a  ->  -> m ()  (&&=)::  a m =>  d 3 a  ->  -> m () Modify the target(s) of a  d  <, 'Iso,  or 3 by taking their logical  with a value   (||=)::  a m =>  d  a  ->  -> m ()  (||=)::  a m =>  d j a  ->  -> m ()  (||=)::  a m =>  d  < a  ->  -> m ()  (||=)::  a m =>  d 3 a  ->  -> m () 6Run a monadic action, and set all of the targets of a  <,  or 3 to its result.    (\<~) ::  a m => j a a c d -> m d -> m ()  (\<~) ::  a m =>  < a a c d -> m d -> m ()  (\<~) ::  a m => 3 a a c d -> m d -> m ()  (\<~) ::  a m =>  a a c d -> m d -> 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 3. Set 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   (\<.=) ::  a m =>  a a c d -> d -> m d  (\<.=) ::  a m => j a a c d -> d -> m d  (\<.=) ::  a m =>  < a a c d -> d -> m d  (\<.=) ::  a m => 3 a a c d -> d -> m d &&&$  Rank2Types provisionalEdward Kmett <ekmett@gmail.com> Safe-Infered *Useful for storing getters in containers. Most - combinators are able to be used with both a  or a   N2 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  <, 3 and  j. we also restricted choices of the irrelevant b and  d parameters. If a function accepts a  r a c , then when r is a Monoid, then  you can pass a  N (or  3&), otherwise you can only pass this a   or  <. A ? describes how to retrieve a single value in a way that can be . composed with other lens-like constructions.  Unlike a  < a  is read-only. Since a  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 -> c).  Moreover, a  can be used directly as a  N,  since it just ignores the  Applicative. Build a % from an arbitrary Haskell function.   f .  g =  (g . f) a   f = f aimport Control.Lens(0, -5)^._2.to abs5View the value pointed to by a , j or   <4 or the result of folding over all the results of a   N or 3 that points  at a monoidal values.   .  = import Control.Lensview _2 (1,"hello")"hello"It may be useful to think of " as having these more restrictive  signatures:    ::  a c -> a -> c   :: Monoid m =>  N a m -> a -> m   ::  d j a c -> a -> c   ::  d  < a c -> a -> c   :: Monoid m =>  d 3 a m -> a -> m View the value of a , j,   <5 or the result of folding over the result of mapping  the targets of a  N or  3. It may be useful to think of " as having these more restrictive  signatures: import Control.Lensviews _2 length (1,"hello")5    :: ' a c -> (c -> d) -> a -> d   :: Monoid m =>  N) a c -> (c -> m) -> a -> m   ::  d j# a c -> (c -> d) -> a -> d   ::  d  <" a c -> (c -> d) -> a -> d   :: Monoid m =>  d 3 a c -> (c -> m) -> a -> m View the value pointed to by a , j or   <4 or the result of folding over all the results of a   N or 3 that points  at a monoidal values. This is the same operation as , only infix. import Control.Lens_2 ^$ (1, "hello")"hello"   () ::  a c -> a -> c  () :: Monoid m =>  N a m -> a -> m  () ::  d j a c -> a -> c  () ::  d  < a c -> a -> c  () :: Monoid m =>  d 3 a m -> a -> m View the value pointed to by a  or  < or the - result of folding over all the results of a  N or  3# 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 () :m + Data.Complex Control.Lens$((0, 1 :+ 2), 3)^._1._2.to magnitude2.23606797749979   () :: a ->  a c -> c  () :: Monoid m => a ->  N a m -> m  () :: a ->  d j a c -> c  () :: a ->  d  < a c -> c  () :: Monoid m => a ->  d 3 a m -> m Use the target of a  <, j, or  - in the current state, or use a summary of a   N or 3 that points  to a monoidal value.    ::  a m =>  a c -> m c   :: ( a m, Monoid r) =>  N a r -> m r   ::  a m =>  d j a c -> m c   ::  a m =>  d  < a c -> m c   :: ( a m, Monoid r) =>  d 3 a r -> m r Use the target of a  <, j or  - in the current state, or use a summary of a   N or 3 that  points to a monoidal value.    ::  a m => " a c -> (c -> e) -> m e   :: ( a m, Monoid r) =>  N$ a c -> (c -> r) -> m r   ::  a m =>  d  < a c -> (c -> e) -> m e   ::  a m =>  d j a c -> (c -> e) -> m e   :: ( a m, Monoid r) =>  d 3 a c -> (c -> r) -> m r Query the target of a  <, j or  - in the current state, or use a summary of a   N or 3 that points  to a monoidal value.    ::  a m =>  a c -> m c   :: ( a m, Monoid c) =>  N a c -> m c   ::  a m =>  d j a c -> m c   ::  a m =>  d  < a c -> m c   :: ( a m, Monoid c) =>  d 3 a c -> m c Use the target of a  <, j or  - in the current state, or use a summary of a   N or 3 that points  to a monoidal value.    ::  a m => " a c -> (c -> e) -> m e   :: ( a m, Monoid c) =>  N$ a c -> (c -> e) -> m e   ::  a m =>  d j a c -> (c -> e) -> m e   ::  a m =>  d  < a c -> (c -> e) -> m e   :: ( a m, Monoid c) =>  d 3 a c -> (c -> e) -> m e   portable provisionalEdward Kmett <ekmett@gmail.com> Safe-InferedThis % can be used to change the type of a  by mapping  the elements to new values. Sadly, you can't create a valid  Traversal for a , but you can  manipulate it by reading using folded and reindexing it via setmap. :m + Data.Set.Lens Control.Lens(over setmapped (+1) (fromList [1,2,3,4])fromList [2,3,4,5]Construct a set from a , Fold,  Traversal, Lens or Iso. :m + Data.Set.Lens Control.Lens5setOf (folded._2) [("hello",1),("world",2),("!!!",3)]fromList [1,2,3]   setOf ::  a c -> a ->  c  setOf ::  c => Fold a c -> a ->  c  setOf :: Simple Iso a c -> a ->  c  setOf :: Simple Lens a c -> a ->  c  setOf ::  c => Simple  Traversal a c -> a ->  c  portable provisionalEdward Kmett <ekmett@gmail.com> Safe-InferedThis % can be used to change the type of a  by mapping  the elements to new values. Sadly, you can't create a valid  Traversal for a Set, but you can  manipulate it by reading using folded and reindexing it via setmap. :m + Data.HashSet Control.Lens(over setmapped (+1) (fromList [1,2,3,4])fromList [2,3,4,5]Construct a set from a , Fold,  Traversal, Lens or Iso. :m + Control.Lens5setOf (folded._2) [("hello",1),("world",2),("!!!",3)]fromList [1,2,3]   setOf ::  c =>  a c -> a ->  c  setOf :: ( c,  c) => Fold a c -> a ->  c  setOf ::  c => Simple Iso a c -> a ->  c  setOf ::  c => Simple Lens a c -> a ->  c  setOf :: ( c,  c) => Simple  Traversal a c -> a ->  c   Rank2Types provisionalEdward Kmett <ekmett@gmail.com> Safe-Infered$ type  =  )Useful for storing lenses in containers. type  k f a b =  ( k f) a b type  f a b c d =  (->) f a b c dMany combinators that accept a  can also accept a  3 in limited situations. 'They do so by specializing the type of  that they require of the  caller. If a function accepts a  f a b c d for some  f,  then they may be passed a .  Further, if f is an , they may also be passed a  3. type  f =  ( f) type  =  A  ,  3 , ... can  be used instead of a ,3, ...  whenever the type variables don't change upon setting a value.     l ::   (mn a) a  o ::  p3 [a] a .Note: To use this alias in your own code with  f or  2, 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:   q l (r l b a) = b"2) Putting back what you got doesn't change anything:  r l ( q l a) a = a.3) Setting twice is the same as setting once:  r l c (r l b a) = r 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 Setter or  3. You can also use a  for  s as if it were a   N or  t. Since every lens is a valid 3, the < traversal laws should also apply to any lenses you create.    l  =    (l f) . l g = uv . l (uw .  f . g)  type  a b c d = forall f.  f =>  f a b c dBuild a  from a getter and a setter. J lens :: Functor f => (a -> c) -> (a -> d -> b) -> (c -> f d) -> a -> f b (') 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 3, 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:  () =    () ::  f => j) a b c d -> (c -> f d) -> a -> f b  () ::  f => ( a b c d -> (c -> f d) -> a -> f b  () ::  f => 3# a b c d -> (c -> f d) -> a -> f b DIt may be beneficial to think about it as if it had these even more  restrictive types, however: When applied to a 3, it can edit the  targets of the  Traversals-, extracting a supplemental monoidal summary  of its actions, by choosing  f = ((,) m)   () :: j/ a b c d -> (c -> (e, d)) -> a -> (e, b)  () :: . a b c d -> (c -> (e, d)) -> a -> (e, b)  () :: Monoid m => 3) a b c d -> (c -> (m, d)) -> a -> (m, b) Modify the target of a + in the current state returning some extra  information of c or modify all targets of a  3( in the current state, extracting extra  information of type c/ and return a monoidal summary of the changes.  () = ( )It may be useful to think of ($), instead, as having either of the , following more restricted type signatures:   () ::  a m => j& a a c d -> (c -> (e, d) -> m e  () ::  a m => % a a c d -> (c -> (e, d) -> m e  () :: ( a m, Monoid e) => 3 a a c d -> (c -> (e, d) -> m e 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.  makes a ) from two other lenses (or isomorphisms)  Cloning a ) is one way to make sure you arent given  something weaker, such as a 3 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 . "/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, (x) is more flexible. -Increment the target of a numerically valued  and return the result 2When you do not need the result of the addition, (x) is more flexible. -Decrement the target of a numerically valued  and return the result 5When you do not need the result of the subtraction, (y) is more flexible. ,Multiply the target of a numerically valued  and return the result 8When you do not need the result of the multiplication, (z ) is more  flexible. +Divide the target of a fractionally valued  and return the result. 2When you do not need the result of the division, ({) is more flexible. )Raise the target of a numerically valued  to a non-negative   power and return the result 2When you do not need the result of the division, (|) is more flexible. *Raise the target of a fractionally valued  to an  power  and return the result. 2When you do not need the result of the division, (}) is more flexible. ,Raise the target of a floating-point valued  to an arbitrary power  and return the result. 2When you do not need the result of the division, (~) is more flexible.  Logically  a Boolean valued  and return the result 3When you do not need the result of the operation, () is more flexible.  Logically  a Boolean valued  and return the result 3When you do not need the result of the operation, () is more flexible. Modify the target of a  into your monad's state by a user supplied ! function and return the result. 3When you do not need the result of the operation, () is more flexible. *Add to the target of a numerically valued  into your monad's state  and return the result. 8When you do not need the result of the multiplication, ( ) is more  flexible. 1Subtract from the target of a numerically valued  into your monad's  state and return the result. 8When you do not need the result of the multiplication, ( ) is more  flexible. ,Multiply the target of a numerically valued  into your monad's  state and return the result. 8When you do not need the result of the multiplication, ( ) is more  flexible. +Divide the target of a fractionally valued  into your monad's state  and return the result. 2When you do not need the result of the division, () is more flexible. )Raise the target of a numerically valued  into your monad's state  to a non-negative  power and return the result. 3When you do not need the result of the operation, () is more flexible. *Raise the target of a fractionally valued  into your monad's state  to an  power and return the result. 3When you do not need the result of the operation, () is more flexible. ,Raise the target of a floating-point valued  into your monad's 4 state to an arbitrary power and return the result. 3When you do not need the result of the operation, () is more flexible.  Logically  a Boolean valued  into your monad's state and return  the result. 3When you do not need the result of the operation, () is more flexible.  Logically  a Boolean valued  into your monad's state and return  the result. 3When you do not need the result of the operation, () is more flexible. &&&$  Rank2Types provisionalEdward Kmett <ekmett@gmail.com> Safe-Infered5(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  a cC 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 c), then there should be a  fooOf method that takes a  a c and a value of type a. A  is a legal  that just ignores the supplied   Unlike a 3 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 fold that replicates its input n times.  n =  ( n)ITransform a fold into a fold that loops over its elements over and over. import Control.Lens+take 6 $ toListOf (cycled traverse) [1,2,3] [1,2,3,1,2,3]2Build a fold that unfolds its values from a seed.  =  . x ^.  f5 Return an infinite fold of repeated applications of f to x. ' toListOf (iterated f) a = iterate f a  Obtain a  by filtering a , j, ,  or 3. .This allows you to traverse the elements of a 3 or  in the opposite order. Note:  should have no impact on a  Setter,  or j. To change the direction of an j, use from.  Obtain a ! by taking elements from another , , j,  or 3 while a predicate holds.   p =  ( p ))toListOf (takingWhile (<=3) folded) [1..][1,2,3] Obtain a # by dropping elements from another , , j,  or 3 while a predicate holds.   p =  ( p ),toListOf (droppingWhile (<=3) folded) [1..6][4,5,6]  =    =     :: % a c -> (c -> r) -> a -> r   ::  r => ' a c -> (c -> r) -> a -> r   ::   a c -> (c -> r) -> a -> r   ::  j! a c -> (c -> r) -> a -> r   ::  r =>  3 a c -> (c -> r) -> a -> r   =    =     ::  a m -> a -> m   ::  m =>  a m -> a -> m   ::   a m -> a -> m   ::  j a m -> a -> m   ::  m =>  3 a m -> a -> m IRight-associative fold of parts of a structure that are viewed through a , ,  or 3.   =      :: / a c -> (c -> e -> e) -> e -> a -> e   :: 1 a c -> (c -> e -> e) -> e -> a -> e   ::  * a c -> (c -> e -> e) -> e -> a -> e   ::  j+ a c -> (c -> e -> e) -> e -> a -> e   ::  3% a c -> (c -> e -> e) -> e -> a -> e LLeft-associative fold of the parts of a structure that are viewed through a , ,  or 3.   =      :: / a c -> (e -> c -> e) -> e -> a -> e   :: 1 a c -> (e -> c -> e) -> e -> a -> e   ::  * a c -> (e -> c -> e) -> e -> a -> e   ::  j+ a c -> (e -> c -> e) -> e -> a -> e   ::  3% a c -> (e -> c -> e) -> e -> a -> e #Extract a list of the targets of a  . See also ().     =    () =       ::  a c -> a -> [c]   ::  a c -> a -> [c]   ::   a c -> a -> [c]   ::  j a c -> a -> [c]   ::  3 a c -> a -> [c] (A convenient infix (flipped) version of .    :: a ->  a c -> [c]   :: a ->  a c -> [c]   :: a ->   a c -> [c]   :: a ->  j a c -> [c]   :: a ->  3 a c -> [c]   =      ::  a  -> a ->    ::  a  -> a ->    ::   a  -> a ->    ::  j a  -> a ->    ::  3 a  -> a ->    =      ::  a  -> a ->    ::  a  -> a ->    ::   a  -> a ->    ::  j a  -> a ->    ::  3 a  -> a ->    =      ::  a c -> (c ->  ) -> a ->    ::  a c -> (c ->  ) -> a ->    ::   a b c d -> (c ->  ) -> a ->    ::  j a b c d -> (c ->  ) -> a ->    ::  3 a b c d -> (c ->  ) -> a ->    =      ::  a c -> (c ->  ) -> a ->    ::  a c -> (c ->  ) -> a ->    ::   a c -> (c ->  ) -> a ->    ::  j a c -> (c ->  ) -> a ->    ::  3 a c -> (c ->  ) -> a ->    =      ::  a c -> a -> c   ::  c =>  a c -> a -> c   ::   a c -> a -> c   ::  j a c -> a -> c   ::  c =>  3 a c -> a -> c   =    _1 :: (a, b) -> a  ( . _1) :: ( f,  a) => f (a, b) -> a    ::  a c -> a -> c   ::  c =>  a c -> a -> c   ::   a c -> a -> c   ::  j a c -> a -> c   ::  c =>  3 a c -> a -> c When passed a ,  can work over a . When passed a ,  requires an .   =    _2 :: # f => (c -> f e) -> (c1, c) -> f ()   ::  f => (a -> f b) ->  a c -> f ()bThe rather specific signature of traverseOf_ allows it to be used as if the signature was either:    ::  f => * a c -> (c -> f e) -> a -> f ()   ::  f => , a c -> (c -> f e) -> a -> f ()   ::  f =>  % a c -> (c -> f e) -> a -> f ()   ::  f =>  j& a c -> (c -> f e) -> a -> f ()   ::  f =>  3 a c -> (c -> f e) -> a -> f ()   =      ::  f => * a c -> a -> (c -> f e) -> f ()   ::  f => , a c -> a -> (c -> f e) -> f ()   ::  f =>  % a c -> a -> (c -> f e) -> f ()   ::  f =>  j& a c -> a -> (c -> f e) -> f ()   ::  f =>  3 a c -> a -> (c -> f e) -> f ()   =      ::  f => ! a (f ()) -> a -> f ()   ::  f => # a (f ()) -> a -> f ()   ::  f =>   a (f ()) -> a -> f ()   ::  f =>  Iso a (f ()) -> a -> f ()   ::  f =>  3 a (f ()) -> a -> f ()  7 =      ::  m => * a c -> (c -> m e) -> a -> m ()   ::  m => , a c -> (c -> m e) -> a -> m ()   ::  m =>  % a c -> (c -> m e) -> a -> m ()   ::  m =>  j& a c -> (c -> m e) -> a -> m ()   ::  m =>  3 a c -> (c -> m e) -> a -> m ()   =      ::  m => * a c -> a -> (c -> m e) -> m ()   ::  m => , a c -> a -> (c -> m e) -> m ()   ::  m =>  % a c -> a -> (c -> m e) -> m ()   ::  m =>  j& a c -> a -> (c -> m e) -> m ()   ::  m =>  3 a c -> a -> (c -> m e) -> m ()   =      ::  m =>  a (m b) -> a -> m ()   ::  m => " a (m b) -> a -> m ()   ::  m =>   a (m b) -> a -> m ()   ::  m =>  j a (m b) -> a -> m ()   ::  m =>  3 a (m b) -> a -> m () 1The sum of a collection of actions, generalizing  .   =      ::  f =>  a c -> a -> f c   ::  f =>  a c -> a -> f c   ::  f =>   a c -> a -> f c   ::  f =>  j a c -> a -> f c   ::  f =>  3 a c -> a -> f c 1The sum of a collection of actions, generalizing  .   =      ::  m =>  a c -> a -> m c   ::  m =>  a c -> a -> m c   ::  m =>   a c -> a -> m c   ::  m =>  j a c -> a -> m c   ::  m =>  3 a c -> a -> m c   =      ::  c =>  a c -> c -> a ->    ::  c =>  a c -> c -> a ->    ::  c =>   a c -> c -> a ->    ::  c =>  j a c -> c -> a ->    ::  c =>  3 a c -> c -> a ->    =      ::  c =>  a c -> c -> a ->    ::  c =>  a c -> c -> a ->    ::  c =>  j a c -> c -> a ->    ::  c =>   a c -> c -> a ->    ::  c =>  3 a c -> c -> a ->     =        ::  a c -> (c -> [e] ) -> a -> [e]    ::  a c -> (c -> [e] ) -> a -> [e]    ::   a c -> (c -> [e] ) -> a -> [e]    ::  j a c -> (c -> [e] ) -> a -> [e]    ::  3 a c -> (c -> [e] ) -> a -> [e]      =       =       ::  a [e] -> a -> [e]    ::  a [e] -> a -> [e]    ::  j a [e] -> a -> [e]    ::   a [e] -> a -> [e]    ::  3 a [e] -> a -> [e]  ;Note: this can be rather inefficient for large containers.   =   import Control.LenslengthOf _1 ("hello",())1   ( . ) ::  f => f (g a) ->      ::  a c -> a ->     ::  a c -> a ->     ::   a c -> a ->     ::  j a c -> a ->     ::  3 a c -> a ->   Perform a safe  of a  or 3 or retrieve  the result  from a  or  . See also ( ).   .  =        ::  a c -> a ->  c    ::  a c -> a ->  c    ::   a c -> a ->  c    ::  j a c -> a ->  c    ::  3 a c -> a ->  c  Perform a safe  of a  or 3 or retrieve  the result  from a  or .  When using a 3 as a partial , or a  as a partial  this can be a convenient $ way to extract the optional value.  ( ) =     (  ) :: a ->  a c ->  c  (  ) :: a ->  a c ->  c  (  ) :: a ->   a c ->  c  (  ) :: a ->  j a c ->  c  (  ) :: a ->  3 a c ->  c Perform a safe  of a  or 3 or retrieve  the result  from a  or .    ::  a c -> a ->  c   ::  a c -> a ->  c   ::   a c -> a ->  c   ::  j a c -> a ->  c   ::  3 a c -> a ->  c Returns  if this  or 3( has no targets in the given container. Note:  on a valid j,  or  should always return    =  /This may be rather inefficient compared to the  check of many containers. import Control.LensnullOf _1 (1,2)False  ( . _1 . ) ::  f => f (g a, b) ->     ::  a c -> a ->    ::  a c -> a ->    ::  j a c -> a ->    ::   a c -> a ->    ::  3 a c -> a ->  2Obtain the maximum element (if any) targeted by a  or 3 Note: maximumOf on a valid j,  or  will always return  a value.   =  ( empty) .      ::  a c -> a ->  c   ::  c =>  a c -> a ->  c   ::  j a c -> a ->  c   ::   a c -> a ->  c   ::  c =>  3 a c -> a ->  c 2Obtain the minimum element (if any) targeted by a  or 3 Note: minimumOf on a valid j,  or  will always return  a value.   =  ( empty) .      ::  a c -> a ->  c   ::  c =>  a c -> a ->  c   ::  j a c -> a ->  c   ::   a c -> a ->  c   ::  c =>  3 a c -> a ->  c 2Obtain the maximum element (if any) targeted by a , 3, , j,  or ( according to a user supplied ordering.   cmp =  ( empty) .   cmp    ::  a c -> (c -> c ->  ) -> a ->  c   ::  a c -> (c -> c ->  ) -> a ->  c   ::  j a c -> (c -> c ->  ) -> a ->  c   ::   a c -> (c -> c ->  ) -> a ->  c   ::  3 a c -> (c -> c ->  ) -> a ->  c 2Obtain the minimum element (if any) targeted by a , 3, , j  or ( according to a user supplied ordering.  D minimumBy cmp = fromMaybe (error "empty") . minimumByOf folded cmp    ::  a c -> (c -> c ->  ) -> a ->  c   ::  a c -> (c -> c ->  ) -> a ->  c   ::  j a c -> (c -> c ->  ) -> a ->  c   ::   a c -> (c -> c ->  ) -> a ->  c   ::  3 a c -> (c -> c ->  ) -> a ->  c The  function takes a  (or , j, , or 3), O a predicate and a structure and returns the leftmost element of the structure  matching the predicate, or  if there is no such element.    ::  a c -> (c ->  ) -> a ->  c   ::  a c -> (c ->  ) -> a ->  c   ::  j a c -> (c ->  ) -> a ->  c   ::   a c -> (c ->  ) -> a ->  c   ::  3 a c -> (c ->  ) -> a ->  c  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 =  f .  l  =      :: * a c -> (c -> c -> c) -> a -> c   :: , a c -> (c -> c -> c) -> a -> c   ::  j& a c -> (c -> c -> c) -> a -> c   ::  % a c -> (c -> c -> c) -> a -> c   ::  3 a c -> (c -> c -> c) -> a -> c  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 =  l f .   =      :: * a c -> (c -> c -> c) -> a -> c   :: , a c -> (c -> c -> c) -> a -> c   ::  j& a c -> (c -> c -> c) -> a -> c   ::  % a c -> (c -> c -> c) -> a -> c   ::  3 a c -> (c -> c -> c) -> a -> c 6Strictly fold right over the elements of a structure.   =      :: / a c -> (c -> e -> e) -> e -> a -> e   :: 1 a c -> (c -> e -> e) -> e -> a -> e   ::  j+ a c -> (c -> e -> e) -> e -> a -> e   ::  * a c -> (c -> e -> e) -> e -> a -> e   ::  3% a c -> (c -> e -> e) -> e -> a -> e NFold over the elements of a structure, associating to the left, but strictly.   =      :: / a c -> (e -> c -> e) -> e -> a -> e   :: 1 a c -> (e -> c -> e) -> e -> a -> e   ::  j+ a c -> (e -> c -> e) -> e -> a -> e   ::  * a c -> (e -> c -> e) -> e -> a -> e   ::  3% a c -> (e -> c -> e) -> e -> a -> e IMonadic fold over the elements of a structure, associating to the right,  i.e. from right to left.   =      ::  m => 3 a c -> (c -> e -> m e) -> e -> a -> m e   ::  m => 5 a c -> (c -> e -> m e) -> e -> a -> m e   ::  m =>  j/ a c -> (c -> e -> m e) -> e -> a -> m e   ::  m =>  . a c -> (c -> e -> m e) -> e -> a -> m e   ::  m =>  3) a c -> (c -> e -> m e) -> e -> a -> m e HMonadic fold over the elements of a structure, associating to the left,  i.e. from left to right.   =      ::  m => 3 a c -> (e -> c -> m e) -> e -> a -> m e   ::  m => 5 a c -> (e -> c -> m e) -> e -> a -> m e   ::  m =>  j/ a c -> (e -> c -> m e) -> e -> a -> m e   ::  m =>  . a c -> (e -> c -> m e) -> e -> a -> m e   ::  m =>  3) a c -> (e -> c -> m e) -> e -> a -> m e 8     7     7     6      Rank2Types provisionalEdward Kmett <ekmett@gmail.com> Safe-Infered type SimpleReifiedTraversal =   A form of  4 that can be stored monomorphically in a container.  type SimpleTraversal =    A   can be used directly as a 2 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 j as a  , and composition of a   (or  or j ) with a   (or  or j)  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  =    (t f) . t g = uv . t (uw .  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.  ! =   = !    ! :: j) a b c d -> (c -> f d) -> a -> f b  ! :: ( a b c d -> (c -> f d) -> a -> f b  ! ::  # a b c d -> (c -> f d) -> a -> f b " " l =  (! l)    = "   " =     " :: j# a b c d -> a -> (c -> f d) -> f b  " :: # a b c d -> a -> (c -> f d) -> f b  " ::  # a b c d -> a -> (c -> f d) -> f b #FEvaluate each action in the structure from left to right, and collect  the results.     = #  =    # l = ! l id  # l = l id    # :: j a b (f c) c -> a -> f b  # ::  a b (f c) c -> a -> f b  # ::  f =>   a b (f c) c -> a -> f b $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.   = $    $ :: j) a b c d -> (c -> m d) -> a -> m b  $ :: ( a b c d -> (c -> m d) -> a -> m b  $ ::  m =>  # a b c d -> (c -> m d) -> a -> m b %    = %   % l =  ($ l)    % :: j) a b c d -> a -> (c -> m d) -> m b  % :: ( a b c d -> a -> (c -> m d) -> m b  % ::  m =>  # a b c d -> a -> (c -> m d) -> m b &     = &   & l = $ l id  & l =   . l      & :: j a b (m c) c -> a -> m b  & ::  a b (m c) c -> a -> m b  & ::  m =>   a b (m c) c -> a -> m b 'This generalizes  to an arbitrary  . Note: F handles ragged inputs more intelligently, but for non-ragged inputs:   = ' &transposeOf traverse [[1,2,3],[4,5,6]][[1,4],[2,5],[3,6]] Since every  is a  , we can use this as a form of  monadic strength as well: ' _2 :: (b, [a] ) -> [(b, a)]( Generalizes   to an arbitrary  .    = ( (' accumulates state from right to left.   ( :: j9 a b c d -> (s -> c -> (s, d)) -> s -> a -> (s, b)  ( :: 8 a b c d -> (s -> c -> (s, d)) -> s -> a -> (s, b)  ( ::  3 a b c d -> (s -> c -> (s, d)) -> s -> a -> (s, b) ) Generalized   to an arbitrary  .    = ) )' accumulates state from left to right.   ) :: j9 a b c d -> (s -> c -> (s, d)) -> s -> a -> (s, b)  ) :: 8 a b c d -> (s -> c -> (s, d)) -> s -> a -> (s, b)  ) ::  3 a b c d -> (s -> c -> (s, d)) -> s -> a -> (s, b) *Permit the use of  over an arbitrary   or .   = *    * :: j* a b c c -> (c -> c -> c) -> a -> b  * :: ) a b c c -> (c -> c -> c) -> a -> b  * ::  $ a b c c -> (c -> c -> c) -> a -> b +Permit the use of  over an arbitrary   or .   = +    *1 :: Iso a b c c -> (c -> c -> c) -> a -> b  *1 :: Lens a b c c -> (c -> c -> c) -> a -> b  *1 :: Traversal a b c c -> (c -> c -> c) -> a -> b ,A  to 4'Control.Lens.Getter.view'/'Control.Lens.Setter.set' the nth element , a  ,  or j. +Attempts to access beyond the range of the   will cause an error. import Control.Lens,[[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. - = , .%This is the traversal that just doesn't return anything  . ::  f => (c -> f d) -> a -> f a . =  /4Traverse both parts of a tuple with matching types. 03A traversal for tweaking the left-hand value of an : traverseLeft ::  f => (a -> f b) ->  a c -> f ( b c)1$traverse the right-hand value of an :  1 = Unfortunately the instance for   ( c) is still missing from base,  so this can' t just be  traverseRight ::  f => (a -> f b) ->  c a -> f ( c a)2A  2 is completely characterized by its behavior on a .  Cloning a  ) is one way to make sure you arent given  something weaker, such as a N 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 22. The former can execute at full speed, while the ( latter needs to round trip through the .  !"#$%&'()*+,-./012 !"#$%&'()*+,-./012 -,!"#$%&')(*+.01/2 !"#$%&'()*+,-./012 Rank2Types provisionalEdward Kmett <ekmett@gmail.com> Safe-Infered 3 type SimpleReifiedIso =  44/Useful for storing isomorphisms in containers. 7 type SimpleIso =  88DIsomorphim 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 ((.),id)  type Iso a b c d = forall k f. ( k,  f) =>  k f a b c d9@Build an isomorphism family from two pairs of inverse functions     (9 ac ca bd db) = ac   ( (9 ac ca bd db)) = ca   (9 ac ca bd db) cd = db . cd . ac   ( (9 ac ca bd db')) ab = bd . ab . ca  8isos :: (a -> c) -> (c -> a) -> (b -> d) -> (d -> b) -> 8 a b c d:<Build a simple isomorphism from a pair of inverse functions     (: f g) = f   ( (: f g)) = g   (9 f g) h = g . h . f   ( (: f g')) h = f . h . g  iso :: (a -> b) -> (b -> a) ->  8 a b; Based on ala from Conor McBride's work on Epigram. Mnemonically, au is a French contraction of  le. 0:m + Control.Lens Data.Monoid.Lens Data.Foldableau _sum foldMap [1,2,3,4]10< Based on ala' from Conor McBride's work on Epigram. Mnemonically, the German auf plays a similar role to  la, and the combinator  is au" with an extra function argument. =The opposite of working  a Setter is working = an Isomorphism.  = =  .  =' :: Iso a b c d -> (a -> b) -> (c -> d)>:This isomorphism can be used to wrap or unwrap a value in .   x^.identity =  x   x   > = x ?:This isomorphism can be used to wrap or unwrap a value in    x  ? =  x   x   ? = x  3456789:;<=>?3456789:;<=>?8:9;<=?>45673 3456789:;<=>?"rank 2 types, MPTCs, TFs, flexible provisionalEdward Kmett <ekmett@gmail.com> Safe-Infered @ type H i =  (A i)AUseful for storage. D Provides an IL that can be used to read, write or delete a member of a set-like container E:m + Control.Lens/contains 3 .~ False $ IntSet.fromList [1,2,3,4]fromList [1,2,4]F Provides an Id that can be used to read, write or delete the value associated with a key in a map-like container. Gimport Control.Lens!Map.fromList [(1,"hello")] ^.at 1 Just "hello" at 1 .~ Just "hello" $ Map.emptyfromList [(1,"hello")]H type H i =  (I i)IEvery I is a valid  and a valid O. JAdjust the target of an I' 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 J  f/When you do not need access to the index then ()) is more liberal in what it can accept. 9If you do not need the intermediate result, you can use (  ) or even ( ).   (\<%\@~) :: I+ i a b c d -> (i -> c -> d) -> a -> (d, b)  (\<%\@~) :: Monoid d => O+ i a b c d -> (i -> c -> d) -> a -> (d, b) KAdjust the target of an I& 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.  (K) = X   (%%\@~) ::  f => I/ i a b c d -> (i -> c -> f d) -> a -> f b  (%%\@~) ::  f => O* i a b c d -> (i -> c -> f d) -> a -> f b ]In particular, it is often useful to think of this function as having one of these even more  restrictive type signatures   (%%\@~) :: I5 i a b c d -> (i -> c -> (e, d)) -> a -> (e, b)  (%%\@~) :: Monoid e => O0 i a b c d -> (i -> c -> (e, d)) -> a -> (e, b) LAdjust the target of an I& 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 L f =  (l K f)   (%%\@=) ::  a m I2 i a a c d -> (i -> c -> (e, d)) -> a -> m e  (%%\@=) :: ( a m, Monoid e) => O- i a a c d -> (i -> c -> (e, d)) -> a -> m e MAdjust the target of an I' 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.   (\<%\@=) ::  a m I- i a a c d -> (i -> c -> d) -> a -> m d  (\<%\@=) :: ( a m, Monoid e) => O( i a a c d -> (i -> c -> d) -> a -> m d @ABCDEFGHIJKLM@ABCDEFGHIJKLMIFGDEKJLMABCH@@ABCDEFGHIJKLM"rank 2 types, MPTCs, TFs, flexible provisionalEdward Kmett <ekmett@gmail.com> Safe-Infered N type R i =  (O i)OUseful for storage. R type R i =  (S i)S#Every indexed traversal is a valid 3 or M. The Z constraint is used to allow an S to be used directly as a 3. The 3" laws are still required to hold. TTraversal with an index. NB: When you don'8t need access to the index then you can just apply your S  directly as a function!    T = X   l = T l .  =     T :: I/ i a b c d -> (i -> c -> f d) -> a -> f b  T :: S* i a b c d -> (i -> c -> f d) -> a -> f b U3Traverse with an index (and the arguments flipped)   l a = U l a .  U =  . T   U :: I/ i a b c d -> a -> (i -> c -> f d) -> f b  U :: S* i a b c d -> a -> (i -> c -> f d) -> f b VHMap 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 = V l .    V ::  m => I/ i a b c d -> (i -> c -> m d) -> a -> m b  V ::  m => S* i a b c d -> (i -> c -> m d) -> a -> m b WHMap 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 = W l a .   W =  . V    W ::  m => I/ i a b c d -> a -> (i -> c -> m d) -> m b  W ::  m => S* i a b c d -> a -> (i -> c -> m d) -> m b X Generalizes   to an arbitrary S with access to the index. X' accumulates state from right to left.   l = X l .    X :: I? i a b c d -> (i -> s -> c -> (s, d)) -> s -> a -> (s, b)  X :: S: i a b c d -> (i -> s -> c -> (s, d)) -> s -> a -> (s, b) Y Generalizes   to an arbitrary S with access to the index. Y' accumulates state from left to right.   l = Y l .    Y :: I? i a b c d -> (i -> s -> c -> (s, d)) -> s -> a -> (s, b)  Y :: S: i a b c d -> (i -> s -> c -> (s, d)) -> s -> a -> (s, b) ZAccess the element of an S& where the index matches a predicate. +Attempts to access beyond the range of the  Traversal will cause an error. :m + Control.LensOover (iwhereOf (indexed traverse) (>0)) reverse $ ["He","was","stressed","o_O"]["He","saw","desserts","O_o"]   Z ::  IndexedFold i a b -> (i -> ) ->  IndexedFold i a b  Z ::  IndexedGetter i a b -> (i -> ) ->  IndexedFold i a b  Z :: H i a b -> (i -> ) -> R i a b  Z :: R i a b -> (i -> ) -> R i a b  Z :: SimpleIndexedSetter i a b -> (i -> ) -> SimpleIndexedSetter i a b [+Traverse the value at a given key in a map [ k = G k \ \This provides a  Traversal) that checks a predicate on a key before ( allowing you to traverse into a value. NOPQRSTUVWXYZ[\NOPQRSTUVWXYZ[\S[Z\TUVWXYOPQRN NOPQRSTUVWXYZ[\ Rank2Types provisionalEdward Kmett <ekmett@gmail.com> Safe-Infered]0Traverse the value at the minimum key in a Map. KThe key of the minimum element is available as the index of the traversal. ^0Traverse the value at the maximum key in a Map. KThe key of the maximum element is available as the index of the traversal. ]^]^]^]^"rank 2 types, MPTCs, TFs, flexible provisionalEdward Kmett <ekmett@gmail.com> Safe-Infered _ type c i =  (` i)`Useful for storage. c type c i =  (d i)dEvery d is a valid Setter The 2" laws are still required to hold. eMap with index. /When you do not need access to the index, then mapOf( is more liberal in what it can accept.   l = e l .    e :: d) i a b c d -> (i -> c -> d) -> a -> b  e :: a+ i a b c d -> (i -> c -> d) -> a -> b  e :: O& i a b c d -> (i -> c -> d) -> a -> b f%Map with index. This is an alias for e. /When you do not need access to the index, then over( is more liberal in what it can accept.   l = f l .    f :: d) i a b c d -> (i -> c -> d) -> a -> b  f :: a+ i a b c d -> (i -> c -> d) -> a -> b  f :: O& i a b c d -> (i -> c -> d) -> a -> b g Build an d from an imap-like function. Your supplied function f is required to satisfy:    f  =   f g  f h = f (g  h) Equational reasoning:    g . f =   f . g =  Another way to view sets is that it takes a "semantic editor combinator"  and transforms it into a Setter. hAdjust every target of an d, a or O  with access to the index.  (h) = e/When you do not need access to the index then (h)) is more liberal in what it can accept.  l  f = l h  f   (h) :: d) i a b c d -> (i -> c -> d) -> a -> b  (h) :: a+ i a b c d -> (i -> c -> d) -> a -> b  (h) :: O& i a b c d -> (i -> c -> d) -> a -> b i/Adjust every target in the current state of an d, a or O  with access to the index. /When you do not need access to the index then (%=)) is more liberal in what it can accept.  l  f = l i  f   (i) ::  a m => d' i a a c d -> (i -> c -> d) -> m ()  (i) ::  a m => a) i a a c d -> (i -> c -> d) -> m ()  (i) ::  a m => O$ i a b c d -> (i -> c -> d) -> m ()  _`abcdefghi _`abcdefghi defghi`abc_ _`abcdefghi Rank2Types provisionalEdward Kmett <ekmett@gmail.com> Safe-Infered jA  with an additional index. 2An instance must satisfy a (modified) form of the  laws:   k ( ) =    (k f)  k g =  getCompose  k (i -> Compose   (f i)  g i) kTraverse an indexed container. l<A container that supports folding with an additional index. m2Fold 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.  = m . nHRight-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.  = n . oGLeft-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.  = o . pStrictlyF 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.  = p . qRFold 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 = w l .    w :: 7 i a c -> (i -> e -> c -> e) -> e -> a -> e  w :: j9 i a c -> (i -> e -> c -> e) -> e -> a -> e  w :: Q3 i a c -> (i -> e -> c -> e) -> e -> a -> e  w :: R. i a c -> (i -> e -> c -> e) -> e -> a -> e rA  with an additional index. .Instances must satisfy a modified form of the  laws:   s f . s g = s (i -> f i . g i)  s (_ a -> a) =  sMap with access to the index. tThe d for a r.  If you don'!t need access to the index, then mapped& is more flexible in what it accepts. uThe j of a l container. v Obtain a Fold9 by lifting an operation that returns a foldable result. +This can be useful to lift operations from  Data.List and elsewhere into a Fold. waReturn 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.  = w . x`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.  = x . y+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 = k . z+Traverse elements with access to the index i7, discarding the results (with the arguments flipped).  z =  y When you don' t need access to the index then & is more flexible in what it accepts.  a = z a . {*Run monadic actions for each target of an j or S with access to the index,  discarding the results.  When you don' t need access to the index then  X& is more flexible in what it accepts.  =  . |*Run monadic actions for each target of an j or S with access to the index, 6 discarding the results (with the arguments flipped).  | =  { When you don' t need access to the index then  Y& is more flexible in what it accepts.  Y l a = W l a . }hConcatenate the results of a function of the elements of an indexed container with access to the index.  When you don' t need access to the index then & is more flexible in what it accepts.    = } .   } = m ~xSearches a container with a predicate that is also supplied the index, returning the left-most element of the structure  matching the predicate, or  if there is no such element.  When you don' t need access to the index then & is more flexible in what it accepts.  = ~ . 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.  =  . 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.   =  . .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. ! = "  . The S of a j container. 3Traverse with an index (and the arguments flipped)    a =  a .    =  k 5Map each element of a structure to a monadic action, Q evaluate these actions from left to right, and collect the results, with access  the index.  When you don't need access to the index ( is more liberal in what it can accept.  =  . 5Map each element of a structure to a monadic action, Q evaluate these actions from left to right, and collect the results, with access + its position (and the arguments flipped).    a =  a .    =    Generalizes   to add access to the index. X' accumulates state from right to left.  =  .  Generalizes   to add access to the index. Y' accumulates state from left to right.  =  . #8The position in the sequence is available as the index. $4The position in the list is available as the index. .jklmnopqrstuvwxyz{|}~%&'()*+,-./0#12$jklmnopqrstuvwxyz{|}~rstlmnopquvwxyz{|}~jk'jklmnopqrstuvwxyz{|}~%&'()*+,-./0#12$ Rank2Types provisionalEdward Kmett <ekmett@gmail.com> Safe-Infered: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 (,,3,4,Data,Typeable)    instance  Expr where   f (Neg e) = Neg 5 f e   f (Add a b) = Add 5 f a 6 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 (,,3,4,Data,Typeable)    instance  (Tree a) where   f (Bin l r) = Bin 5 f l 6 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 =  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.  =   Provided for compatibility with uniplate.   =   ::  a b -> a -> [b]LRewrite by applying a rule everywhere you can. Ensures that the rule cannot $ be applied anywhere in the result:  propRewrite r x = 7 ( . 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 = 7 ( . 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.    ::  j 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.    ::  c =>  j a b -> (b ->  b) -> a -> a   ::  c =>   a b -> (b ->  b) -> a -> a   ::  c =>    a b -> (b ->  b) -> a -> a   ::  c =>   a b -> (b ->  b) -> a -> a NRewrite recursively over part of a larger structure using a specified setter.    ::  b =>  j a b ->  j b b -> (b ->  b) -> a -> a   ::  b =>   a b ->   b b -> (b ->  b) -> a -> a   ::  b =>    a b ->    b b -> (b ->  b) -> a -> a   ::  b =>   a b ->   b b -> (b ->  b) -> a -> a 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 =  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 (8 i)  _ -> x WTransform every element in the tree in a bottom-up manner over a region indicated by a .    ::  b =>    a b -> (b -> b) -> a -> a   ::  b =>   a b -> (b -> b) -> a -> a 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.    ::  a b ->    b b -> (b -> b) -> a -> a   ::  a b ->   b b -> (b -> b) -> a -> a 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,  c) =>    a b -> (b -> m b) -> a -> m a8Transform 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 =>    a b ->    b b -> (b -> m b) -> a -> m a+Recurse one level into a structure. (a.k.a composOp from Bjrn Bringert's compos)  =  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 b -> (b -> b) -> a -> a   ::    a b -> (b -> b) -> a -> a 2Recurse one level into the parts delimited by one , using another.   b l =  (b  l)    ::   a b ->   b b -> (b -> b) -> a -> a   ::    a b ->    b b -> (b -> b) -> a -> a ARecurse one level into the parts of the structure delimited by a .   b =  (b  )  ::  c =>  a b -> (b -> b) -> a -> a+Recurse one level into a structure with an  effect, this is , but it is supplied ( for consistency with the uniplate API.  = 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.   =   ::  m =>    a b => (b -> m b) -> a -> m a2Recurse one level into the parts delimited by one  , using another with  effects.   = ()  ::  f =>    a b ->    b b -> (b -> f b) -> a -> f aARecurse one level into the parts of the structure delimited by a   with  effects.   b = b    :: ( f, Plated' c) =>    a b -> (b -> f b) -> a -> f 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.   =   ::  f =>  a b => (b -> f b) -> a -> f ()2Recurse one level into the parts delimited by one , using another with ; effects, without reconstructing the structure behind you.   b l =  (b  l)  ::  f =>  a b ->  b b -> (b -> f c) -> a -> f ()ARecurse one level into the parts of the structure delimited by a   with monadic effects.   b =  (b  )  :: ( f,  b) =>    a b -> (b -> f c) -> a -> f ()ARecurse one level into a structure with a monadic effect. (a.k.a  composOpM from Bjrn Bringert's compos)  = $ 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.   = $  ::  m =>    a b => (b -> m b) -> a -> m a2Recurse one level into the parts delimited by one  &, using another with monadic effects.   b l = $ (b  l)  ::  m =>    a b ->    b b -> (b -> m b) -> a -> m aARecurse one level into the parts of the structure delimited by a   with monadic effects.   b = $ (b . )  :: ( m,  c) =>    a b -> (b -> m b) -> a -> m a?Descend one level into a structure with monadic effects (a.k.a  composOpM from Bjrn Bringert's compos)  = mapMOf_' mRecurse one level into a structure using a user specified recursion scheme and monadic effects. This is just #, but is provided for consistency.   =   ::  m =>  a b => (b -> m b) -> a -> m ()2Recurse one level into the parts delimited by one  &, using another with monadic effects.   b l =  (b  l)  ::  m =>  a b ->  b b -> (b -> m b) -> a -> m ()ARecurse one level into the parts of the structure delimited by a   with monadic effects.   b =  (b  )  :: ( m,  b) =>    a b -> (b -> m c) -> a -> m ()`Return a list of all of the editable contexts for every location in the structure, recursively.    propUniverse x =  x ==  pos ( x)  propId x = 7 (9 x) [extract w | w <-  x]   =  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 ==  pos ( l x)  propId l x = 7 (9 x) [extract w | w <-  l x]   ::    a a -> a -> [6 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 =  b   ::  b =>    a b -> a -> [6 b b 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  another user-supplied   to walk each layer.  ::    a b ->    b b -> a -> [6 b b a]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 9  pos ( l x)  propId x = 7 (9 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 9  pos ( l x)  propId l x = 7 (9 x) [extract w | w <-  l x]     ::  Iso a b -> a -> [6 b a]   ::   a b -> a -> [6 b a]   ::    a b -> a -> [6 b a]  An alias for 7, provided for consistency with the other combinators.   =     ::  Iso a b -> a -> [6 b b a]   ::   a b -> a -> [6 b b a]   ::    a b -> a -> [6 b b a] IExtract one level of holes from a container in a region specified by one  , using another.   b l =  (b  l)    ::  Iso a b ->  Iso b b -> a -> [6 b a]   ::   a b ->   b b -> a -> [6 b a]   ::    a b ->    b b -> a -> [6 b a] KPerform a fold-like computation on each value, technically a paramorphism.  ::  a a -> (a -> [r] -> r) -> a -> rKPerform a fold-like computation on each value, technically a paramorphism.  =  !Fold the immediate children of a  container.  z c f =   (c  f) z The original uniplate% combinator, implemented in terms of  as 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:R You should really, maintain the invariant of the number of children in the list. Any extras will be lost. WIf you do not supply enough, then the remainder will come from the original structure.    ::  j a b -> a ->   a [b]   ::   a b -> a ->   a [b]   ::    a b -> a ->    a [b]  turns a   into a uniplate (or biplate ) family.  If you do not need the types of c and d) 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 d's as you were  given c's, then the reconstruction of b will result in an error! >:;<=::=:;<= RankNTypes provisionalEdward Kmett <ekmett@gmail.com> Safe-InferedGSometimes 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 polymorphic lenses. 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 =  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. The representation of a   as Lenses # is a valid default definition for  for a   functor.   f m =   i -> f (m  i) Usage for a  Foo:   instance  Foo where   =  # is a valid default definition for  and > for a   functor.   =  .  Usage for a  Foo:    instance  Foo where   =   ...    instance  Foo where  > =   ... $ is a valid default definition for (6) for a   functor.   mf ma =   i -> mf  i  ma  i Usage for a  Foo:   instance  Foo where   =   (6) =  + is a valid default default definition for '(>>=)' for a  representable functor.   m f =   i -> f (m  i)  i Usage for a  Foo:   instance  Foo where  > =   (?) =  A default definition for  for a     wf =   i ->  ( i) wf Usage for a  Foo:   instance  Foo where   =  A  - has a fixed shape. This fills each position  in it with a   A version of 5 that is an isomorphism. Predicativity requires that  we wrap the  as a Key , however.  Map over a  functor with access to the  for the  current position  f m =   i -> f i (m  i) Traverse a ) functor with access to the current path  Traverse a ) functor with access to the current path  as a , discarding the result  Traverse a ) functor with access to the current path  and a  (and the arguments flipped)  over a ) functor with access to the current path  as a   over a ) functor with access to the current path  as a , discarding the result  over a ) functor with access to the current path  as a  (with the arguments flipped)  Fold over a ) functor with access to the current path  as a  , yielding a   Fold over a ) functor with access to the current path  as a . @NB: The @ requirement on this instance is a consequence of the choice of  as a , it isn't fundamental. @A@A Rank2Types provisionalEdward Kmett <ekmett@gmail.com> Safe-Infered,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 import Control.Lens_2 .~ "hello" $ (1,(),3,4)(1,"hello",3,4)    U  :: (c -> ) -> (a, c) ->   gi   :: ( Applicative f, g. t) => (a -> f b) -> t (c, a) -> f (t (c, b))   P (gi  ) :: (g t, ! m) => (c -> m) -> t (b, c) -> m )Provides access to 1st field of a tuple. @Access the 1st field of a tuple (and possibly change its type). import Control.Lens (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' >BCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklm5BCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklm Rank2Types provisionalEdward Kmett <ekmett@gmail.com> Safe-InferedThis class allows us to use ? part of the environment, changing the environment supplied by + many different monad transformers. Unlike focusG this can change the environment of a deeply nested monad transformer.  Also, unlike focus", this can be used with any valid , but cannot be used with a  Traversal or Fold. MRun a monadic action in a larger environment than it was defined in, using a . This acts like D, but can in many cases change the type of the environment as well. 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:    ::  a b -> (b -> c) -> a -> c   ::  c => Fold a b -> (b -> c) -> a -> c   ::  w  a b -> n a w s c -> n b w s c   :: ( w,  c) => Fold a b -> n a w s c -> n b w s c  ... This class allows us to use $ in, changing the State supplied by Y many different monad transformers, potentially quite deep in a monad transformer stack. ?Run a monadic action in a larger state than it was defined in,  using a   or  3. 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 3 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!    ::  m =>   a b -> o b m c -> o a m c   :: ( m,  c) =>  3 a b -> o b m c -> o a m c   ::  m =>   a b -> n r w b m c -> n r w a m c   :: ( m,  c) =>  3 a b -> n r w b m c -> n r w a m c   ::  m =>   a b -> p e (n r w b m c) -> p e (n r w a m c)   :: ( m,  c) =>  3 a b -> p e (n r w b m c) -> p e (n r w a m c)  ... q  = rstquvwxyz{|}~rstquvwxyz{|}~TemplateHaskell 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.   TemplateHaskell experimentalEdward Kmett <ekmett@gmail.com> Trustworthy+This configuration describes the options we'+ll be using to make isomorphisms or lenses Flags for lens construction Only Generate valid   lenses (Handle singleton constructors specially #Use Iso for singleton constructors @Expect a single constructor, single field newtype or data type. 6Create the class if the constructor is simple and the   rule matches 9Create the instance if the constructor is simple and the   rule matches  Die if the   fails to match  RLens to access the convention for naming top level isomorphisms in our lens rules =Defaults to lowercasing the first letter of the constructor.  BLens to access the convention for naming fields in our lens rules ODefaults to stripping the _ off of the field name and lowercasing the name and  rejecting the field if it doesn't start with an '_'.  wRetrieve options such as the name of the class and method to put in it to build a class around monomorphic data types.  wRetrieve options such as the name of the class and method to put in it to build a class around monomorphic data types.  Default lens rules )Build lenses with a custom configuration 3Build lenses with a sensible default configuration ' makeLenses = makeLensesWith lensRules 7Make 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 # makeIso = makeLensesWith isoRules 1Rules for making an isomorphism from a data type Make ' classy lenses' for a type ) makeClassy = makeLensesWith classyRules 6Rules for making lenses that precompose another lens. /Derive lenses, specifying explicit pairings of (fieldName, lensName). Example usage: < makeLensesFor [("_foo", "fooLens"), ("bar", "lbar")] ''Foo pRules for making fairly simple lenses, ignoring the special cases for isomorphisms, and not making any classes. /Derive lenses, specifying explicit pairings of (fieldName, lensName)  using a wrapper class. Example usage: K makeClassyFor "HasFoo" "foo" [("_foo", "fooLens"), ("bar", "lbar")] ''Foo                        Rank2Types provisionalEdward Kmett <ekmett@gmail.com> Safe-InferedVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\_`abcdefghijklmnopqrstuvwxyz{|}~     Control.Exception provisionalEdward Kmett <ekmett@gmail.com> Safe-InferedTraverse the strongly typed  contained in ) where the type of your function matches  the desired .   traverseException :: ( f,  a,  b) $ => (a -> f b) ->  -> f  LiberalTypeSynonyms experimentalEdward Kmett <ekmett@gmail.com> Safe-Infered Bitwise  the target(s) of a  or  _2 |~ 6 $ ("hello",3) ("hello",7)   (|~) ::  c =>  a b c c -> c -> a -> b  (|~) ::  c => 8 a b c c -> c -> a -> b  (|~) ::  c =>  a b c c -> c -> a -> b  (|~) :: ('Monoid c',  c) =>   a b c c -> c -> a -> b Bitwise  the target(s) of a  or  _2 &~ 7 $ ("hello",254) ("hello",6)   (&~) ::  c =>  a b c c -> c -> a -> b  (&~) ::  c => 8 a b c c -> c -> a -> b  (&~) ::  c =>  a b c c -> c -> a -> b  (&~) :: ('Monoid c',  c) =>   a b c c -> c -> a -> b Modify the target(s) of a  ,  or   by computing its bitwise  with another value.   (&=):: ( a m,  b) =>   a b -> b -> m ()  (&=):: ( a m,  b) =>  8 a b -> b -> m ()  (&=):: ( a m,  b) =>   a b -> b -> m ()  (&=):: ( a m,  b) =>    a b -> b -> m () Modify the target(s) of a  ,  or   by computing its bitwise  with another value.   (|=):: ( a m,  b) =>   a b -> b -> m ()  (|=):: ( a m,  b) =>  8 a b -> b -> m ()  (|=):: ( a m,  b) =>   a b -> b -> m ()  (|=):: ( a m,  b) =>    a b -> b -> m () Bitwise  the target(s) of a  (or  ), returning the result 0 (or a monoidal summary of all of the results). _2 <|~ 6 $ ("hello",3)(7,("hello",7))   (<|~) ::  c => 8 a b c c -> c -> a -> (c, b)  (<|~) ::  c =>  a b c c -> c -> a -> (c, b)  (<|~) :: ( c, ' Monoid c) =>   a b c c -> c -> a -> (c, b) Bitwise  the target(s) of a  or  , returning the result 0 (or a monoidal summary of all of the results). _2 <&~ 7 $ ("hello",254)(6,("hello",6))   (<&~) ::  c => 8 a b c c -> c -> a -> (c, b)  (<&~) ::  c =>  a b c c -> c -> a -> (c, b)  (<&~) :: ( c, ' Monoid c) =>   a b c c -> c -> a -> (c, b) Modify the target(s) of a   (or  ) by computing its bitwise  with another value, N returning the result (or a monoidal summary of all of the results traversed)   (<&=) :: ( a m,  b) =>   a b -> b -> m b  (<&=) :: ( a m,  b, Monoid b) =>    a b -> b -> m b Modify the target(s) of a  , (or  ) by computing its bitwise  with another value, N returning the result (or a monoidal summary of all of the results traversed)   (<|=) :: ( a m,  b) =>   a b -> b -> m b  (<|=) :: ( a m,  b, Monoid b) =>    a b -> b -> m b  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 <  ( :: 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 , the result will  be an infinite  $ that can be productively consumed.  !  !  !  !portable provisionalEdward Kmett <ekmett@gmail.com> Safe-Infered ",A lens reading and writing to the head of a  non-empty list [1,2,3]^._head1#,A lens reading and writing to the tail of a  non-empty list _tail .~ [3,4,5] $ [1,2] [1,3,4,5]$4A lens reading and writing to the last element of a  non-empty list  [1,2]^._last2%=A lens reading and replacing all but the a last element of a  non-empty list [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 'BObtain 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. )<The 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] = traverseHead :: Applicative f => (a -> f a) -> [a] -> f [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] = traverseTail :: Applicative f => (a -> f a) -> [a] -> f [a] +%Traverse 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] = traverseLast :: Applicative f => (a -> f a) -> [a] -> f [a] ,,Traverse 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] = traverseInit :: Applicative f => (a -> f a) -> [a] -> f [a] "#$%&'()*+, "#$%&'()*+, "#$%&'()*,+ "#$%&'()*+,portable provisionalEdward Kmett <ekmett@gmail.com> Safe-Infered- (or ) a list of bytes into a    x = x  -  x = x   -.Traverse each  in a   . =  - ] (  . (9 0x80) ::  -> / (or ) a list of characters into a  When writing back to the  it is assumed that every   lies between '\x00' and '\xff'.   x = x  /  x = x   /0#Traverse the individual bytes in a  as characters. When writing back to the  it is assumed that every   lies between '\x00' and '\xff'.  0 =  / .   0 (9 'c') ::  -> -./0-./0-./0-./0portable provisionalEdward Kmett <ekmett@gmail.com> Safe-Infered1 (or ) a list of bytes into a    x = x  1  x = x   12#Traverse the individual bytes in a   2 =  1 . (  2 (9 0x80) ::  -> 3 (or ) a list of characters into a  When writing back to the  it is assumed that every   lies between '\x00' and '\xff'.   x = x  3  x = x   34#Traverse the individual bytes in a  as characters. When writing back to the  it is assumed that every   lies between '\x00' and '\xff'.  4 =  3 ] (  4 (9 'c') ::  -> 1234123412341234portable provisionalEdward Kmett <ekmett@gmail.com> Safe-Infered5Traversals for ByteStrings. 6 (or () a list of bytes into a strict or lazy    x = x  6  x = x   67 (or -) a list of characters into a strict or lazy  When writing back to the  it is assumed that every   lies between '\x00' and '\xff'.   x = x  7  x = x   78Traverse each  in a strict or lazy   8 =  6 ]  traverseList  8 (9 0x80) ::  -> 92Traverse the individual bytes in a strict or lazy  as characters. When writing back to the  it is assumed that every   lies between '\x00' and '\xff'.  9 =  7 .   9 (9 'c') ::  -> 56789567895678956789  Rank2Types experimentalEdward Kmett <ekmett@gmail.com> Safe-Infered: Access the  of a  number ? real :: Functor f => (a -> f a) -> Complex a -> f (Complex a) ; Access the  imaginaryPart of a  number D imaginary :: Functor f => (a -> f a) -> Complex a -> f (Complex a) <This isn't quite a legal lens. Notably the   l ( l b a) = blaw is violated when you set a  value with 0  and non-zero   as the  information is lost. So don' t do that! )Otherwise, this is a perfectly cromulent . =0Traverse both the real and imaginary parts of a  number. N traverseComplex :: Applicative f => (a -> f b) -> Complex a -> f (Complex b) :;<=:;<=:;<=:;<=! Rank2Types experimentalEdward Kmett <ekmett@gmail.com> Trustworthy>LA generic applicative transformation that maps over the immediate subterms. > is to  what  is to  This really belongs in  Data.Data. ?Nave   using 3. This does not attempt to optimize the traversal. ZThis is primarily useful when the children are immediately obvious, and for benchmarking.   ? :: ( a,  b) =>    a b @%Find every occurence of a given type b recursively that doesn' t require # passing through something of type b using , while avoiding traversal . of areas that cannot contain a value of type b. This is A with a more liberal signature. AFind descendants of type aU non-transitively, while avoiding computation of areas that cannot contain values of  type a using . A$ is a useful default definition for  BB performs like @, except when a ~ b&, it returns itself and nothing else. >?@AB>?@AB@?AB>>?@AB"portable provisionalEdward Kmett <ekmett@gmail.com> Safe-InferedC(Traverse the typed value contained in a 7 where the type required by your function matches that  of the contents of the . b traverseDynamic :: (Applicative f, Typeable a, Typeable b) => (a -> f b) -> Dynamic -> f Dynamic CCCC# Rank2Types provisionalEdward Kmett <ekmett@gmail.com> Safe-InferedD/Traverse the value at the minimum key in a Map :The key of the minimum element is available as the index. E/Traverse the value at the maximum key in a Map DEDEDEDE$portable provisionalEdward Kmett <ekmett@gmail.com> Safe-InferedF IntSet isn't Foldable, but this ) can be used to access the members of an . &sumOf members $ setOf folded [1,2,3,4]10GThis * can be used to change the contents of an  by mapping  the elements to new values. Sadly, you can't create a valid   for a Set, because the number of B elements might change but you can manipulate it by reading using  and  reindexing it via setmap. (over setmapped (+1) (fromList [1,2,3,4])fromList [2,3,4,5]H Construct an  from a , ,  ,  or 8. ":m + Data.IntSet.Lens Control.Lens5setOf (folded._2) [("hello",1),("world",2),("!!!",3)]fromList [1,2,3]   setOf ::  a  -> a ->   setOf ::  a  -> a ->   setOf ::  8 a  -> a ->   setOf ::   a  -> a ->   setOf ::    a  -> a ->  FGHFGHFGHFGH% Rank2Types experimentalEdward Kmett <ekmett@gmail.com> Safe-Infered I,Modify the target of a monoidally valued by ing another value. :m + Control.Lens"both <>~ "!!!" $ ("hello","world")("hello!!!","world!!!")   (I) ::  c =>  a b c c -> c -> a -> b  (I) ::  c => 8 a b c c -> c -> a -> b  (I) ::  c =>  a b c c -> c -> a -> b  (I) ::  c =>   a b c c -> c -> a -> b JModify the target(s) of a  , 8,  or   by  ing a value.   (J) :: ( a m,  b) =>   a b -> b -> m ()  (J) :: ( a m,  b) =>  8 a b -> b -> m ()  (J) :: ( a m,  b) =>   a b -> b -> m ()  (J) :: ( a m,  b) =>    a b -> b -> m () K2 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, (I) is more flexible. L2 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, (J) is more flexible. MIsomorphism for  NIsomorphism for  OIsomorphism for  0:m + Control.Lens Data.Monoid.Lens Data.Foldableau _all foldMap [True,True]True0:m + Control.Lens Data.Monoid.Lens Data.Foldableau _all foldMap [True,False]FalsePIsomorphism for  0:m + Control.Lens Data.Monoid.Lens Data.Foldableau _any foldMap [False,False]False0:m + Control.Lens Data.Monoid.Lens Data.Foldableau _any foldMap [True,False]TrueQIsomorphism for  0:m + Control.Lens Data.Monoid.Lens Data.Foldableau _sum foldMap [1,2,3,4]10RIsomorphism for  0:m + Control.Lens Data.Monoid.Lens Data.Foldableau _product foldMap [1,2,3,4]24SIsomorphism for  TIsomorphism for  IJKLMNOPQRST IJKLMNOPQRST IKJLMNOPQRST IJKLMNOPQRST&portable provisionalEdward Kmett <ekmett@gmail.com> Safe-Infered UA  that can access the nth element of a . ENote: This is only a legal lens if there is already such an element! VA  is isomorphic to a   m = m  VWA  is isomorphic to a   m = m  WXTraverse the head of a  YTraverse the tail of a  ZTraverse 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  UVWXYZ[\]^ UVWXYZ[\]^ UVWXYZ[\]^ UVWXYZ[\]^'portable provisionalEdward Kmett <ekmett@gmail.com> Safe-Infered_ (or  ) strict .    x = x  _   x = x   _ `-Traverse the individual characters in strict . $anyOf text (=='o') $ "hello"^.packedTrue_`_`_`_`(portable provisionalEdward Kmett <ekmett@gmail.com> Safe-InferedaPack (or unpack) lazy .    x = x  a   x = x   a b(Traverse the individual characters in a . $ anyOf text (=='c') :: Text -> Bool abababab)portable provisionalEdward Kmett <ekmett@gmail.com> Safe-InferedcTraversals for strict or lazy  d (or ) strict or lazy .    x = x  d   x = x   d e5Traverse the individual characters in strict or lazy . cdecdecdecde*MTPCs provisionalEdward Kmett <ekmett@gmail.com> Safe-InferedfA  that focuses on the root of a . gA  , of the direct descendants of the root of a  1 indexed by its position in the list of children fgfgfgfg+ Rank2Types experimentalEdward Kmett <ekmett@gmail.com> Safe-InferedhA    for working with a  of a  value. iA    for working with a  of a  value. hihihihi,&MPTCs, Rank2Types, LiberalTypeSynonyms provisionalEdward Kmett <ekmett@gmail.com> Safe-InferedjAccess an element of an array. <Note: The indexed element is assumed to exist in the target .  arr  i = arr  j i arr  [(i,e)] = j 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)]k(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 .   =  . k k =  .   (k b) f arr  i = arr  f i  ( (k b) f arr) = blAn S of the elements of an  , using the 5 index into the array as the index of the traversal.  =  ljkljkljkljkl- Rank2Types experimentalEdward Kmett <ekmett@gmail.com> Safe-Infered m(Modify the path by adding another path. :m + Control.Lens#both </>~ "!!!" $ ("hello","world")("hello/!!!","world/!!!")   (m) ::  a b   ->  -> a -> b  (m) :: 8 a b   ->  -> a -> b  (m) ::  a b   ->  -> a -> b  (m) ::   a b   ->  -> a -> b nModify the target(s) of a  , 8,  or   by adding a path.   (n) ::  a m =>   a  ->  -> m ()  (n) ::  a m =>  8 a  ->  -> m ()  (n) ::  a m =>   a  ->  -> m ()  (n) ::  a m =>    a  ->  -> m () o+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, (m) is more flexible. p+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, (n) is more flexible. q%Modify the path by adding extension. :m + Control.Lens#both <.>~ "!!!" $ ("hello","world")("hello.!!!","world.!!!")   (q) ::  a b   ->  -> a -> b  (q) :: 8 a b   ->  -> a -> b  (q) ::  a b   ->  -> a -> b  (q) ::   a b   ->  -> a -> b rModify the target(s) of a  , 8,  or   by adding an extension.   (r) ::  a m =>   a  ->  -> m ()  (r) ::  a m =>  8 a  ->  -> m ()  (r) ::  a m =>   a  ->  -> m ()  (r) ::  a m =>    a  ->  -> m () s1Add an extension onto the end of the target of a  and return the result 3When you do not need the result of the operation, (q) is more flexible. t1Add 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, (r) is more flexible. u,A lens reading and writing to the basename. )_basename .~ "filename" $ "path/name.png""path/filename.png"v-A lens reading and writing to the directory. ""long/path/name.txt" ^. _directory "long/path"w-A lens reading and writing to the extension. &_extension .~ ".png" $ "path/name.txt""path/name.png"x1A lens reading and writing to the full filename. )_filename .~ "name.txt" $ "path/name.png""path/name.txt" mnopqrstuvwx mnopqrstuvwx moqsnprtuvwx mnopqrstuvwx.portable provisionalEdward Kmett <ekmett@gmail.com> Safe-InferedyEvaluate the targets of a  or   into a data structure " according to the given strategy.     = y  =   y =     evalOf ::   a b ->  b ->  a  evalOf ::    a b ->  b ->  a  evalOf :: (b ->  b) -> a ->  a) ->  b ->  a zEvaluate the targets of a  or   according into a % data structure according to a given  in parallel.   = z    parOf ::   a b ->  b ->  a  parOf ::    a b ->  b ->  a  parOf :: ((b ->  b) -> a ->  a) ->  b ->  a { Transform a , , ,  or   to < first evaluates its argument according to a given strategy before proceeding.   {   ::  t =>  a ->  [a] | Transform a , , ,  or   to 5 evaluate its argument according to a given strategy in parallel with evaluating.   |   ::  t =>  a ->  [a] yz{|yz{|yz{|yz{|/portable provisionalEdward Kmett <ekmett@gmail.com> Safe-Infered}$Evaluate the elements targeted by a ,  , 8,   or " according to the given strategy.  = } }}}}0GHC experimentalEdward Kmett <ekmett@gmail.com> Safe-Infered~Used to traverse  data by uniplate. ;Convert from the data type to its representation (or back) '"hello"^.generic.from generic :: String"hello";Convert from the data type to its representation (or back) A    that visits every occurence  of something  anywhere in a container. BallOf tinplate (=="Hello") (1::Int,2::Double,(),"Hello",["Hello"])True:mapMOf_ tinplate putStrLn ("hello",[(2 :: Int, "world!")])helloworld! ~~~ ~ggi1     ;M !"#$%&'()*+,-./0123456789:2;<r=>xzy{|}~?@AB C D E s t F q G H I J K L M N O N O P Q R S T U V W X d < Y Z [ \ ] ^ _ ` a b c d e f g h i j k l m n o p q r s t u v N w x y z { | } ~ L   P  S T `    U V   8 W  X Y      Z       5 6   [  \ ] ^ _34kjQaRO      !"#$%&'()*+,,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRST>?UVWXYZ[\]^^_`abcdefghijklmnopqrstuvwxyz{|}~o  l  !!!!!"##$$N$O%%%%%%%%%%%%&&&&o&&&&&&''(()))**++,,,------------..../0000      !"#$%&'()*+,-.-/012324567589:;2<=>?@AB2C56DEFGFHFIFJKLMNObPQRSTFUFVWXFYZ[F\]^_`abF cgdgegfggghijggkFlFmnopqrs9t9u7v9t9t$wxcyz{|}~F+2IKA_mmnmmmbf!!9     99999eff))9 !"#$"#%"#&"#'"#("#)*+,-./-.0-.1-.2-.3-456708090:0;0<0=>lens-2.5Control.Lens.TraversalControl.Lens.IsomorphicControl.Lens.InternalControl.Lens.IndexedControl.Lens.IndexedGetterControl.Lens.IndexedFoldControl.Lens.ActionControl.Lens.SetterControl.Lens.Getter Data.Set.LensData.HashSet.LensControl.Lens.TypeControl.Lens.FoldControl.Lens.IsoControl.Lens.IndexedLensControl.Lens.IndexedTraversal Data.Map.LensControl.Lens.IndexedSetterControl.Lens.WithIndexControl.Lens.PlatedControl.Lens.RepresentableControl.Lens.TupleControl.Lens.ZoomLanguage.Haskell.TH.LensControl.Lens.THControl.Exception.LensData.Bits.LensData.List.LensData.ByteString.Strict.LensData.ByteString.Lazy.LensData.ByteString.LensData.Complex.LensData.Data.LensData.Dynamic.LensData.IntMap.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.LensGHC.Generics.LensSettableSetter Traversalelement maximumOf minimumOfmapM_ traverseOf_Control.Monad.Trans.State.LazyStateindexedLenscloneZoomzoomControl.Monad.ErrorErrorTControl.Monad.Trans.MaybeMaybeTControl.Monad.Trans.ListListTControl.Monad.WriterWriterTControl.Monad.RWSRWSTControl.Monad.StateStateT backwards IndexedFoldFoldIndexedTraversal foldMapOfSimpleIndexedLensSimpleIndexedTraversalfoldrOffoldlOfanyOfallOfforOf_mapMOf_forMOf_ concatMapOffindOffoldrOf'foldlOf'foldrMOffoldlMOftoListOf IndexedLens Control.MonadjoinSimpleData.Text.InternalTextData.Traversable fmapDefaulttraverseIsoboth imaginary Data.ComplexComplex traverseHeadControl.Lens.LensviewsetGettingGetterData.Functor.Compose getComposeCompose+~-~*~//~^~^^~**~||~&&~%=+=-=*=//=**=^^=||=&&=Preludeunfoldr Data.FoldablefoldMapfoldfoldrfoldltoListandoranyallproductsum traverse_Data.Either.Lens traverseLeftforM_ sequence_ maximumByfoldr1foldl1Offoldl1foldr'foldl'foldrMfoldlM Data.List transpose%@~%~ traverseOfforOfmapMOfforMOf mapAccumROf mapAccumLOfmapOfoverData.Functor.IdentityIdentity IndexedGetter mapAccumRuniplatebiplate Data.Just isNothingData.Distributive distribute Distributive Traversable Data.MonoidMonoidControl.Monad.Reader.Classlocal Control.LensData.ByteStringpackunpackData.ByteString.Char8Data.ByteString.LazyData.ByteString.Lazy.Char8Control.Platedplatebase Isomorphism Isomorphic isomorphicisomapfromviaMutator runMutator untainted Effective effectiveAccessor runAccessorGettablecoerce EffectRWS getEffectRWSEffect getEffectBazaar _runBazaar ElementOf getElementOfElementOfResultNotFoundFound SearchingMaxNoMaxMinNoMin Sequenced getSequenced Traversed getTraversedIndexing runIndexingIndexingResultContext FocusingErr unfocusingErrErrgetErr FocusingMay unfocusingMayMaygetMay FocusingOn unfocusingOn FocusingPlusunfocusingPlus FocusingWithunfocusingWithFocusing unfocusinggetMingetMaxbazaarduplicateBazaarsell ineffectiveIndex withIndex IndexableIndexedindex<..>reindex<.>icomposeReifiedIndexedGetterReifyIndexedGetterreflectIndexedGetterIndexedGettingReifiedIndexedFoldReifyIndexedFoldreflectIndexedFold ifoldMapOfifoldrOfifoldlOfianyOfiallOf itraverseOf_iforOf_imapMOf_iforMOf_ iconcatMapOfifindOf ifoldrOf' ifoldlOf' ifoldrMOf ifoldlMOf itoListOf ifiltered itakingWhileidroppingWhileActing MonadicFoldActionperform^!actactsliftActSimpleReifiedSetter ReifiedSetter ReifySetter reflectSetter SimpleSetting SimpleSetterSettingmappedsets.~<.~.=^=<~<.= ReifiedGetter ReifyGetter reflectGettertoviews^$^.useusesqueryqueries setmappedsetOfSimpleReifiedLens ReifiedLens ReifyLens reflectLensSimpleOverloaded OverloadedLensLikeSimpleLensLike SimpleLenslens%%~%%=resultAtmerged alongside cloneLens<%~<+~<-~<*~~<>=<<>~<<>=_dual_endo_all_any_sum_product_firstordinalviewLviewR traverseTo traverseFrom traverseSlicepackedtextIsTextrootbranches_cast_gcastixixmapped traverseArray~=<~<=<.>~<.>=<<.>~<<.>= _basename _directory _extension _filenameevalOfparOfafter throughoutseqOf GTraversalgenericgeneric1Control.CategoryCategory.$fIsomorphicIsomorphism$fCategoryIsomorphism$fIsomorphic(->)transformers-0.3.0.0GHC.BaseFunctorControl.Applicative ApplicativeConstidfmapghc-prim GHC.TypesInt Data.EitherEither Data.MaybeMaybecomonad-3.0.0.2Control.ComonadComonad$fSettableBackwards$fSettableIdentity$fGettableElementOf$fApplicativeMutator$fFunctorMutator$fSettableMutator$fSettableCompose$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$fComonadStorecContext$fComonadContext$fFunctorContext$fApplicativeFocusingErr$fFunctorFocusingErr $fMonoidErr$fApplicativeFocusingMay$fFunctorFocusingMay $fMonoidMay$fApplicativeFocusingOn$fFunctorFocusingOn$fApplicativeFocusingPlus$fFunctorFocusingPlus$fApplicativeFocusingWith$fFunctorFocusingWith$fApplicativeFocusing$fFunctorFocusing$fIndexediIndex$fIndexedi(->)constBoolflipMonadNothingmap Data.TuplefstCharpure<$$GHC.NumNumGHC.Real FractionalIntegral GHC.FloatFloating GHC.Classes||&& mtl-2.1.2Control.Monad.State.Class MonadState MonadReadercontainers-0.4.2.1Data.SetSetOrdunordered-containers-0.2.2.0 Data.HashSetHashSethashable-1.1.2.5 Data.HashableHashableEqstateFoldableGHC.Listrepeat replicate takeWhile dropWhilefor_ sequenceA_asum Alternativemsum MonadPluselemnotElem concatMapconcatlengthheadJust listToMaybelastTrueFalsenullmaximum fromMaybeGHC.ErrerrorminimumOrdering $fMonoidGAfor sequenceAmapMforMsequence unwrapMonad WrapMonad mapAccumLscanr1scanl1$fContainskHashSet$fContainskSet$fContainsIntIntSet $fAtkHashMap$fAtkMap $fAtIntIntMap Data.IntMapData.Mapfind$fFunctorWithIndexIntSeq$fFunctorWithIndexInt[]$fTraversableWithIndexkHashMap$fFoldableWithIndexkHashMap$fFunctorWithIndexkHashMap$fTraversableWithIndexkMap$fFoldableWithIndexkMap$fFunctorWithIndexkMap$fTraversableWithIndexIntIntMap$fFoldableWithIndexIntIntMap$fFunctorWithIndexIntIntMap$fTraversableWithIndexIntSeq$fFoldableWithIndexIntSeq$fTraversableWithIndexInt[]$fFoldableWithIndexInt[]GHC.ShowShowGHC.ReadRead Data.Functor<$><*>negate==$fApplicativeOut $fFunctorOut $fPlatedTree $fPlated[]return>>=$fRepresentable(->)$fRepresentableIdentity$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'Control.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$fZoomStateTStateTFocusingst0template-haskellLanguage.Haskell.TH.SyntaxnewNameName$fSubstTypePred $fSubstType[]$fSubstTypeType$fHasTypeVars[]$fHasTypeVarsPred$fHasTypeVarsType$fHasTypeVarsName$fHasTypeVarsTyVarBndr $fHasNameCon $fHasNameName$fHasNameTyVarBndr GHC.Exception Exception SomeException Data.Bits.|.Bits.&.bitSize undefined integer-gmpGHC.Integer.TypeIntegerbytestring-0.9.2.1Data.ByteString.Internal ByteStringGHC.WordWord8Data.ByteString.Lazy.Internal$fIsByteStringByteString$fIsByteStringByteString0realPartpolar magnitudephase Data.DatagmapMDataData.Typeable.InternalTypeable$fFunctorOracle$fFunctorAnswer Data.DynamicDynamic Data.IntSetIntSetmappendDualEndoAllAnySumProductFirstLast Data.SequenceSeqViewLviewlViewRviewr text-0.11.2.3 Data.TextData.Text.Lazy.InternalData.Text.Lazy $fIsTextText $fIsTextText0 Data.TreeTree Data.Typeablecastgcast array-0.4.0.0Data.Array.BaseIArray!//ixmapboundsamapGHC.IOFilePathStringparallel-3.2.0.3Control.Parallel.StrategiesevalTraversableStrategyEvalparTraversablerdeepseq Control.Seq seqFoldable GHC.GenericsGeneric$fGTraversal:.:$fGTraversalM1$fGTraversal:+:$fGTraversal:*:$fGTraversalU1$fGTraversalK1