úΔ=tl      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijkRankNTypes, TemplateHaskell provisionalEdward Kmett <ekmett@gmail.com>None<This class allows us to use . on a number of different monad transformers. KUse a lens to lift an operation with simpler context into a larger context (Build a lens from a getter and a setter :Built a lens from an isomorphism or an isomorphism family Build a getter Building a multigetter Build a setter Get the value of a  ,   or   or the fold of a  l,  or  that points at monoidal  values. Modify the target of a  ,   or all the targets of a   Multilens, ,  or  Modify the target of a  ,   or all the targets of a   Multilens, ,  or  Replace the target of a  ,  ,  or  Read the value of a  ,   or  .  This is the same operation as . Read a field from a  ,   or  . I The fixity and semantics are such that subsequent field accesses can be : performed with (Prelude..) This is the same operation as ' flip reading' 5 ghci> ((0, 1 :+ 2), 3)^.fstL.sndL.getting magnitude  2.23606797749979 Modifies the target of a  ,  , , or . This is an infix version of  Replaces the target(s) of a  ,  ,  or . This is an infix version of  0Increment the target(s) of a numerically valued   or Setter'  ghci> fstL ^+= 1 $ (1,2)  (2,2) 0Decrement the target(s) of a numerically valued   or   ghci> fstL ^-= 2 $ (1,2)  (-1,2) /Multiply the target(s) of a numerically valued   or Setter'  ghci> sndL ^*= 4 $ (1,2)  (1,8) -Divide the target(s) of a numerically valued   or   Logically m the target(s) of a n-valued   or   Logically o the target(s) of a n-valued   or   Cloning a   or  ) is one way to make sure you arent given  something weaker, such as a  or , and can be used ? as a way to pass around lenses that have to be monomorphic in f. QThis is a lens family that can change the value (and type) of the first field of  a pair. !As  &, but for the second field of a pair. "=This lens can be used to read, write or delete a member of a p. 3 ghci> Map.fromList [("hello",12)] ^. keyL "hello"  Just 12 #>This lens can be used to read, write or delete a member of an q.  0 ghci> IntMap.fromList [(1,"hello")] ^. keyL 1  Just "hello" ; ghci> keyL 2 ^= "goodbye" $ IntMap.fromList [(1,"hello")] & fromList [(1,"hello"),(2,"goodbye")] $=This lens can be used to read, write or delete a member of a r 3 ghci> memberL 3 ^= False $ Set.fromList [1,2,3,4]  fromList [1,2,4] %>This lens can be used to read, write or delete a member of an s 9 ghci> intMemberL 3 ^= False $ IntSet.fromList [1,2,3,4]  fromList [1,2,4] &CThis lens can be used to access the contents of the Identity monad 'HThis lens can be used to change the result of a function but only where $ the arguments match the key given. ( Access a field of a state monad ).Set the value of a field in our monadic state *1Modify the value of a field in our monadic state +VModify the value of a field in our monadic state and return some information about it ,<Modify a numeric field in our monadic state by adding to it -CModify a numeric field in our monadic state by subtracting from it .>Modify a numeric field in our monadic state by multiplying it /;Modify a numeric field in our monadic state by dividing it 0EModify a boolean field in our monadic state by computing its logical o with another value. 1EModify a boolean field in our monadic state by computing its logical m with another value. 2 @ foldMapOf :: Monoid m => MultiGetter a b -> (b -> m) -> a -> m 3 1 foldOf :: Monoid m => MultiGetter a m -> a -> m 4 < foldrOf :: MultiGetter a b -> (b -> c -> c) -> c -> a -> c 5 ) toListOf :: MultiGetter a b -> a -> [b] 8 6 anyOf :: MultiGetter a b -> (b -> Bool) -> a -> Bool 9 6 allOf :: MultiGetter a b -> (b -> Bool) -> a -> Bool < L traverseOf_ :: Applicative f => MultiGetter a b -> (b -> f c) -> a -> f () = G forOf_ :: Applicative f => MultiGetter a b -> a -> (b -> f c) -> f () > D sequenceAOf_ :: Applicative f => MultiGetter a (f ()) -> a -> f () ? B mapMOf_ :: Monad m => MultiGetter a b -> (b -> m c) -> a -> m () @ B forMOf_ :: Monad m => MultiGetter a b -> a -> (b -> m c) -> m () A < sequenceOf_ :: Monad m => MultiGetter a (m b) -> a -> m () B1The sum of a collection of actions, generalizing G. C1The sum of a collection of actions, generalizing G. F*concatMapOf :: MultiGetter a c -> (c -> [e] ) -> a -> [e] METhis is the partial lens that never succeeds at returning any values T4Derive lenses with the provided name transformation ! and filtering function. Produce  Just lensName to generate a lens  of the resultant name, or Nothing to not generate a lens  for the input record name. Example usage: , makeLensesBy (\n -> Just (n ++ "L")) ''Foo U*Derive lenses for the record selectors in ( a single-constructor data declaration, 6 or for the record selector in a newtype declaration. 7 Lenses will only be generated for record fields which " are prefixed with an underscore. Example usage:  makeLenses ''Foo V/Derive lenses, specifying explicit pairings of (fieldName, lensName). Example usage: < makeLensesFor [("_foo", "fooLens"), ("bar", "lbar")] ''Foo t'We can focus Reader environments, too! `  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTthe name transformer UVuvwtxyz{|W  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVW UTV (*)+,-./10 !"#$%&'L24358967:;<=>?@ABCFGDEMQRNOPSHIJK_  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVuvwtxyz{| RankNTypes provisionalEdward Kmett <ekmett@gmail.com> Safe-InferedWGSometimes you need to store a path lens into a container, but at least F at this time, impredicative polymorphism in GHC is somewhat lacking. FThis type provides a way to, say, store a list of polymorphic lenses. ZRepresentable Functors. A } f is Z if it is isomorphic to (x -> a) > for some x. 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 = Rep f is a valid choice of x for every  Z }. @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 Z  here. \The representation of a Z } as Lenses ]]# is a valid default definition for ~ for a representable  functor.  $ fmapRep f m = rep $ \i -> f (m^.i) "Usage for a representable functor Foo:  instance Functor Foo where  fmap = fmapRep ^^# is a valid default definition for  and € for a  representable functor.   pureRep = rep . const "Usage for a representable functor Foo:   instance Applicative Foo where  pure = pureRep  (<*>) = apRep  instance Monad Foo where  return = pureRep  (>>=) = bindRep __# is a valid default definition for '( *)' for a representable  functor.  ) apRep mf ma = rep $ \i -> mf^.i $ ma^.i "Usage for a representable functor Foo:  instance Applicative Foo where  pure = pureRep  (<*>) = apRep ``+ is a valid default default definition for '(>>=)' for a  representable functor.  & bindRep m f = rep $ \i -> f(m^.i)^.i "Usage for a representable functor Foo:  instance Monad ... where  return = pureRep  (>>=) = bindRep aA default definition for  for a Z }  . distributeRep wf = rep $ \i -> fmap (^.i) wf Typical Usage: ! instance Distributive ... where  distribute = distributeRep bA Z }. has a fixed shape. This fills each position  in it with a W c Map over a Z }" with access to the lens for the  current position ) mapWithKey f m = rep $ \i -> f i (m^.i) d Traverse a Z }! with access to the current path e Traverse a Z }! with access to the current path " as a lens, discarding the result f Traverse a Z }! with access to the current path ( and a lens (and the arguments flipped) g over a Z }! with access to the current path  as a lens h over a Z }! with access to the current path " as a lens, discarding the result i over a Z }! with access to the current path ( as a lens (with the arguments flipped) j Fold over a Z }! with access to the current path  as a lens, yielding a ‚ k Fold over a Z }! with access to the current path  as a lens. ƒCNB: The Eq requirement on this instance is a consequence of a lens  rather than e as the representation. WXYZ[\]^_`abcdefghijkƒ„WXYZ[\]^_`abcdefghijkZ[\]^_`aWXYbcjkdefghiWXYZ[\]^_`abcdefghijkƒ„…      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrsqtuqrvwxywz{w|}w~€‚ƒ„…†‡ˆ‰Š‹‰ŠŒ‰Ž‰Š‰‘‰’“”•–lens-0.2 Control.LensControl.Lens.RepData.Distributive distribute TraversalFocusfocusFocusing IndexedStoreMultiLensFamily MultiLens SetterFamilySetterGetter LensFamilyLenslensisogetting gettingManysettingreadingmapOf modifyingwriting^$^.^%=^=^+=^-=^*=^/=^||=^&&=clonefstLsndLkeyLintKeyLmemberL intMemberL identityLatLaccess~=%=%%=+=-=*=//=&&=||= foldMapOffoldOffoldrOftoListOfandOforOfanyOfallOf productOfsumOf traverseOf_forOf_ sequenceAOf_mapMOf_forMOf_ sequenceOf_asumOfmsumOfelemOf notElemOf concatMapOfconcatOf traverseOfmapMOf sequenceAOf sequenceOffoldedconstMLheadMLtailMLleftMLkeyMLintKeyML elementML makeLensesBy makeLenses makeLensesForKeyturn RepresentablerepRepfmapReppureRepapRepbindRep distributeRepkeys mapWithReptraverseWithReptraverseWithRep_ forWithRep mapMWithRep mapMWithRep_ forMWithRepfoldMapWithRep foldrWithRep MultiGetterghc-prim GHC.Classes|| GHC.TypesBool&&containers-0.4.2.1Data.MapMap Data.IntMapIntMapData.SetSet Data.IntSetIntSet$fFocusReaderT$fMonoidTraversal$fApplicativeSA $fFunctorSA $fFocusStateT$fFocusStateT0$fApplicativeFocusing$fFunctorFocusing$fFunctorIndexedStorebaseGHC.BaseFunctorfmapControl.ApplicativepurereturnData.TraversablemapM Data.MonoidMonoid$fRepresentable(->)$fRepresentableIdentity