lens 3.0.6 → 3.1
raw patch · 35 files changed
+1432/−1398 lines, 35 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
- Control.Lens.IndexedFold: ifiltered :: (Gettable f, Applicative f, Indexed i k) => (i -> c -> Bool) -> Index i (c -> f c) (a -> f b) -> k (c -> f c) (a -> f b)
- Control.Lens.Internal: instance (Monad m, Monoid c) => Applicative (Focusing m c)
- Control.Lens.Internal: instance (Monad m, Monoid c, Monoid w) => Applicative (FocusingWith w m c)
- Control.Lens.Internal: instance (Monoid c, Monoid w, Monad m) => Applicative (EffectRWS w s m c)
- Control.Lens.Internal: instance (Monoid w, Applicative (k (c, w))) => Applicative (FocusingPlus w k c)
- Control.Lens.Internal: instance Applicative (Bazaar c d)
- Control.Lens.Internal: instance Applicative (k (Err e c)) => Applicative (FocusingErr e k c)
- Control.Lens.Internal: instance Applicative (k (May c)) => Applicative (FocusingMay k c)
- Control.Lens.Internal: instance Applicative (k (f c)) => Applicative (FocusingOn f k c)
- Control.Lens.Internal: instance Functor (Bazaar c d)
- Control.Lens.Internal: instance Functor (Context c d)
- Control.Lens.Internal: instance Functor (EffectRWS w s m c)
- Control.Lens.Internal: instance Functor (k (Err e c)) => Functor (FocusingErr e k c)
- Control.Lens.Internal: instance Functor (k (May c)) => Functor (FocusingMay k c)
- Control.Lens.Internal: instance Functor (k (c, w)) => Functor (FocusingPlus w k c)
- Control.Lens.Internal: instance Functor (k (f c)) => Functor (FocusingOn f k c)
- Control.Lens.Internal: instance Gettable (EffectRWS w s m c)
- Control.Lens.Internal: instance Monad m => Functor (Focusing m c)
- Control.Lens.Internal: instance Monad m => Functor (FocusingWith w m c)
- Control.Lens.Internal: instance c ~ d => Comonad (Bazaar c d)
- Control.Lens.Internal: instance c ~ d => Comonad (Context c d)
- Control.Lens.Internal: instance c ~ d => ComonadApply (Bazaar c d)
- Control.Lens.Internal: instance c ~ d => ComonadStore c (Context c d)
- Control.Lens.Plated: instance Applicative (Out c)
- Control.Lens.Plated: instance Functor (Out c)
- Control.Lens.Projection: instance (a ~ a', d ~ d') => Projective (Project a d) a' d'
+ Control.Lens.IndexedFold: ifiltering :: (Applicative f, Indexed i k) => (i -> a -> Bool) -> Index i (a -> f a) (s -> f t) -> k (a -> f a) (s -> f t)
+ Control.Lens.Internal: instance (Monad m, Monoid s) => Applicative (Focusing m s)
+ Control.Lens.Internal: instance (Monad m, Monoid s, Monoid w) => Applicative (FocusingWith w m s)
+ Control.Lens.Internal: instance (Monoid s, Monoid w, Monad m) => Applicative (EffectRWS w st m s)
+ Control.Lens.Internal: instance (Monoid w, Applicative (k (s, w))) => Applicative (FocusingPlus w k s)
+ Control.Lens.Internal: instance Applicative (Bazaar a b)
+ Control.Lens.Internal: instance Applicative (k (Err e s)) => Applicative (FocusingErr e k s)
+ Control.Lens.Internal: instance Applicative (k (May s)) => Applicative (FocusingMay k s)
+ Control.Lens.Internal: instance Applicative (k (f s)) => Applicative (FocusingOn f k s)
+ Control.Lens.Internal: instance Functor (Bazaar s t)
+ Control.Lens.Internal: instance Functor (Context a b)
+ Control.Lens.Internal: instance Functor (EffectRWS w st m s)
+ Control.Lens.Internal: instance Functor (k (Err e s)) => Functor (FocusingErr e k s)
+ Control.Lens.Internal: instance Functor (k (May s)) => Functor (FocusingMay k s)
+ Control.Lens.Internal: instance Functor (k (f s)) => Functor (FocusingOn f k s)
+ Control.Lens.Internal: instance Functor (k (s, w)) => Functor (FocusingPlus w k s)
+ Control.Lens.Internal: instance Gettable (EffectRWS w st m s)
+ Control.Lens.Internal: instance Monad m => Functor (Focusing m s)
+ Control.Lens.Internal: instance Monad m => Functor (FocusingWith w m s)
+ Control.Lens.Internal: instance a ~ b => Comonad (Bazaar a b)
+ Control.Lens.Internal: instance a ~ b => Comonad (Context a b)
+ Control.Lens.Internal: instance a ~ b => ComonadStore a (Context a b)
+ Control.Lens.Internal: instance s ~ t => ComonadApply (Bazaar s t)
+ Control.Lens.Plated: instance Applicative (Out s)
+ Control.Lens.Plated: instance Functor (Out s)
+ Control.Lens.Projection: instance (s ~ s', b ~ b') => Projective (Project s b) s' b'
+ Control.Lens.Traversal: dropping :: Applicative f => Int -> SimpleLensLike (Indexing f) s a -> SimpleLensLike f s a
+ Control.Lens.Traversal: taking :: Applicative f => Int -> SimpleLensLike (Indexing f) s a -> SimpleLensLike f s a
- Control.Lens.Action: (^!) :: Monad m => a -> Acting m c a b c d -> m c
+ Control.Lens.Action: (^!) :: Monad m => s -> Acting m a s t a b -> m a
- Control.Lens.Action: act :: Monad m => (a -> m c) -> Action m a c
+ Control.Lens.Action: act :: Monad m => (s -> m a) -> Action m s a
- Control.Lens.Action: liftAct :: (MonadTrans t, Monad m) => Acting m c a b c d -> Action (t m) a c
+ Control.Lens.Action: liftAct :: (MonadTrans trans, Monad m) => Acting m a s t a b -> Action (trans m) s a
- Control.Lens.Action: perform :: Monad m => Acting m c a b c d -> a -> m c
+ Control.Lens.Action: perform :: Monad m => Acting m a s t a b -> s -> m a
- Control.Lens.Action: performs :: Monad m => Acting m e a b c d -> (c -> e) -> a -> m e
+ Control.Lens.Action: performs :: Monad m => Acting m e s t a b -> (a -> e) -> s -> m e
- Control.Lens.Action: type MonadicFold m a c = forall f r. (Effective m r f, Applicative f) => (c -> f c) -> a -> f a
+ Control.Lens.Action: type MonadicFold m s a = forall f r. (Effective m r f, Applicative f) => (a -> f a) -> s -> f s
- Control.Lens.Action: type Acting m r a b c d = (c -> Effect m r d) -> a -> Effect m r b
+ Control.Lens.Action: type Acting m r s t a b = (a -> Effect m r b) -> s -> Effect m r t
- Control.Lens.Fold: (^..) :: a -> Getting [c] a b c d -> [c]
+ Control.Lens.Fold: (^..) :: s -> Getting [a] s t a b -> [a]
- Control.Lens.Fold: (^?) :: a -> Getting (First c) a b c d -> Maybe c
+ Control.Lens.Fold: (^?) :: s -> Getting (First a) s t a b -> Maybe a
- Control.Lens.Fold: ReifyFold :: Fold a c -> ReifiedFold a c
+ Control.Lens.Fold: ReifyFold :: Fold s a -> ReifiedFold s a
- Control.Lens.Fold: allOf :: Getting All a b c d -> (c -> Bool) -> a -> Bool
+ Control.Lens.Fold: allOf :: Getting All s t a b -> (a -> Bool) -> s -> Bool
- Control.Lens.Fold: andOf :: Getting All a b Bool d -> a -> Bool
+ Control.Lens.Fold: andOf :: Getting All s t Bool b -> s -> Bool
- Control.Lens.Fold: anyOf :: Getting Any a b c d -> (c -> Bool) -> a -> Bool
+ Control.Lens.Fold: anyOf :: Getting Any s t a b -> (a -> Bool) -> s -> Bool
- Control.Lens.Fold: asumOf :: Alternative f => Getting (Endo (f c)) a b (f c) d -> a -> f c
+ Control.Lens.Fold: asumOf :: Alternative f => Getting (Endo (f a)) s t (f a) b -> s -> f a
- Control.Lens.Fold: backwards :: LensLike (Backwards f) a b c d -> LensLike f a b c d
+ Control.Lens.Fold: backwards :: LensLike (Backwards f) s t a b -> LensLike f s t a b
- Control.Lens.Fold: concatMapOf :: Getting [e] a b c d -> (c -> [e]) -> a -> [e]
+ Control.Lens.Fold: concatMapOf :: Getting [r] s t a b -> (a -> [r]) -> s -> [r]
- Control.Lens.Fold: concatOf :: Getting [e] a b [e] d -> a -> [e]
+ Control.Lens.Fold: concatOf :: Getting [r] s t [r] b -> s -> [r]
- Control.Lens.Fold: cycled :: (Applicative f, Gettable f) => LensLike f a b c d -> LensLike f a b c d
+ Control.Lens.Fold: cycled :: (Applicative f, Gettable f) => LensLike f s t a b -> LensLike f s t a b
- Control.Lens.Fold: droppingWhile :: (Gettable f, Applicative f) => (c -> Bool) -> Getting (Endo (f a, f a)) a a c c -> LensLike f a a c c
+ Control.Lens.Fold: droppingWhile :: (Gettable f, Applicative f) => (a -> Bool) -> Getting (Endo (f s, f s)) s s a a -> LensLike f s s a a
- Control.Lens.Fold: elemOf :: Eq c => Getting Any a b c d -> c -> a -> Bool
+ Control.Lens.Fold: elemOf :: Eq a => Getting Any s t a b -> a -> s -> Bool
- Control.Lens.Fold: filtered :: (Gettable f, Applicative f) => (c -> Bool) -> LensLike f a b c d -> LensLike f a b c d
+ Control.Lens.Fold: filtered :: Applicative f => (a -> Bool) -> SimpleLensLike f a a
- Control.Lens.Fold: findOf :: Getting (First c) a b c d -> (c -> Bool) -> a -> Maybe c
+ Control.Lens.Fold: findOf :: Getting (First a) s t a b -> (a -> Bool) -> s -> Maybe a
- Control.Lens.Fold: foldMapOf :: Getting r a b c d -> (c -> r) -> a -> r
+ Control.Lens.Fold: foldMapOf :: Getting r s t a b -> (a -> r) -> s -> r
- Control.Lens.Fold: foldOf :: Getting c a b c d -> a -> c
+ Control.Lens.Fold: foldOf :: Getting a s t a b -> s -> a
- Control.Lens.Fold: folded :: Foldable f => Fold (f c) c
+ Control.Lens.Fold: folded :: Foldable f => Fold (f a) a
- Control.Lens.Fold: folding :: (Foldable f, Applicative g, Gettable g) => (a -> f c) -> LensLike g a b c d
+ Control.Lens.Fold: folding :: (Foldable f, Applicative g, Gettable g) => (s -> f a) -> LensLike g s t a b
- Control.Lens.Fold: foldl1Of :: Getting (Dual (Endo (Maybe c))) a b c d -> (c -> c -> c) -> a -> c
+ Control.Lens.Fold: foldl1Of :: Getting (Dual (Endo (Maybe a))) s t a b -> (a -> a -> a) -> s -> a
- Control.Lens.Fold: foldlMOf :: Monad m => Getting (Endo (e -> m e)) a b c d -> (e -> c -> m e) -> e -> a -> m e
+ Control.Lens.Fold: foldlMOf :: Monad m => Getting (Endo (r -> m r)) s t a b -> (r -> a -> m r) -> r -> s -> m r
- Control.Lens.Fold: foldlOf :: Getting (Dual (Endo e)) a b c d -> (e -> c -> e) -> e -> a -> e
+ Control.Lens.Fold: foldlOf :: Getting (Dual (Endo r)) s t a b -> (r -> a -> r) -> r -> s -> r
- Control.Lens.Fold: foldlOf' :: Getting (Endo (e -> e)) a b c d -> (e -> c -> e) -> e -> a -> e
+ Control.Lens.Fold: foldlOf' :: Getting (Endo (r -> r)) s t a b -> (r -> a -> r) -> r -> s -> r
- Control.Lens.Fold: foldr1Of :: Getting (Endo (Maybe c)) a b c d -> (c -> c -> c) -> a -> c
+ Control.Lens.Fold: foldr1Of :: Getting (Endo (Maybe a)) s t a b -> (a -> a -> a) -> s -> a
- Control.Lens.Fold: foldrMOf :: Monad m => Getting (Dual (Endo (e -> m e))) a b c d -> (c -> e -> m e) -> e -> a -> m e
+ Control.Lens.Fold: foldrMOf :: Monad m => Getting (Dual (Endo (r -> m r))) s t a b -> (a -> r -> m r) -> r -> s -> m r
- Control.Lens.Fold: foldrOf :: Getting (Endo e) a b c d -> (c -> e -> e) -> e -> a -> e
+ Control.Lens.Fold: foldrOf :: Getting (Endo r) s t a b -> (a -> r -> r) -> r -> s -> r
- Control.Lens.Fold: foldrOf' :: Getting (Dual (Endo (e -> e))) a b c d -> (c -> e -> e) -> e -> a -> e
+ Control.Lens.Fold: foldrOf' :: Getting (Dual (Endo (r -> r))) s t a b -> (a -> r -> r) -> r -> s -> r
- Control.Lens.Fold: forMOf_ :: Monad m => Getting (Sequenced m) a b c d -> a -> (c -> m e) -> m ()
+ Control.Lens.Fold: forMOf_ :: Monad m => Getting (Sequenced m) s t a b -> s -> (a -> m r) -> m ()
- Control.Lens.Fold: forOf_ :: Functor f => Getting (Traversed f) a b c d -> a -> (c -> f e) -> f ()
+ Control.Lens.Fold: forOf_ :: Functor f => Getting (Traversed f) s t a b -> s -> (a -> f r) -> f ()
- Control.Lens.Fold: headOf :: Getting (First c) a b c d -> a -> Maybe c
+ Control.Lens.Fold: headOf :: Getting (First a) s t a b -> s -> Maybe a
- Control.Lens.Fold: lastOf :: Getting (Last c) a b c d -> a -> Maybe c
+ Control.Lens.Fold: lastOf :: Getting (Last a) s t a b -> s -> Maybe a
- Control.Lens.Fold: lengthOf :: Getting (Sum Int) a b c d -> a -> Int
+ Control.Lens.Fold: lengthOf :: Getting (Sum Int) s t a b -> s -> Int
- Control.Lens.Fold: mapMOf_ :: Monad m => Getting (Sequenced m) a b c d -> (c -> m e) -> a -> m ()
+ Control.Lens.Fold: mapMOf_ :: Monad m => Getting (Sequenced m) s t a b -> (a -> m r) -> s -> m ()
- Control.Lens.Fold: maximumByOf :: Getting (Endo (Maybe c)) a b c d -> (c -> c -> Ordering) -> a -> Maybe c
+ Control.Lens.Fold: maximumByOf :: Getting (Endo (Maybe a)) s t a b -> (a -> a -> Ordering) -> s -> Maybe a
- Control.Lens.Fold: maximumOf :: Getting (Max c) a b c d -> a -> Maybe c
+ Control.Lens.Fold: maximumOf :: Getting (Max a) s t a b -> s -> Maybe a
- Control.Lens.Fold: minimumByOf :: Getting (Endo (Maybe c)) a b c d -> (c -> c -> Ordering) -> a -> Maybe c
+ Control.Lens.Fold: minimumByOf :: Getting (Endo (Maybe a)) s t a b -> (a -> a -> Ordering) -> s -> Maybe a
- Control.Lens.Fold: minimumOf :: Getting (Min c) a b c d -> a -> Maybe c
+ Control.Lens.Fold: minimumOf :: Getting (Min a) s t a b -> s -> Maybe a
- Control.Lens.Fold: msumOf :: MonadPlus m => Getting (Endo (m c)) a b (m c) d -> a -> m c
+ Control.Lens.Fold: msumOf :: MonadPlus m => Getting (Endo (m a)) s t (m a) b -> s -> m a
- Control.Lens.Fold: newtype ReifiedFold a c
+ Control.Lens.Fold: newtype ReifiedFold s a
- Control.Lens.Fold: notElemOf :: Eq c => Getting All a b c d -> c -> a -> Bool
+ Control.Lens.Fold: notElemOf :: Eq a => Getting All s t a b -> a -> s -> Bool
- Control.Lens.Fold: nullOf :: Getting All a b c d -> a -> Bool
+ Control.Lens.Fold: nullOf :: Getting All s t a b -> s -> Bool
- Control.Lens.Fold: orOf :: Getting Any a b Bool d -> a -> Bool
+ Control.Lens.Fold: orOf :: Getting Any s t Bool b -> s -> Bool
- Control.Lens.Fold: productOf :: Getting (Product c) a b c d -> a -> c
+ Control.Lens.Fold: productOf :: Getting (Product a) s t a b -> s -> a
- Control.Lens.Fold: reflectFold :: ReifiedFold a c -> Fold a c
+ Control.Lens.Fold: reflectFold :: ReifiedFold s a -> Fold s a
- Control.Lens.Fold: sequenceAOf_ :: Functor f => Getting (Traversed f) a b (f ()) d -> a -> f ()
+ Control.Lens.Fold: sequenceAOf_ :: Functor f => Getting (Traversed f) s t (f ()) b -> s -> f ()
- Control.Lens.Fold: sequenceOf_ :: Monad m => Getting (Sequenced m) a b (m c) d -> a -> m ()
+ Control.Lens.Fold: sequenceOf_ :: Monad m => Getting (Sequenced m) s t (m a) b -> s -> m ()
- Control.Lens.Fold: sumOf :: Getting (Sum c) a b c d -> a -> c
+ Control.Lens.Fold: sumOf :: Getting (Sum a) s t a b -> s -> a
- Control.Lens.Fold: takingWhile :: (Gettable f, Applicative f) => (c -> Bool) -> Getting (Endo (f a)) a a c c -> LensLike f a a c c
+ Control.Lens.Fold: takingWhile :: (Gettable f, Applicative f) => (a -> Bool) -> Getting (Endo (f s)) s s a a -> LensLike f s s a a
- Control.Lens.Fold: toListOf :: Getting [c] a b c d -> a -> [c]
+ Control.Lens.Fold: toListOf :: Getting [a] s t a b -> s -> [a]
- Control.Lens.Fold: traverseOf_ :: Functor f => Getting (Traversed f) a b c d -> (c -> f e) -> a -> f ()
+ Control.Lens.Fold: traverseOf_ :: Functor f => Getting (Traversed f) s t a b -> (a -> f r) -> s -> f ()
- Control.Lens.Fold: type Fold a c = forall f. (Gettable f, Applicative f) => (c -> f c) -> a -> f a
+ Control.Lens.Fold: type Fold s a = forall f. (Gettable f, Applicative f) => (a -> f a) -> s -> f s
- Control.Lens.Getter: (^$) :: Getting c a b c d -> a -> c
+ Control.Lens.Getter: (^$) :: Getting a s t a b -> s -> a
- Control.Lens.Getter: (^.) :: a -> Getting c a b c d -> c
+ Control.Lens.Getter: (^.) :: s -> Getting a s t a b -> a
- Control.Lens.Getter: ReifyGetter :: Getter a c -> ReifiedGetter a c
+ Control.Lens.Getter: ReifyGetter :: Getter s a -> ReifiedGetter s a
- Control.Lens.Getter: newtype ReifiedGetter a c
+ Control.Lens.Getter: newtype ReifiedGetter s a
- Control.Lens.Getter: queries :: MonadReader a m => Getting e a b c d -> (c -> e) -> m e
+ Control.Lens.Getter: queries :: MonadReader s m => Getting r s t a b -> (a -> r) -> m r
- Control.Lens.Getter: query :: MonadReader a m => Getting c a b c d -> m c
+ Control.Lens.Getter: query :: MonadReader s m => Getting a s t a b -> m a
- Control.Lens.Getter: reflectGetter :: ReifiedGetter a c -> Getter a c
+ Control.Lens.Getter: reflectGetter :: ReifiedGetter s a -> Getter s a
- Control.Lens.Getter: to :: (a -> c) -> Getter a c
+ Control.Lens.Getter: to :: (s -> a) -> Getter s a
- Control.Lens.Getter: type Getter a c = forall f. Gettable f => (c -> f c) -> a -> f a
+ Control.Lens.Getter: type Getter s a = forall f. Gettable f => (a -> f a) -> s -> f s
- Control.Lens.Getter: type Getting r a b c d = (c -> Accessor r d) -> a -> Accessor r b
+ Control.Lens.Getter: type Getting r s t a b = (a -> Accessor r b) -> s -> Accessor r t
- Control.Lens.Getter: use :: MonadState a m => Getting c a b c d -> m c
+ Control.Lens.Getter: use :: MonadState s m => Getting a s t a b -> m a
- Control.Lens.Getter: uses :: MonadState a m => Getting e a b c d -> (c -> e) -> m e
+ Control.Lens.Getter: uses :: MonadState s m => Getting e s t a b -> (a -> e) -> m e
- Control.Lens.Getter: view :: Getting c a b c d -> a -> c
+ Control.Lens.Getter: view :: Getting a s t a b -> s -> a
- Control.Lens.Getter: views :: Getting m a b c d -> (c -> m) -> a -> m
+ Control.Lens.Getter: views :: Getting m s t a b -> (a -> m) -> s -> m
- Control.Lens.Indexed: indexed :: Indexed Int k => ((c -> Indexing f d) -> a -> Indexing f b) -> k (c -> f d) (a -> f b)
+ Control.Lens.Indexed: indexed :: Indexed Int k => ((a -> Indexing f b) -> s -> Indexing f t) -> k (a -> f b) (s -> f t)
- Control.Lens.IndexedFold: ReifyIndexedFold :: IndexedFold i a c -> ReifiedIndexedFold i a c
+ Control.Lens.IndexedFold: ReifyIndexedFold :: IndexedFold i s a -> ReifiedIndexedFold i s a
- Control.Lens.IndexedFold: iallOf :: IndexedGetting i All a b c d -> (i -> c -> Bool) -> a -> Bool
+ Control.Lens.IndexedFold: iallOf :: IndexedGetting i All s t a b -> (i -> a -> Bool) -> s -> Bool
- Control.Lens.IndexedFold: ianyOf :: IndexedGetting i Any a b c d -> (i -> c -> Bool) -> a -> Bool
+ Control.Lens.IndexedFold: ianyOf :: IndexedGetting i Any s t a b -> (i -> a -> Bool) -> s -> Bool
- Control.Lens.IndexedFold: ibackwards :: Indexed i k => Index i (c -> (Backwards f) d) (a -> (Backwards f) b) -> k (c -> f d) (a -> f b)
+ Control.Lens.IndexedFold: ibackwards :: Indexed i k => Index i (a -> (Backwards f) b) (s -> (Backwards f) t) -> k (a -> f b) (s -> f t)
- Control.Lens.IndexedFold: iconcatMapOf :: IndexedGetting i [e] a b c d -> (i -> c -> [e]) -> a -> [e]
+ Control.Lens.IndexedFold: iconcatMapOf :: IndexedGetting i [r] s t a b -> (i -> a -> [r]) -> s -> [r]
- Control.Lens.IndexedFold: idroppingWhile :: (Gettable f, Applicative f, Indexed i k) => (i -> c -> Bool) -> IndexedGetting i (Endo (f a, f a)) a a c c -> k (c -> f c) (a -> f a)
+ Control.Lens.IndexedFold: idroppingWhile :: (Gettable f, Applicative f, Indexed i k) => (i -> a -> Bool) -> IndexedGetting i (Endo (f s, f s)) s s a a -> k (a -> f a) (s -> f s)
- Control.Lens.IndexedFold: ifindOf :: IndexedGetting i (First (i, c)) a b c d -> (i -> c -> Bool) -> a -> Maybe (i, c)
+ Control.Lens.IndexedFold: ifindOf :: IndexedGetting i (First (i, a)) s t a b -> (i -> a -> Bool) -> s -> Maybe (i, a)
- Control.Lens.IndexedFold: ifoldMapOf :: IndexedGetting i m a b c d -> (i -> c -> m) -> a -> m
+ Control.Lens.IndexedFold: ifoldMapOf :: IndexedGetting i m s t a b -> (i -> a -> m) -> s -> m
- Control.Lens.IndexedFold: ifoldlMOf :: Monad m => IndexedGetting i (Endo (e -> m e)) a b c d -> (i -> e -> c -> m e) -> e -> a -> m e
+ Control.Lens.IndexedFold: ifoldlMOf :: Monad m => IndexedGetting i (Endo (r -> m r)) s t a b -> (i -> r -> a -> m r) -> r -> s -> m r
- Control.Lens.IndexedFold: ifoldlOf :: IndexedGetting i (Dual (Endo e)) a b c d -> (i -> e -> c -> e) -> e -> a -> e
+ Control.Lens.IndexedFold: ifoldlOf :: IndexedGetting i (Dual (Endo r)) s t a b -> (i -> r -> a -> r) -> r -> s -> r
- Control.Lens.IndexedFold: ifoldlOf' :: IndexedGetting i (Endo (e -> e)) a b c d -> (i -> e -> c -> e) -> e -> a -> e
+ Control.Lens.IndexedFold: ifoldlOf' :: IndexedGetting i (Endo (r -> r)) s t a b -> (i -> r -> a -> r) -> r -> s -> r
- Control.Lens.IndexedFold: ifoldrMOf :: Monad m => IndexedGetting i (Dual (Endo (e -> m e))) a b c d -> (i -> c -> e -> m e) -> e -> a -> m e
+ Control.Lens.IndexedFold: ifoldrMOf :: Monad m => IndexedGetting i (Dual (Endo (r -> m r))) s t a b -> (i -> a -> r -> m r) -> r -> s -> m r
- Control.Lens.IndexedFold: ifoldrOf :: IndexedGetting i (Endo e) a b c d -> (i -> c -> e -> e) -> e -> a -> e
+ Control.Lens.IndexedFold: ifoldrOf :: IndexedGetting i (Endo r) s t a b -> (i -> a -> r -> r) -> r -> s -> r
- Control.Lens.IndexedFold: ifoldrOf' :: IndexedGetting i (Dual (Endo (e -> e))) a b c d -> (i -> c -> e -> e) -> e -> a -> e
+ Control.Lens.IndexedFold: ifoldrOf' :: IndexedGetting i (Dual (Endo (r -> r))) s t a b -> (i -> a -> r -> r) -> r -> s -> r
- Control.Lens.IndexedFold: iforMOf_ :: Monad m => IndexedGetting i (Sequenced m) a b c d -> a -> (i -> c -> m e) -> m ()
+ Control.Lens.IndexedFold: iforMOf_ :: Monad m => IndexedGetting i (Sequenced m) s t a b -> s -> (i -> a -> m r) -> m ()
- Control.Lens.IndexedFold: iforOf_ :: Functor f => IndexedGetting i (Traversed f) a b c d -> a -> (i -> c -> f e) -> f ()
+ Control.Lens.IndexedFold: iforOf_ :: Functor f => IndexedGetting i (Traversed f) s t a b -> s -> (i -> a -> f r) -> f ()
- Control.Lens.IndexedFold: imapMOf_ :: Monad m => IndexedGetting i (Sequenced m) a b c d -> (i -> c -> m e) -> a -> m ()
+ Control.Lens.IndexedFold: imapMOf_ :: Monad m => IndexedGetting i (Sequenced m) s t a b -> (i -> a -> m r) -> s -> m ()
- Control.Lens.IndexedFold: indicesOf :: Gettable f => Overloaded (Index i) f a b c c -> LensLike f a b i j
+ Control.Lens.IndexedFold: indicesOf :: Gettable f => Overloaded (Index i) f s t a a -> LensLike f s t i j
- Control.Lens.IndexedFold: itakingWhile :: (Gettable f, Applicative f, Indexed i k) => (i -> c -> Bool) -> IndexedGetting i (Endo (f a)) a a c c -> k (c -> f c) (a -> f a)
+ Control.Lens.IndexedFold: itakingWhile :: (Gettable f, Applicative f, Indexed i k) => (i -> a -> Bool) -> IndexedGetting i (Endo (f s)) s s a a -> k (a -> f a) (s -> f s)
- Control.Lens.IndexedFold: itoListOf :: IndexedGetting i [(i, c)] a b c d -> a -> [(i, c)]
+ Control.Lens.IndexedFold: itoListOf :: IndexedGetting i [(i, a)] s t a b -> s -> [(i, a)]
- Control.Lens.IndexedFold: itraverseOf_ :: Functor f => IndexedGetting i (Traversed f) a b c d -> (i -> c -> f e) -> a -> f ()
+ Control.Lens.IndexedFold: itraverseOf_ :: Functor f => IndexedGetting i (Traversed f) s t a b -> (i -> a -> f r) -> s -> f ()
- Control.Lens.IndexedFold: newtype ReifiedIndexedFold i a c
+ Control.Lens.IndexedFold: newtype ReifiedIndexedFold i s a
- Control.Lens.IndexedFold: reflectIndexedFold :: ReifiedIndexedFold i a c -> IndexedFold i a c
+ Control.Lens.IndexedFold: reflectIndexedFold :: ReifiedIndexedFold i s a -> IndexedFold i s a
- Control.Lens.IndexedFold: type IndexedFold i a c = forall k f. (Indexed i k, Applicative f, Gettable f) => k (c -> f c) (a -> f a)
+ Control.Lens.IndexedFold: type IndexedFold i s a = forall k f. (Indexed i k, Applicative f, Gettable f) => k (a -> f a) (s -> f s)
- Control.Lens.IndexedFold: withIndicesOf :: Functor f => Overloaded (Index i) f a b c d -> LensLike f a b (i, c) (j, d)
+ Control.Lens.IndexedFold: withIndicesOf :: Functor f => Overloaded (Index i) f s t a b -> LensLike f s t (i, a) (j, b)
- Control.Lens.IndexedGetter: ReifyIndexedGetter :: IndexedGetter i a c -> ReifiedIndexedGetter i a c
+ Control.Lens.IndexedGetter: ReifyIndexedGetter :: IndexedGetter i s a -> ReifiedIndexedGetter i s a
- Control.Lens.IndexedGetter: newtype ReifiedIndexedGetter i a c
+ Control.Lens.IndexedGetter: newtype ReifiedIndexedGetter i s a
- Control.Lens.IndexedGetter: reflectIndexedGetter :: ReifiedIndexedGetter i a c -> IndexedGetter i a c
+ Control.Lens.IndexedGetter: reflectIndexedGetter :: ReifiedIndexedGetter i s a -> IndexedGetter i s a
- Control.Lens.IndexedGetter: type IndexedGetting i m a b c d = Index i (c -> Accessor m d) (a -> Accessor m b)
+ Control.Lens.IndexedGetter: type IndexedGetting i m s t a b = Index i (a -> Accessor m b) (s -> Accessor m t)
- Control.Lens.IndexedGetter: type IndexedGetter i a c = forall k f. (Indexed i k, Gettable f) => k (c -> f c) (a -> f a)
+ Control.Lens.IndexedGetter: type IndexedGetter i s a = forall k f. (Indexed i k, Gettable f) => k (a -> f a) (s -> f s)
- Control.Lens.IndexedLens: (%%@=) :: MonadState a m => Overloaded (Index i) ((,) e) a a c d -> (i -> c -> (e, d)) -> m e
+ Control.Lens.IndexedLens: (%%@=) :: MonadState s m => Overloaded (Index i) ((,) r) s s a b -> (i -> a -> (r, b)) -> m r
- Control.Lens.IndexedLens: (%%@~) :: Overloaded (Index i) f a b c d -> (i -> c -> f d) -> a -> f b
+ Control.Lens.IndexedLens: (%%@~) :: Overloaded (Index i) f s t a b -> (i -> a -> f b) -> s -> f t
- Control.Lens.IndexedLens: (<%@=) :: MonadState a m => Overloaded (Index i) ((,) d) a a c d -> (i -> c -> d) -> m d
+ Control.Lens.IndexedLens: (<%@=) :: MonadState s m => Overloaded (Index i) ((,) b) s s a b -> (i -> a -> b) -> m b
- Control.Lens.IndexedLens: (<%@~) :: Overloaded (Index i) ((,) d) a b c d -> (i -> c -> d) -> a -> (d, b)
+ Control.Lens.IndexedLens: (<%@~) :: Overloaded (Index i) ((,) b) s t a b -> (i -> a -> b) -> s -> (b, t)
- Control.Lens.IndexedLens: ReifyIndexedLens :: IndexedLens i a b c d -> ReifiedIndexedLens i a b c d
+ Control.Lens.IndexedLens: ReifyIndexedLens :: IndexedLens i s t a b -> ReifiedIndexedLens i s t a b
- Control.Lens.IndexedLens: newtype ReifiedIndexedLens i a b c d
+ Control.Lens.IndexedLens: newtype ReifiedIndexedLens i s t a b
- Control.Lens.IndexedLens: reflectIndexedLens :: ReifiedIndexedLens i a b c d -> IndexedLens i a b c d
+ Control.Lens.IndexedLens: reflectIndexedLens :: ReifiedIndexedLens i s t a b -> IndexedLens i s t a b
- Control.Lens.IndexedLens: type SimpleIndexedLens i a b = IndexedLens i a a b b
+ Control.Lens.IndexedLens: type SimpleIndexedLens i s a = IndexedLens i s s a a
- Control.Lens.IndexedLens: type SimpleReifiedIndexedLens i a b = ReifiedIndexedLens i a a b b
+ Control.Lens.IndexedLens: type SimpleReifiedIndexedLens i s a = ReifiedIndexedLens i s s a a
- Control.Lens.IndexedLens: type IndexedLens i a b c d = forall f k. (Indexed i k, Functor f) => k (c -> f d) (a -> f b)
+ Control.Lens.IndexedLens: type IndexedLens i s t a b = forall f k. (Indexed i k, Functor f) => k (a -> f b) (s -> f t)
- Control.Lens.IndexedSetter: (%@=) :: MonadState a m => Overloaded (Index i) Mutator a a c d -> (i -> c -> d) -> m ()
+ Control.Lens.IndexedSetter: (%@=) :: MonadState s m => Overloaded (Index i) Mutator s s a b -> (i -> a -> b) -> m ()
- Control.Lens.IndexedSetter: (%@~) :: Overloaded (Index i) Mutator a b c d -> (i -> c -> d) -> a -> b
+ Control.Lens.IndexedSetter: (%@~) :: Overloaded (Index i) Mutator s t a b -> (i -> a -> b) -> s -> t
- Control.Lens.IndexedSetter: ReifyIndexedSetter :: IndexedSetter i a b c d -> ReifiedIndexedSetter i a b c d
+ Control.Lens.IndexedSetter: ReifyIndexedSetter :: IndexedSetter i s t a b -> ReifiedIndexedSetter i s t a b
- Control.Lens.IndexedSetter: imapOf :: Overloaded (Index i) Mutator a b c d -> (i -> c -> d) -> a -> b
+ Control.Lens.IndexedSetter: imapOf :: Overloaded (Index i) Mutator s t a b -> (i -> a -> b) -> s -> t
- Control.Lens.IndexedSetter: iover :: Overloaded (Index i) Mutator a b c d -> (i -> c -> d) -> a -> b
+ Control.Lens.IndexedSetter: iover :: Overloaded (Index i) Mutator s t a b -> (i -> a -> b) -> s -> t
- Control.Lens.IndexedSetter: isets :: ((i -> c -> d) -> a -> b) -> IndexedSetter i a b c d
+ Control.Lens.IndexedSetter: isets :: ((i -> a -> b) -> s -> t) -> IndexedSetter i s t a b
- Control.Lens.IndexedSetter: newtype ReifiedIndexedSetter i a b c d
+ Control.Lens.IndexedSetter: newtype ReifiedIndexedSetter i s t a b
- Control.Lens.IndexedSetter: reflectIndexedSetter :: ReifiedIndexedSetter i a b c d -> IndexedSetter i a b c d
+ Control.Lens.IndexedSetter: reflectIndexedSetter :: ReifiedIndexedSetter i s t a b -> IndexedSetter i s t a b
- Control.Lens.IndexedSetter: type SimpleIndexedSetter i a b = IndexedSetter i a a b b
+ Control.Lens.IndexedSetter: type SimpleIndexedSetter i s a = IndexedSetter i s s a a
- Control.Lens.IndexedSetter: type SimpleReifiedIndexedSetter i a b = ReifiedIndexedSetter i a a b b
+ Control.Lens.IndexedSetter: type SimpleReifiedIndexedSetter i s a = ReifiedIndexedSetter i s s a a
- Control.Lens.IndexedSetter: type IndexedSetter i a b c d = forall f k. (Indexed i k, Settable f) => k (c -> f d) (a -> f b)
+ Control.Lens.IndexedSetter: type IndexedSetter i s t a b = forall f k. (Indexed i k, Settable f) => k (a -> f b) (s -> f t)
- Control.Lens.IndexedTraversal: ReifyIndexedTraversal :: IndexedTraversal i a b c d -> ReifiedIndexedTraversal i a b c d
+ Control.Lens.IndexedTraversal: ReifyIndexedTraversal :: IndexedTraversal i s t a b -> ReifiedIndexedTraversal i s t a b
- Control.Lens.IndexedTraversal: iforMOf :: Overloaded (Index i) (WrappedMonad m) a b c d -> a -> (i -> c -> m d) -> m b
+ Control.Lens.IndexedTraversal: iforMOf :: Overloaded (Index i) (WrappedMonad m) s t a b -> s -> (i -> a -> m b) -> m t
- Control.Lens.IndexedTraversal: iforOf :: Overloaded (Index i) f a b c d -> a -> (i -> c -> f d) -> f b
+ Control.Lens.IndexedTraversal: iforOf :: Overloaded (Index i) f s t a b -> s -> (i -> a -> f b) -> f t
- Control.Lens.IndexedTraversal: imapAccumLOf :: Overloaded (Index i) (Backwards (State s)) a b c d -> (i -> s -> c -> (s, d)) -> s -> a -> (s, b)
+ Control.Lens.IndexedTraversal: imapAccumLOf :: Overloaded (Index i) (Backwards (State s)) s t a b -> (i -> s -> a -> (s, b)) -> s -> s -> (s, t)
- Control.Lens.IndexedTraversal: imapAccumROf :: Overloaded (Index i) (State s) a b c d -> (i -> s -> c -> (s, d)) -> s -> a -> (s, b)
+ Control.Lens.IndexedTraversal: imapAccumROf :: Overloaded (Index i) (State s) s t a b -> (i -> s -> a -> (s, b)) -> s -> s -> (s, t)
- Control.Lens.IndexedTraversal: imapMOf :: Overloaded (Index i) (WrappedMonad m) a b c d -> (i -> c -> m d) -> a -> m b
+ Control.Lens.IndexedTraversal: imapMOf :: Overloaded (Index i) (WrappedMonad m) s t a b -> (i -> a -> m b) -> s -> m t
- Control.Lens.IndexedTraversal: itraverseOf :: Overloaded (Index i) f a b c d -> (i -> c -> f d) -> a -> f b
+ Control.Lens.IndexedTraversal: itraverseOf :: Overloaded (Index i) f s t a b -> (i -> a -> f b) -> s -> f t
- Control.Lens.IndexedTraversal: iwhereOf :: (Indexed i k, Applicative f) => Overloaded (Index i) f a b c c -> (i -> Bool) -> Overloaded k f a b c c
+ Control.Lens.IndexedTraversal: iwhereOf :: (Indexed i k, Applicative f) => Overloaded (Index i) f s t a a -> (i -> Bool) -> Overloaded k f s t a a
- Control.Lens.IndexedTraversal: newtype ReifiedIndexedTraversal i a b c d
+ Control.Lens.IndexedTraversal: newtype ReifiedIndexedTraversal i s t a b
- Control.Lens.IndexedTraversal: reflectIndexedTraversal :: ReifiedIndexedTraversal i a b c d -> IndexedTraversal i a b c d
+ Control.Lens.IndexedTraversal: reflectIndexedTraversal :: ReifiedIndexedTraversal i s t a b -> IndexedTraversal i s t a b
- Control.Lens.IndexedTraversal: type SimpleIndexedTraversal i a b = IndexedTraversal i a a b b
+ Control.Lens.IndexedTraversal: type SimpleIndexedTraversal i s a = IndexedTraversal i s s a a
- Control.Lens.IndexedTraversal: type SimpleReifiedIndexedTraversal i a b = ReifiedIndexedTraversal i a a b b
+ Control.Lens.IndexedTraversal: type SimpleReifiedIndexedTraversal i s a = ReifiedIndexedTraversal i s s a a
- Control.Lens.IndexedTraversal: type IndexedTraversal i a b c d = forall f k. (Indexed i k, Applicative f) => k (c -> f d) (a -> f b)
+ Control.Lens.IndexedTraversal: type IndexedTraversal i s t a b = forall f k. (Indexed i k, Applicative f) => k (a -> f b) (s -> f t)
- Control.Lens.Internal: Bazaar :: (forall f. Applicative f => (c -> f d) -> f a) -> Bazaar c d a
+ Control.Lens.Internal: Bazaar :: (forall f. Applicative f => (a -> f b) -> f s) -> Bazaar a b s
- Control.Lens.Internal: Context :: (d -> a) -> c -> Context c d a
+ Control.Lens.Internal: Context :: (b -> s) -> a -> Context a b s
- Control.Lens.Internal: EffectRWS :: (s -> m (c, s, w)) -> EffectRWS w s m c a
+ Control.Lens.Internal: EffectRWS :: (st -> m (s, st, w)) -> EffectRWS w st m s a
- Control.Lens.Internal: Focusing :: m (c, a) -> Focusing m c a
+ Control.Lens.Internal: Focusing :: m (s, a) -> Focusing m s a
- Control.Lens.Internal: FocusingErr :: k (Err e c) a -> FocusingErr e k c a
+ Control.Lens.Internal: FocusingErr :: k (Err e s) a -> FocusingErr e k s a
- Control.Lens.Internal: FocusingMay :: k (May c) a -> FocusingMay k c a
+ Control.Lens.Internal: FocusingMay :: k (May s) a -> FocusingMay k s a
- Control.Lens.Internal: FocusingOn :: k (f c) a -> FocusingOn f k c a
+ Control.Lens.Internal: FocusingOn :: k (f s) a -> FocusingOn f k s a
- Control.Lens.Internal: FocusingPlus :: k (c, w) a -> FocusingPlus w k c a
+ Control.Lens.Internal: FocusingPlus :: k (s, w) a -> FocusingPlus w k s a
- Control.Lens.Internal: FocusingWith :: m (c, a, w) -> FocusingWith w m c a
+ Control.Lens.Internal: FocusingWith :: m (s, a, w) -> FocusingWith w m s a
- Control.Lens.Internal: _runBazaar :: Bazaar c d a -> forall f. Applicative f => (c -> f d) -> f a
+ Control.Lens.Internal: _runBazaar :: Bazaar a b s -> forall f. Applicative f => (a -> f b) -> f s
- Control.Lens.Internal: bazaar :: Applicative f => (c -> f d) -> Bazaar c d b -> f b
+ Control.Lens.Internal: bazaar :: Applicative f => (a -> f b) -> Bazaar a b s -> f s
- Control.Lens.Internal: data Context c d a
+ Control.Lens.Internal: data Context a b s
- Control.Lens.Internal: duplicateBazaar :: Bazaar c e a -> Bazaar c d (Bazaar d e a)
+ Control.Lens.Internal: duplicateBazaar :: Bazaar a c s -> Bazaar a b (Bazaar b c s)
- Control.Lens.Internal: getEffectRWS :: EffectRWS w s m c a -> s -> m (c, s, w)
+ Control.Lens.Internal: getEffectRWS :: EffectRWS w st m s a -> st -> m (s, st, w)
- Control.Lens.Internal: newtype Bazaar c d a
+ Control.Lens.Internal: newtype Bazaar a b s
- Control.Lens.Internal: newtype EffectRWS w s m c a
+ Control.Lens.Internal: newtype EffectRWS w st m s a
- Control.Lens.Internal: newtype Focusing m c a
+ Control.Lens.Internal: newtype Focusing m s a
- Control.Lens.Internal: newtype FocusingErr e k c a
+ Control.Lens.Internal: newtype FocusingErr e k s a
- Control.Lens.Internal: newtype FocusingMay k c a
+ Control.Lens.Internal: newtype FocusingMay k s a
- Control.Lens.Internal: newtype FocusingOn f k c a
+ Control.Lens.Internal: newtype FocusingOn f k s a
- Control.Lens.Internal: newtype FocusingPlus w k c a
+ Control.Lens.Internal: newtype FocusingPlus w k s a
- Control.Lens.Internal: newtype FocusingWith w m c a
+ Control.Lens.Internal: newtype FocusingWith w m s a
- Control.Lens.Internal: sell :: c -> Bazaar c d d
+ Control.Lens.Internal: sell :: a -> Bazaar a b b
- Control.Lens.Internal: unfocusing :: Focusing m c a -> m (c, a)
+ Control.Lens.Internal: unfocusing :: Focusing m s a -> m (s, a)
- Control.Lens.Internal: unfocusingErr :: FocusingErr e k c a -> k (Err e c) a
+ Control.Lens.Internal: unfocusingErr :: FocusingErr e k s a -> k (Err e s) a
- Control.Lens.Internal: unfocusingMay :: FocusingMay k c a -> k (May c) a
+ Control.Lens.Internal: unfocusingMay :: FocusingMay k s a -> k (May s) a
- Control.Lens.Internal: unfocusingOn :: FocusingOn f k c a -> k (f c) a
+ Control.Lens.Internal: unfocusingOn :: FocusingOn f k s a -> k (f s) a
- Control.Lens.Internal: unfocusingPlus :: FocusingPlus w k c a -> k (c, w) a
+ Control.Lens.Internal: unfocusingPlus :: FocusingPlus w k s a -> k (s, w) a
- Control.Lens.Internal: unfocusingWith :: FocusingWith w m c a -> m (c, a, w)
+ Control.Lens.Internal: unfocusingWith :: FocusingWith w m s a -> m (s, a, w)
- Control.Lens.Iso: ReifyIso :: Iso a b c d -> ReifiedIso a b c d
+ Control.Lens.Iso: ReifyIso :: Iso s t a b -> ReifiedIso s t a b
- Control.Lens.Iso: ala :: Simple Iso a b -> ((a -> b) -> c -> b) -> c -> a
+ Control.Lens.Iso: ala :: Simple Iso s a -> ((s -> a) -> e -> a) -> e -> s
- Control.Lens.Iso: auf :: Simple Iso a b -> ((d -> b) -> c -> b) -> (d -> a) -> c -> a
+ Control.Lens.Iso: auf :: Simple Iso s a -> ((b -> a) -> e -> a) -> (b -> s) -> e -> s
- Control.Lens.Iso: iso :: (Isomorphic k, Functor f) => (a -> b) -> (b -> a) -> k (b -> f b) (a -> f a)
+ Control.Lens.Iso: iso :: (Isomorphic k, Functor f) => (s -> a) -> (a -> s) -> k (a -> f a) (s -> f s)
- Control.Lens.Iso: isos :: (Isomorphic k, Functor f) => (a -> c) -> (c -> a) -> (b -> d) -> (d -> b) -> k (c -> f d) (a -> f b)
+ Control.Lens.Iso: isos :: (Isomorphic k, Functor f) => (s -> a) -> (a -> s) -> (t -> b) -> (b -> t) -> k (a -> f b) (s -> f t)
- Control.Lens.Iso: newtype ReifiedIso a b c d
+ Control.Lens.Iso: newtype ReifiedIso s t a b
- Control.Lens.Iso: reflectIso :: ReifiedIso a b c d -> Iso a b c d
+ Control.Lens.Iso: reflectIso :: ReifiedIso s t a b -> Iso s t a b
- Control.Lens.Iso: type (:<->) a b = Iso a a b b
+ Control.Lens.Iso: type (:<->) s a = Iso s s a a
- Control.Lens.Iso: type SimpleIso a b = Iso a a b b
+ Control.Lens.Iso: type SimpleIso s a = Iso s s a a
- Control.Lens.Iso: type SimpleReifiedIso a b = ReifiedIso a a b b
+ Control.Lens.Iso: type SimpleReifiedIso s a = ReifiedIso s s a a
- Control.Lens.Iso: type Iso a b c d = forall k f. (Isomorphic k, Functor f) => k (c -> f d) (a -> f b)
+ Control.Lens.Iso: type Iso s t a b = forall k f. (Isomorphic k, Functor f) => k (a -> f b) (s -> f t)
- Control.Lens.Iso: under :: Isomorphism (c -> Mutator d) (a -> Mutator b) -> (a -> b) -> c -> d
+ Control.Lens.Iso: under :: Isomorphism (a -> Mutator b) (s -> Mutator t) -> (s -> t) -> a -> b
- Control.Lens.Plated: childrenOn :: Getting [c] a b c d -> a -> [c]
+ Control.Lens.Plated: childrenOn :: Getting [a] s t a b -> s -> [a]
- Control.Lens.Plated: contextsOn :: Plated c => LensLike (Bazaar c c) a b c c -> a -> [Context c c b]
+ Control.Lens.Plated: contextsOn :: Plated a => LensLike (Bazaar a a) s t a a -> s -> [Context a a t]
- Control.Lens.Plated: contextsOnOf :: LensLike (Bazaar c c) a b c c -> SimpleLensLike (Bazaar c c) c c -> a -> [Context c c b]
+ Control.Lens.Plated: contextsOnOf :: LensLike (Bazaar a a) s t a a -> SimpleLensLike (Bazaar a a) a a -> s -> [Context a a t]
- Control.Lens.Plated: descendAOf :: Applicative f => LensLike f a b c d -> (c -> f d) -> a -> f b
+ Control.Lens.Plated: descendAOf :: Applicative f => LensLike f s t a b -> (a -> f b) -> s -> f t
- Control.Lens.Plated: descendAOf_ :: Applicative f => Getting (Traversed f) a b c d -> (c -> f e) -> a -> f ()
+ Control.Lens.Plated: descendAOf_ :: Applicative f => Getting (Traversed f) s t a b -> (a -> f r) -> s -> f ()
- Control.Lens.Plated: descendAOn :: (Applicative f, Plated c) => LensLike f a b c c -> (c -> f c) -> a -> f b
+ Control.Lens.Plated: descendAOn :: (Applicative f, Plated a) => LensLike f s t a a -> (a -> f a) -> s -> f t
- Control.Lens.Plated: descendAOnOf :: Applicative g => LensLike g a b c d -> LensLike g c d e f -> (e -> g f) -> a -> g b
+ Control.Lens.Plated: descendAOnOf :: Applicative f => LensLike f u v s t -> LensLike f s t a b -> (a -> f b) -> u -> f v
- Control.Lens.Plated: descendAOnOf_ :: Applicative f => Getting (Traversed f) a b c d -> Getting (Traversed f) c d c d -> (c -> f e) -> a -> f ()
+ Control.Lens.Plated: descendAOnOf_ :: Applicative f => Getting (Traversed f) s t a b -> Getting (Traversed f) a b a b -> (a -> f r) -> s -> f ()
- Control.Lens.Plated: descendAOn_ :: (Applicative f, Plated c) => Getting (Traversed f) a b c c -> (c -> f e) -> a -> f ()
+ Control.Lens.Plated: descendAOn_ :: (Applicative f, Plated a) => Getting (Traversed f) s t a a -> (a -> f r) -> s -> f ()
- Control.Lens.Plated: descendMOf :: Monad m => LensLike (WrappedMonad m) a b c d -> (c -> m d) -> a -> m b
+ Control.Lens.Plated: descendMOf :: Monad m => LensLike (WrappedMonad m) s t a b -> (a -> m b) -> s -> m t
- Control.Lens.Plated: descendMOf_ :: Monad m => Getting (Sequenced m) a b c d -> (c -> m e) -> a -> m ()
+ Control.Lens.Plated: descendMOf_ :: Monad m => Getting (Sequenced m) s t a b -> (a -> m r) -> s -> m ()
- Control.Lens.Plated: descendMOn :: (Monad m, Plated c) => LensLike (WrappedMonad m) a b c c -> (c -> m c) -> a -> m b
+ Control.Lens.Plated: descendMOn :: (Monad m, Plated a) => LensLike (WrappedMonad m) s t a a -> (a -> m a) -> s -> m t
- Control.Lens.Plated: descendMOnOf :: Monad m => LensLike (WrappedMonad m) a b c c -> SimpleLensLike (WrappedMonad m) c c -> (c -> m c) -> a -> m b
+ Control.Lens.Plated: descendMOnOf :: Monad m => LensLike (WrappedMonad m) s t a a -> SimpleLensLike (WrappedMonad m) a a -> (a -> m a) -> s -> m t
- Control.Lens.Plated: descendMOnOf_ :: Monad m => Getting (Sequenced m) a b c d -> Getting (Sequenced m) c d c d -> (c -> m e) -> a -> m ()
+ Control.Lens.Plated: descendMOnOf_ :: Monad m => Getting (Sequenced m) s t a b -> Getting (Sequenced m) a b a b -> (a -> m r) -> s -> m ()
- Control.Lens.Plated: descendMOn_ :: (Monad m, Plated c) => Getting (Sequenced m) a b c c -> (c -> m e) -> a -> m ()
+ Control.Lens.Plated: descendMOn_ :: (Monad m, Plated a) => Getting (Sequenced m) s t a a -> (a -> m r) -> s -> m ()
- Control.Lens.Plated: descendOf :: Setting a b c d -> (c -> d) -> a -> b
+ Control.Lens.Plated: descendOf :: Setting s t a b -> (a -> b) -> s -> t
- Control.Lens.Plated: descendOn :: Plated c => Setting a b c c -> (c -> c) -> a -> b
+ Control.Lens.Plated: descendOn :: Plated a => Setting s t a a -> (a -> a) -> s -> t
- Control.Lens.Plated: descendOnOf :: Setting a b c d -> Setting c d e f -> (e -> f) -> a -> b
+ Control.Lens.Plated: descendOnOf :: Setting s t a b -> Setting a b u v -> (u -> v) -> s -> t
- Control.Lens.Plated: holesOf :: LensLike (Bazaar c c) a b c c -> a -> [Context c c b]
+ Control.Lens.Plated: holesOf :: LensLike (Bazaar a a) s t a a -> s -> [Context a a t]
- Control.Lens.Plated: holesOn :: LensLike (Bazaar c c) a b c c -> a -> [Context c c b]
+ Control.Lens.Plated: holesOn :: LensLike (Bazaar a a) s t a a -> s -> [Context a a t]
- Control.Lens.Plated: holesOnOf :: LensLike (Bazaar e e) a b c d -> LensLike (Bazaar e e) c d e e -> a -> [Context e e b]
+ Control.Lens.Plated: holesOnOf :: LensLike (Bazaar r r) s t a b -> LensLike (Bazaar r r) a b r r -> s -> [Context r r t]
- Control.Lens.Plated: partsOf :: LensLike (Bazaar c c) a b c c -> Lens a b [c] [c]
+ Control.Lens.Plated: partsOf :: LensLike (Bazaar a a) s t a a -> Lens s t [a] [a]
- Control.Lens.Plated: rewriteMOn :: (Monad m, Plated c) => LensLike (WrappedMonad m) a b c c -> (c -> m (Maybe c)) -> a -> m b
+ Control.Lens.Plated: rewriteMOn :: (Monad m, Plated a) => LensLike (WrappedMonad m) s t a a -> (a -> m (Maybe a)) -> s -> m t
- Control.Lens.Plated: rewriteMOnOf :: Monad m => LensLike (WrappedMonad m) a b c c -> SimpleLensLike (WrappedMonad m) c c -> (c -> m (Maybe c)) -> a -> m b
+ Control.Lens.Plated: rewriteMOnOf :: Monad m => LensLike (WrappedMonad m) s t a a -> SimpleLensLike (WrappedMonad m) a a -> (a -> m (Maybe a)) -> s -> m t
- Control.Lens.Plated: rewriteOn :: Plated c => Setting a b c c -> (c -> Maybe c) -> a -> b
+ Control.Lens.Plated: rewriteOn :: Plated a => Setting s t a a -> (a -> Maybe a) -> s -> t
- Control.Lens.Plated: rewriteOnOf :: Setting a b c c -> SimpleSetting c c -> (c -> Maybe c) -> a -> b
+ Control.Lens.Plated: rewriteOnOf :: Setting s t a a -> SimpleSetting a a -> (a -> Maybe a) -> s -> t
- Control.Lens.Plated: transformMOn :: (Monad m, Plated c) => LensLike (WrappedMonad m) a b c c -> (c -> m c) -> a -> m b
+ Control.Lens.Plated: transformMOn :: (Monad m, Plated a) => LensLike (WrappedMonad m) s t a a -> (a -> m a) -> s -> m t
- Control.Lens.Plated: transformMOnOf :: Monad m => LensLike (WrappedMonad m) a b c c -> SimpleLensLike (WrappedMonad m) c c -> (c -> m c) -> a -> m b
+ Control.Lens.Plated: transformMOnOf :: Monad m => LensLike (WrappedMonad m) s a a a -> SimpleLensLike (WrappedMonad m) a a -> (a -> m a) -> s -> m a
- Control.Lens.Plated: transformOn :: Plated c => Setting a b c c -> (c -> c) -> a -> b
+ Control.Lens.Plated: transformOn :: Plated a => Setting s t a a -> (a -> a) -> s -> t
- Control.Lens.Plated: transformOnOf :: Setting a b c c -> SimpleSetting c c -> (c -> c) -> a -> b
+ Control.Lens.Plated: transformOnOf :: Setting s t a a -> SimpleSetting a a -> (a -> a) -> s -> t
- Control.Lens.Plated: universeOn :: Plated c => Getting [c] a b c c -> a -> [c]
+ Control.Lens.Plated: universeOn :: Plated a => Getting [a] s t a a -> s -> [a]
- Control.Lens.Plated: universeOnOf :: Getting [c] a b c d -> Getting [c] c d c d -> a -> [c]
+ Control.Lens.Plated: universeOnOf :: Getting [a] s t a b -> Getting [a] a b a b -> s -> [a]
- Control.Lens.Plated: unsafePartsOf :: LensLike (Bazaar c d) a b c d -> Lens a b [c] [d]
+ Control.Lens.Plated: unsafePartsOf :: LensLike (Bazaar a b) s t a b -> Lens s t [a] [b]
- Control.Lens.Projection: Project :: (d -> a) -> (x -> y) -> Project a d x y
+ Control.Lens.Projection: Project :: (b -> s) -> (x -> y) -> Project s b x y
- Control.Lens.Projection: by :: Project a d (d -> Identity d) (a -> Identity a) -> Getter d a
+ Control.Lens.Projection: by :: Project s b (b -> Identity b) (s -> Identity s) -> Getter b s
- Control.Lens.Projection: data Project a d x y
+ Control.Lens.Projection: data Project s b x y
- Control.Lens.Projection: mirror :: Projective k a c => Simple Iso a c -> Simple Projection a c
+ Control.Lens.Projection: mirror :: Projective k s a => Simple Iso s a -> Simple Projection s a
- Control.Lens.Projection: project :: Projective k a d => Overloaded (Project a d) f a a c d -> Overloaded k f a a c d
+ Control.Lens.Projection: project :: Projective k s b => Overloaded (Project s b) f s s a b -> Overloaded k f s s a b
- Control.Lens.Projection: projection :: (d -> a) -> (a -> Maybe c) -> Projection a b c d
+ Control.Lens.Projection: projection :: (b -> s) -> (s -> Maybe a) -> Projection s t a b
- Control.Lens.Projection: stereo :: Projective k a c => Project b c y z -> Project a b x y -> k x z
+ Control.Lens.Projection: stereo :: Projective k s a => Project t a y z -> Project s t x y -> k x z
- Control.Lens.Projection: type SimpleProjection a b = Projection a a b b
+ Control.Lens.Projection: type SimpleProjection s a = Projection s s a a
- Control.Lens.Projection: type Projection a b c d = forall k f. (Projective k a d, Applicative f) => k (c -> f d) (a -> f a)
+ Control.Lens.Projection: type Projection s t a b = forall k f. (Projective k s b, Applicative f) => k (a -> f b) (s -> f s)
- Control.Lens.Setter: (%=) :: MonadState a m => Setting a a c d -> (c -> d) -> m ()
+ Control.Lens.Setter: (%=) :: MonadState s m => Setting s s a b -> (a -> b) -> m ()
- Control.Lens.Setter: (%~) :: Setting a b c d -> (c -> d) -> a -> b
+ Control.Lens.Setter: (%~) :: Setting s t a b -> (a -> b) -> s -> t
- Control.Lens.Setter: (&&=) :: MonadState a m => SimpleSetting a Bool -> Bool -> m ()
+ Control.Lens.Setter: (&&=) :: MonadState s m => SimpleSetting s Bool -> Bool -> m ()
- Control.Lens.Setter: (&&~) :: Setting a b Bool Bool -> Bool -> a -> b
+ Control.Lens.Setter: (&&~) :: Setting s t Bool Bool -> Bool -> s -> t
- Control.Lens.Setter: (**=) :: (MonadState a m, Floating b) => SimpleSetting a b -> b -> m ()
+ Control.Lens.Setter: (**=) :: (MonadState s m, Floating a) => SimpleSetting s a -> a -> m ()
- Control.Lens.Setter: (**~) :: Floating c => Setting a b c c -> c -> a -> b
+ Control.Lens.Setter: (**~) :: Floating a => Setting s t a a -> a -> s -> t
- Control.Lens.Setter: (*=) :: (MonadState a m, Num b) => SimpleSetting a b -> b -> m ()
+ Control.Lens.Setter: (*=) :: (MonadState s m, Num a) => SimpleSetting s a -> a -> m ()
- Control.Lens.Setter: (*~) :: Num c => Setting a b c c -> c -> a -> b
+ Control.Lens.Setter: (*~) :: Num a => Setting s t a a -> a -> s -> t
- Control.Lens.Setter: (+=) :: (MonadState a m, Num b) => SimpleSetting a b -> b -> m ()
+ Control.Lens.Setter: (+=) :: (MonadState s m, Num a) => SimpleSetting s a -> a -> m ()
- Control.Lens.Setter: (+~) :: Num c => Setting a b c c -> c -> a -> b
+ Control.Lens.Setter: (+~) :: Num a => Setting s t a a -> a -> s -> t
- Control.Lens.Setter: (-=) :: (MonadState a m, Num b) => SimpleSetting a b -> b -> m ()
+ Control.Lens.Setter: (-=) :: (MonadState s m, Num a) => SimpleSetting s a -> a -> m ()
- Control.Lens.Setter: (-~) :: Num c => Setting a b c c -> c -> a -> b
+ Control.Lens.Setter: (-~) :: Num a => Setting s t a a -> a -> s -> t
- Control.Lens.Setter: (.=) :: MonadState a m => Setting a a c d -> d -> m ()
+ Control.Lens.Setter: (.=) :: MonadState s m => Setting s s a b -> b -> m ()
- Control.Lens.Setter: (.~) :: Setting a b c d -> d -> a -> b
+ Control.Lens.Setter: (.~) :: Setting s t a b -> b -> s -> t
- Control.Lens.Setter: (//=) :: (MonadState a m, Fractional b) => SimpleSetting a b -> b -> m ()
+ Control.Lens.Setter: (//=) :: (MonadState s m, Fractional a) => SimpleSetting s a -> a -> m ()
- Control.Lens.Setter: (//~) :: Fractional c => Setting a b c c -> c -> a -> b
+ Control.Lens.Setter: (//~) :: Fractional s => Setting a b s s -> s -> a -> b
- Control.Lens.Setter: (<.=) :: MonadState a m => Setting a a c d -> d -> m d
+ Control.Lens.Setter: (<.=) :: MonadState s m => Setting s s a b -> b -> m b
- Control.Lens.Setter: (<.~) :: Setting a b c d -> d -> a -> (d, b)
+ Control.Lens.Setter: (<.~) :: Setting s t a b -> b -> s -> (b, t)
- Control.Lens.Setter: (<?=) :: MonadState a m => Setting a a c (Maybe d) -> d -> m d
+ Control.Lens.Setter: (<?=) :: MonadState s m => Setting s s a (Maybe b) -> b -> m b
- Control.Lens.Setter: (<?~) :: Setting a b c (Maybe d) -> d -> a -> (d, b)
+ Control.Lens.Setter: (<?~) :: Setting s t a (Maybe b) -> b -> s -> (b, t)
- Control.Lens.Setter: (<~) :: MonadState a m => Setting a a c d -> m d -> m ()
+ Control.Lens.Setter: (<~) :: MonadState s m => Setting s s a b -> m b -> m ()
- Control.Lens.Setter: (?=) :: MonadState a m => Setting a a c (Maybe d) -> d -> m ()
+ Control.Lens.Setter: (?=) :: MonadState s m => Setting s s a (Maybe b) -> b -> m ()
- Control.Lens.Setter: (?~) :: Setting a b c (Maybe d) -> d -> a -> b
+ Control.Lens.Setter: (?~) :: Setting s t a (Maybe b) -> b -> s -> t
- Control.Lens.Setter: (^=) :: (MonadState a m, Num b, Integral c) => SimpleSetting a b -> c -> m ()
+ Control.Lens.Setter: (^=) :: (MonadState s m, Num a, Integral e) => SimpleSetting s a -> e -> m ()
- Control.Lens.Setter: (^^=) :: (MonadState a m, Fractional b, Integral c) => SimpleSetting a b -> c -> m ()
+ Control.Lens.Setter: (^^=) :: (MonadState s m, Fractional a, Integral e) => SimpleSetting s a -> e -> m ()
- Control.Lens.Setter: (^^~) :: (Fractional c, Integral e) => Setting a b c c -> e -> a -> b
+ Control.Lens.Setter: (^^~) :: (Fractional a, Integral e) => Setting s t a a -> e -> s -> t
- Control.Lens.Setter: (^~) :: (Num c, Integral e) => Setting a b c c -> e -> a -> b
+ Control.Lens.Setter: (^~) :: (Num a, Integral e) => Setting s t a a -> e -> s -> t
- Control.Lens.Setter: (||=) :: MonadState a m => SimpleSetting a Bool -> Bool -> m ()
+ Control.Lens.Setter: (||=) :: MonadState s m => SimpleSetting s Bool -> Bool -> m ()
- Control.Lens.Setter: (||~) :: Setting a b Bool Bool -> Bool -> a -> b
+ Control.Lens.Setter: (||~) :: Setting s t Bool Bool -> Bool -> s -> t
- Control.Lens.Setter: ReifySetter :: Setter a b c d -> ReifiedSetter a b c d
+ Control.Lens.Setter: ReifySetter :: Setter s t a b -> ReifiedSetter s t a b
- Control.Lens.Setter: assign :: MonadState a m => Setting a a c d -> d -> m ()
+ Control.Lens.Setter: assign :: MonadState s m => Setting s s a b -> b -> m ()
- Control.Lens.Setter: mapOf :: Setting a b c d -> (c -> d) -> a -> b
+ Control.Lens.Setter: mapOf :: Setting s t a b -> (a -> b) -> s -> t
- Control.Lens.Setter: newtype ReifiedSetter a b c d
+ Control.Lens.Setter: newtype ReifiedSetter s t a b
- Control.Lens.Setter: over :: Setting a b c d -> (c -> d) -> a -> b
+ Control.Lens.Setter: over :: Setting s t a b -> (a -> b) -> s -> t
- Control.Lens.Setter: reflectSetter :: ReifiedSetter a b c d -> Setter a b c d
+ Control.Lens.Setter: reflectSetter :: ReifiedSetter s t a b -> Setter s t a b
- Control.Lens.Setter: set :: Setting a b c d -> d -> a -> b
+ Control.Lens.Setter: set :: Setting s t a b -> b -> s -> t
- Control.Lens.Setter: sets :: ((c -> d) -> a -> b) -> Setter a b c d
+ Control.Lens.Setter: sets :: ((a -> b) -> s -> t) -> Setter s t a b
- Control.Lens.Setter: type Setter a b c d = forall f. Settable f => (c -> f d) -> a -> f b
+ Control.Lens.Setter: type Setter s t a b = forall f. Settable f => (a -> f b) -> s -> f t
- Control.Lens.Setter: type Setting a b c d = (c -> Mutator d) -> a -> Mutator b
+ Control.Lens.Setter: type Setting s t a b = (a -> Mutator b) -> s -> Mutator t
- Control.Lens.Setter: type SimpleReifiedSetter a b = ReifiedSetter a a b b
+ Control.Lens.Setter: type SimpleReifiedSetter s a = ReifiedSetter s s a a
- Control.Lens.Setter: type SimpleSetter a b = Setter a a b b
+ Control.Lens.Setter: type SimpleSetter s a = Setter s s a a
- Control.Lens.Setter: type SimpleSetting a b = Setting a a b b
+ Control.Lens.Setter: type SimpleSetting s a = Setting s s a a
- Control.Lens.Traversal: ReifyTraversal :: Traversal a b c d -> ReifiedTraversal a b c d
+ Control.Lens.Traversal: ReifyTraversal :: Traversal s t a b -> ReifiedTraversal s t a b
- Control.Lens.Traversal: cloneTraversal :: Applicative f => ((c -> Bazaar c d d) -> a -> Bazaar c d b) -> (c -> f d) -> a -> f b
+ Control.Lens.Traversal: cloneTraversal :: Applicative f => ((a -> Bazaar a b b) -> s -> Bazaar a b t) -> (a -> f b) -> s -> f t
- Control.Lens.Traversal: data ReifiedTraversal a b c d
+ Control.Lens.Traversal: data ReifiedTraversal s t a b
- Control.Lens.Traversal: elementOf :: Functor f => LensLike (ElementOf f) a b c c -> Int -> LensLike f a b c c
+ Control.Lens.Traversal: elementOf :: Functor f => LensLike (ElementOf f) s t a a -> Int -> LensLike f s t a a
- Control.Lens.Traversal: forMOf :: LensLike (WrappedMonad m) a b c d -> a -> (c -> m d) -> m b
+ Control.Lens.Traversal: forMOf :: LensLike (WrappedMonad m) s t a b -> s -> (a -> m b) -> m t
- Control.Lens.Traversal: forOf :: LensLike f a b c d -> a -> (c -> f d) -> f b
+ Control.Lens.Traversal: forOf :: LensLike f s t a b -> s -> (a -> f b) -> f t
- Control.Lens.Traversal: ignored :: Traversal a a c d
+ Control.Lens.Traversal: ignored :: Traversal s s a b
- Control.Lens.Traversal: mapAccumLOf :: LensLike (Backwards (State s)) a b c d -> (s -> c -> (s, d)) -> s -> a -> (s, b)
+ Control.Lens.Traversal: mapAccumLOf :: LensLike (Backwards (State acc)) s t a b -> (acc -> a -> (acc, b)) -> acc -> s -> (acc, t)
- Control.Lens.Traversal: mapAccumROf :: LensLike (State s) a b c d -> (s -> c -> (s, d)) -> s -> a -> (s, b)
+ Control.Lens.Traversal: mapAccumROf :: LensLike (State acc) s t a b -> (acc -> a -> (acc, b)) -> acc -> s -> (acc, t)
- Control.Lens.Traversal: mapMOf :: LensLike (WrappedMonad m) a b c d -> (c -> m d) -> a -> m b
+ Control.Lens.Traversal: mapMOf :: LensLike (WrappedMonad m) s t a b -> (a -> m b) -> s -> m t
- Control.Lens.Traversal: reflectTraversal :: ReifiedTraversal a b c d -> Traversal a b c d
+ Control.Lens.Traversal: reflectTraversal :: ReifiedTraversal s t a b -> Traversal s t a b
- Control.Lens.Traversal: scanl1Of :: LensLike (Backwards (State (Maybe c))) a b c c -> (c -> c -> c) -> a -> b
+ Control.Lens.Traversal: scanl1Of :: LensLike (Backwards (State (Maybe a))) s t a a -> (a -> a -> a) -> s -> t
- Control.Lens.Traversal: scanr1Of :: LensLike (State (Maybe c)) a b c c -> (c -> c -> c) -> a -> b
+ Control.Lens.Traversal: scanr1Of :: LensLike (State (Maybe a)) s t a a -> (a -> a -> a) -> s -> t
- Control.Lens.Traversal: sequenceAOf :: LensLike f a b (f c) c -> a -> f b
+ Control.Lens.Traversal: sequenceAOf :: LensLike f s t (f b) b -> s -> f t
- Control.Lens.Traversal: sequenceOf :: LensLike (WrappedMonad m) a b (m c) c -> a -> m b
+ Control.Lens.Traversal: sequenceOf :: LensLike (WrappedMonad m) s t (m b) b -> s -> m t
- Control.Lens.Traversal: transposeOf :: LensLike ZipList a b [c] c -> a -> [b]
+ Control.Lens.Traversal: transposeOf :: LensLike ZipList s t [a] a -> s -> [t]
- Control.Lens.Traversal: traverseOf :: LensLike f a b c d -> (c -> f d) -> a -> f b
+ Control.Lens.Traversal: traverseOf :: LensLike f s t a b -> (a -> f b) -> s -> f t
- Control.Lens.Traversal: type (:=>) a b = forall f. Applicative f => (b -> f b) -> a -> f a
+ Control.Lens.Traversal: type (:=>) s a = forall f. Applicative f => (a -> f a) -> s -> f s
- Control.Lens.Traversal: type SimpleReifiedTraversal a b = ReifiedTraversal a a b b
+ Control.Lens.Traversal: type SimpleReifiedTraversal s a = ReifiedTraversal s s a a
- Control.Lens.Traversal: type SimpleTraversal a b = Traversal a a b b
+ Control.Lens.Traversal: type SimpleTraversal s a = Traversal s s a a
- Control.Lens.Tuple: _1 :: Field1 a b c d => Lens a b c d
+ Control.Lens.Tuple: _1 :: Field1 s t a b => Lens s t a b
- Control.Lens.Tuple: _2 :: Field2 a b c d => Lens a b c d
+ Control.Lens.Tuple: _2 :: Field2 s t a b => Lens s t a b
- Control.Lens.Tuple: _3 :: Field3 a b c d => Lens a b c d
+ Control.Lens.Tuple: _3 :: Field3 s t a b => Lens s t a b
- Control.Lens.Tuple: _4 :: Field4 a b c d => Lens a b c d
+ Control.Lens.Tuple: _4 :: Field4 s t a b => Lens s t a b
- Control.Lens.Tuple: _5 :: Field5 a b c d => Lens a b c d
+ Control.Lens.Tuple: _5 :: Field5 s t a b => Lens s t a b
- Control.Lens.Tuple: _6 :: Field6 a b c d => Lens a b c d
+ Control.Lens.Tuple: _6 :: Field6 s t a b => Lens s t a b
- Control.Lens.Tuple: _7 :: Field7 a b c d => Lens a b c d
+ Control.Lens.Tuple: _7 :: Field7 s t a b => Lens s t a b
- Control.Lens.Tuple: _8 :: Field8 a b c d => Lens a b c d
+ Control.Lens.Tuple: _8 :: Field8 s t a b => Lens s t a b
- Control.Lens.Tuple: _9 :: Field9 a b c d => Lens a b c d
+ Control.Lens.Tuple: _9 :: Field9 s t a b => Lens s t a b
- Control.Lens.Tuple: class Field1 a b c d | a -> c, b -> d, a d -> b, b c -> a
+ Control.Lens.Tuple: class Field1 s t a b | s -> a, t -> b, s b -> t, t a -> s
- Control.Lens.Tuple: class Field2 a b c d | a -> c, b -> d, a d -> b, b c -> a
+ Control.Lens.Tuple: class Field2 s t a b | s -> a, t -> b, s b -> t, t a -> s
- Control.Lens.Tuple: class Field3 a b c d | a -> c, b -> d, a d -> b, b c -> a
+ Control.Lens.Tuple: class Field3 s t a b | s -> a, t -> b, s b -> t, t a -> s
- Control.Lens.Tuple: class Field4 a b c d | a -> c, b -> d, a d -> b, b c -> a
+ Control.Lens.Tuple: class Field4 s t a b | s -> a, t -> b, s b -> t, t a -> s
- Control.Lens.Tuple: class Field5 a b c d | a -> c, b -> d, a d -> b, b c -> a
+ Control.Lens.Tuple: class Field5 s t a b | s -> a, t -> b, s b -> t, t a -> s
- Control.Lens.Tuple: class Field6 a b c d | a -> c, b -> d, a d -> b, b c -> a
+ Control.Lens.Tuple: class Field6 s t a b | s -> a, t -> b, s b -> t, t a -> s
- Control.Lens.Tuple: class Field7 a b c d | a -> c, b -> d, a d -> b, b c -> a
+ Control.Lens.Tuple: class Field7 s t a b | s -> a, t -> b, s b -> t, t a -> s
- Control.Lens.Tuple: class Field8 a b c d | a -> c, b -> d, a d -> b, b c -> a
+ Control.Lens.Tuple: class Field8 s t a b | s -> a, t -> b, s b -> t, t a -> s
- Control.Lens.Tuple: class Field9 a b c d | a -> c, b -> d, a d -> b, b c -> a
+ Control.Lens.Tuple: class Field9 s t a b | s -> a, t -> b, s b -> t, t a -> s
- Control.Lens.Type: (%%=) :: MonadState a m => LensLike ((,) e) a a c d -> (c -> (e, d)) -> m e
+ Control.Lens.Type: (%%=) :: MonadState s m => LensLike ((,) r) s s a b -> (a -> (r, b)) -> m r
- Control.Lens.Type: (%%~) :: LensLike f a b c d -> (c -> f d) -> a -> f b
+ Control.Lens.Type: (%%~) :: LensLike f s t a b -> (a -> f b) -> s -> f t
- Control.Lens.Type: (<%=) :: MonadState a m => LensLike ((,) d) a a c d -> (c -> d) -> m d
+ Control.Lens.Type: (<%=) :: MonadState s m => LensLike ((,) b) s s a b -> (a -> b) -> m b
- Control.Lens.Type: (<%~) :: LensLike ((,) d) a b c d -> (c -> d) -> a -> (d, b)
+ Control.Lens.Type: (<%~) :: LensLike ((,) b) s t a b -> (a -> b) -> s -> (b, t)
- Control.Lens.Type: (<&&=) :: MonadState a m => SimpleLensLike ((,) Bool) a Bool -> Bool -> m Bool
+ Control.Lens.Type: (<&&=) :: MonadState s m => SimpleLensLike ((,) Bool) s Bool -> Bool -> m Bool
- Control.Lens.Type: (<&&~) :: LensLike ((,) Bool) a b Bool Bool -> Bool -> a -> (Bool, b)
+ Control.Lens.Type: (<&&~) :: LensLike ((,) Bool) s t Bool Bool -> Bool -> s -> (Bool, t)
- Control.Lens.Type: (<**=) :: (MonadState a m, Floating b) => SimpleLensLike ((,) b) a b -> b -> m b
+ Control.Lens.Type: (<**=) :: (MonadState s m, Floating a) => SimpleLensLike ((,) a) s a -> a -> m a
- Control.Lens.Type: (<**~) :: Floating c => LensLike ((,) c) a b c c -> c -> a -> (c, b)
+ Control.Lens.Type: (<**~) :: Floating a => LensLike ((,) a) s t a a -> a -> s -> (a, t)
- Control.Lens.Type: (<*=) :: (MonadState a m, Num b) => SimpleLensLike ((,) b) a b -> b -> m b
+ Control.Lens.Type: (<*=) :: (MonadState s m, Num a) => SimpleLensLike ((,) a) s a -> a -> m a
- Control.Lens.Type: (<*~) :: Num c => LensLike ((,) c) a b c c -> c -> a -> (c, b)
+ Control.Lens.Type: (<*~) :: Num a => LensLike ((,) a) s t a a -> a -> s -> (a, t)
- Control.Lens.Type: (<+=) :: (MonadState a m, Num b) => SimpleLensLike ((,) b) a b -> b -> m b
+ Control.Lens.Type: (<+=) :: (MonadState s m, Num a) => SimpleLensLike ((,) a) s a -> a -> m a
- Control.Lens.Type: (<+~) :: Num c => LensLike ((,) c) a b c c -> c -> a -> (c, b)
+ Control.Lens.Type: (<+~) :: Num a => LensLike ((,) a) s t a a -> a -> s -> (a, t)
- Control.Lens.Type: (<-=) :: (MonadState a m, Num b) => SimpleLensLike ((,) b) a b -> b -> m b
+ Control.Lens.Type: (<-=) :: (MonadState s m, Num a) => SimpleLensLike ((,) a) s a -> a -> m a
- Control.Lens.Type: (<-~) :: Num c => LensLike ((,) c) a b c c -> c -> a -> (c, b)
+ Control.Lens.Type: (<-~) :: Num a => LensLike ((,) a) s t a a -> a -> s -> (a, t)
- Control.Lens.Type: (<//=) :: (MonadState a m, Fractional b) => SimpleLensLike ((,) b) a b -> b -> m b
+ Control.Lens.Type: (<//=) :: (MonadState s m, Fractional a) => SimpleLensLike ((,) a) s a -> a -> m a
- Control.Lens.Type: (<//~) :: Fractional c => LensLike ((,) c) a b c c -> c -> a -> (c, b)
+ Control.Lens.Type: (<//~) :: Fractional a => LensLike ((,) a) s t a a -> a -> s -> (a, t)
- Control.Lens.Type: (<<%=) :: MonadState a m => LensLike ((,) c) a a c d -> (c -> d) -> m c
+ Control.Lens.Type: (<<%=) :: MonadState s m => LensLike ((,) a) s s a b -> (a -> b) -> m a
- Control.Lens.Type: (<<%~) :: LensLike ((,) c) a b c d -> (c -> d) -> a -> (c, b)
+ Control.Lens.Type: (<<%~) :: LensLike ((,) a) s t a b -> (a -> b) -> s -> (a, t)
- Control.Lens.Type: (<<.=) :: MonadState a m => LensLike ((,) c) a a c d -> d -> m c
+ Control.Lens.Type: (<<.=) :: MonadState s m => LensLike ((,) a) s s a b -> b -> m a
- Control.Lens.Type: (<<.~) :: LensLike ((,) c) a b c d -> d -> a -> (c, b)
+ Control.Lens.Type: (<<.~) :: LensLike ((,) a) s t a b -> b -> s -> (a, t)
- Control.Lens.Type: (<<~) :: MonadState a m => LensLike (Context c d) a a c d -> m d -> m d
+ Control.Lens.Type: (<<~) :: MonadState s m => LensLike (Context a b) s s a b -> m b -> m b
- Control.Lens.Type: (<^=) :: (MonadState a m, Num b, Integral c) => SimpleLensLike ((,) b) a b -> c -> m b
+ Control.Lens.Type: (<^=) :: (MonadState s m, Num a, Integral e) => SimpleLensLike ((,) a) s a -> e -> m a
- Control.Lens.Type: (<^^=) :: (MonadState a m, Fractional b, Integral c) => SimpleLensLike ((,) b) a b -> c -> m b
+ Control.Lens.Type: (<^^=) :: (MonadState s m, Fractional a, Integral e) => SimpleLensLike ((,) a) s a -> e -> m a
- Control.Lens.Type: (<^^~) :: (Fractional c, Integral d) => LensLike ((,) c) a b c c -> d -> a -> (c, b)
+ Control.Lens.Type: (<^^~) :: (Fractional a, Integral e) => LensLike ((,) a) s t a a -> e -> s -> (a, t)
- Control.Lens.Type: (<^~) :: (Num c, Integral d) => LensLike ((,) c) a b c c -> d -> a -> (c, b)
+ Control.Lens.Type: (<^~) :: (Num a, Integral e) => LensLike ((,) a) s t a a -> e -> s -> (a, t)
- Control.Lens.Type: (<||=) :: MonadState a m => SimpleLensLike ((,) Bool) a Bool -> Bool -> m Bool
+ Control.Lens.Type: (<||=) :: MonadState s m => SimpleLensLike ((,) Bool) s Bool -> Bool -> m Bool
- Control.Lens.Type: (<||~) :: LensLike ((,) Bool) a b Bool Bool -> Bool -> a -> (Bool, b)
+ Control.Lens.Type: (<||~) :: LensLike ((,) Bool) s t Bool Bool -> Bool -> s -> (Bool, t)
- Control.Lens.Type: ReifyLens :: Lens a b c d -> ReifiedLens a b c d
+ Control.Lens.Type: ReifyLens :: Lens s t a b -> ReifiedLens s t a b
- Control.Lens.Type: alongside :: LensLike (Context c d) a b c d -> LensLike (Context c' d') a' b' c' d' -> Lens (a, a') (b, b') (c, c') (d, d')
+ Control.Lens.Type: alongside :: LensLike (Context a b) s t a b -> LensLike (Context a' b') s' t' a' b' -> Lens (s, s') (t, t') (a, a') (b, b')
- Control.Lens.Type: choosing :: Functor f => LensLike f a b c c -> LensLike f a' b' c c -> LensLike f (Either a a') (Either b b') c c
+ Control.Lens.Type: choosing :: Functor f => LensLike f s t a a -> LensLike f s' t' a a -> LensLike f (Either s s') (Either t t') a a
- Control.Lens.Type: cloneLens :: Functor f => LensLike (Context c d) a b c d -> (c -> f d) -> a -> f b
+ Control.Lens.Type: cloneLens :: Functor f => LensLike (Context a b) s t a b -> (a -> f b) -> s -> f t
- Control.Lens.Type: lens :: (a -> c) -> (a -> d -> b) -> Lens a b c d
+ Control.Lens.Type: lens :: (s -> a) -> (s -> b -> t) -> Lens s t a b
- Control.Lens.Type: newtype ReifiedLens a b c d
+ Control.Lens.Type: newtype ReifiedLens s t a b
- Control.Lens.Type: reflectLens :: ReifiedLens a b c d -> Lens a b c d
+ Control.Lens.Type: reflectLens :: ReifiedLens s t a b -> Lens s t a b
- Control.Lens.Type: simple :: SimpleLensLike f a b -> SimpleLensLike f a b
+ Control.Lens.Type: simple :: SimpleLensLike f s a -> SimpleLensLike f s a
- Control.Lens.Type: type (:->) a b = forall f. Functor f => (b -> f b) -> a -> f a
+ Control.Lens.Type: type (:->) s a = forall f. Functor f => (a -> f a) -> s -> f s
- Control.Lens.Type: type LensLike f a b c d = (c -> f d) -> a -> f b
+ Control.Lens.Type: type LensLike f s t a b = (a -> f b) -> s -> f t
- Control.Lens.Type: type Overloaded k f a b c d = k (c -> f d) (a -> f b)
+ Control.Lens.Type: type Overloaded k f s t a b = k (a -> f b) (s -> f t)
- Control.Lens.Type: type Simple f a b = f a a b b
+ Control.Lens.Type: type Simple f s a = f s s a a
- Control.Lens.Type: type SimpleLens a b = Lens a a b b
+ Control.Lens.Type: type SimpleLens s a = Lens s s a a
- Control.Lens.Type: type SimpleLensLike f a b = LensLike f a a b b
+ Control.Lens.Type: type SimpleLensLike f s a = LensLike f s s a a
- Control.Lens.Type: type SimpleOverloaded k f a b = Overloaded k f a a b b
+ Control.Lens.Type: type SimpleOverloaded k f s a = Overloaded k f s s a a
- Control.Lens.Type: type SimpleReifiedLens a b = ReifiedLens a a b b
+ Control.Lens.Type: type SimpleReifiedLens s a = ReifiedLens s s a a
- Control.Parallel.Strategies.Lens: after :: Strategy a -> LensLike f a b c d -> LensLike f a b c d
+ Control.Parallel.Strategies.Lens: after :: Strategy s -> LensLike f s t a b -> LensLike f s t a b
- Control.Parallel.Strategies.Lens: evalOf :: SimpleLensLike Eval a b -> Strategy b -> Strategy a
+ Control.Parallel.Strategies.Lens: evalOf :: SimpleLensLike Eval s a -> Strategy a -> Strategy s
- Control.Parallel.Strategies.Lens: parOf :: SimpleLensLike Eval a b -> Strategy b -> Strategy a
+ Control.Parallel.Strategies.Lens: parOf :: SimpleLensLike Eval s a -> Strategy a -> Strategy s
- Control.Parallel.Strategies.Lens: throughout :: Strategy a -> LensLike f a b c d -> LensLike f a b c d
+ Control.Parallel.Strategies.Lens: throughout :: Strategy s -> LensLike f s t a b -> LensLike f s t a b
- Control.Seq.Lens: seqOf :: Getting [c] a b c d -> Strategy c -> Strategy a
+ Control.Seq.Lens: seqOf :: Getting [a] s t a b -> Strategy a -> Strategy s
- Data.Array.Lens: traverseArray :: (IArray a c, IArray a d, Ix i) => IndexedTraversal i (a i c) (a i d) c d
+ Data.Array.Lens: traverseArray :: (IArray arr a, IArray arr b, Ix i) => IndexedTraversal i (arr i a) (arr i b) a b
- Data.Bits.Lens: (&=) :: (MonadState a m, Bits b) => Simple Setting a b -> b -> m ()
+ Data.Bits.Lens: (&=) :: (MonadState s m, Bits a) => Simple Setting s a -> a -> m ()
- Data.Bits.Lens: (&~) :: Bits c => Setting a b c c -> c -> a -> b
+ Data.Bits.Lens: (&~) :: Bits a => Setting s t a a -> a -> s -> t
- Data.Bits.Lens: (<&=) :: (MonadState a m, Bits b) => SimpleLensLike ((,) b) a b -> b -> m b
+ Data.Bits.Lens: (<&=) :: (MonadState s m, Bits a) => SimpleLensLike ((,) a) s a -> a -> m a
- Data.Bits.Lens: (<&~) :: Bits c => LensLike ((,) c) a b c c -> c -> a -> (c, b)
+ Data.Bits.Lens: (<&~) :: Bits a => LensLike ((,) a) s t a a -> a -> s -> (a, t)
- Data.Bits.Lens: (<|=) :: (MonadState a m, Bits b) => SimpleLensLike ((,) b) a b -> b -> m b
+ Data.Bits.Lens: (<|=) :: (MonadState s m, Bits a) => SimpleLensLike ((,) a) s a -> a -> m a
- Data.Bits.Lens: (<|~) :: Bits c => LensLike ((,) c) a b c c -> c -> a -> (c, b)
+ Data.Bits.Lens: (<|~) :: Bits a => LensLike ((,) a) s t a a -> a -> s -> (a, t)
- Data.Bits.Lens: (|=) :: (MonadState a m, Bits b) => Simple Setting a b -> b -> m ()
+ Data.Bits.Lens: (|=) :: (MonadState s m, Bits a) => Simple Setting s a -> a -> m ()
- Data.Bits.Lens: (|~) :: Bits c => Setting a b c c -> c -> a -> b
+ Data.Bits.Lens: (|~) :: Bits a => Setting s t a a -> a -> s -> t
- Data.Data.Lens: biplate :: (Data a, Typeable b) => Simple Traversal a b
+ Data.Data.Lens: biplate :: (Data s, Typeable a) => Simple Traversal s a
- Data.Data.Lens: template :: (Data a, Typeable b) => Simple Traversal a b
+ Data.Data.Lens: template :: (Data s, Typeable a) => Simple Traversal s a
- Data.Data.Lens: tinplate :: (Data a, Typeable b) => Simple Traversal a b
+ Data.Data.Lens: tinplate :: (Data s, Typeable a) => Simple Traversal s a
- Data.HashSet.Lens: setOf :: Hashable c => Getting (HashSet c) a b c d -> a -> HashSet c
+ Data.HashSet.Lens: setOf :: Hashable a => Getting (HashSet a) s t a b -> s -> HashSet a
- Data.IntSet.Lens: setOf :: Getting IntSet a b Int d -> a -> IntSet
+ Data.IntSet.Lens: setOf :: Getting IntSet s t Int b -> s -> IntSet
- Data.List.Lens: (++=) :: MonadState a m => SimpleSetting a [b] -> [b] -> m ()
+ Data.List.Lens: (++=) :: MonadState s m => SimpleSetting s [a] -> [a] -> m ()
- Data.List.Lens: (++~) :: Setting a b [c] [c] -> [c] -> a -> b
+ Data.List.Lens: (++~) :: Setting s t [a] [a] -> [a] -> s -> t
- Data.List.Lens: (<++=) :: MonadState a m => SimpleLensLike ((,) [b]) a [b] -> [b] -> m [b]
+ Data.List.Lens: (<++=) :: MonadState s m => SimpleLensLike ((,) [a]) s [a] -> [a] -> m [a]
- Data.List.Lens: (<++~) :: LensLike ((,) [c]) a b [c] [c] -> [c] -> a -> ([c], b)
+ Data.List.Lens: (<++~) :: LensLike ((,) [a]) s t [a] [a] -> [a] -> s -> ([a], t)
- Data.List.Lens: (<=:) :: MonadState a m => c -> SimpleLensLike ((,) [c]) a [c] -> m [c]
+ Data.List.Lens: (<=:) :: MonadState s m => a -> SimpleLensLike ((,) [a]) s [a] -> m [a]
- Data.List.Lens: (<~:) :: c -> LensLike ((,) [c]) a b [c] [c] -> a -> ([c], b)
+ Data.List.Lens: (<~:) :: a -> LensLike ((,) [a]) s t [a] [a] -> s -> ([a], t)
- Data.List.Lens: (=:) :: MonadState a m => c -> SimpleSetting a [c] -> m ()
+ Data.List.Lens: (=:) :: MonadState s m => a -> SimpleSetting s [a] -> m ()
- Data.List.Lens: (~:) :: c -> Setting a b [c] [c] -> a -> b
+ Data.List.Lens: (~:) :: a -> Setting s t [a] [a] -> s -> t
- Data.Monoid.Lens: (<<>=) :: (MonadState a m, Monoid r) => SimpleLensLike ((,) r) a r -> r -> m r
+ Data.Monoid.Lens: (<<>=) :: (MonadState s m, Monoid r) => SimpleLensLike ((,) r) s r -> r -> m r
- Data.Monoid.Lens: (<<>~) :: Monoid m => LensLike ((,) m) a b m m -> m -> a -> (m, b)
+ Data.Monoid.Lens: (<<>~) :: Monoid m => LensLike ((,) m) s t m m -> m -> s -> (m, t)
- Data.Monoid.Lens: (<>=) :: (MonadState a m, Monoid b) => SimpleSetting a b -> b -> m ()
+ Data.Monoid.Lens: (<>=) :: (MonadState s m, Monoid a) => SimpleSetting s a -> a -> m ()
- Data.Monoid.Lens: (<>~) :: Monoid c => Setting a b c c -> c -> a -> b
+ Data.Monoid.Lens: (<>~) :: Monoid a => Setting s t a a -> a -> s -> t
- Data.Set.Lens: setOf :: Getting (Set c) a b c d -> a -> Set c
+ Data.Set.Lens: setOf :: Getting (Set a) s t a b -> s -> Set a
- Data.Typeable.Lens: _cast :: (Typeable a, Typeable b) => Simple Traversal a b
+ Data.Typeable.Lens: _cast :: (Typeable s, Typeable a) => Simple Traversal s a
- Data.Typeable.Lens: _gcast :: (Typeable a, Typeable b) => Simple Traversal (c a) (c b)
+ Data.Typeable.Lens: _gcast :: (Typeable s, Typeable a) => Simple Traversal (c s) (c a)
- System.FilePath.Lens: (<.>=) :: MonadState a m => SimpleSetting a FilePath -> String -> m ()
+ System.FilePath.Lens: (<.>=) :: MonadState s m => SimpleSetting s FilePath -> String -> m ()
- System.FilePath.Lens: (<.>~) :: Setting a b FilePath FilePath -> String -> a -> b
+ System.FilePath.Lens: (<.>~) :: Setting s a FilePath FilePath -> String -> s -> a
- System.FilePath.Lens: (</>=) :: MonadState a m => SimpleSetting a FilePath -> FilePath -> m ()
+ System.FilePath.Lens: (</>=) :: MonadState s m => SimpleSetting s FilePath -> FilePath -> m ()
- System.FilePath.Lens: (</>~) :: Setting a b FilePath FilePath -> FilePath -> a -> b
+ System.FilePath.Lens: (</>~) :: Setting s t FilePath FilePath -> FilePath -> s -> t
- System.FilePath.Lens: (<<.>=) :: MonadState a m => SimpleLensLike ((,) FilePath) a FilePath -> String -> m FilePath
+ System.FilePath.Lens: (<<.>=) :: MonadState s m => SimpleLensLike ((,) FilePath) s FilePath -> String -> m FilePath
- System.FilePath.Lens: (<<.>~) :: LensLike ((,) FilePath) a b FilePath FilePath -> String -> a -> (FilePath, b)
+ System.FilePath.Lens: (<<.>~) :: LensLike ((,) FilePath) s a FilePath FilePath -> String -> s -> (FilePath, a)
- System.FilePath.Lens: (<</>=) :: MonadState a m => SimpleLensLike ((,) FilePath) a FilePath -> FilePath -> m FilePath
+ System.FilePath.Lens: (<</>=) :: MonadState s m => SimpleLensLike ((,) FilePath) s FilePath -> FilePath -> m FilePath
- System.FilePath.Lens: (<</>~) :: LensLike ((,) FilePath) a b FilePath FilePath -> FilePath -> a -> (FilePath, b)
+ System.FilePath.Lens: (<</>~) :: LensLike ((,) FilePath) s a FilePath FilePath -> FilePath -> s -> (FilePath, a)
Files
- CHANGELOG.markdown +7/−0
- benchmarks/alongside.hs +37/−37
- lens.cabal +2/−2
- src/Control/Lens.hs +1/−1
- src/Control/Lens/Action.hs +9/−9
- src/Control/Lens/Fold.hs +281/−270
- src/Control/Lens/Getter.hs +64/−64
- src/Control/Lens/Indexed.hs +7/−7
- src/Control/Lens/IndexedFold.hs +110/−106
- src/Control/Lens/IndexedGetter.hs +3/−3
- src/Control/Lens/IndexedLens.hs +23/−23
- src/Control/Lens/IndexedSetter.hs +21/−21
- src/Control/Lens/IndexedTraversal.hs +29/−29
- src/Control/Lens/Internal.hs +65/−63
- src/Control/Lens/Iso.hs +22/−21
- src/Control/Lens/Plated.hs +91/−91
- src/Control/Lens/Projection.hs +10/−10
- src/Control/Lens/Setter.hs +191/−191
- src/Control/Lens/Traversal.hs +74/−61
- src/Control/Lens/Tuple.hs +21/−21
- src/Control/Lens/Type.hs +163/−163
- src/Control/Lens/Zoom.hs +12/−12
- src/Control/Parallel/Strategies/Lens.hs +10/−10
- src/Control/Seq/Lens.hs +1/−1
- src/Data/Array/Lens.hs +1/−1
- src/Data/Bits/Lens.hs +36/−36
- src/Data/Data/Lens.hs +25/−29
- src/Data/HashSet/Lens.hs +7/−7
- src/Data/IntSet/Lens.hs +6/−6
- src/Data/List/Lens.hs +30/−30
- src/Data/Monoid/Lens.hs +13/−13
- src/Data/Set/Lens.hs +6/−6
- src/Data/Typeable/Lens.hs +8/−8
- src/System/FilePath/Lens.hs +24/−24
- tests/properties.hs +22/−22
CHANGELOG.markdown view
@@ -1,5 +1,12 @@+3.1+---+* Simplified the type of `filtered`, so that it can be composed with other folds rather than be parameterized on one. Included the caveat that the new `filtered` is still not a legal `Traversal`, despite seeming to compose like one.+* Renamed `ifiltered` to `ifiltering`, and while it still must take an indexed lens-like as an argument, I included a similar caveat about the result not being a legal `IndexedLens` when given an `IndexedLens`. The function was renamed because its signature no longer lined up with the new `filtered` and the gerundive '-ing' suffix has come to indicate an operator that transformers another lens/traversal/etc. into a new one.+* Added `taking` and `dropping` to `Control.Lens.Traversal`.+ 3.0.6 -----+* Alpha-renamed all combinators to a new scheme. Instead of `Foo a b c d`, they now follow `Foo s t a b`. This means that you don't need to alpha rename everything in your head to work through the examples, simplifies exposition, and uses s and t for common state monad parameters. Thanks go to Shachaf Ben-Kiki for the grunt work of slogging through hundreds of definitions by hand and with regular expressions! * Restored lenses to `Trustworthy` status so they can be used with Safe Haskell once more. 3.0.5
benchmarks/alongside.hs view
@@ -12,85 +12,85 @@ import Data.Functor.Identity -- | A finally encoded Store-newtype Experiment c d a = Experiment { runExperiment :: forall f. Functor f => (c -> f d) -> f a }+newtype Experiment a b s = Experiment { runExperiment :: forall f. Functor f => (a -> f b) -> f s } -instance Functor (Experiment c d) where+instance Functor (Experiment a b) where fmap f (Experiment k) = Experiment (fmap f . k) {-# INLINE fmap #-} -instance (c ~ d) => Comonad (Experiment c d) where+instance (a ~ b) => Comonad (Experiment a b) where extract (Experiment m) = runIdentity (m Identity) {-# INLINE extract #-} duplicate = duplicateExperiment {-# INLINE duplicate #-} -- | 'Experiment' is an indexed 'Comonad'.-duplicateExperiment :: Experiment c e a -> Experiment c d (Experiment d e a)+duplicateExperiment :: Experiment a c s -> Experiment a b (Experiment b c s) duplicateExperiment (Experiment m) = getCompose (m (Compose . fmap placebo . placebo)) {-# INLINE duplicateExperiment #-} -- | A trivial 'Experiment'.-placebo :: c -> Experiment c d d+placebo :: a -> Experiment a b b placebo i = Experiment (\k -> k i) {-# INLINE placebo #-} -instance (c ~ d) => ComonadStore c (Experiment c d) where+instance (a ~ b) => ComonadStore a (Experiment a b) where pos m = posExperiment m peek d m = peekExperiment d m peeks f m = runIdentity $ runExperiment m (\c -> Identity (f c)) experiment f m = runExperiment m f -posExperiment :: Experiment c d a -> c+posExperiment :: Experiment a b s -> a posExperiment m = getConst (runExperiment m Const) {-# INLINE posExperiment #-} -peekExperiment :: d -> Experiment c d a -> a-peekExperiment d m = runIdentity $ runExperiment m (\_ -> Identity d)+peekExperiment :: b -> Experiment a b s -> s+peekExperiment b m = runIdentity $ runExperiment m (\_ -> Identity b) {-# INLINE peekExperiment #-} -trial :: Lens a b c d -> Lens a' b' c' d' -> Lens (a,a') (b,b') (c,c') (d,d')-trial l r pfq (a,a') = fmap (\(d,b') -> (peekExperiment d x,b')) (getCompose (r (\c' -> Compose $ pfq (posExperiment x, c')) a'))- where x = l placebo a+trial :: Lens s t a b -> Lens s' t' a' b' -> Lens (s,s') (t,t') (a,a') (b,b')+trial l r pfq (s,s') = fmap (\(b,t') -> (peekExperiment b x,t')) (getCompose (r (\a' -> Compose $ pfq (posExperiment x, a')) s'))+ where x = l placebo s {-# INLINE trial #-} -posContext :: Context c d a -> c-posContext (Context _ c) = c+posContext :: Context a b s -> a+posContext (Context _ a) = a {-# INLINE posContext #-} -peekContext :: d -> Context c d a -> a-peekContext d (Context f _) = f d+peekContext :: b -> Context a b s -> s+peekContext b (Context f _) = f b {-# INLINE peekContext #-} -- a version of alongside built with Context and product-half :: LensLike (Context c d) a b c d -> Lens a' b' c' d' -> Lens (a,a') (b,b') (c,c') (d,d')-half l r pfq (a,a') = fmap (\(d,b') -> (peekContext d x,b')) (getCompose (r (\c' -> Compose $ pfq (posContext x, c')) a'))- where x = l (Context id) a+half :: LensLike (Context a b) s t a b -> Lens s' t' a' b' -> Lens (s,s') (t,t') (a,a') (b,b')+half l r pfq (s,s') = fmap (\(b,t') -> (peekContext b x,t')) (getCompose (r (\a' -> Compose $ pfq (posContext x, a')) s'))+ where x = l (Context id) s {-# INLINE half #-} --- alongside' :: Lens a b c d -> Lens a' b' c' d' -> Lens (a,a') (b,b') (c,c') (d,d')+-- alongside' :: Lens s t a b -> Lens s' t' a' b' -> Lens (s,s') (t,t') (a,a') (b,b') -- {-# INLINE alongside'#-} -compound :: Lens a b c d- -> Lens a' b' c' d'- -> Lens (a,a') (b,b') (c,c') (d,d')-compound l r = lens (\(a, a') -> (view l a, view r a'))- (\(a, a') (b, b') -> (set l b a, set r b' a'))+compound :: Lens s t a b+ -> Lens s' t' a' b'+ -> Lens (s,s') (t,t') (a,a') (b,b')+compound l r = lens (\(s, s') -> (view l s, view r s'))+ (\(s, s') (t, t') -> (set l t s, set r t' s')) {-# INLINE compound #-} -compound5 :: Lens a b c d- -> Lens a' b' c' d'- -> Lens a'' b'' c'' d''- -> Lens a''' b''' c''' d'''- -> Lens a'''' b'''' c'''' d''''- -> Lens (a, (a', (a'', (a''', a''''))))+compound5 :: Lens s t a b+ -> Lens s' t' a' b'+ -> Lens s'' t'' a'' b''+ -> Lens s''' t''' a''' b'''+ -> Lens s'''' t'''' a'''' b''''+ -> Lens (s, (s', (s'', (s''', s''''))))+ (t, (t', (t'', (t''', t''''))))+ (a, (a', (a'', (a''', a'''')))) (b, (b', (b'', (b''', b''''))))- (c, (c', (c'', (c''', c''''))))- (d, (d', (d'', (d''', d'''')))) compound5 l l' l'' l''' l''''- = lens (\(a, (a', (a'', (a''', a''''))))- -> (view l a, (view l' a', (view l'' a'', (view l''' a''', view l'''' a'''')))) )- (\(a, (a', (a'', (a''', a'''')))) (b, (b', (b'', (b''', b''''))))- -> (set l b a, (set l' b' a', (set l'' b'' a'', (set l''' b''' a''', set l'''' b'''' a'''')))) )+ = lens (\(s, (s', (s'', (s''', s''''))))+ -> (view l s, (view l' s', (view l'' s'', (view l''' s''', view l'''' s'''')))) )+ (\(s, (s', (s'', (s''', s'''')))) (t, (t', (t'', (t''', t''''))))+ -> (set l t s, (set l' t' s', (set l'' t'' s'', (set l''' t''' s''', set l'''' t'''' s'''')))) ) main = defaultMain [ bench "alongside1" $ nf (view $ alongside _1 _2) (("hi", 1), (2, "there!"))
lens.cabal view
@@ -1,6 +1,6 @@ name: lens category: Data, Lenses-version: 3.0.6+version: 3.1 license: BSD3 cabal-version: >= 1.8 license-file: LICENSE@@ -37,7 +37,7 @@ . The core of this hierarchy looks like: .- <<https://github.com/ekmett/lens/wiki/images/Hierarchy-3.0.png>>+ <<https://github.com/ekmett/lens/wiki/images/Hierarchy-3.1.png>> . You can compose any two elements of the hierarchy above using (.) from the Prelude, and you can use any element of the hierarchy as any type it links to above it.
src/Control/Lens.hs view
@@ -41,7 +41,7 @@ -- -- <http://github.com/ekmett/lens/wiki> ----- <<http://github.com/ekmett/lens/wiki/images/Hierarchy-3.0.png>>+-- <<http://github.com/ekmett/lens/wiki/images/Hierarchy-3.1.png>> ---------------------------------------------------------------------------- module Control.Lens ( module Control.Lens.Type
src/Control/Lens/Action.hs view
@@ -42,27 +42,27 @@ -- Every 'Getter' can be used as an 'Action' -- -- You can compose an 'Action' with another 'Action' using ('Prelude..') from the @Prelude@.-type Action m a c = forall f r. Effective m r f => (c -> f c) -> a -> f a+type Action m s a = forall f r. Effective m r f => (a -> f a) -> s -> f s -- | A 'MonadicFold' is a 'Fold' enriched with access to a 'Monad' for side-effects. -- -- Every 'Fold' can be used as a 'MonadicFold', that simply ignores the access to the 'Monad'. -- -- You can compose a 'MonadicFold' with another 'MonadicFold' using ('Prelude..') from the @Prelude@.-type MonadicFold m a c = forall f r. (Effective m r f, Applicative f) => (c -> f c) -> a -> f a+type MonadicFold m s a = forall f r. (Effective m r f, Applicative f) => (a -> f a) -> s -> f s -- | Used to evaluate an 'Action'.-type Acting m r a b c d = (c -> Effect m r d) -> a -> Effect m r b+type Acting m r s t a b = (a -> Effect m r b) -> s -> Effect m r t -- | Perform an 'Action'. -- -- > perform = flip (^!)-perform :: Monad m => Acting m c a b c d -> a -> m c+perform :: Monad m => Acting m a s t a b -> s -> m a perform l = getEffect . l (Effect . return) {-# INLINE perform #-} -- | Perform an 'Action' and modify the result.-performs :: Monad m => Acting m e a b c d -> (c -> e) -> a -> m e+performs :: Monad m => Acting m e s t a b -> (a -> e) -> s -> m e performs l f = getEffect . l (Effect . return . f) -- | Perform an 'Action'@@ -70,13 +70,13 @@ -- >>> ["hello","world"]^!folded.act putStrLn -- hello -- world-(^!) :: Monad m => a -> Acting m c a b c d -> m c+(^!) :: Monad m => s -> Acting m a s t a b -> m a a ^! l = getEffect (l (Effect . return) a) {-# INLINE (^!) #-} -- | Construct an 'Action' from a monadic side-effect-act :: Monad m => (a -> m c) -> Action m a c-act amc cfd a = effective (amc a >>= ineffective . cfd)+act :: Monad m => (s -> m a) -> Action m s a+act sma afb a = effective (sma a >>= ineffective . afb) {-# INLINE act #-} -- | A self-running 'Action', analogous to 'Control.Monad.join'.@@ -90,6 +90,6 @@ {-# INLINE acts #-} -- | Apply a 'Monad' transformer to an 'Action'.-liftAct :: (MonadTrans t, Monad m) => Acting m c a b c d -> Action (t m) a c+liftAct :: (MonadTrans trans, Monad m) => Acting m a s t a b -> Action (trans m) s a liftAct l = act (lift . perform l) {-# INLINE liftAct #-}
src/Control/Lens/Fold.hs view
@@ -13,15 +13,15 @@ -- Stability : provisional -- Portability : Rank2Types ----- A @'Fold' a c@ is a generalization of something 'Foldable'. It allows+-- A @'Fold' s a@ is a generalization of something 'Foldable'. It allows -- you to extract multiple results from a container. A 'Foldable' container -- can be characterized by the behavior of--- @foldMap :: ('Foldable' t, 'Monoid' m) => (c -> m) -> t c -> m@.+-- @foldMap :: ('Foldable' t, 'Monoid' m) => (a -> m) -> t a -> m@. -- Since we want to be able to work with monomorphic containers, we could--- generalize this signature to @forall m. 'Monoid' m => (c -> m) -> a -> m@,+-- generalize this signature to @forall m. 'Monoid' m => (a -> m) -> s -> m@, -- and then decorate it with 'Accessor' to obtain ----- @type 'Fold' a c = forall m. 'Monoid' m => 'Getting' m a a c c@+-- @type 'Fold' s a = forall m. 'Monoid' m => 'Getting' m s s a a@ -- -- Every 'Getter' is a valid 'Fold' that simply doesn't use the 'Monoid' -- it is passed.@@ -98,28 +98,28 @@ -- | A 'Fold' describes how to retrieve multiple values in a way that can be composed -- with other lens-like constructions. ----- A @'Fold' a c@ provides a structure with operations very similar to those of the 'Foldable'+-- A @'Fold' s a@ provides a structure with operations very similar to those of the 'Foldable' -- typeclass, see 'foldMapOf' and the other 'Fold' combinators. ----- By convention, if there exists a 'foo' method that expects a @'Foldable' (f c)@, then there should be a--- @fooOf@ method that takes a @'Fold' a c@ and a value of type @a@.+-- By convention, if there exists a 'foo' method that expects a @'Foldable' (f a)@, then there should be a+-- @fooOf@ method that takes a @'Fold' s a@ and a value of type @s@. -- -- A 'Getter' is a legal 'Fold' that just ignores the supplied 'Monoid' -- -- Unlike a 'Control.Lens.Traversal.Traversal' a 'Fold' is read-only. Since a 'Fold' cannot be used to write back -- there are no lens laws that apply.-type Fold a c = forall f. (Gettable f, Applicative f) => (c -> f c) -> a -> f a+type Fold s a = forall f. (Gettable f, Applicative f) => (a -> f a) -> s -> f s -- | Obtain a 'Fold' by lifting an operation that returns a foldable result. -- -- This can be useful to lift operations from @Data.List@ and elsewhere into a 'Fold'.-folding :: (Foldable f, Applicative g, Gettable g) => (a -> f c) -> LensLike g a b c d-folding afc cgd = coerce . traverse_ cgd . afc+folding :: (Foldable f, Applicative g, Gettable g) => (s -> f a) -> LensLike g s t a b+folding sfa agb = coerce . traverse_ agb . sfa {-# INLINE folding #-} -- | Obtain a 'Fold' from any 'Foldable'.-folded :: Foldable f => Fold (f c) c+folded :: Foldable f => Fold (f a) a folded f = coerce . getFolding . foldMap (Folding . f) {-# INLINE folded #-} @@ -143,7 +143,7 @@ -- -- >>> take 6 $ toListOf (cycled traverse) [1,2,3] -- [1,2,3,1,2,3]-cycled :: (Applicative f, Gettable f) => LensLike f a b c d -> LensLike f a b c d+cycled :: (Applicative f, Gettable f) => LensLike f s t a b -> LensLike f s t a b cycled l f a = as where as = l f a *> as -- | Build a fold that unfolds its values from a seed.@@ -164,10 +164,21 @@ go a = g a *> go (f a) {-# INLINE iterated #-} --- | Obtain a 'Fold' by filtering a 'Lens', 'Control.Lens.Iso.Iso', 'Getter', 'Fold' or 'Control.Lens.Traversal.Traversal'.-filtered :: (Gettable f, Applicative f) => (c -> Bool) -> LensLike f a b c d -> LensLike f a b c d-filtered p l f = l $ \c -> if p c then f c- else noEffect+-- | Obtain a 'Fold' that can be composed with to filter another 'Lens', 'Control.Lens.Iso.Iso', 'Getter', 'Fold' (or 'Control.Lens.Traversal.Traversal')+--+-- Note: This is /not/ a legal 'Control.Lens.Traversal.Traversal', unless you are very careful not to invalidate the predicate on the target.+--+-- As a counter example, consider that given @evens = 'filtered' 'even'@ the second 'Control.Lens.Traversal.Traversal' law is violated:+--+-- @'over' evens 'succ' '.' 'over' evens 'succ' /= 'over' evens ('succ' '.' 'succ')@+--+-- So, in order for this to qualify as a legal 'Traversal' you can only use it for actions that preserve the result of the predicate!+--+-- @'filtered' :: (a -> 'Bool') -> 'Fold' a a@+filtered :: Applicative f => (a -> Bool) -> SimpleLensLike f a a+filtered p f a+ | p a = f a+ | otherwise = pure a {-# INLINE filtered #-} -- | This allows you to traverse the elements of a 'Control.Lens.Traversal.Traversal' or 'Fold' in the opposite order.@@ -177,7 +188,7 @@ -- Note: 'backwards' should have no impact on a 'Getter' 'Setter', 'Lens' or 'Control.Lens.Iso.Iso'. -- -- To change the direction of an 'Control.Lens.Iso.Iso', use 'from'.-backwards :: LensLike (Backwards f) a b c d -> LensLike f a b c d+backwards :: LensLike (Backwards f) s t a b -> LensLike f s t a b backwards l f = forwards . l (Backwards . f) {-# INLINE backwards #-} @@ -188,9 +199,9 @@ -- >>> toListOf (takingWhile (<=3) folded) [1..] -- [1,2,3] takingWhile :: (Gettable f, Applicative f)- => (c -> Bool)- -> Getting (Endo (f a)) a a c c- -> LensLike f a a c c+ => (a -> Bool)+ -> Getting (Endo (f s)) s s a a+ -> LensLike f s s a a takingWhile p l f = foldrOf l (\a r -> if p a then f a *> r else noEffect) noEffect {-# INLINE takingWhile #-} @@ -205,9 +216,9 @@ -- >>> toListOf (droppingWhile (<=3) folded) [1,6,1] -- [6,1] droppingWhile :: (Gettable f, Applicative f)- => (c -> Bool)- -> Getting (Endo (f a, f a)) a a c c- -> LensLike f a a c c+ => (a -> Bool)+ -> Getting (Endo (f s, f s)) s s a a+ -> LensLike f s s a a droppingWhile p l f = fst . foldrOf l (\a r -> let s = f a *> snd r in if p a then (fst r, s) else (s, s)) (noEffect, noEffect) {-# INLINE droppingWhile #-} @@ -221,13 +232,13 @@ -- @'foldMapOf' ≡ 'views'@ -- -- @--- 'foldMapOf' :: 'Getter' a c -> (c -> r) -> a -> r--- 'foldMapOf' :: 'Monoid' r => 'Fold' a c -> (c -> r) -> a -> r--- 'foldMapOf' :: 'Simple' 'Lens' a c -> (c -> r) -> a -> r--- 'foldMapOf' :: 'Simple' 'Control.Lens.Iso.Iso' a c -> (c -> r) -> a -> r--- 'foldMapOf' :: 'Monoid' r => 'Simple' 'Control.Lens.Traversal.Traversal' a c -> (c -> r) -> a -> r+-- 'foldMapOf' :: 'Getter' s a -> (a -> r) -> s -> r+-- 'foldMapOf' :: 'Monoid' r => 'Fold' s a -> (a -> r) -> s -> r+-- 'foldMapOf' :: 'Simple' 'Lens' s a -> (a -> r) -> s -> r+-- 'foldMapOf' :: 'Simple' 'Control.Lens.Iso.Iso' s a -> (a -> r) -> s -> r+-- 'foldMapOf' :: 'Monoid' r => 'Simple' 'Control.Lens.Traversal.Traversal' s a -> (a -> r) -> s -> r -- @-foldMapOf :: Getting r a b c d -> (c -> r) -> a -> r+foldMapOf :: Getting r s t a b -> (a -> r) -> s -> r foldMapOf l f = runAccessor . l (Accessor . f) {-# INLINE foldMapOf #-} @@ -237,13 +248,13 @@ -- @'foldOf' ≡ 'view'@ -- -- @--- 'foldOf' :: 'Getter' a m -> a -> m--- 'foldOf' :: 'Monoid' m => 'Fold' a m -> a -> m--- 'foldOf' :: 'Simple' 'Lens' a m -> a -> m--- 'foldOf' :: 'Simple' 'Control.Lens.Iso.Iso' a m -> a -> m--- 'foldOf' :: 'Monoid' m => 'Simple' 'Control.Lens.Traversal.Traversal' a m -> a -> m+-- 'foldOf' :: 'Getter' s m -> s -> m+-- 'foldOf' :: 'Monoid' m => 'Fold' s m -> s -> m+-- 'foldOf' :: 'Simple' 'Lens' s m -> s -> m+-- 'foldOf' :: 'Simple' 'Control.Lens.Iso.Iso' s m -> s -> m+-- 'foldOf' :: 'Monoid' m => 'Simple' 'Control.Lens.Traversal.Traversal' s m -> s -> m -- @-foldOf :: Getting c a b c d -> a -> c+foldOf :: Getting a s t a b -> s -> a foldOf l = runAccessor . l Accessor {-# INLINE foldOf #-} @@ -253,13 +264,13 @@ -- @'Data.Foldable.foldr' ≡ 'foldrOf' 'folded'@ -- -- @--- 'foldrOf' :: 'Getter' a c -> (c -> e -> e) -> e -> a -> e--- 'foldrOf' :: 'Fold' a c -> (c -> e -> e) -> e -> a -> e--- 'foldrOf' :: 'Simple' 'Lens' a c -> (c -> e -> e) -> e -> a -> e--- 'foldrOf' :: 'Simple' 'Control.Lens.Iso.Iso' a c -> (c -> e -> e) -> e -> a -> e--- 'foldrOf' :: 'Simple' 'Control.Lens.Traversal.Traversal' a c -> (c -> e -> e) -> e -> a -> e+-- 'foldrOf' :: 'Getter' s a -> (a -> r -> r) -> r -> s -> r+-- 'foldrOf' :: 'Fold' s a -> (a -> r -> r) -> r -> s -> r+-- 'foldrOf' :: 'Simple' 'Lens' s a -> (a -> r -> r) -> r -> s -> r+-- 'foldrOf' :: 'Simple' 'Control.Lens.Iso.Iso' s a -> (a -> r -> r) -> r -> s -> r+-- 'foldrOf' :: 'Simple' 'Control.Lens.Traversal.Traversal' s a -> (a -> r -> r) -> r -> s -> r -- @-foldrOf :: Getting (Endo e) a b c d -> (c -> e -> e) -> e -> a -> e+foldrOf :: Getting (Endo r) s t a b -> (a -> r -> r) -> r -> s -> r foldrOf l f z t = appEndo (foldMapOf l (Endo . f) t) z {-# INLINE foldrOf #-} @@ -269,13 +280,13 @@ -- @'Data.Foldable.foldl' ≡ 'foldlOf' 'folded'@ -- -- @--- 'foldlOf' :: 'Getter' a c -> (e -> c -> e) -> e -> a -> e--- 'foldlOf' :: 'Fold' a c -> (e -> c -> e) -> e -> a -> e--- 'foldlOf' :: 'Simple' 'Lens' a c -> (e -> c -> e) -> e -> a -> e--- 'foldlOf' :: 'Simple' 'Control.Lens.Iso.Iso' a c -> (e -> c -> e) -> e -> a -> e--- 'foldlOf' :: 'Simple' 'Control.Lens.Traversal.Traversal' a c -> (e -> c -> e) -> e -> a -> e+-- 'foldlOf' :: 'Getter' s a -> (r -> a -> r) -> r -> s -> r+-- 'foldlOf' :: 'Fold' s a -> (r -> a -> r) -> r -> s -> r+-- 'foldlOf' :: 'Simple' 'Lens' s a -> (r -> a -> r) -> r -> s -> r+-- 'foldlOf' :: 'Simple' 'Control.Lens.Iso.Iso' s a -> (r -> a -> r) -> r -> s -> r+-- 'foldlOf' :: 'Simple' 'Control.Lens.Traversal.Traversal' s a -> (r -> a -> r) -> r -> s -> r -- @-foldlOf :: Getting (Dual (Endo e)) a b c d -> (e -> c -> e) -> e -> a -> e+foldlOf :: Getting (Dual (Endo r)) s t a b -> (r -> a -> r) -> r -> s -> r foldlOf l f z t = appEndo (getDual (foldMapOf l (Dual . Endo . flip f) t)) z {-# INLINE foldlOf #-} @@ -290,13 +301,13 @@ -- ["hello","world"] -- -- @--- 'toListOf' :: 'Getter' a c -> a -> [c]--- 'toListOf' :: 'Fold' a c -> a -> [c]--- 'toListOf' :: 'Simple' 'Lens' a c -> a -> [c]--- 'toListOf' :: 'Simple' 'Control.Lens.Iso.Iso' a c -> a -> [c]--- 'toListOf' :: 'Simple' 'Control.Lens.Traversal.Traversal' a c -> a -> [c]+-- 'toListOf' :: 'Getter' s a -> s -> [a]+-- 'toListOf' :: 'Fold' s a -> s -> [a]+-- 'toListOf' :: 'Simple' 'Lens' s a -> s -> [a]+-- 'toListOf' :: 'Simple' 'Control.Lens.Iso.Iso' s a -> s -> [a]+-- 'toListOf' :: 'Simple' 'Control.Lens.Traversal.Traversal' s a -> s -> [a] -- @-toListOf :: Getting [c] a b c d -> a -> [c]+toListOf :: Getting [a] s t a b -> s -> [a] toListOf l = foldMapOf l return {-# INLINE toListOf #-} @@ -316,14 +327,14 @@ -- @ -- -- @--- ('^..') :: a -> 'Getter' a c -> [c]--- ('^..') :: a -> 'Fold' a c -> [c]--- ('^..') :: a -> 'Simple' 'Lens' a c -> [c]--- ('^..') :: a -> 'Simple' 'Control.Lens.Iso.Iso' a c -> [c]--- ('^..') :: a -> 'Simple' 'Control.Lens.Traversal.Traversal' a c -> [c]+-- ('^..') :: s -> 'Getter' s a -> [a]+-- ('^..') :: s -> 'Fold' s a -> [a]+-- ('^..') :: s -> 'Simple' 'Lens' s a -> [a]+-- ('^..') :: s -> 'Simple' 'Control.Lens.Iso.Iso' s a -> [a]+-- ('^..') :: s -> 'Simple' 'Control.Lens.Traversal.Traversal' s a -> [a] -- @-(^..) :: a -> Getting [c] a b c d -> [c]-a ^.. l = foldMapOf l return a+(^..) :: s -> Getting [a] s t a b -> [a]+s ^.. l = foldMapOf l return s -- | Returns 'True' if every target of a 'Fold' is 'True'. --@@ -335,13 +346,13 @@ -- @'Data.Foldable.and' ≡ 'andOf' 'folded'@ -- -- @--- 'andOf' :: 'Getter' a 'Bool' -> a -> 'Bool'--- 'andOf' :: 'Fold' a 'Bool' -> a -> 'Bool'--- 'andOf' :: 'Simple' 'Lens' a 'Bool' -> a -> 'Bool'--- 'andOf' :: 'Simple' 'Control.Lens.Iso.Iso' a 'Bool' -> a -> 'Bool'--- 'andOf' :: 'Simple' 'Control.Lens.Traversal.Traversal' a 'Bool' -> a -> 'Bool'+-- 'andOf' :: 'Getter' s 'Bool' -> s -> 'Bool'+-- 'andOf' :: 'Fold' s 'Bool' -> s -> 'Bool'+-- 'andOf' :: 'Simple' 'Lens' s 'Bool' -> s -> 'Bool'+-- 'andOf' :: 'Simple' 'Control.Lens.Iso.Iso' s 'Bool' -> s -> 'Bool'+-- 'andOf' :: 'Simple' 'Control.Lens.Traversal.Traversal' s 'Bool' -> s -> 'Bool' -- @-andOf :: Getting All a b Bool d -> a -> Bool+andOf :: Getting All s t Bool b -> s -> Bool andOf l = getAll . foldMapOf l All {-# INLINE andOf #-} @@ -355,13 +366,13 @@ -- @'Data.Foldable.or' ≡ 'orOf' 'folded'@ -- -- @--- 'orOf' :: 'Getter' a 'Bool' -> a -> 'Bool'--- 'orOf' :: 'Fold' a 'Bool' -> a -> 'Bool'--- 'orOf' :: 'Simple' 'Lens' a 'Bool' -> a -> 'Bool'--- 'orOf' :: 'Simple' 'Control.Lens.Iso.Iso' a 'Bool' -> a -> 'Bool'--- 'orOf' :: 'Simple' 'Control.Lens.Traversal.Traversal' a 'Bool' -> a -> 'Bool'+-- 'orOf' :: 'Getter' s 'Bool' -> s -> 'Bool'+-- 'orOf' :: 'Fold' s 'Bool' -> s -> 'Bool'+-- 'orOf' :: 'Simple' 'Lens' s 'Bool' -> s -> 'Bool'+-- 'orOf' :: 'Simple' 'Control.Lens.Iso.Iso' s 'Bool' -> s -> 'Bool'+-- 'orOf' :: 'Simple' 'Control.Lens.Traversal.Traversal' s 'Bool' -> s -> 'Bool' -- @-orOf :: Getting Any a b Bool d -> a -> Bool+orOf :: Getting Any s t Bool b -> s -> Bool orOf l = getAny . foldMapOf l Any {-# INLINE orOf #-} @@ -376,13 +387,13 @@ -- @'Data.Foldable.any' ≡ 'anyOf' 'folded'@ -- -- @--- 'anyOf' :: 'Getter' a c -> (c -> 'Bool') -> a -> 'Bool'--- 'anyOf' :: 'Fold' a c -> (c -> 'Bool') -> a -> 'Bool'--- 'anyOf' :: 'Simple' 'Lens' a b c d -> (c -> 'Bool') -> a -> 'Bool'--- 'anyOf' :: 'Simple' 'Control.Lens.Iso.Iso' a b c d -> (c -> 'Bool') -> a -> 'Bool'--- 'anyOf' :: 'Simple' 'Control.Lens.Traversal.Traversal' a b c d -> (c -> 'Bool') -> a -> 'Bool'+-- 'anyOf' :: 'Getter' s a -> (a -> 'Bool') -> s -> 'Bool'+-- 'anyOf' :: 'Fold' s a -> (a -> 'Bool') -> s -> 'Bool'+-- 'anyOf' :: 'Simple' 'Lens' s a -> (a -> 'Bool') -> s -> 'Bool'+-- 'anyOf' :: 'Simple' 'Control.Lens.Iso.Iso' s a -> (a -> 'Bool') -> s -> 'Bool'+-- 'anyOf' :: 'Simple' 'Control.Lens.Traversal.Traversal' s a -> (a -> 'Bool') -> s -> 'Bool' -- @-anyOf :: Getting Any a b c d -> (c -> Bool) -> a -> Bool+anyOf :: Getting Any s t a b -> (a -> Bool) -> s -> Bool anyOf l f = getAny . foldMapOf l (Any . f) {-# INLINE anyOf #-} @@ -396,13 +407,13 @@ -- @'Data.Foldable.all' ≡ 'allOf' 'folded'@ -- -- @--- 'allOf' :: 'Getter' a c -> (c -> 'Bool') -> a -> 'Bool'--- 'allOf' :: 'Fold' a c -> (c -> 'Bool') -> a -> 'Bool'--- 'allOf' :: 'Simple' 'Lens' a c -> (c -> 'Bool') -> a -> 'Bool'--- 'allOf' :: 'Simple' 'Control.Lens.Iso.Iso' a c -> (c -> 'Bool') -> a -> 'Bool'--- 'allOf' :: 'Simple' 'Control.Lens.Traversal.Traversal' a c -> (c -> 'Bool') -> a -> 'Bool'+-- 'allOf' :: 'Getter' s a -> (a -> 'Bool') -> s -> 'Bool'+-- 'allOf' :: 'Fold' s a -> (a -> 'Bool') -> s -> 'Bool'+-- 'allOf' :: 'Simple' 'Lens' s a -> (a -> 'Bool') -> s -> 'Bool'+-- 'allOf' :: 'Simple' 'Control.Lens.Iso.Iso' s a -> (a -> 'Bool') -> s -> 'Bool'+-- 'allOf' :: 'Simple' 'Control.Lens.Traversal.Traversal' s a -> (a -> 'Bool') -> s -> 'Bool' -- @-allOf :: Getting All a b c d -> (c -> Bool) -> a -> Bool+allOf :: Getting All s t a b -> (a -> Bool) -> s -> Bool allOf l f = getAll . foldMapOf l (All . f) {-# INLINE allOf #-} @@ -416,13 +427,13 @@ -- @'Data.Foldable.product' ≡ 'productOf' 'folded'@ -- -- @--- 'productOf' :: 'Getter' a c -> a -> c--- 'productOf' :: 'Num' c => 'Fold' a c -> a -> c--- 'productOf' :: 'Simple' 'Lens' a c -> a -> c--- 'productOf' :: 'Simple' 'Control.Lens.Iso.Iso' a c -> a -> c--- 'productOf' :: 'Num' c => 'Simple' 'Control.Lens.Traversal.Traversal' a c -> a -> c+-- 'productOf' :: 'Getter' s a -> s -> a+-- 'productOf' :: 'Num' a => 'Fold' s a -> s -> a+-- 'productOf' :: 'Simple' 'Lens' s a -> s -> a+-- 'productOf' :: 'Simple' 'Control.Lens.Iso.Iso' s a -> s -> a+-- 'productOf' :: 'Num' a => 'Simple' 'Control.Lens.Traversal.Traversal' s a -> s -> a -- @-productOf :: Getting (Product c) a b c d -> a -> c+productOf :: Getting (Product a) s t a b -> s -> a productOf l = getProduct . foldMapOf l Product {-# INLINE productOf #-} @@ -446,13 +457,13 @@ -- @ -- -- @--- 'sumOf' :: 'Getter' a c -> a -> c--- 'sumOf' :: 'Num' c => 'Fold' a c -> a -> c--- 'sumOf' :: 'Simple' 'Lens' a c -> a -> c--- 'sumOf' :: 'Simple' 'Control.Lens.Iso.Iso' a c -> a -> c--- 'sumOf' :: 'Num' c => 'Simple' 'Control.Lens.Traversal.Traversal' a c -> a -> c+-- 'sumOf' :: 'Getter' s a -> s -> a+-- 'sumOf' :: 'Num' a => 'Fold' s a -> s -> a+-- 'sumOf' :: 'Simple' 'Lens' s a -> s -> a+-- 'sumOf' :: 'Simple' 'Control.Lens.Iso.Iso' s a -> s -> a+-- 'sumOf' :: 'Num' a => 'Simple' 'Control.Lens.Traversal.Traversal' s a -> s -> a -- @-sumOf :: Getting (Sum c) a b c d -> a -> c+sumOf :: Getting (Sum a) s t a b -> s -> a sumOf l = getSum . foldMapOf l Sum {-# INLINE sumOf #-} @@ -470,20 +481,20 @@ -- @'Data.Foldable.traverse_' ≡ 'traverseOf_' 'folded'@ -- -- @--- 'traverseOf_' '_2' :: 'Functor' f => (c -> f e) -> (c1, c) -> f ()+-- 'traverseOf_' '_2' :: 'Functor' f => (c -> f r) -> (d, c) -> f () -- 'traverseOf_' 'Data.Either.Lens.traverseLeft' :: 'Applicative' f => (a -> f b) -> 'Either' a c -> f () -- @ -- -- The rather specific signature of 'traverseOf_' allows it to be used as if the signature was any of: -- -- @--- 'traverseOf_' :: 'Functor' f => 'Getter' a c -> (c -> f e) -> a -> f ()--- 'traverseOf_' :: 'Applicative' f => 'Fold' a c -> (c -> f e) -> a -> f ()--- 'traverseOf_' :: 'Functor' f => 'Simple' 'Lens' a c -> (c -> f e) -> a -> f ()--- 'traverseOf_' :: 'Functor' f => 'Simple' 'Control.Lens.Iso.Iso' a c -> (c -> f e) -> a -> f ()--- 'traverseOf_' :: 'Applicative' f => 'Simple' 'Control.Lens.Traversal.Traversal' a c -> (c -> f e) -> a -> f ()+-- 'traverseOf_' :: 'Functor' f => 'Getter' s a -> (a -> f r) -> s -> f ()+-- 'traverseOf_' :: 'Applicative' f => 'Fold' s a -> (a -> f r) -> s -> f ()+-- 'traverseOf_' :: 'Functor' f => 'Simple' 'Lens' s a -> (a -> f r) -> s -> f ()+-- 'traverseOf_' :: 'Functor' f => 'Simple' 'Control.Lens.Iso.Iso' s a -> (a -> f r) -> s -> f ()+-- 'traverseOf_' :: 'Applicative' f => 'Simple' 'Control.Lens.Traversal.Traversal' s a -> (a -> f r) -> s -> f () -- @-traverseOf_ :: Functor f => Getting (Traversed f) a b c d -> (c -> f e) -> a -> f ()+traverseOf_ :: Functor f => Getting (Traversed f) s t a b -> (a -> f r) -> s -> f () traverseOf_ l f = getTraversed . foldMapOf l (Traversed . void . f) {-# INLINE traverseOf_ #-} @@ -499,13 +510,13 @@ -- The rather specific signature of 'forOf_' allows it to be used as if the signature was any of: -- -- @--- 'forOf_' :: 'Functor' f => 'Getter' a c -> a -> (c -> f e) -> f ()--- 'forOf_' :: 'Applicative' f => 'Fold' a c -> a -> (c -> f e) -> f ()--- 'forOf_' :: 'Functor' f => 'Simple' 'Lens' a c -> a -> (c -> f e) -> f ()--- 'forOf_' :: 'Functor' f => 'Simple' 'Control.Lens.Iso.Iso' a c -> a -> (c -> f e) -> f ()--- 'forOf_' :: 'Applicative' f => 'Simple' 'Control.Lens.Traversal.Traversal' a c -> a -> (c -> f e) -> f ()+-- 'forOf_' :: 'Functor' f => 'Getter' s a -> s -> (a -> f r) -> f ()+-- 'forOf_' :: 'Applicative' f => 'Fold' s a -> s -> (a -> f r) -> f ()+-- 'forOf_' :: 'Functor' f => 'Simple' 'Lens' s a -> s -> (a -> f r) -> f ()+-- 'forOf_' :: 'Functor' f => 'Simple' 'Control.Lens.Iso.Iso' s a -> s -> (a -> f r) -> f ()+-- 'forOf_' :: 'Applicative' f => 'Simple' 'Control.Lens.Traversal.Traversal' s a -> s -> (a -> f r) -> f () -- @-forOf_ :: Functor f => Getting (Traversed f) a b c d -> a -> (c -> f e) -> f ()+forOf_ :: Functor f => Getting (Traversed f) s t a b -> s -> (a -> f r) -> f () forOf_ = flip . traverseOf_ {-# INLINE forOf_ #-} @@ -514,13 +525,13 @@ -- @'sequenceA_' ≡ 'sequenceAOf_' 'folded'@ -- -- @--- 'sequenceAOf_' :: 'Functor' f => 'Getter' a (f ()) -> a -> f ()--- 'sequenceAOf_' :: 'Applicative' f => 'Fold' a (f ()) -> a -> f ()--- 'sequenceAOf_' :: 'Functor' f => 'Simple' 'Lens' a (f ()) -> a -> f ()--- 'sequenceAOf_' :: 'Functor' f => 'Simple' 'Iso' a (f ()) -> a -> f ()--- 'sequenceAOf_' :: 'Applicative' f => 'Simple' 'Control.Lens.Traversal.Traversal' a (f ()) -> a -> f ()+-- 'sequenceAOf_' :: 'Functor' f => 'Getter' s (f ()) -> s -> f ()+-- 'sequenceAOf_' :: 'Applicative' f => 'Fold' s (f ()) -> s -> f ()+-- 'sequenceAOf_' :: 'Functor' f => 'Simple' 'Lens' s (f ()) -> s -> f ()+-- 'sequenceAOf_' :: 'Functor' f => 'Simple' 'Iso' s (f ()) -> s -> f ()+-- 'sequenceAOf_' :: 'Applicative' f => 'Simple' 'Control.Lens.Traversal.Traversal' s (f ()) -> s -> f () -- @-sequenceAOf_ :: Functor f => Getting (Traversed f) a b (f ()) d -> a -> f ()+sequenceAOf_ :: Functor f => Getting (Traversed f) s t (f ()) b -> s -> f () sequenceAOf_ l = getTraversed . foldMapOf l (Traversed . void) {-# INLINE sequenceAOf_ #-} @@ -529,13 +540,13 @@ -- @'Data.Foldable.mapM_' ≡ 'mapMOf_' 'folded'@ -- -- @--- 'mapMOf_' :: 'Monad' m => 'Getter' a c -> (c -> m e) -> a -> m ()--- 'mapMOf_' :: 'Monad' m => 'Fold' a c -> (c -> m e) -> a -> m ()--- 'mapMOf_' :: 'Monad' m => 'Simple' 'Lens' a c -> (c -> m e) -> a -> m ()--- 'mapMOf_' :: 'Monad' m => 'Simple' 'Control.Lens.Iso.Iso' a c -> (c -> m e) -> a -> m ()--- 'mapMOf_' :: 'Monad' m => 'Simple' 'Control.Lens.Traversal.Traversal' a c -> (c -> m e) -> a -> m ()+-- 'mapMOf_' :: 'Monad' m => 'Getter' s a -> (a -> m r) -> s -> m ()+-- 'mapMOf_' :: 'Monad' m => 'Fold' s a -> (a -> m r) -> s -> m ()+-- 'mapMOf_' :: 'Monad' m => 'Simple' 'Lens' s a -> (a -> m r) -> s -> m ()+-- 'mapMOf_' :: 'Monad' m => 'Simple' 'Control.Lens.Iso.Iso' s a -> (a -> m r) -> s -> m ()+-- 'mapMOf_' :: 'Monad' m => 'Simple' 'Control.Lens.Traversal.Traversal' s a -> (a -> m r) -> s -> m () -- @-mapMOf_ :: Monad m => Getting (Sequenced m) a b c d -> (c -> m e) -> a -> m ()+mapMOf_ :: Monad m => Getting (Sequenced m) s t a b -> (a -> m r) -> s -> m () mapMOf_ l f = getSequenced . foldMapOf l (Sequenced . liftM skip . f) {-# INLINE mapMOf_ #-} @@ -548,13 +559,13 @@ -- @'Data.Foldable.forM_' ≡ 'forMOf_' 'folded'@ -- -- @--- 'forMOf_' :: 'Monad' m => 'Getter' a c -> a -> (c -> m e) -> m ()--- 'forMOf_' :: 'Monad' m => 'Fold' a c -> a -> (c -> m e) -> m ()--- 'forMOf_' :: 'Monad' m => 'Simple' 'Lens' a c -> a -> (c -> m e) -> m ()--- 'forMOf_' :: 'Monad' m => 'Simple' 'Control.Lens.Iso.Iso' a c -> a -> (c -> m e) -> m ()--- 'forMOf_' :: 'Monad' m => 'Simple' 'Control.Lens.Traversal.Traversal' a c -> a -> (c -> m e) -> m ()+-- 'forMOf_' :: 'Monad' m => 'Getter' s a -> s -> (a -> m r) -> m ()+-- 'forMOf_' :: 'Monad' m => 'Fold' s a -> s -> (a -> m r) -> m ()+-- 'forMOf_' :: 'Monad' m => 'Simple' 'Lens' s a -> s -> (a -> m r) -> m ()+-- 'forMOf_' :: 'Monad' m => 'Simple' 'Control.Lens.Iso.Iso' s a -> s -> (a -> m r) -> m ()+-- 'forMOf_' :: 'Monad' m => 'Simple' 'Control.Lens.Traversal.Traversal' s a -> s -> (a -> m r) -> m () -- @-forMOf_ :: Monad m => Getting (Sequenced m) a b c d -> a -> (c -> m e) -> m ()+forMOf_ :: Monad m => Getting (Sequenced m) s t a b -> s -> (a -> m r) -> m () forMOf_ = flip . mapMOf_ {-# INLINE forMOf_ #-} @@ -563,13 +574,13 @@ -- @'Data.Foldable.sequence_' ≡ 'sequenceOf_' 'folded'@ -- -- @--- 'sequenceOf_' :: 'Monad' m => 'Getter' a (m b) -> a -> m ()--- 'sequenceOf_' :: 'Monad' m => 'Fold' a (m b) -> a -> m ()--- 'sequenceOf_' :: 'Monad' m => 'Simple' 'Lens' a (m b) -> a -> m ()--- 'sequenceOf_' :: 'Monad' m => 'Simple' 'Control.Lens.Iso.Iso' a (m b) -> a -> m ()--- 'sequenceOf_' :: 'Monad' m => 'Simple' 'Control.Lens.Traversal.Traversal' a (m b) -> a -> m ()+-- 'sequenceOf_' :: 'Monad' m => 'Getter' s (m a) -> s -> m ()+-- 'sequenceOf_' :: 'Monad' m => 'Fold' s (m a) -> s -> m ()+-- 'sequenceOf_' :: 'Monad' m => 'Simple' 'Lens' s (m a) -> s -> m ()+-- 'sequenceOf_' :: 'Monad' m => 'Simple' 'Control.Lens.Iso.Iso' s (m a) -> s -> m ()+-- 'sequenceOf_' :: 'Monad' m => 'Simple' 'Control.Lens.Traversal.Traversal' s (m a) -> s -> m () -- @-sequenceOf_ :: Monad m => Getting (Sequenced m) a b (m c) d -> a -> m ()+sequenceOf_ :: Monad m => Getting (Sequenced m) s t (m a) b -> s -> m () sequenceOf_ l = getSequenced . foldMapOf l (Sequenced . liftM skip) {-# INLINE sequenceOf_ #-} @@ -578,13 +589,13 @@ -- @'asum' ≡ 'asumOf' 'folded'@ -- -- @--- 'asumOf' :: 'Alternative' f => 'Getter' a c -> a -> f c--- 'asumOf' :: 'Alternative' f => 'Fold' a c -> a -> f c--- 'asumOf' :: 'Alternative' f => 'Simple' 'Lens' a c -> a -> f c--- 'asumOf' :: 'Alternative' f => 'Simple' 'Control.Lens.Iso.Iso' a c -> a -> f c--- 'asumOf' :: 'Alternative' f => 'Simple' 'Control.Lens.Traversal.Traversal' a c -> a -> f c+-- 'asumOf' :: 'Alternative' f => 'Getter' s a -> s -> f a+-- 'asumOf' :: 'Alternative' f => 'Fold' s a -> s -> f a+-- 'asumOf' :: 'Alternative' f => 'Simple' 'Lens' s a -> s -> f a+-- 'asumOf' :: 'Alternative' f => 'Simple' 'Control.Lens.Iso.Iso' s a -> s -> f a+-- 'asumOf' :: 'Alternative' f => 'Simple' 'Control.Lens.Traversal.Traversal' s a -> s -> f a -- @-asumOf :: Alternative f => Getting (Endo (f c)) a b (f c) d -> a -> f c+asumOf :: Alternative f => Getting (Endo (f a)) s t (f a) b -> s -> f a asumOf l = foldrOf l (<|>) Applicative.empty {-# INLINE asumOf #-} @@ -593,13 +604,13 @@ -- @'msum' ≡ 'msumOf' 'folded'@ -- -- @--- 'msumOf' :: 'MonadPlus' m => 'Getter' a c -> a -> m c--- 'msumOf' :: 'MonadPlus' m => 'Fold' a c -> a -> m c--- 'msumOf' :: 'MonadPlus' m => 'Simple' 'Lens' a c -> a -> m c--- 'msumOf' :: 'MonadPlus' m => 'Simple' 'Control.Lens.Iso.Iso' a c -> a -> m c--- 'msumOf' :: 'MonadPlus' m => 'Simple' 'Control.Lens.Traversal.Traversal' a c -> a -> m c+-- 'msumOf' :: 'MonadPlus' m => 'Getter' s a -> s -> m a+-- 'msumOf' :: 'MonadPlus' m => 'Fold' s a -> s -> m a+-- 'msumOf' :: 'MonadPlus' m => 'Simple' 'Lens' s a -> s -> m a+-- 'msumOf' :: 'MonadPlus' m => 'Simple' 'Control.Lens.Iso.Iso' s a -> s -> m a+-- 'msumOf' :: 'MonadPlus' m => 'Simple' 'Control.Lens.Traversal.Traversal' s a -> s -> m a -- @-msumOf :: MonadPlus m => Getting (Endo (m c)) a b (m c) d -> a -> m c+msumOf :: MonadPlus m => Getting (Endo (m a)) s t (m a) b -> s -> m a msumOf l = foldrOf l mplus mzero {-# INLINE msumOf #-} @@ -611,13 +622,13 @@ -- @'elem' ≡ 'elemOf' 'folded'@ -- -- @--- 'elemOf' :: 'Eq' c => 'Getter' a c -> c -> a -> 'Bool'--- 'elemOf' :: 'Eq' c => 'Fold' a c -> c -> a -> 'Bool'--- 'elemOf' :: 'Eq' c => 'Simple' 'Lens' a c -> c -> a -> 'Bool'--- 'elemOf' :: 'Eq' c => 'Simple' 'Control.Lens.Iso.Iso' a c -> c -> a -> 'Bool'--- 'elemOf' :: 'Eq' c => 'Simple' 'Control.Lens.Traversal.Traversal' a c -> c -> a -> 'Bool'+-- 'elemOf' :: 'Eq' a => 'Getter' s a -> a -> s -> 'Bool'+-- 'elemOf' :: 'Eq' a => 'Fold' s a -> a -> s -> 'Bool'+-- 'elemOf' :: 'Eq' a => 'Simple' 'Lens' s a -> a -> s -> 'Bool'+-- 'elemOf' :: 'Eq' a => 'Simple' 'Control.Lens.Iso.Iso' s a -> a -> s -> 'Bool'+-- 'elemOf' :: 'Eq' a => 'Simple' 'Control.Lens.Traversal.Traversal' s a -> a -> s -> 'Bool' -- @-elemOf :: Eq c => Getting Any a b c d -> c -> a -> Bool+elemOf :: Eq a => Getting Any s t a b -> a -> s -> Bool elemOf l = anyOf l . (==) {-# INLINE elemOf #-} @@ -626,13 +637,13 @@ -- @'notElem' ≡ 'notElemOf' 'folded'@ -- -- @--- 'notElemOf' :: 'Eq' c => 'Getter' a c -> c -> a -> 'Bool'--- 'notElemOf' :: 'Eq' c => 'Fold' a c -> c -> a -> 'Bool'--- 'notElemOf' :: 'Eq' c => 'Simple' 'Control.Lens.Iso.Iso' a c -> c -> a -> 'Bool'--- 'notElemOf' :: 'Eq' c => 'Simple' 'Lens' a c -> c -> a -> 'Bool'--- 'notElemOf' :: 'Eq' c => 'Simple' 'Control.Lens.Traversal.Traversal' a c -> c -> a -> 'Bool'+-- 'notElemOf' :: 'Eq' a => 'Getter' s a -> a -> s -> 'Bool'+-- 'notElemOf' :: 'Eq' a => 'Fold' s a -> a -> s -> 'Bool'+-- 'notElemOf' :: 'Eq' a => 'Simple' 'Control.Lens.Iso.Iso' s a -> a -> s -> 'Bool'+-- 'notElemOf' :: 'Eq' a => 'Simple' 'Lens' s a -> a -> s -> 'Bool'+-- 'notElemOf' :: 'Eq' a => 'Simple' 'Control.Lens.Traversal.Traversal' s a -> a -> s -> 'Bool' -- @-notElemOf :: Eq c => Getting All a b c d -> c -> a -> Bool+notElemOf :: Eq a => Getting All s t a b -> a -> s -> Bool notElemOf l = allOf l . (/=) {-# INLINE notElemOf #-} @@ -641,13 +652,13 @@ -- @'concatMap' ≡ 'concatMapOf' 'folded'@ -- -- @--- 'concatMapOf' :: 'Getter' a c -> (c -> [e]) -> a -> [e]--- 'concatMapOf' :: 'Fold' a c -> (c -> [e]) -> a -> [e]--- 'concatMapOf' :: 'Simple' 'Lens' a c -> (c -> [e]) -> a -> [e]--- 'concatMapOf' :: 'Simple' 'Control.Lens.Iso.Iso' a c -> (c -> [e]) -> a -> [e]--- 'concatMapOf' :: 'Simple' 'Control.Lens.Traversal.Traversal' a c -> (c -> [e]) -> a -> [e]+-- 'concatMapOf' :: 'Getter' s a -> (a -> [r]) -> s -> [r]+-- 'concatMapOf' :: 'Fold' s a -> (a -> [r]) -> s -> [r]+-- 'concatMapOf' :: 'Simple' 'Lens' s a -> (a -> [r]) -> s -> [r]+-- 'concatMapOf' :: 'Simple' 'Control.Lens.Iso.Iso' s a -> (a -> [r]) -> s -> [r]+-- 'concatMapOf' :: 'Simple' 'Control.Lens.Traversal.Traversal' s a -> (a -> [r]) -> s -> [r] -- @-concatMapOf :: Getting [e] a b c d -> (c -> [e]) -> a -> [e]+concatMapOf :: Getting [r] s t a b -> (a -> [r]) -> s -> [r] concatMapOf l ces = runAccessor . l (Accessor . ces) {-# INLINE concatMapOf #-} @@ -662,13 +673,13 @@ -- @ -- -- @--- 'concatOf' :: 'Getter' a [e] -> a -> [e]--- 'concatOf' :: 'Fold' a [e] -> a -> [e]--- 'concatOf' :: 'Simple' 'Control.Lens.Iso.Iso' a [e] -> a -> [e]--- 'concatOf' :: 'Simple' 'Lens' a [e] -> a -> [e]--- 'concatOf' :: 'Simple' 'Control.Lens.Traversal.Traversal' a [e] -> a -> [e]+-- 'concatOf' :: 'Getter' s [r] -> s -> [r]+-- 'concatOf' :: 'Fold' s [r] -> s -> [r]+-- 'concatOf' :: 'Simple' 'Control.Lens.Iso.Iso' s [r] -> s -> [r]+-- 'concatOf' :: 'Simple' 'Lens' s [r] -> s -> [r]+-- 'concatOf' :: 'Simple' 'Control.Lens.Traversal.Traversal' s [r] -> s -> [r] -- @-concatOf :: Getting [e] a b [e] d -> a -> [e]+concatOf :: Getting [r] s t [r] b -> s -> [r] concatOf = view {-# INLINE concatOf #-} @@ -683,13 +694,13 @@ -- @'lengthOf' ('folded' . 'folded') :: 'Foldable' f => f (g a) -> 'Int'@ -- -- @--- 'lengthOf' :: 'Getter' a c -> a -> 'Int'--- 'lengthOf' :: 'Fold' a c -> a -> 'Int'--- 'lengthOf' :: 'Simple' 'Lens' a c -> a -> 'Int'--- 'lengthOf' :: 'Simple' 'Control.Lens.Iso.Iso' a c -> a -> 'Int'--- 'lengthOf' :: 'Simple' 'Control.Lens.Traversal.Traversal' a c -> a -> 'Int'+-- 'lengthOf' :: 'Getter' s a -> s -> 'Int'+-- 'lengthOf' :: 'Fold' s a -> s -> 'Int'+-- 'lengthOf' :: 'Simple' 'Lens' s a -> s -> 'Int'+-- 'lengthOf' :: 'Simple' 'Control.Lens.Iso.Iso' s a -> s -> 'Int'+-- 'lengthOf' :: 'Simple' 'Control.Lens.Traversal.Traversal' s a -> s -> 'Int' -- @-lengthOf :: Getting (Sum Int) a b c d -> a -> Int+lengthOf :: Getting (Sum Int) s t a b -> s -> Int lengthOf l = getSum . foldMapOf l (\_ -> Sum 1) {-# INLINE lengthOf #-} @@ -699,13 +710,13 @@ -- @'Data.Maybe.listToMaybe' '.' 'toList' ≡ 'headOf' 'folded'@ -- -- @--- 'headOf' :: 'Getter' a c -> a -> 'Maybe' c--- 'headOf' :: 'Fold' a c -> a -> 'Maybe' c--- 'headOf' :: 'Simple' 'Lens' a c -> a -> 'Maybe' c--- 'headOf' :: 'Simple' 'Control.Lens.Iso.Iso' a c -> a -> 'Maybe' c--- 'headOf' :: 'Simple' 'Control.Lens.Traversal.Traversal' a c -> a -> 'Maybe' c+-- 'headOf' :: 'Getter' s a -> s -> 'Maybe' a+-- 'headOf' :: 'Fold' s a -> s -> 'Maybe' a+-- 'headOf' :: 'Simple' 'Lens' s a -> s -> 'Maybe' a+-- 'headOf' :: 'Simple' 'Control.Lens.Iso.Iso' s a -> s -> 'Maybe' a+-- 'headOf' :: 'Simple' 'Control.Lens.Traversal.Traversal' s a -> s -> 'Maybe' a -- @-headOf :: Getting (First c) a b c d -> a -> Maybe c+headOf :: Getting (First a) s t a b -> s -> Maybe a headOf l = getFirst . foldMapOf l (First . Just) {-# INLINE headOf #-} @@ -718,13 +729,13 @@ -- @('^?') ≡ 'flip' 'headOf'@ -- -- @--- ('^?') :: a -> 'Getter' a c -> 'Maybe' c--- ('^?') :: a -> 'Fold' a c -> 'Maybe' c--- ('^?') :: a -> 'Simple' 'Lens' a c -> 'Maybe' c--- ('^?') :: a -> 'Simple' 'Control.Lens.Iso.Iso' a c -> 'Maybe' c--- ('^?') :: a -> 'Simple' 'Control.Lens.Traversal.Traversal' a c -> 'Maybe' c+-- ('^?') :: s -> 'Getter' s a -> 'Maybe' a+-- ('^?') :: s -> 'Fold' s a -> 'Maybe' a+-- ('^?') :: s -> 'Simple' 'Lens' s a -> 'Maybe' a+-- ('^?') :: s -> 'Simple' 'Control.Lens.Iso.Iso' s a -> 'Maybe' a+-- ('^?') :: s -> 'Simple' 'Control.Lens.Traversal.Traversal' s a -> 'Maybe' a -- @-(^?) :: a -> Getting (First c) a b c d -> Maybe c+(^?) :: s -> Getting (First a) s t a b -> Maybe a a ^? l = getFirst (foldMapOf l (First . Just) a) {-# INLINE (^?) #-} @@ -732,13 +743,13 @@ -- from a 'Getter' or 'Lens'. -- -- @--- 'lastOf' :: 'Getter' a c -> a -> 'Maybe' c--- 'lastOf' :: 'Fold' a c -> a -> 'Maybe' c--- 'lastOf' :: 'Simple' 'Lens' a c -> a -> 'Maybe' c--- 'lastOf' :: 'Simple' 'Control.Lens.Iso.Iso' a c -> a -> 'Maybe' c--- 'lastOf' :: 'Simple' 'Control.Lens.Traversal.Traversal' a c -> a -> 'Maybe' c+-- 'lastOf' :: 'Getter' s a -> s -> 'Maybe' a+-- 'lastOf' :: 'Fold' s a -> s -> 'Maybe' a+-- 'lastOf' :: 'Simple' 'Lens' s a -> s -> 'Maybe' a+-- 'lastOf' :: 'Simple' 'Control.Lens.Iso.Iso' s a -> s -> 'Maybe' a+-- 'lastOf' :: 'Simple' 'Control.Lens.Traversal.Traversal' s a -> s -> 'Maybe' a -- @-lastOf :: Getting (Last c) a b c d -> a -> Maybe c+lastOf :: Getting (Last a) s t a b -> s -> Maybe a lastOf l = getLast . foldMapOf l (Last . Just) {-# INLINE lastOf #-} @@ -757,13 +768,13 @@ -- @'nullOf' ('folded' '.' '_1' '.' 'folded') :: 'Foldable' f => f (g a, b) -> 'Bool'@ -- -- @--- 'nullOf' :: 'Getter' a c -> a -> 'Bool'--- 'nullOf' :: 'Fold' a c -> a -> 'Bool'--- 'nullOf' :: 'Simple' 'Control.Lens.Iso.Iso' a c -> a -> 'Bool'--- 'nullOf' :: 'Simple' 'Lens' a c -> a -> 'Bool'--- 'nullOf' :: 'Simple' 'Control.Lens.Traversal.Traversal' a c -> a -> 'Bool'+-- 'nullOf' :: 'Getter' s a -> s -> 'Bool'+-- 'nullOf' :: 'Fold' s a -> s -> 'Bool'+-- 'nullOf' :: 'Simple' 'Control.Lens.Iso.Iso' s a -> s -> 'Bool'+-- 'nullOf' :: 'Simple' 'Lens' s a -> s -> 'Bool'+-- 'nullOf' :: 'Simple' 'Control.Lens.Traversal.Traversal' s a -> s -> 'Bool' -- @-nullOf :: Getting All a b c d -> a -> Bool+nullOf :: Getting All s t a b -> s -> Bool nullOf l = getAll . foldMapOf l (\_ -> All False) {-# INLINE nullOf #-} @@ -775,13 +786,13 @@ -- @'maximum' ≡ 'fromMaybe' ('error' "empty") '.' 'maximumOf' 'folded'@ -- -- @--- 'maximumOf' :: 'Getter' a c -> a -> 'Maybe' c--- 'maximumOf' :: 'Ord' c => 'Fold' a c -> a -> 'Maybe' c--- 'maximumOf' :: 'Simple' 'Control.Lens.Iso.Iso' a c -> a -> 'Maybe' c--- 'maximumOf' :: 'Simple' 'Lens' a c -> a -> 'Maybe' c--- 'maximumOf' :: 'Ord' c => 'Simple' 'Control.Lens.Traversal.Traversal' a c -> a -> 'Maybe' c+-- 'maximumOf' :: 'Getter' s a -> s -> 'Maybe' a+-- 'maximumOf' :: 'Ord' a => 'Fold' s a -> s -> 'Maybe' a+-- 'maximumOf' :: 'Simple' 'Control.Lens.Iso.Iso' s a -> s -> 'Maybe' a+-- 'maximumOf' :: 'Simple' 'Lens' s a -> s -> 'Maybe' a+-- 'maximumOf' :: 'Ord' a => 'Simple' 'Control.Lens.Traversal.Traversal' s a -> s -> 'Maybe' a -- @-maximumOf :: Getting (Max c) a b c d -> a -> Maybe c+maximumOf :: Getting (Max a) s t a b -> s -> Maybe a maximumOf l = getMax . foldMapOf l Max {-# INLINE maximumOf #-} @@ -793,13 +804,13 @@ -- @'minimum' ≡ 'Data.Maybe.fromMaybe' ('error' "empty") '.' 'minimumOf' 'folded'@ -- -- @--- 'minimumOf' :: 'Getter' a c -> a -> 'Maybe' c--- 'minimumOf' :: 'Ord' c => 'Fold' a c -> a -> 'Maybe' c--- 'minimumOf' :: 'Simple' 'Control.Lens.Iso.Iso' a c -> a -> 'Maybe' c--- 'minimumOf' :: 'Simple' 'Lens' a c -> a -> 'Maybe' c--- 'minimumOf' :: 'Ord' c => 'Simple' 'Control.Lens.Traversal.Traversal' a c -> a -> 'Maybe' c+-- 'minimumOf' :: 'Getter' s a -> s -> 'Maybe' a+-- 'minimumOf' :: 'Ord' a => 'Fold' s a -> s -> 'Maybe' a+-- 'minimumOf' :: 'Simple' 'Control.Lens.Iso.Iso' s a -> s -> 'Maybe' a+-- 'minimumOf' :: 'Simple' 'Lens' s a -> s -> 'Maybe' a+-- 'minimumOf' :: 'Ord' a => 'Simple' 'Control.Lens.Traversal.Traversal' s a -> s -> 'Maybe' a -- @-minimumOf :: Getting (Min c) a b c d -> a -> Maybe c+minimumOf :: Getting (Min a) s t a b -> s -> Maybe a minimumOf l = getMin . foldMapOf l Min {-# INLINE minimumOf #-} @@ -810,13 +821,13 @@ -- @'Data.Foldable.maximumBy' cmp ≡ 'Data.Maybe.fromMaybe' ('error' "empty") '.' 'maximumByOf' 'folded' cmp@ -- -- @--- 'maximumByOf' :: 'Getter' a c -> (c -> c -> 'Ordering') -> a -> 'Maybe' c--- 'maximumByOf' :: 'Fold' a c -> (c -> c -> 'Ordering') -> a -> 'Maybe' c--- 'maximumByOf' :: 'Simple' 'Control.Lens.Iso.Iso' a c -> (c -> c -> 'Ordering') -> a -> 'Maybe' c--- 'maximumByOf' :: 'Simple' 'Lens' a c -> (c -> c -> 'Ordering') -> a -> 'Maybe' c--- 'maximumByOf' :: 'Simple' 'Control.Lens.Traversal.Traversal' a c -> (c -> c -> 'Ordering') -> a -> 'Maybe' c+-- 'maximumByOf' :: 'Getter' s a -> (a -> a -> 'Ordering') -> s -> 'Maybe' a+-- 'maximumByOf' :: 'Fold' s a -> (a -> a -> 'Ordering') -> s -> 'Maybe' a+-- 'maximumByOf' :: 'Simple' 'Control.Lens.Iso.Iso' s a -> (a -> a -> 'Ordering') -> s -> 'Maybe' a+-- 'maximumByOf' :: 'Simple' 'Lens' s a -> (a -> a -> 'Ordering') -> s -> 'Maybe' a+-- 'maximumByOf' :: 'Simple' 'Control.Lens.Traversal.Traversal' s a -> (a -> a -> 'Ordering') -> s -> 'Maybe' a -- @-maximumByOf :: Getting (Endo (Maybe c)) a b c d -> (c -> c -> Ordering) -> a -> Maybe c+maximumByOf :: Getting (Endo (Maybe a)) s t a b -> (a -> a -> Ordering) -> s -> Maybe a maximumByOf l cmp = foldrOf l step Nothing where step a Nothing = Just a step a (Just b) = Just (if cmp a b == GT then a else b)@@ -829,13 +840,13 @@ -- @'minimumBy' cmp ≡ 'Data.Maybe.fromMaybe' ('error' "empty") '.' 'minimumByOf' 'folded' cmp@ -- -- @--- 'minimumByOf' :: 'Getter' a c -> (c -> c -> 'Ordering') -> a -> 'Maybe' c--- 'minimumByOf' :: 'Fold' a c -> (c -> c -> 'Ordering') -> a -> 'Maybe' c--- 'minimumByOf' :: 'Simple' 'Control.Lens.Iso.Iso' a c -> (c -> c -> 'Ordering') -> a -> 'Maybe' c--- 'minimumByOf' :: 'Simple' 'Lens' a c -> (c -> c -> 'Ordering') -> a -> 'Maybe' c--- 'minimumByOf' :: 'Simple' 'Control.Lens.Traversal.Traversal' a c -> (c -> c -> 'Ordering') -> a -> 'Maybe' c+-- 'minimumByOf' :: 'Getter' s a -> (a -> a -> 'Ordering') -> s -> 'Maybe' a+-- 'minimumByOf' :: 'Fold' s a -> (a -> a -> 'Ordering') -> s -> 'Maybe' a+-- 'minimumByOf' :: 'Simple' 'Control.Lens.Iso.Iso' s a -> (a -> a -> 'Ordering') -> s -> 'Maybe' a+-- 'minimumByOf' :: 'Simple' 'Lens' s a -> (a -> a -> 'Ordering') -> s -> 'Maybe' a+-- 'minimumByOf' :: 'Simple' 'Control.Lens.Traversal.Traversal' s a -> (a -> a -> 'Ordering') -> s -> 'Maybe' a -- @-minimumByOf :: Getting (Endo (Maybe c)) a b c d -> (c -> c -> Ordering) -> a -> Maybe c+minimumByOf :: Getting (Endo (Maybe a)) s t a b -> (a -> a -> Ordering) -> s -> Maybe a minimumByOf l cmp = foldrOf l step Nothing where step a Nothing = Just a step a (Just b) = Just (if cmp a b == GT then b else a)@@ -846,16 +857,16 @@ -- matching the predicate, or 'Nothing' if there is no such element. -- -- @--- 'findOf' :: 'Getter' a c -> (c -> 'Bool') -> a -> 'Maybe' c--- 'findOf' :: 'Fold' a c -> (c -> 'Bool') -> a -> 'Maybe' c--- 'findOf' :: 'Simple' 'Control.Lens.Iso.Iso' a c -> (c -> 'Bool') -> a -> 'Maybe' c--- 'findOf' :: 'Simple' 'Lens' a c -> (c -> 'Bool') -> a -> 'Maybe' c--- 'findOf' :: 'Simple' 'Control.Lens.Traversal.Traversal' a c -> (c -> 'Bool') -> a -> 'Maybe' c+-- 'findOf' :: 'Getter' s a -> (a -> 'Bool') -> s -> 'Maybe' a+-- 'findOf' :: 'Fold' s a -> (a -> 'Bool') -> s -> 'Maybe' a+-- 'findOf' :: 'Simple' 'Control.Lens.Iso.Iso' s a -> (a -> 'Bool') -> s -> 'Maybe' a+-- 'findOf' :: 'Simple' 'Lens' s a -> (a -> 'Bool') -> s -> 'Maybe' a+-- 'findOf' :: 'Simple' 'Control.Lens.Traversal.Traversal' s a -> (a -> 'Bool') -> s -> 'Maybe' a -- @-findOf :: Getting (First c) a b c d -> (c -> Bool) -> a -> Maybe c+findOf :: Getting (First a) s t a b -> (a -> Bool) -> s -> Maybe a findOf l p = getFirst . foldMapOf l step where- step c- | p c = First (Just c)+ step a+ | p a = First (Just a) | otherwise = First Nothing {-# INLINE findOf #-} @@ -870,13 +881,13 @@ -- @ -- -- @--- 'foldr1Of' :: 'Getter' a c -> (c -> c -> c) -> a -> c--- 'foldr1Of' :: 'Fold' a c -> (c -> c -> c) -> a -> c--- 'foldr1Of' :: 'Simple' 'Control.Lens.Iso.Iso' a c -> (c -> c -> c) -> a -> c--- 'foldr1Of' :: 'Simple' 'Lens' a c -> (c -> c -> c) -> a -> c--- 'foldr1Of' :: 'Simple' 'Control.Lens.Traversal.Traversal' a c -> (c -> c -> c) -> a -> c+-- 'foldr1Of' :: 'Getter' s a -> (a -> a -> a) -> s -> a+-- 'foldr1Of' :: 'Fold' s a -> (a -> a -> a) -> s -> a+-- 'foldr1Of' :: 'Simple' 'Control.Lens.Iso.Iso' s a -> (a -> a -> a) -> s -> a+-- 'foldr1Of' :: 'Simple' 'Lens' s a -> (a -> a -> a) -> s -> a+-- 'foldr1Of' :: 'Simple' 'Control.Lens.Traversal.Traversal' s a -> (a -> a -> a) -> s -> a -- @-foldr1Of :: Getting (Endo (Maybe c)) a b c d -> (c -> c -> c) -> a -> c+foldr1Of :: Getting (Endo (Maybe a)) s t a b -> (a -> a -> a) -> s -> a foldr1Of l f xs = fromMaybe (error "foldr1Of: empty structure") (foldrOf l mf Nothing xs) where mf x Nothing = Just x@@ -892,13 +903,13 @@ -- @ -- -- @--- 'foldl1Of' :: 'Getter' a c -> (c -> c -> c) -> a -> c--- 'foldl1Of' :: 'Fold' a c -> (c -> c -> c) -> a -> c--- 'foldl1Of' :: 'Simple' 'Control.Lens.Iso.Iso' a c -> (c -> c -> c) -> a -> c--- 'foldl1Of' :: 'Simple' 'Lens' a c -> (c -> c -> c) -> a -> c--- 'foldl1Of' :: 'Simple' 'Control.Lens.Traversal.Traversal' a c -> (c -> c -> c) -> a -> c+-- 'foldl1Of' :: 'Getter' s a -> (a -> a -> a) -> s -> a+-- 'foldl1Of' :: 'Fold' s a -> (a -> a -> a) -> s -> a+-- 'foldl1Of' :: 'Simple' 'Control.Lens.Iso.Iso' s a -> (a -> a -> a) -> s -> a+-- 'foldl1Of' :: 'Simple' 'Lens' s a -> (a -> a -> a) -> s -> a+-- 'foldl1Of' :: 'Simple' 'Control.Lens.Traversal.Traversal' s a -> (a -> a -> a) -> s -> a -- @-foldl1Of :: Getting (Dual (Endo (Maybe c))) a b c d -> (c -> c -> c) -> a -> c+foldl1Of :: Getting (Dual (Endo (Maybe a))) s t a b -> (a -> a -> a) -> s -> a foldl1Of l f xs = fromMaybe (error "foldl1Of: empty structure") (foldlOf l mf Nothing xs) where mf Nothing y = Just y mf (Just x) y = Just (f x y)@@ -909,13 +920,13 @@ -- @'Data.Foldable.foldr'' ≡ 'foldrOf'' 'folded'@ -- -- @--- 'foldrOf'' :: 'Getter' a c -> (c -> e -> e) -> e -> a -> e--- 'foldrOf'' :: 'Fold' a c -> (c -> e -> e) -> e -> a -> e--- 'foldrOf'' :: 'Simple' 'Control.Lens.Iso.Iso' a c -> (c -> e -> e) -> e -> a -> e--- 'foldrOf'' :: 'Simple' 'Lens' a c -> (c -> e -> e) -> e -> a -> e--- 'foldrOf'' :: 'Simple' 'Control.Lens.Traversal.Traversal' a c -> (c -> e -> e) -> e -> a -> e+-- 'foldrOf'' :: 'Getter' s a -> (a -> r -> r) -> r -> s -> r+-- 'foldrOf'' :: 'Fold' s a -> (a -> r -> r) -> r -> s -> r+-- 'foldrOf'' :: 'Simple' 'Control.Lens.Iso.Iso' s a -> (a -> r -> r) -> r -> s -> r+-- 'foldrOf'' :: 'Simple' 'Lens' s a -> (a -> r -> r) -> r -> s -> r+-- 'foldrOf'' :: 'Simple' 'Control.Lens.Traversal.Traversal' s a -> (a -> r -> r) -> r -> s -> r -- @-foldrOf' :: Getting (Dual (Endo (e -> e))) a b c d -> (c -> e -> e) -> e -> a -> e+foldrOf' :: Getting (Dual (Endo (r -> r))) s t a b -> (a -> r -> r) -> r -> s -> r foldrOf' l f z0 xs = foldlOf l f' id xs z0 where f' k x z = k $! f x z {-# INLINE foldrOf' #-}@@ -925,13 +936,13 @@ -- @'Data.Foldable.foldl'' ≡ 'foldlOf'' 'folded'@ -- -- @--- 'foldlOf'' :: 'Getter' a c -> (e -> c -> e) -> e -> a -> e--- 'foldlOf'' :: 'Fold' a c -> (e -> c -> e) -> e -> a -> e--- 'foldlOf'' :: 'Simple' 'Control.Lens.Iso.Iso' a c -> (e -> c -> e) -> e -> a -> e--- 'foldlOf'' :: 'Simple' 'Lens' a c -> (e -> c -> e) -> e -> a -> e--- 'foldlOf'' :: 'Simple' 'Control.Lens.Traversal.Traversal' a c -> (e -> c -> e) -> e -> a -> e+-- 'foldlOf'' :: 'Getter' s a -> (r -> a -> r) -> r -> s -> r+-- 'foldlOf'' :: 'Fold' s a -> (r -> a -> r) -> r -> s -> r+-- 'foldlOf'' :: 'Simple' 'Control.Lens.Iso.Iso' s a -> (r -> a -> r) -> r -> s -> r+-- 'foldlOf'' :: 'Simple' 'Lens' s a -> (r -> a -> r) -> r -> s -> r+-- 'foldlOf'' :: 'Simple' 'Control.Lens.Traversal.Traversal' s a -> (r -> a -> r) -> r -> s -> r -- @-foldlOf' :: Getting (Endo (e -> e)) a b c d -> (e -> c -> e) -> e -> a -> e+foldlOf' :: Getting (Endo (r -> r)) s t a b -> (r -> a -> r) -> r -> s -> r foldlOf' l f z0 xs = foldrOf l f' id xs z0 where f' x k z = k $! f z x {-# INLINE foldlOf' #-}@@ -942,15 +953,15 @@ -- @'Data.Foldable.foldrM' ≡ 'foldrMOf' 'folded'@ -- -- @--- 'foldrMOf' :: 'Monad' m => 'Getter' a c -> (c -> e -> m e) -> e -> a -> m e--- 'foldrMOf' :: 'Monad' m => 'Fold' a c -> (c -> e -> m e) -> e -> a -> m e--- 'foldrMOf' :: 'Monad' m => 'Simple' 'Control.Lens.Iso.Iso' a c -> (c -> e -> m e) -> e -> a -> m e--- 'foldrMOf' :: 'Monad' m => 'Simple' 'Lens' a c -> (c -> e -> m e) -> e -> a -> m e--- 'foldrMOf' :: 'Monad' m => 'Simple' 'Control.Lens.Traversal.Traversal' a c -> (c -> e -> m e) -> e -> a -> m e+-- 'foldrMOf' :: 'Monad' m => 'Getter' s a -> (a -> r -> m r) -> r -> s -> m r+-- 'foldrMOf' :: 'Monad' m => 'Fold' s a -> (a -> r -> m r) -> r -> s -> m r+-- 'foldrMOf' :: 'Monad' m => 'Simple' 'Control.Lens.Iso.Iso' s a -> (a -> r -> m r) -> r -> s -> m r+-- 'foldrMOf' :: 'Monad' m => 'Simple' 'Lens' s a -> (a -> r -> m r) -> r -> s -> m r+-- 'foldrMOf' :: 'Monad' m => 'Simple' 'Control.Lens.Traversal.Traversal' s a -> (a -> r -> m r) -> r -> s -> m r -- @ foldrMOf :: Monad m- => Getting (Dual (Endo (e -> m e))) a b c d- -> (c -> e -> m e) -> e -> a -> m e+ => Getting (Dual (Endo (r -> m r))) s t a b+ -> (a -> r -> m r) -> r -> s -> m r foldrMOf l f z0 xs = foldlOf l f' return xs z0 where f' k x z = f x z >>= k {-# INLINE foldrMOf #-}@@ -961,18 +972,18 @@ -- @'Data.Foldable.foldlM' ≡ 'foldlMOf' 'folded'@ -- -- @--- 'foldlMOf' :: 'Monad' m => 'Getter' a c -> (e -> c -> m e) -> e -> a -> m e--- 'foldlMOf' :: 'Monad' m => 'Fold' a c -> (e -> c -> m e) -> e -> a -> m e--- 'foldlMOf' :: 'Monad' m => 'Simple' 'Control.Lens.Iso.Iso' a c -> (e -> c -> m e) -> e -> a -> m e--- 'foldlMOf' :: 'Monad' m => 'Simple' 'Lens' a c -> (e -> c -> m e) -> e -> a -> m e--- 'foldlMOf' :: 'Monad' m => 'Simple' 'Control.Lens.Traversal.Traversal' a c -> (e -> c -> m e) -> e -> a -> m e+-- 'foldlMOf' :: 'Monad' m => 'Getter' s a -> (r -> a -> m r) -> r -> s -> m r+-- 'foldlMOf' :: 'Monad' m => 'Fold' s a -> (r -> a -> m r) -> r -> s -> m r+-- 'foldlMOf' :: 'Monad' m => 'Simple' 'Control.Lens.Iso.Iso' s a -> (r -> a -> m r) -> r -> s -> m r+-- 'foldlMOf' :: 'Monad' m => 'Simple' 'Lens' s a -> (r -> a -> m r) -> r -> s -> m r+-- 'foldlMOf' :: 'Monad' m => 'Simple' 'Control.Lens.Traversal.Traversal' s a -> (r -> a -> m r) -> r -> s -> m r -- @ foldlMOf :: Monad m- => Getting (Endo (e -> m e)) a b c d- -> (e -> c -> m e) -> e -> a -> m e+ => Getting (Endo (r -> m r)) s t a b+ -> (r -> a -> m r) -> r -> s -> m r foldlMOf l f z0 xs = foldrOf l f' return xs z0 where f' x k z = f z x >>= k {-# INLINE foldlMOf #-} -- | Useful for storing folds in containers.-newtype ReifiedFold a c = ReifyFold { reflectFold :: Fold a c }+newtype ReifiedFold s a = ReifyFold { reflectFold :: Fold s a }
src/Control/Lens/Getter.hs view
@@ -17,22 +17,22 @@ -- Portability : Rank2Types -- ----- A @'Getter' a c@ is just any function @(a -> c)@, which we've flipped--- into continuation passing style, @(c -> r) -> a -> r@ and decorated+-- A @'Getter' s a@ is just any function @(s -> a)@, which we've flipped+-- into continuation passing style, @(a -> r) -> s -> r@ and decorated -- with 'Accessor' to obtain: ----- @type 'Getting' r a b c d = (c -> 'Accessor' r d) -> a -> 'Accessor' r b@+-- @type 'Getting' r s t a b = (a -> 'Accessor' r b) -> s -> 'Accessor' r t@ -- -- If we restrict access to knowledge about the type 'r' and can work for--- any d and b, we could get:+-- any b and t, we could get: ----- @type 'Getter' a c = forall r. 'Getting' r a a c c@+-- @type 'Getter' s a = forall r. 'Getting' r s s a a@ -- -- But we actually hide the use of 'Accessor' behind a class 'Gettable' -- to error messages from type class resolution rather than at unification -- time, where they are much uglier. ----- @type 'Getter' a c = forall f. 'Gettable' f => (c -> f c) -> a -> f a@+-- @type 'Getter' s a = forall f. 'Gettable' f => (a -> f a) -> s -> f s@ -- -- Everything you can do with a function, you can do with a 'Getter', but -- note that because of the continuation passing style ('.') composes them@@ -111,11 +111,11 @@ -- -- Unlike a 'Control.Lens.Type.Lens' a 'Getter' is read-only. Since a 'Getter' -- 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)@.+-- it. In fact, it is isomorphic to an arbitrary function from @(a -> s)@. -- -- Moreover, a 'Getter' can be used directly as a 'Control.Lens.Fold.Fold', -- since it just ignores the 'Applicative'.-type Getter a c = forall f. Gettable f => (c -> f c) -> a -> f a+type Getter s a = forall f. Gettable f => (a -> f a) -> s -> f s -- | Build a 'Getter' from an arbitrary Haskell function. --@@ -132,7 +132,7 @@ -- -- >>> (0, -5)^._2.to abs -- 5-to :: (a -> c) -> Getter a c+to :: (s -> a) -> Getter s a to f g = coerce . g . f {-# INLINE to #-} @@ -142,14 +142,14 @@ -- 'Control.Lens.Fold.Fold' in limited situations, to do so, they need to be -- monomorphic in what we are going to extract with 'Const'. To be compatible -- with 'Control.Lens.Type.Lens', 'Control.Lens.Traversal.Traversal' and--- 'Control.Lens.Iso.Iso' we also restricted choices of the irrelevant @b@ and--- @d@ parameters.+-- 'Control.Lens.Iso.Iso' we also restricted choices of the irrelevant @t@ and+-- @b@ parameters. ----- If a function accepts a @'Getting' r a b c d@, then when @r@ is a 'Monoid', then+-- If a function accepts a @'Getting' r s t a b@, then when @r@ is a 'Monoid', then -- you can pass a 'Control.Lens.Fold.Fold' (or -- 'Control.Lens.Traversal.Traversal'), otherwise you can only pass this a -- 'Getter' or 'Control.Lens.Type.Lens'.-type Getting r a b c d = (c -> Accessor r d) -> a -> Accessor r b+type Getting r s t a b = (a -> Accessor r b) -> s -> Accessor r t ------------------------------------------------------------------------------- -- Getting Values@@ -176,13 +176,13 @@ -- signatures: -- -- @--- 'view' :: 'Getter' a c -> a -> c--- 'view' :: 'Monoid' m => 'Control.Lens.Fold.Fold' a m -> a -> m--- 'view' :: 'Control.Lens.Type.Simple' 'Control.Lens.Iso.Iso' a c -> a -> c--- 'view' :: 'Control.Lens.Type.Simple' 'Control.Lens.Type.Lens' a c -> a -> c--- 'view' :: 'Monoid' m => 'Control.Lens.Type.Simple' 'Control.Lens.Traversal.Traversal' a m -> a -> m+-- 'view' :: 'Getter' s a -> s -> a+-- 'view' :: 'Monoid' m => 'Control.Lens.Fold.Fold' s m -> s -> m+-- 'view' :: 'Control.Lens.Type.Simple' 'Control.Lens.Iso.Iso' s a -> s -> a+-- 'view' :: 'Control.Lens.Type.Simple' 'Control.Lens.Type.Lens' s a -> s -> a+-- 'view' :: 'Monoid' m => 'Control.Lens.Type.Simple' 'Control.Lens.Traversal.Traversal' s m -> s -> m -- @-view :: Getting c a b c d -> a -> c+view :: Getting a s t a b -> s -> a view l = runAccessor . l Accessor {-# INLINE view #-} @@ -200,13 +200,13 @@ -- 5 -- -- @--- 'views' :: 'Getter' a c -> (c -> d) -> a -> d--- 'views' :: 'Monoid' m => 'Control.Lens.Fold.Fold' a c -> (c -> m) -> a -> m--- 'views' :: 'Control.Lens.Type.Simple' 'Control.Lens.Iso.Iso' a c -> (c -> d) -> a -> d--- 'views' :: 'Control.Lens.Type.Simple' 'Control.Lens.Type.Lens' a c -> (c -> d) -> a -> d--- 'views' :: 'Monoid' m => 'Control.Lens.Type.Simple' 'Control.Lens.Traversal.Traversal' a c -> (c -> m) -> a -> m+-- 'views' :: 'Getter' s a -> (a -> b) -> s -> b+-- 'views' :: 'Monoid' m => 'Control.Lens.Fold.Fold' s a -> (a -> m) -> s -> m+-- 'views' :: 'Control.Lens.Type.Simple' 'Control.Lens.Iso.Iso' s a -> (a -> b) -> s -> b+-- 'views' :: 'Control.Lens.Type.Simple' 'Control.Lens.Type.Lens' s a -> (a -> b) -> s -> b+-- 'views' :: 'Monoid' m => 'Control.Lens.Type.Simple' 'Control.Lens.Traversal.Traversal' s a -> (a -> m) -> s -> m -- @-views :: Getting m a b c d -> (c -> m) -> a -> m+views :: Getting m s t a b -> (a -> m) -> s -> m views l f = runAccessor . l (Accessor . f) {-# INLINE views #-} @@ -223,14 +223,14 @@ -- "hello" -- -- @--- ('^$') :: 'Getter' a c -> a -> c--- ('^$') :: 'Monoid' m => 'Control.Lens.Fold.Fold' a m -> a -> m--- ('^$') :: 'Control.Lens.Type.Simple' 'Control.Lens.Iso.Iso' a c -> a -> c--- ('^$') :: 'Control.Lens.Type.Simple' 'Control.Lens.Type.Lens' a c -> a -> c--- ('^$') :: 'Monoid' m => 'Control.Lens.Type.Simple' 'Control.Lens.Traversal.Traversal' a m -> a -> m+-- ('^$') :: 'Getter' s a -> s -> a+-- ('^$') :: 'Monoid' m => 'Control.Lens.Fold.Fold' s m -> s -> m+-- ('^$') :: 'Control.Lens.Type.Simple' 'Control.Lens.Iso.Iso' s a -> s -> a+-- ('^$') :: 'Control.Lens.Type.Simple' 'Control.Lens.Type.Lens' s a -> s -> a+-- ('^$') :: 'Monoid' m => 'Control.Lens.Type.Simple' 'Control.Lens.Traversal.Traversal' s m -> s -> m -- @-(^$) :: Getting c a b c d -> a -> c-l ^$ a = runAccessor (l Accessor a)+(^$) :: Getting a s t a b -> s -> a+l ^$ s = runAccessor (l Accessor s) {-# INLINE (^$) #-} -- | View the value pointed to by a 'Getter' or 'Control.Lens.Type.Lens' or the@@ -250,14 +250,14 @@ -- 2.23606797749979 -- -- @--- ('^.') :: a -> 'Getter' a c -> c--- ('^.') :: 'Monoid' m => a -> 'Control.Lens.Fold.Fold' a m -> m--- ('^.') :: a -> 'Control.Lens.Type.Simple' 'Control.Lens.Iso.Iso' a c -> c--- ('^.') :: a -> 'Control.Lens.Type.Simple' 'Control.Lens.Type.Lens' a c -> c--- ('^.') :: 'Monoid' m => a -> 'Control.Lens.Type.Simple' 'Control.Lens.Traversal.Traversal' a m -> m+-- ('^.') :: s -> 'Getter' s a -> a+-- ('^.') :: 'Monoid' m => s -> 'Control.Lens.Fold.Fold' s m -> m+-- ('^.') :: s -> 'Control.Lens.Type.Simple' 'Control.Lens.Iso.Iso' s a -> a+-- ('^.') :: s -> 'Control.Lens.Type.Simple' 'Control.Lens.Type.Lens' s a -> a+-- ('^.') :: 'Monoid' m => s -> 'Control.Lens.Type.Simple' 'Control.Lens.Traversal.Traversal' s m -> m -- @-(^.) :: a -> Getting c a b c d -> c-a ^. l = runAccessor (l Accessor a)+(^.) :: s -> Getting a s t a b -> a+s ^. l = runAccessor (l Accessor s) {-# INLINE (^.) #-} -------------------------------------------------------------------------------@@ -271,13 +271,13 @@ -- to a monoidal value. -- -- @--- 'use' :: 'MonadState' a m => 'Getter' a c -> m c--- 'use' :: ('MonadState' a m, 'Monoid' r) => 'Control.Lens.Fold.Fold' a r -> m r--- 'use' :: 'MonadState' a m => 'Control.Lens.Type.Simple' 'Control.Lens.Iso.Iso' a c -> m c--- 'use' :: 'MonadState' a m => 'Control.Lens.Type.Simple' 'Control.Lens.Type.Lens' a c -> m c--- 'use' :: ('MonadState' a m, 'Monoid' r) => 'Control.Lens.Type.Simple' 'Control.Lens.Traversal.Traversal' a r -> m r+-- 'use' :: 'MonadState' s m => 'Getter' s a -> m a+-- 'use' :: ('MonadState' s m, 'Monoid' r) => 'Control.Lens.Fold.Fold' s r -> m r+-- 'use' :: 'MonadState' s m => 'Control.Lens.Type.Simple' 'Control.Lens.Iso.Iso' s a -> m a+-- 'use' :: 'MonadState' s m => 'Control.Lens.Type.Simple' 'Control.Lens.Type.Lens' s a -> m a+-- 'use' :: ('MonadState' s m, 'Monoid' r) => 'Control.Lens.Type.Simple' 'Control.Lens.Traversal.Traversal' s r -> m r -- @-use :: MonadState a m => Getting c a b c d -> m c+use :: MonadState s m => Getting a s t a b -> m a use l = State.gets (view l) {-# INLINE use #-} @@ -288,13 +288,13 @@ -- points to a monoidal value. -- -- @--- 'uses' :: 'MonadState' a m => 'Getter' a c -> (c -> e) -> m e--- 'uses' :: ('MonadState' a m, 'Monoid' r) => 'Control.Lens.Fold.Fold' a c -> (c -> r) -> m r--- 'uses' :: 'MonadState' a m => 'Control.Lens.Type.Simple' 'Control.Lens.Type.Lens' a c -> (c -> e) -> m e--- 'uses' :: 'MonadState' a m => 'Control.Lens.Type.Simple' 'Control.Lens.Iso.Iso' a c -> (c -> e) -> m e--- 'uses' :: ('MonadState' a m, 'Monoid' r) => 'Control.Lens.Type.Simple' 'Control.Lens.Traversal.Traversal' a c -> (c -> r) -> m r+-- 'uses' :: 'MonadState' s m => 'Getter' s a -> (a -> e) -> m e+-- 'uses' :: ('MonadState' s m, 'Monoid' r) => 'Control.Lens.Fold.Fold' s a -> (a -> r) -> m r+-- 'uses' :: 'MonadState' s m => 'Control.Lens.Type.Simple' 'Control.Lens.Type.Lens' s a -> (a -> e) -> m e+-- 'uses' :: 'MonadState' s m => 'Control.Lens.Type.Simple' 'Control.Lens.Iso.Iso' s a -> (a -> e) -> m e+-- 'uses' :: ('MonadState' s m, 'Monoid' r) => 'Control.Lens.Type.Simple' 'Control.Lens.Traversal.Traversal' s a -> (a -> r) -> m r -- @-uses :: MonadState a m => Getting e a b c d -> (c -> e) -> m e+uses :: MonadState s m => Getting e s t a b -> (a -> e) -> m e uses l f = State.gets (views l f) {-# INLINE uses #-} @@ -309,13 +309,13 @@ -- to a monoidal value. -- -- @--- 'query' :: 'MonadReader' a m => 'Getter' a c -> m c--- 'query' :: ('MonadReader' a m, 'Monoid' c) => 'Control.Lens.Fold.Fold' a c -> m c--- 'query' :: 'MonadReader' a m => 'Control.Lens.Type.Simple' 'Control.Lens.Iso.Iso' a c -> m c--- 'query' :: 'MonadReader' a m => 'Control.Lens.Type.Simple' 'Control.Lens.Type.Lens' a c -> m c--- 'query' :: ('MonadReader' a m, 'Monoid' c) => 'Control.Lens.Type.Simple' 'Control.Lens.Traversal.Traversal' a c -> m c+-- 'query' :: 'MonadReader' s m => 'Getter' s a -> m a+-- 'query' :: ('MonadReader' s m, 'Monoid' a) => 'Control.Lens.Fold.Fold' s a -> m a+-- 'query' :: 'MonadReader' s m => 'Control.Lens.Type.Simple' 'Control.Lens.Iso.Iso' s a -> m a+-- 'query' :: 'MonadReader' s m => 'Control.Lens.Type.Simple' 'Control.Lens.Type.Lens' s a -> m a+-- 'query' :: ('MonadReader' s m, 'Monoid' a) => 'Control.Lens.Type.Simple' 'Control.Lens.Traversal.Traversal' s a -> m a -- @-query :: MonadReader a m => Getting c a b c d -> m c+query :: MonadReader s m => Getting a s t a b -> m a query l = Reader.asks (^.l) {-# INLINE query #-} @@ -326,15 +326,15 @@ -- to a monoidal value. -- -- @--- 'queries' :: 'MonadReader' a m => 'Getter' a c -> (c -> e) -> m e--- 'queries' :: ('MonadReader' a m, 'Monoid' c) => 'Control.Lens.Fold.Fold' a c -> (c -> e) -> m e--- 'queries' :: 'MonadReader' a m => 'Control.Lens.Type.Simple' 'Control.Lens.Iso.Iso' a c -> (c -> e) -> m e--- 'queries' :: 'MonadReader' a m => 'Control.Lens.Type.Simple' 'Control.Lens.Type.Lens' a c -> (c -> e) -> m e--- 'queries' :: ('MonadReader' a m, 'Monoid' c) => 'Control.Lens.Type.Simple' 'Control.Lens.Traversal.Traversal' a c -> (c -> e) -> m e+-- 'queries' :: 'MonadReader' s m => 'Getter' s a -> (a -> r) -> m r+-- 'queries' :: ('MonadReader' s m, 'Monoid' a) => 'Control.Lens.Fold.Fold' s a -> (a -> r) -> m r+-- 'queries' :: 'MonadReader' s m => 'Control.Lens.Type.Simple' 'Control.Lens.Iso.Iso' s a -> (a -> r) -> m r+-- 'queries' :: 'MonadReader' s m => 'Control.Lens.Type.Simple' 'Control.Lens.Type.Lens' s a -> (a -> r) -> m r+-- 'queries' :: ('MonadReader' s m, 'Monoid' a) => 'Control.Lens.Type.Simple' 'Control.Lens.Traversal.Traversal' s a -> (a -> r) -> m r -- @-queries :: MonadReader a m => Getting e a b c d -> (c -> e) -> m e+queries :: MonadReader s m => Getting r s t a b -> (a -> r) -> m r queries l f = Reader.asks (views l f) {-# INLINE queries #-} -- | Useful for storing getters in containers.-newtype ReifiedGetter a c = ReifyGetter { reflectGetter :: Getter a c }+newtype ReifiedGetter s a = ReifyGetter { reflectGetter :: Getter s a }
src/Control/Lens/Indexed.hs view
@@ -89,13 +89,13 @@ -- | Transform an Traversal into an IndexedTraversal, a Fold into an IndexedFold, etc. -- -- @--- 'indexed' :: 'Control.Lens.Traversal.Traversal' a b c d -> 'Control.Lens.IndexedTraversal.IndexedTraversal' 'Int' a b c d--- 'indexed' :: 'Control.Lens.Type.Lens' a b c d -> 'Control.Lens.IndexedLens.IndexedLens' 'Int' a b c d--- 'indexed' :: 'Control.Lens.Fold.Fold' a b -> 'Control.Lens.IndexedFold.IndexedFold' 'Int' a b--- 'indexed' :: 'Control.Lens.Iso.Iso' a b c d -> 'Control.Lens.IndexedLens.IndexedLens' 'Int' a b c d--- 'indexed' :: 'Control.Lens.Getter.Getter' a b -> 'Control.Lens.IndexedGetter.IndexedGetter' 'Int' a b c d+-- 'indexed' :: 'Control.Lens.Traversal.Traversal' s t a b -> 'Control.Lens.IndexedTraversal.IndexedTraversal' 'Int' s t a b+-- 'indexed' :: 'Control.Lens.Type.Lens' s t a b -> 'Control.Lens.IndexedLens.IndexedLens' 'Int' s t a b+-- 'indexed' :: 'Control.Lens.Fold.Fold' s t -> 'Control.Lens.IndexedFold.IndexedFold' 'Int' s t+-- 'indexed' :: 'Control.Lens.Iso.Iso' s t a b -> 'Control.Lens.IndexedLens.IndexedLens' 'Int' s t a b+-- 'indexed' :: 'Control.Lens.Getter.Getter' s t -> 'Control.Lens.IndexedGetter.IndexedGetter' 'Int' s t a b -- @-indexed :: Indexed Int k => ((c -> Indexing f d) -> a -> Indexing f b) -> k (c -> f d) (a -> f b)-indexed l = index $ \icfd a -> case runIndexing (l (\c -> Indexing (\i -> IndexingResult (icfd i c) (i + 1))) a) 0 of+indexed :: Indexed Int k => ((a -> Indexing f b) -> s -> Indexing f t) -> k (a -> f b) (s -> f t)+indexed l = index $ \iafb s -> case runIndexing (l (\a -> Indexing (\i -> IndexingResult (iafb i a) (i + 1))) s) 0 of IndexingResult r _ -> r {-# INLINE indexed #-}
src/Control/Lens/IndexedFold.hs view
@@ -41,7 +41,7 @@ , indicesOf -- * Building Indexed Folds- , ifiltered+ , ifiltering , ibackwards , itakingWhile , idroppingWhile@@ -64,7 +64,7 @@ ------------------------------------------------------------------------------ -- | Every 'IndexedFold' is a valid 'Control.Lens.Fold.Fold'.-type IndexedFold i a c = forall k f. (Indexed i k, Applicative f, Gettable f) => k (c -> f c) (a -> f a)+type IndexedFold i s a = forall k f. (Indexed i k, Applicative f, Gettable f) => k (a -> f a) (s -> f s) -- | -- Fold an 'IndexedFold' or 'Control.Lens.IndexedTraversal.IndexedTraversal' by mapping indices and values to an arbitrary 'Monoid' with access@@ -75,12 +75,12 @@ -- @'Control.Lens.Fold.foldMapOf' l ≡ 'ifoldMapOf' l '.' 'const'@ -- -- @--- 'ifoldMapOf' :: 'IndexedGetter' i a c -> (i -> c -> m) -> a -> m--- 'ifoldMapOf' :: 'Monoid' m => 'IndexedFold' i a c -> (i -> c -> m) -> a -> m--- 'ifoldMapOf' :: 'Control.Lens.IndexedLens.SimpleIndexedLens' i a c -> (i -> c -> m) -> a -> m--- 'ifoldMapOf' :: 'Monoid' m => 'Control.Lens.IndexedTraversal.SimpleIndexedTraversal' i a c -> (i -> c -> m) -> a -> m+-- 'ifoldMapOf' :: 'IndexedGetter' i a s -> (i -> s -> m) -> a -> m+-- 'ifoldMapOf' :: 'Monoid' m => 'IndexedFold' i a s -> (i -> s -> m) -> a -> m+-- 'ifoldMapOf' :: 'Control.Lens.IndexedLens.SimpleIndexedLens' i a s -> (i -> s -> m) -> a -> m+-- 'ifoldMapOf' :: 'Monoid' m => 'Control.Lens.IndexedTraversal.SimpleIndexedTraversal' i a s -> (i -> s -> m) -> a -> m -- @-ifoldMapOf :: IndexedGetting i m a b c d -> (i -> c -> m) -> a -> m+ifoldMapOf :: IndexedGetting i m s t a b -> (i -> a -> m) -> s -> m ifoldMapOf l f = runAccessor . withIndex l (\i -> Accessor . f i) {-# INLINE ifoldMapOf #-} @@ -93,12 +93,12 @@ -- @'Control.Lens.Fold.foldrOf' l ≡ 'ifoldrOf' l '.' 'const'@ -- -- @--- 'ifoldrOf' :: 'IndexedGetter' i a c -> (i -> c -> e -> e) -> e -> a -> e--- 'ifoldrOf' :: 'IndexedFold' i a c -> (i -> c -> e -> e) -> e -> a -> e--- 'ifoldrOf' :: 'Control.Lens.IndexedLens.SimpleIndexedLens' i a c -> (i -> c -> e -> e) -> e -> a -> e--- 'ifoldrOf' :: 'Control.Lens.IndexedTraversal.SimpleIndexedTraversal' i a c -> (i -> c -> e -> e) -> e -> a -> e+-- 'ifoldrOf' :: 'IndexedGetter' i s a -> (i -> a -> r -> r) -> r -> s -> r+-- 'ifoldrOf' :: 'IndexedFold' i s a -> (i -> a -> r -> r) -> r -> s -> r+-- 'ifoldrOf' :: 'Control.Lens.IndexedLens.SimpleIndexedLens' i s a -> (i -> a -> r -> r) -> r -> s -> r+-- 'ifoldrOf' :: 'Control.Lens.IndexedTraversal.SimpleIndexedTraversal' i s a -> (i -> a -> r -> r) -> r -> s -> r -- @-ifoldrOf :: IndexedGetting i (Endo e) a b c d -> (i -> c -> e -> e) -> e -> a -> e+ifoldrOf :: IndexedGetting i (Endo r) s t a b -> (i -> a -> r -> r) -> r -> s -> r ifoldrOf l f z t = appEndo (ifoldMapOf l (\i -> Endo . f i) t) z {-# INLINE ifoldrOf #-} @@ -111,12 +111,12 @@ -- @'Control.Lens.Fold.foldlOf' l ≡ 'ifoldlOf' l '.' 'const'@ -- -- @--- 'ifoldlOf' :: 'IndexedGetter' i a c -> (i -> e -> c -> e) -> e -> a -> e--- 'ifoldlOf' :: 'IndexedFold' i a c -> (i -> e -> c -> e) -> e -> a -> e--- 'ifoldlOf' :: 'Control.Lens.IndexedLens.SimpleIndexedLens' i a c -> (i -> e -> c -> e) -> e -> a -> e--- 'ifoldlOf' :: 'Control.Lens.IndexedTraversal.SimpleIndexedTraversal' i a c -> (i -> e -> c -> e) -> e -> a -> e+-- 'ifoldlOf' :: 'IndexedGetter' i s a -> (i -> r -> a -> r) -> r -> s -> r+-- 'ifoldlOf' :: 'IndexedFold' i s a -> (i -> r -> a -> r) -> r -> s -> r+-- 'ifoldlOf' :: 'Control.Lens.IndexedLens.SimpleIndexedLens' i s a -> (i -> r -> a -> r) -> r -> s -> r+-- 'ifoldlOf' :: 'Control.Lens.IndexedTraversal.SimpleIndexedTraversal' i s a -> (i -> r -> a -> r) -> r -> s -> r -- @-ifoldlOf :: IndexedGetting i (Dual (Endo e)) a b c d -> (i -> e -> c -> e) -> e -> a -> e+ifoldlOf :: IndexedGetting i (Dual (Endo r)) s t a b -> (i -> r -> a -> r) -> r -> s -> r ifoldlOf l f z t = appEndo (getDual (ifoldMapOf l (\i -> Dual . Endo . flip (f i)) t)) z {-# INLINE ifoldlOf #-} @@ -129,12 +129,12 @@ -- @'Control.Lens.Fold.anyOf' l ≡ 'ianyOf' l '.' 'const'@ -- -- @--- 'ianyOf' :: 'IndexedGetter' i a c -> (i -> c -> 'Bool') -> a -> 'Bool'--- 'ianyOf' :: 'IndexedFold' i a c -> (i -> c -> 'Bool') -> a -> 'Bool'--- 'ianyOf' :: 'Control.Lens.IndexedLens.SimpleIndexedLens' i a c -> (i -> c -> 'Bool') -> a -> 'Bool'--- 'ianyOf' :: 'Control.Lens.IndexedTraversal.SimpleIndexedTraversal' i a c -> (i -> c -> 'Bool') -> a -> 'Bool'+-- 'ianyOf' :: 'IndexedGetter' i s a -> (i -> a -> 'Bool') -> s -> 'Bool'+-- 'ianyOf' :: 'IndexedFold' i s a -> (i -> a -> 'Bool') -> s -> 'Bool'+-- 'ianyOf' :: 'Control.Lens.IndexedLens.SimpleIndexedLens' i s a -> (i -> a -> 'Bool') -> s -> 'Bool'+-- 'ianyOf' :: 'Control.Lens.IndexedTraversal.SimpleIndexedTraversal' i s a -> (i -> a -> 'Bool') -> s -> 'Bool' -- @-ianyOf :: IndexedGetting i Any a b c d -> (i -> c -> Bool) -> a -> Bool+ianyOf :: IndexedGetting i Any s t a b -> (i -> a -> Bool) -> s -> Bool ianyOf l f = getAny . ifoldMapOf l (\i -> Any . f i) {-# INLINE ianyOf #-} @@ -147,12 +147,12 @@ -- @'Control.Lens.Fold.allOf' l ≡ 'iallOf' l '.' 'const'@ -- -- @--- 'iallOf' :: 'IndexedGetter' i a c -> (i -> c -> 'Bool') -> a -> 'Bool'--- 'iallOf' :: 'IndexedFold' i a c -> (i -> c -> 'Bool') -> a -> 'Bool'--- 'iallOf' :: 'Control.Lens.IndexedLens.SimpleIndexedLens' i a c -> (i -> c -> 'Bool') -> a -> 'Bool'--- 'iallOf' :: 'Control.Lens.IndexedTraversal.SimpleIndexedTraversal' i a c -> (i -> c -> 'Bool') -> a -> 'Bool'+-- 'iallOf' :: 'IndexedGetter' i s a -> (i -> a -> 'Bool') -> s -> 'Bool'+-- 'iallOf' :: 'IndexedFold' i s a -> (i -> a -> 'Bool') -> s -> 'Bool'+-- 'iallOf' :: 'Control.Lens.IndexedLens.SimpleIndexedLens' i s a -> (i -> a -> 'Bool') -> s -> 'Bool'+-- 'iallOf' :: 'Control.Lens.IndexedTraversal.SimpleIndexedTraversal' i s a -> (i -> a -> 'Bool') -> s -> 'Bool' -- @-iallOf :: IndexedGetting i All a b c d -> (i -> c -> Bool) -> a -> Bool+iallOf :: IndexedGetting i All s t a b -> (i -> a -> Bool) -> s -> Bool iallOf l f = getAll . ifoldMapOf l (\i -> All . f i) {-# INLINE iallOf #-} @@ -164,12 +164,12 @@ -- @'Control.Lens.Fold.traverseOf_' l ≡ 'itraverseOf' l '.' 'const'@ -- -- @--- 'itraverseOf_' :: 'Functor' f => 'IndexedGetter' i a c -> (i -> c -> f e) -> a -> f ()--- 'itraverseOf_' :: 'Applicative' f => 'IndexedFold' i a c -> (i -> c -> f e) -> a -> f ()--- 'itraverseOf_' :: 'Functor' f => 'Control.Lens.IndexedLens.SimpleIndexedLens' i a c -> (i -> c -> f e) -> a -> f ()--- 'itraverseOf_' :: 'Applicative' f => 'Control.Lens.IndexedTraversal.SimpleIndexedTraversal' i a c -> (i -> c -> f e) -> a -> f ()+-- 'itraverseOf_' :: 'Functor' f => 'IndexedGetter' i s a -> (i -> a -> f r) -> s -> f ()+-- 'itraverseOf_' :: 'Applicative' f => 'IndexedFold' i s a -> (i -> a -> f r) -> s -> f ()+-- 'itraverseOf_' :: 'Functor' f => 'Control.Lens.IndexedLens.SimpleIndexedLens' i s a -> (i -> a -> f r) -> s -> f ()+-- 'itraverseOf_' :: 'Applicative' f => 'Control.Lens.IndexedTraversal.SimpleIndexedTraversal' i s a -> (i -> a -> f r) -> s -> f () -- @-itraverseOf_ :: Functor f => IndexedGetting i (Traversed f) a b c d -> (i -> c -> f e) -> a -> f ()+itraverseOf_ :: Functor f => IndexedGetting i (Traversed f) s t a b -> (i -> a -> f r) -> s -> f () itraverseOf_ l f = getTraversed . ifoldMapOf l (\i -> Traversed . void . f i) {-# INLINE itraverseOf_ #-} @@ -184,12 +184,12 @@ -- @'Control.Lens.Fold.forOf_' l a ≡ 'iforOf_' l a '.' 'const'@ -- -- @--- 'iforOf_' :: 'Functor' f => 'IndexedGetter' i a c -> a -> (i -> c -> f e) -> f ()--- 'iforOf_' :: 'Applicative' f => 'IndexedFold' i a c -> a -> (i -> c -> f e) -> f ()--- 'iforOf_' :: 'Functor' f => 'Control.Lens.IndexedLens.SimpleIndexedLens' i a c -> a -> (i -> c -> f e) -> f ()--- 'iforOf_' :: 'Applicative' f => 'Control.Lens.IndexedTraversal.SimpleIndexedTraversal' i a c -> a -> (i -> c -> f e) -> f ()+-- 'iforOf_' :: 'Functor' f => 'IndexedGetter' i s a -> s -> (i -> a -> f r) -> f ()+-- 'iforOf_' :: 'Applicative' f => 'IndexedFold' i s a -> s -> (i -> a -> f r) -> f ()+-- 'iforOf_' :: 'Functor' f => 'Control.Lens.IndexedLens.SimpleIndexedLens' i s a -> s -> (i -> a -> f r) -> f ()+-- 'iforOf_' :: 'Applicative' f => 'Control.Lens.IndexedTraversal.SimpleIndexedTraversal' i s a -> s -> (i -> a -> f r) -> f () -- @-iforOf_ :: Functor f => IndexedGetting i (Traversed f) a b c d -> a -> (i -> c -> f e) -> f ()+iforOf_ :: Functor f => IndexedGetting i (Traversed f) s t a b -> s -> (i -> a -> f r) -> f () iforOf_ = flip . itraverseOf_ {-# INLINE iforOf_ #-} @@ -202,12 +202,12 @@ -- @'Control.Lens.Fold.mapMOf_' l ≡ 'imapMOf' l '.' 'const'@ -- -- @--- 'imapMOf_' :: 'Monad' m => 'IndexedGetter' i a c -> (i -> c -> m e) -> a -> m ()--- 'imapMOf_' :: 'Monad' m => 'IndexedFold' i a c -> (i -> c -> m e) -> a -> m ()--- 'imapMOf_' :: 'Monad' m => 'Control.Lens.IndexedLens.SimpleIndexedLens' i a c -> (i -> c -> m e) -> a -> m ()--- 'imapMOf_' :: 'Monad' m => 'Control.Lens.IndexedTraversal.SimpleIndexedTraversal' i a c -> (i -> c -> m e) -> a -> m ()+-- 'imapMOf_' :: 'Monad' m => 'IndexedGetter' i s a -> (i -> a -> m r) -> s -> m ()+-- 'imapMOf_' :: 'Monad' m => 'IndexedFold' i s a -> (i -> a -> m r) -> s -> m ()+-- 'imapMOf_' :: 'Monad' m => 'Control.Lens.IndexedLens.SimpleIndexedLens' i s a -> (i -> a -> m r) -> s -> m ()+-- 'imapMOf_' :: 'Monad' m => 'Control.Lens.IndexedTraversal.SimpleIndexedTraversal' i s a -> (i -> a -> m r) -> s -> m () -- @-imapMOf_ :: Monad m => IndexedGetting i (Sequenced m) a b c d -> (i -> c -> m e) -> a -> m ()+imapMOf_ :: Monad m => IndexedGetting i (Sequenced m) s t a b -> (i -> a -> m r) -> s -> m () imapMOf_ l f = getSequenced . ifoldMapOf l (\i -> Sequenced . liftM skip . f i) {-# INLINE imapMOf_ #-} @@ -226,12 +226,12 @@ -- @'Control.Lens.Fold.forMOf_' l a ≡ 'iforMOf' l a '.' 'const'@ -- -- @--- 'iforMOf_' :: 'Monad' m => 'IndexedGetter' i a c -> a -> (i -> c -> m e) -> m ()--- 'iforMOf_' :: 'Monad' m => 'IndexedFold' i a c -> a -> (i -> c -> m e) -> m ()--- 'iforMOf_' :: 'Monad' m => 'Control.Lens.IndexedLens.SimpleIndexedLens' i a c -> a -> (i -> c -> m e) -> m ()--- 'iforMOf_' :: 'Monad' m => 'Control.Lens.IndexedTraversal.SimpleIndexedTraversal' i a c -> a -> (i -> c -> m e) -> m ()+-- 'iforMOf_' :: 'Monad' m => 'IndexedGetter' i s a -> s -> (i -> a -> m r) -> m ()+-- 'iforMOf_' :: 'Monad' m => 'IndexedFold' i s a -> s -> (i -> a -> m r) -> m ()+-- 'iforMOf_' :: 'Monad' m => 'Control.Lens.IndexedLens.SimpleIndexedLens' i s a -> s -> (i -> a -> m r) -> m ()+-- 'iforMOf_' :: 'Monad' m => 'Control.Lens.IndexedTraversal.SimpleIndexedTraversal' i s a -> s -> (i -> a -> m r) -> m () -- @-iforMOf_ :: Monad m => IndexedGetting i (Sequenced m) a b c d -> a -> (i -> c -> m e) -> m ()+iforMOf_ :: Monad m => IndexedGetting i (Sequenced m) s t a b -> s -> (i -> a -> m r) -> m () iforMOf_ = flip . imapMOf_ {-# INLINE iforMOf_ #-} @@ -247,12 +247,12 @@ -- @ -- -- @--- 'iconcatMapOf' :: 'IndexedGetter' i a c -> (i -> c -> [e]) -> a -> [e]--- 'iconcatMapOf' :: 'IndexedFold' i a c -> (i -> c -> [e]) -> a -> [e]--- 'iconcatMapOf' :: 'Control.Lens.IndexedLens.SimpleIndexedLens' i a c -> (i -> c -> [e]) -> a -> [e]--- 'iconcatMapOf' :: 'Control.Lens.IndexedTraversal.SimpleIndexedTraversal' i a c -> (i -> c -> [e]) -> a -> [e]+-- 'iconcatMapOf' :: 'IndexedGetter' i s a -> (i -> a -> [r]) -> s -> [r]+-- 'iconcatMapOf' :: 'IndexedFold' i s a -> (i -> a -> [r]) -> s -> [r]+-- 'iconcatMapOf' :: 'Control.Lens.IndexedLens.SimpleIndexedLens' i s a -> (i -> a -> [r]) -> s -> [r]+-- 'iconcatMapOf' :: 'Control.Lens.IndexedTraversal.SimpleIndexedTraversal' i s a -> (i -> a -> [r]) -> s -> [r] -- @-iconcatMapOf :: IndexedGetting i [e] a b c d -> (i -> c -> [e]) -> a -> [e]+iconcatMapOf :: IndexedGetting i [r] s t a b -> (i -> a -> [r]) -> s -> [r] iconcatMapOf = ifoldMapOf {-# INLINE iconcatMapOf #-} @@ -265,15 +265,15 @@ -- @'Control.Lens.Fold.findOf' l ≡ 'ifindOf' l '.' 'const'@ -- -- @--- 'ifindOf' :: 'IndexedGetter' a c -> (i -> c -> 'Bool') -> a -> 'Maybe' (i, c)--- 'ifindOf' :: 'IndexedFold' a c -> (i -> c -> 'Bool') -> a -> 'Maybe' (i, c)--- 'ifindOf' :: 'Control.Lens.IndexedLens.SimpleIndexedLens' a c -> (i -> c -> 'Bool') -> a -> 'Maybe' (i, c)--- 'ifindOf' :: 'Control.Lens.IndexedTraversal.SimpleIndexedTraversal' a c -> (i -> c -> 'Bool') -> a -> 'Maybe' (i, c)+-- 'ifindOf' :: 'IndexedGetter' s a -> (i -> a -> 'Bool') -> s -> 'Maybe' (i, a)+-- 'ifindOf' :: 'IndexedFold' s a -> (i -> a -> 'Bool') -> s -> 'Maybe' (i, a)+-- 'ifindOf' :: 'Control.Lens.IndexedLens.SimpleIndexedLens' s a -> (i -> a -> 'Bool') -> s -> 'Maybe' (i, a)+-- 'ifindOf' :: 'Control.Lens.IndexedTraversal.SimpleIndexedTraversal' s a -> (i -> a -> 'Bool') -> s -> 'Maybe' (i, a) -- @-ifindOf :: IndexedGetting i (First (i, c)) a b c d -> (i -> c -> Bool) -> a -> Maybe (i, c)+ifindOf :: IndexedGetting i (First (i, a)) s t a b -> (i -> a -> Bool) -> s -> Maybe (i, a) ifindOf l p = getFirst . ifoldMapOf l step where- step i c- | p i c = First $ Just (i, c)+ step i a+ | p i a = First $ Just (i, a) | otherwise = First Nothing {-# INLINE ifindOf #-} @@ -284,12 +284,12 @@ -- @'Control.Lens.Fold.foldrOf'' l ≡ 'ifoldrOf'' l '.' 'const'@ -- -- @--- 'ifoldrOf'' :: 'IndexedGetter' i a c -> (i -> c -> e -> e) -> e -> a -> e--- 'ifoldrOf'' :: 'IndexedFold' i a c -> (i -> c -> e -> e) -> e -> a -> e--- 'ifoldrOf'' :: 'Control.Lens.IndexedLens.SimpleIndexedLens' i a c -> (i -> c -> e -> e) -> e -> a -> e--- 'ifoldrOf'' :: 'Control.Lens.IndexedTraversal.SimpleIndexedTraversal' i a c -> (i -> c -> e -> e) -> e -> a -> e+-- 'ifoldrOf'' :: 'IndexedGetter' i s a -> (i -> a -> r -> r) -> r -> s -> r+-- 'ifoldrOf'' :: 'IndexedFold' i s a -> (i -> a -> r -> r) -> r -> s -> r+-- 'ifoldrOf'' :: 'Control.Lens.IndexedLens.SimpleIndexedLens' i s a -> (i -> a -> r -> r) -> r -> s -> r+-- 'ifoldrOf'' :: 'Control.Lens.IndexedTraversal.SimpleIndexedTraversal' i s a -> (i -> a -> r -> r) -> r -> s -> r -- @-ifoldrOf' :: IndexedGetting i (Dual (Endo (e -> e))) a b c d -> (i -> c -> e -> e) -> e -> a -> e+ifoldrOf' :: IndexedGetting i (Dual (Endo (r -> r))) s t a b -> (i -> a -> r -> r) -> r -> s -> r ifoldrOf' l f z0 xs = ifoldlOf l f' id xs z0 where f' i k x z = k $! f i x z {-# INLINE ifoldrOf' #-}@@ -301,12 +301,12 @@ -- @'Control.Lens.Fold.foldlOf'' l ≡ 'ifoldlOf'' l '.' 'const'@ -- -- @--- 'ifoldlOf'' :: 'IndexedGetter' i a c -> (i -> e -> c -> e) -> e -> a -> e--- 'ifoldlOf'' :: 'IndexedFold' i a c -> (i -> e -> c -> e) -> e -> a -> e--- 'ifoldlOf'' :: 'Control.Lens.IndexedLens.SimpleIndexedLens' i a c -> (i -> e -> c -> e) -> e -> a -> e--- 'ifoldlOf'' :: 'Control.Lens.IndexedTraversal.SimpleIndexedTraversal' i a c -> (i -> e -> c -> e) -> e -> a -> e+-- 'ifoldlOf'' :: 'IndexedGetter' i s a -> (i -> r -> a -> r) -> r -> s -> r+-- 'ifoldlOf'' :: 'IndexedFold' i s a -> (i -> r -> a -> r) -> r -> s -> r+-- 'ifoldlOf'' :: 'Control.Lens.IndexedLens.SimpleIndexedLens' i s a -> (i -> r -> a -> r) -> r -> s -> r+-- 'ifoldlOf'' :: 'Control.Lens.IndexedTraversal.SimpleIndexedTraversal' i s a -> (i -> r -> a -> r) -> r -> s -> r -- @-ifoldlOf' :: IndexedGetting i (Endo (e -> e)) a b c d -> (i -> e -> c -> e) -> e -> a -> e+ifoldlOf' :: IndexedGetting i (Endo (r -> r)) s t a b -> (i -> r -> a -> r) -> r -> s -> r ifoldlOf' l f z0 xs = ifoldrOf l f' id xs z0 where f' i x k z = k $! f i z x {-# INLINE ifoldlOf' #-}@@ -318,12 +318,12 @@ -- @'Control.Lens.Fold.foldrMOf' l ≡ 'ifoldrMOf' l '.' 'const'@ -- -- @--- 'ifoldrMOf' :: 'Monad' m => 'IndexedGetter' i a c -> (i -> c -> e -> m e) -> e -> a -> e--- 'ifoldrMOf' :: 'Monad' m => 'IndexedFold' i a c -> (i -> c -> e -> m e) -> e -> a -> e--- 'ifoldrMOf' :: 'Monad' m => 'Control.Lens.IndexedLens.SimpleIndexedLens' i a c -> (i -> c -> e -> m e) -> e -> a -> e--- 'ifoldrMOf' :: 'Monad' m => 'Control.Lens.IndexedTraversal.SimpleIndexedTraversal' i a c -> (i -> c -> e -> m e) -> e -> a -> e+-- 'ifoldrMOf' :: 'Monad' m => 'IndexedGetter' i s a -> (i -> a -> r -> m r) -> r -> s -> r+-- 'ifoldrMOf' :: 'Monad' m => 'IndexedFold' i s a -> (i -> a -> r -> m r) -> r -> s -> r+-- 'ifoldrMOf' :: 'Monad' m => 'Control.Lens.IndexedLens.SimpleIndexedLens' i s a -> (i -> a -> r -> m r) -> r -> s -> r+-- 'ifoldrMOf' :: 'Monad' m => 'Control.Lens.IndexedTraversal.SimpleIndexedTraversal' i s a -> (i -> a -> r -> m r) -> r -> s -> r -- @-ifoldrMOf :: Monad m => IndexedGetting i (Dual (Endo (e -> m e))) a b c d -> (i -> c -> e -> m e) -> e -> a -> m e+ifoldrMOf :: Monad m => IndexedGetting i (Dual (Endo (r -> m r))) s t a b -> (i -> a -> r -> m r) -> r -> s -> m r ifoldrMOf l f z0 xs = ifoldlOf l f' return xs z0 where f' i k x z = f i x z >>= k {-# INLINE ifoldrMOf #-}@@ -335,12 +335,12 @@ -- @'Control.Lens.Fold.foldlMOf' l ≡ 'ifoldlMOf' l '.' 'const'@ -- -- @--- 'ifoldlOf'' :: 'Monad' m => 'IndexedGetter' i a c -> (i -> e -> c -> m e) -> e -> a -> e--- 'ifoldlOf'' :: 'Monad' m => 'IndexedFold' i a c -> (i -> e -> c -> m e) -> e -> a -> e--- 'ifoldlOf'' :: 'Monad' m => 'Control.Lens.IndexedLens.SimpleIndexedLens' i a c -> (i -> e -> c -> m e) -> e -> a -> e--- 'ifoldlOf'' :: 'Monad' m => 'Control.Lens.IndexedTraversal.SimpleIndexedTraversal' i a c -> (i -> e -> c -> m e) -> e -> a -> e+-- 'ifoldlOf'' :: 'Monad' m => 'IndexedGetter' i s a -> (i -> r -> a -> m r) -> r -> s -> r+-- 'ifoldlOf'' :: 'Monad' m => 'IndexedFold' i s a -> (i -> r -> a -> m r) -> r -> s -> r+-- 'ifoldlOf'' :: 'Monad' m => 'Control.Lens.IndexedLens.SimpleIndexedLens' i s a -> (i -> r -> a -> m r) -> r -> s -> r+-- 'ifoldlOf'' :: 'Monad' m => 'Control.Lens.IndexedTraversal.SimpleIndexedTraversal' i s a -> (i -> r -> a -> m r) -> r -> s -> r -- @-ifoldlMOf :: Monad m => IndexedGetting i (Endo (e -> m e)) a b c d -> (i -> e -> c -> m e) -> e -> a -> m e+ifoldlMOf :: Monad m => IndexedGetting i (Endo (r -> m r)) s t a b -> (i -> r -> a -> m r) -> r -> s -> m r ifoldlMOf l f z0 xs = ifoldrOf l f' return xs z0 where f' i x k z = f i z x >>= k {-# INLINE ifoldlMOf #-}@@ -352,13 +352,13 @@ -- @'Control.Lens.Fold.toListOf' l ≡ 'map' 'fst' '.' 'itoListOf' l@ -- -- @--- 'itoListOf' :: 'IndexedGetter' i a c -> a -> [(i,c)]--- 'itoListOf' :: 'IndexedFold' i a c -> a -> [(i,c)]--- 'itoListOf' :: 'Control.Lens.IndexedLens.SimpleIndexedLens' i a c -> a -> [(i,c)]--- 'itoListOf' :: 'Control.Lens.IndexedTraversal.SimpleIndexedTraversal' i a c -> a -> [(i,c)]+-- 'itoListOf' :: 'IndexedGetter' i s a -> s -> [(i,a)]+-- 'itoListOf' :: 'IndexedFold' i s a -> s -> [(i,a)]+-- 'itoListOf' :: 'Control.Lens.IndexedLens.SimpleIndexedLens' i s a -> s -> [(i,a)]+-- 'itoListOf' :: 'Control.Lens.IndexedTraversal.SimpleIndexedTraversal' i s a -> s -> [(i,a)] -- @-itoListOf :: IndexedGetting i [(i,c)] a b c d -> a -> [(i,c)]-itoListOf l = ifoldMapOf l (\i c -> [(i,c)])+itoListOf :: IndexedGetting i [(i,a)] s t a b -> s -> [(i,a)]+itoListOf l = ifoldMapOf l (\i a -> [(i,a)]) {-# INLINE itoListOf #-} -------------------------------------------------------------------------------@@ -368,9 +368,9 @@ -- | Transform an indexed fold into a fold of both the indices and the values. -- -- @--- 'withIndices' :: 'IndexedFold' i a c -> 'Fold' a (i, c)--- 'withIndices' :: 'Simple' 'IndexedLens' i a c -> 'Getter' a (i, c)--- 'withIndices' :: 'Simple' 'IndexedTraversal' i a c -> 'Fold' a (i, c)+-- 'withIndicesOf' :: 'IndexedFold' i s a -> 'Fold' s (i, a)+-- 'withIndicesOf' :: 'SimpleIndexedLens' i s a -> 'Getter' s (i, a)+-- 'withIndicesOf' :: 'SimpleIndexedTraversal' i s a -> 'Fold' s (i, a) -- @ -- -- All 'Fold' operations are safe, and comply with the laws. However,@@ -380,22 +380,22 @@ -- can only be legally traversed by operations that do not edit the indices. -- -- @--- 'withIndices' :: 'IndexedTraversal' i a b c d -> 'Traversal' a b (i, c) (j, d)+-- 'withIndicesOf' :: 'IndexedTraversal' i s t a b -> 'Traversal' s t (i, a) (j, b) -- @ -- -- Change made to the indices will be discarded.-withIndicesOf :: Functor f => Overloaded (Index i) f a b c d -> LensLike f a b (i, c) (j, d)+withIndicesOf :: Functor f => Overloaded (Index i) f s t a b -> LensLike f s t (i, a) (j, b) withIndicesOf l f = withIndex l (\i c -> snd <$> f (i,c)) {-# INLINE withIndicesOf #-} -- | Transform an indexed fold into a fold of the indices. -- -- @--- 'indices' :: 'IndexedFold' i a c -> 'Fold' a i--- 'indices' :: 'Simple' 'IndexedLens' i a c -> 'Getter' a i--- 'indices' :: 'Simple' 'IndexedTraversal' i a c -> 'Fold' a i+-- 'indicesOf' :: 'IndexedFold' i s a -> 'Fold' s i+-- 'indicesOf' :: 'SimpleIndexedLens' i s a -> 'Getter' s i+-- 'indicesOf' :: 'SimpleIndexedTraversal' i s a -> 'Fold' s i -- @-indicesOf :: Gettable f => Overloaded (Index i) f a b c c -> LensLike f a b i j+indicesOf :: Gettable f => Overloaded (Index i) f s t a a -> LensLike f s t i j indicesOf l f = withIndex l (const . coerce . f) {-# INLINE indicesOf #-} @@ -403,31 +403,35 @@ -- Converting to Folds ------------------------------------------------------------------------------- --- | Obtain an 'IndexedFold' by filtering an 'Control.Lens.IndexedLens.IndexedLens', 'IndexedGetter', 'IndexedFold' or 'Control.Lens.IndexedTraversal.IndexedTraversal'.-ifiltered :: (Gettable f, Applicative f, Indexed i k) => (i -> c -> Bool) -> Index i (c -> f c) (a -> f b) -> k (c -> f c) (a -> f b)-ifiltered p l = index $ \ f -> withIndex l $ \ i c -> if p i c then f i c else noEffect-{-# INLINE ifiltered #-}+-- | Obtain an 'IndexedFold' by filtering an 'Control.Lens.IndexedLens.IndexedLens', 'IndexedGetter', or 'IndexedFold'.+--+-- When passed an 'Control.Lens.IndexedTraversal.IndexedTraversal', sadly the result is /not/ a legal 'Control.Lens.IndexedTraversal.IndexedTraversal'.+--+-- See 'filtered' for a related counter-example.+ifiltering :: (Applicative f, Indexed i k) => (i -> a -> Bool) -> Index i (a -> f a) (s -> f t) -> k (a -> f a) (s -> f t)+ifiltering p l = index $ \ f -> withIndex l $ \ i c -> if p i c then f i c else pure c+{-# INLINE ifiltering #-} -- | Reverse the order of the elements of an 'IndexedFold' or 'Control.Lens.IndexedTraversal.IndexedTraversal'. -- This has no effect on an 'Control.Lens.IndexedLens.IndexedLens', 'IndexedGetter', or 'Control.Lens.IndexedSetter.IndexedSetter'.-ibackwards :: Indexed i k => Index i (c -> (Backwards f) d) (a -> (Backwards f) b) -> k (c -> f d) (a -> f b)+ibackwards :: Indexed i k => Index i (a -> (Backwards f) b) (s -> (Backwards f) t) -> k (a -> f b) (s -> f t) ibackwards l = index $ \ f -> fmap forwards . withIndex l $ \ i -> Backwards . f i {-# INLINE ibackwards #-} -- | Obtain an 'IndexedFold' by taking elements from another 'IndexedFold', 'Control.Lens.IndexedLens.IndexedLens', 'IndexedGetter' or 'Control.Lens.IndexedTraversal.IndexedTraversal' while a predicate holds. itakingWhile :: (Gettable f, Applicative f, Indexed i k)- => (i -> c -> Bool)- -> IndexedGetting i (Endo (f a)) a a c c- -> k (c -> f c) (a -> f a)+ => (i -> a -> Bool)+ -> IndexedGetting i (Endo (f s)) s s a a+ -> k (a -> f a) (s -> f s) itakingWhile p l = index $ \ f -> ifoldrOf l (\i a r -> if p i a then f i a *> r else noEffect) noEffect {-# INLINE itakingWhile #-} -- | Obtain an 'IndexedFold' by dropping elements from another 'IndexedFold', 'Control.Lens.IndexedLens.IndexedLens', 'IndexedGetter' or 'Control.Lens.IndexedTraversal.IndexedTraversal' while a predicate holds. idroppingWhile :: (Gettable f, Applicative f, Indexed i k)- => (i -> c -> Bool)- -> IndexedGetting i (Endo (f a, f a)) a a c c- -> k (c -> f c) (a -> f a)+ => (i -> a -> Bool)+ -> IndexedGetting i (Endo (f s, f s)) s s a a+ -> k (a -> f a) (s -> f s) idroppingWhile p l = index $ \f -> fst . ifoldrOf l (\i a r -> let s = f i a *> snd r in if p i a then (fst r, s) else (s, s)) (noEffect, noEffect) {-# INLINE idroppingWhile #-} @@ -436,4 +440,4 @@ ------------------------------------------------------------------------------ -- | Useful for storage.-newtype ReifiedIndexedFold i a c = ReifyIndexedFold { reflectIndexedFold :: IndexedFold i a c }+newtype ReifiedIndexedFold i s a = ReifyIndexedFold { reflectIndexedFold :: IndexedFold i s a }
src/Control/Lens/IndexedGetter.hs view
@@ -26,10 +26,10 @@ ------------------------------------------------------------------------------ -- | Every 'IndexedGetter' is a valid 'Control.Lens.IndexedFold.IndexedFold' and 'Getter'.-type IndexedGetter i a c = forall k f. (Indexed i k, Gettable f) => k (c -> f c) (a -> f a)+type IndexedGetter i s a = forall k f. (Indexed i k, Gettable f) => k (a -> f a) (s -> f s) -- | Used to consume an 'Control.Lens.IndexedFold.IndexedFold'.-type IndexedGetting i m a b c d = Index i (c -> Accessor m d) (a -> Accessor m b)+type IndexedGetting i m s t a b = Index i (a -> Accessor m b) (s -> Accessor m t) -- | Useful for storage.-newtype ReifiedIndexedGetter i a c = ReifyIndexedGetter { reflectIndexedGetter :: IndexedGetter i a c }+newtype ReifiedIndexedGetter i s a = ReifyIndexedGetter { reflectIndexedGetter :: IndexedGetter i s a }
src/Control/Lens/IndexedLens.hs view
@@ -62,10 +62,10 @@ infix 4 %%@=, <%@= -- | Every 'IndexedLens' is a valid 'Lens' and a valid 'Control.Lens.IndexedTraversal.IndexedTraversal'.-type IndexedLens i a b c d = forall f k. (Indexed i k, Functor f) => k (c -> f d) (a -> f b)+type IndexedLens i s t a b = forall f k. (Indexed i k, Functor f) => k (a -> f b) (s -> f t) -- | @type 'SimpleIndexedLens' i = 'Simple' ('IndexedLens' i)@-type SimpleIndexedLens i a b = IndexedLens i a a b b+type SimpleIndexedLens i s a = IndexedLens i s s a a -- | Adjust the target of an 'IndexedLens' returning the intermediate result, or -- adjust all of the targets of an 'Control.Lens.IndexedTraversal.IndexedTraversal' and return a monoidal summary@@ -78,11 +78,11 @@ -- If you do not need the intermediate result, you can use ('Control.Lens.Type.%@~') or even ('Control.Lens.Type.%~'). -- -- @--- ('<%@~') :: 'IndexedLens' i a b c d -> (i -> c -> d) -> a -> (d, b)--- ('<%@~') :: 'Monoid' d => 'Control.Lens.IndexedTraversal.IndexedTraversal' i a b c d -> (i -> c -> d) -> a -> (d, b)+-- ('<%@~') :: 'IndexedLens' i s t a b -> (i -> a -> b) -> s -> (b, t)+-- ('<%@~') :: 'Monoid' b => 'Control.Lens.IndexedTraversal.IndexedTraversal' i s t a b -> (i -> a -> b) -> s -> (b, t) -- @-(<%@~) :: Overloaded (Index i) ((,)d) a b c d -> (i -> c -> d) -> a -> (d, b)-l <%@~ f = withIndex l $ \i c -> let d = f i c in (d, d)+(<%@~) :: Overloaded (Index i) ((,)b) s t a b -> (i -> a -> b) -> s -> (b, t)+l <%@~ f = withIndex l $ \i a -> let b = f i a in (b, b) {-# INLINE (<%@~) #-} -- | Adjust the target of an 'IndexedLens' returning a supplementary result, or@@ -92,18 +92,18 @@ -- @('%%@~') = 'withIndex'@ -- -- @--- ('%%@~') :: 'Functor' f => 'IndexedLens' i a b c d -> (i -> c -> f d) -> a -> f b--- ('%%@~') :: 'Functor' f => 'Control.Lens.IndexedTraversal.IndexedTraversal' i a b c d -> (i -> c -> f d) -> a -> f b+-- ('%%@~') :: 'Functor' f => 'IndexedLens' i s t a b -> (i -> a -> f b) -> s -> f t+-- ('%%@~') :: 'Functor' f => 'Control.Lens.IndexedTraversal.IndexedTraversal' i s t a b -> (i -> a -> f b) -> s -> f t -- @ -- -- In particular, it is often useful to think of this function as having one of these even more -- restrictive type signatures -- -- @--- ('%%@~') :: 'IndexedLens' i a b c d -> (i -> c -> (e, d)) -> a -> (e, b)--- ('%%@~') :: 'Monoid' e => 'Control.Lens.IndexedTraversal.IndexedTraversal' i a b c d -> (i -> c -> (e, d)) -> a -> (e, b)+-- ('%%@~') :: 'IndexedLens' i s t a b -> (i -> a -> (r, b)) -> s -> (r, t)+-- ('%%@~') :: 'Monoid' r => 'Control.Lens.IndexedTraversal.IndexedTraversal' i s t a b -> (i -> a -> (r, b)) -> s -> (r, t) -- @-(%%@~) :: Overloaded (Index i) f a b c d -> (i -> c -> f d) -> a -> f b+(%%@~) :: Overloaded (Index i) f s t a b -> (i -> a -> f b) -> s -> f t (%%@~) = withIndex {-# INLINE (%%@~) #-} @@ -114,17 +114,17 @@ -- @l '%%@=' f = 'state' (l '%%@~' f)@ -- -- @--- ('%%@=') :: 'MonadState' a m 'IndexedLens' i a a c d -> (i -> c -> (e, d)) -> a -> m e--- ('%%@=') :: ('MonadState' a m, 'Monoid' e) => 'Control.Lens.IndexedTraversal.IndexedTraversal' i a a c d -> (i -> c -> (e, d)) -> a -> m e+-- ('%%@=') :: 'MonadState' s m 'IndexedLens' i s s a b -> (i -> a -> (r, b)) -> s -> m r+-- ('%%@=') :: ('MonadState' s m, 'Monoid' r) => 'Control.Lens.IndexedTraversal.IndexedTraversal' i s s a b -> (i -> a -> (r, b)) -> s -> m r -- @-(%%@=) :: MonadState a m => Overloaded (Index i) ((,)e) a a c d -> (i -> c -> (e, d)) -> m e+(%%@=) :: MonadState s m => Overloaded (Index i) ((,)r) s s a b -> (i -> a -> (r, b)) -> m r #if MIN_VERSION_mtl(2,1,0) l %%@= f = State.state (l %%@~ f) #else l %%@= f = do- (e, d) <- State.gets (l %%@~ f)- State.put d- return e+ (r, s) <- State.gets (l %%@~ f)+ State.put s+ return r #endif {-# INLINE (%%@=) #-} @@ -133,11 +133,11 @@ -- return a monoidal summary of the intermediate results. -- -- @--- ('<%@=') :: 'MonadState' a m 'IndexedLens' i a a c d -> (i -> c -> d) -> a -> m d--- ('<%@=') :: ('MonadState' a m, 'Monoid' e) => 'Control.Lens.IndexedTraversal.IndexedTraversal' i a a c d -> (i -> c -> d) -> a -> m d+-- ('<%@=') :: 'MonadState' s m 'IndexedLens' i s s a b -> (i -> a -> b) -> m b+-- ('<%@=') :: ('MonadState' s m, 'Monoid' b) => 'Control.Lens.IndexedTraversal.IndexedTraversal' i s s a b -> (i -> a -> b) -> m b -- @-(<%@=) :: MonadState a m => Overloaded (Index i) ((,)d) a a c d -> (i -> c -> d) -> m d-l <%@= f = l %%@= \ i c -> let d = f i c in (d, d)+(<%@=) :: MonadState s m => Overloaded (Index i) ((,)b) s s a b -> (i -> a -> b) -> m b+l <%@= f = l %%@= \ i a -> let b = f i a in (b, b) {-# INLINE (<%@=) #-} -- | Provides an 'IndexedLens' that can be used to read, write or delete the value associated with a key in a map-like container.@@ -192,7 +192,7 @@ ------------------------------------------------------------------------------ -- | Useful for storage.-newtype ReifiedIndexedLens i a b c d = ReifyIndexedLens { reflectIndexedLens :: IndexedLens i a b c d }+newtype ReifiedIndexedLens i s t a b = ReifyIndexedLens { reflectIndexedLens :: IndexedLens i s t a b } -- | @type 'SimpleIndexedLens' i = 'Simple' ('ReifiedIndexedLens' i)@-type SimpleReifiedIndexedLens i a b = ReifiedIndexedLens i a a b b+type SimpleReifiedIndexedLens i s a = ReifiedIndexedLens i s s a a
src/Control/Lens/IndexedSetter.hs view
@@ -40,11 +40,11 @@ -- | Every 'IndexedSetter' is a valid 'Setter' -- -- The 'Control.Lens.Setter.Setter' laws are still required to hold.-type IndexedSetter i a b c d = forall f k. (Indexed i k, Settable f) => k (c -> f d) (a -> f b)+type IndexedSetter i s t a b = forall f k. (Indexed i k, Settable f) => k (a -> f b) (s -> f t) -- | -- @type 'SimpleIndexedSetter' i = 'Simple' ('IndexedSetter' i)@-type SimpleIndexedSetter i a b = IndexedSetter i a a b b+type SimpleIndexedSetter i s a = IndexedSetter i s s a a -- | Map with index. --@@ -53,11 +53,11 @@ -- @'Control.Lens.Setter.mapOf' l ≡ 'imapOf' l '.' 'const'@ -- -- @--- 'imapOf' :: 'IndexedSetter' i a b c d -> (i -> c -> d) -> a -> b--- 'imapOf' :: 'Control.Lens.IndexedLens.IndexedLens' i a b c d -> (i -> c -> d) -> a -> b--- 'imapOf' :: 'Control.Lens.IndexedTraversal.IndexedTraversal' i a b c d -> (i -> c -> d) -> a -> b+-- 'imapOf' :: 'IndexedSetter' i s t a b -> (i -> a -> b) -> s -> t+-- 'imapOf' :: 'Control.Lens.IndexedLens.IndexedLens' i s t a b -> (i -> a -> b) -> s -> t+-- 'imapOf' :: 'Control.Lens.IndexedTraversal.IndexedTraversal' i s t a b -> (i -> a -> b) -> s -> t -- @-imapOf :: Overloaded (Index i) Mutator a b c d -> (i -> c -> d) -> a -> b+imapOf :: Overloaded (Index i) Mutator s t a b -> (i -> a -> b) -> s -> t imapOf l f = runMutator . withIndex l (\i -> Mutator . f i) {-# INLINE imapOf #-} @@ -68,11 +68,11 @@ -- @'Control.Lens.Setter.over' l ≡ 'iover' l '.' 'const'@ -- -- @--- 'iover' :: 'IndexedSetter' i a b c d -> (i -> c -> d) -> a -> b--- 'iover' :: 'Control.Lens.IndexedLens.IndexedLens' i a b c d -> (i -> c -> d) -> a -> b--- 'iover' :: 'Control.Lens.IndexedTraversal.IndexedTraversal' i a b c d -> (i -> c -> d) -> a -> b+-- 'iover' :: 'IndexedSetter' i s t a b -> (i -> a -> b) -> s -> t+-- 'iover' :: 'Control.Lens.IndexedLens.IndexedLens' i s t a b -> (i -> a -> b) -> s -> t+-- 'iover' :: 'Control.Lens.IndexedTraversal.IndexedTraversal' i s t a b -> (i -> a -> b) -> s -> t -- @-iover :: Overloaded (Index i) Mutator a b c d -> (i -> c -> d) -> a -> b+iover :: Overloaded (Index i) Mutator s t a b -> (i -> a -> b) -> s -> t iover l f = runMutator . withIndex l (\i -> Mutator . f i) {-# INLINE iover #-} @@ -94,7 +94,7 @@ -- -- Another way to view 'sets' is that it takes a \"semantic editor combinator\" -- and transforms it into a 'Setter'.-isets :: ((i -> c -> d) -> a -> b) -> IndexedSetter i a b c d+isets :: ((i -> a -> b) -> s -> t) -> IndexedSetter i s t a b isets f = index $ \ g -> pure . f (\i -> untainted . g i) {-# INLINE isets #-} @@ -108,11 +108,11 @@ -- @l 'Control.Lens.Setter.%~' f ≡ l '%@~' 'const' f@ -- -- @--- ('%@~') :: 'IndexedSetter' i a b c d -> (i -> c -> d) -> a -> b--- ('%@~') :: 'Control.Lens.IndexedLens.IndexedLens' i a b c d -> (i -> c -> d) -> a -> b--- ('%@~') :: 'Control.Lens.IndexedTraversal.IndexedTraversal' i a b c d -> (i -> c -> d) -> a -> b+-- ('%@~') :: 'IndexedSetter' i s t a b -> (i -> a -> b) -> s -> t+-- ('%@~') :: 'Control.Lens.IndexedLens.IndexedLens' i s t a b -> (i -> a -> b) -> s -> t+-- ('%@~') :: 'Control.Lens.IndexedTraversal.IndexedTraversal' i s t a b -> (i -> a -> b) -> s -> t -- @-(%@~) :: Overloaded (Index i) Mutator a b c d -> (i -> c -> d) -> a -> b+(%@~) :: Overloaded (Index i) Mutator s t a b -> (i -> a -> b) -> s -> t l %@~ f = runMutator . withIndex l (\i -> Mutator . f i) {-# INLINE (%@~) #-} @@ -124,11 +124,11 @@ -- @l 'Control.Lens.Setter.%=' f ≡ l '%@=' 'const' f@ -- -- @--- ('%@=') :: 'MonadState' a m => 'IndexedSetter' i a a c d -> (i -> c -> d) -> m ()--- ('%@=') :: 'MonadState' a m => 'Control.Lens.IndexedLens.IndexedLens' i a a c d -> (i -> c -> d) -> m ()--- ('%@=') :: 'MonadState' a m => 'Control.Lens.IndexedTraversal.IndexedTraversal' i a b c d -> (i -> c -> d) -> m ()+-- ('%@=') :: 'MonadState' s m => 'IndexedSetter' i s s a b -> (i -> a -> b) -> m ()+-- ('%@=') :: 'MonadState' s m => 'Control.Lens.IndexedLens.IndexedLens' i s s a b -> (i -> a -> b) -> m ()+-- ('%@=') :: 'MonadState' s m => 'Control.Lens.IndexedTraversal.IndexedTraversal' i s t a b -> (i -> a -> b) -> m () -- @-(%@=) :: MonadState a m => Overloaded (Index i) Mutator a a c d -> (i -> c -> d) -> m ()+(%@=) :: MonadState s m => Overloaded (Index i) Mutator s s a b -> (i -> a -> b) -> m () l %@= f = State.modify (l %@~ f) {-# INLINE (%@=) #-} @@ -137,8 +137,8 @@ ------------------------------------------------------------------------------ -- | Useful for storage.-newtype ReifiedIndexedSetter i a b c d = ReifyIndexedSetter { reflectIndexedSetter :: IndexedSetter i a b c d }+newtype ReifiedIndexedSetter i s t a b = ReifyIndexedSetter { reflectIndexedSetter :: IndexedSetter i s t a b } -- | @type 'SimpleIndexedSetter' i = 'Simple' ('ReifiedIndexedSetter' i)@-type SimpleReifiedIndexedSetter i a b = ReifiedIndexedSetter i a a b b+type SimpleReifiedIndexedSetter i s a = ReifiedIndexedSetter i s s a a
src/Control/Lens/IndexedTraversal.hs view
@@ -73,10 +73,10 @@ -- The 'Indexed' constraint is used to allow an 'IndexedTraversal' to be used directly as a 'Control.Lens.Traversal.Traversal'. -- -- The 'Control.Lens.Traversal.Traversal' laws are still required to hold.-type IndexedTraversal i a b c d = forall f k. (Indexed i k, Applicative f) => k (c -> f d) (a -> f b)+type IndexedTraversal i s t a b = forall f k. (Indexed i k, Applicative f) => k (a -> f b) (s -> f t) -- | @type 'SimpleIndexedTraversal' i = 'Simple' ('IndexedTraversal' i)@-type SimpleIndexedTraversal i a b = IndexedTraversal i a a b b+type SimpleIndexedTraversal i s a = IndexedTraversal i s s a a -- | Traversal with an index. --@@ -89,10 +89,10 @@ -- @ -- -- @--- 'itraverseOf' :: 'Control.Lens.IndexedLens.IndexedLens' i a b c d -> (i -> c -> f d) -> a -> f b--- 'itraverseOf' :: 'IndexedTraversal' i a b c d -> (i -> c -> f d) -> a -> f b+-- 'itraverseOf' :: 'Control.Lens.IndexedLens.IndexedLens' i s t a b -> (i -> a -> f b) -> s -> f t+-- 'itraverseOf' :: 'IndexedTraversal' i s t a b -> (i -> a -> f b) -> s -> f t -- @-itraverseOf :: Overloaded (Index i) f a b c d -> (i -> c -> f d) -> a -> f b+itraverseOf :: Overloaded (Index i) f s t a b -> (i -> a -> f b) -> s -> f t itraverseOf = withIndex {-# INLINE itraverseOf #-} @@ -105,10 +105,10 @@ -- @ -- -- @--- 'iforOf' :: 'Control.Lens.IndexedLens.IndexedLens' i a b c d -> a -> (i -> c -> f d) -> f b--- 'iforOf' :: 'IndexedTraversal' i a b c d -> a -> (i -> c -> f d) -> f b+-- 'iforOf' :: 'Control.Lens.IndexedLens.IndexedLens' i s t a b -> s -> (i -> a -> f b) -> f t+-- 'iforOf' :: 'IndexedTraversal' i s t a b -> s -> (i -> a -> f b) -> f t -- @-iforOf :: Overloaded (Index i) f a b c d -> a -> (i -> c -> f d) -> f b+iforOf :: Overloaded (Index i) f s t a b -> s -> (i -> a -> f b) -> f t iforOf = flip . withIndex {-# INLINE iforOf #-} @@ -121,10 +121,10 @@ -- @'Control.Lens.Traversal.mapMOf' l ≡ 'imapMOf' l '.' 'const'@ -- -- @--- 'imapMOf' :: 'Monad' m => 'Control.Lens.IndexedLens.IndexedLens' i a b c d -> (i -> c -> m d) -> a -> m b--- 'imapMOf' :: 'Monad' m => 'IndexedTraversal' i a b c d -> (i -> c -> m d) -> a -> m b+-- 'imapMOf' :: 'Monad' m => 'Control.Lens.IndexedLens.IndexedLens' i s t a b -> (i -> a -> m b) -> s -> m t+-- 'imapMOf' :: 'Monad' m => 'IndexedTraversal' i s t a b -> (i -> a -> m b) -> s -> m t -- @-imapMOf :: Overloaded (Index i) (WrappedMonad m) a b c d -> (i -> c -> m d) -> a -> m b+imapMOf :: Overloaded (Index i) (WrappedMonad m) s t a b -> (i -> a -> m b) -> s -> m t imapMOf l f = unwrapMonad . withIndex l (\i -> WrapMonad . f i) {-# INLINE imapMOf #-} @@ -138,10 +138,10 @@ -- @ -- -- @--- 'iforMOf' :: 'Monad' m => 'Control.Lens.IndexedLens.IndexedLens' i a b c d -> a -> (i -> c -> m d) -> m b--- 'iforMOf' :: 'Monad' m => 'IndexedTraversal' i a b c d -> a -> (i -> c -> m d) -> m b+-- 'iforMOf' :: 'Monad' m => 'Control.Lens.IndexedLens.IndexedLens' i s t a b -> s -> (i -> a -> m b) -> m t+-- 'iforMOf' :: 'Monad' m => 'IndexedTraversal' i s t a b -> s -> (i -> a -> m b) -> m t -- @-iforMOf :: Overloaded (Index i) (WrappedMonad m) a b c d -> a -> (i -> c -> m d) -> m b+iforMOf :: Overloaded (Index i) (WrappedMonad m) s t a b -> s -> (i -> a -> m b) -> m t iforMOf = flip . imapMOf {-# INLINE iforMOf #-} @@ -152,10 +152,10 @@ -- @'Control.Lens.Traversal.mapAccumROf' l ≡ 'imapAccumROf' l '.' 'const'@ -- -- @--- 'imapAccumROf' :: 'Control.Lens.IndexedLens.IndexedLens' i a b c d -> (i -> s -> c -> (s, d)) -> s -> a -> (s, b)--- 'imapAccumROf' :: 'IndexedTraversal' i a b c d -> (i -> s -> c -> (s, d)) -> s -> a -> (s, b)+-- 'imapAccumROf' :: 'Control.Lens.IndexedLens.IndexedLens' i s t a b -> (i -> s -> a -> (s, b)) -> s -> s -> (s, t)+-- 'imapAccumROf' :: 'IndexedTraversal' i s t a b -> (i -> s -> a -> (s, b)) -> s -> s -> (s, t) -- @-imapAccumROf :: Overloaded (Index i) (Lazy.State s) a b c d -> (i -> s -> c -> (s, d)) -> s -> a -> (s, b)+imapAccumROf :: Overloaded (Index i) (Lazy.State s) s t a b -> (i -> s -> a -> (s, b)) -> s -> s -> (s, t) imapAccumROf l f s0 a = swap (Lazy.runState (withIndex l (\i c -> Lazy.state (\s -> swap (f i s c))) a) s0) {-# INLINE imapAccumROf #-} @@ -166,10 +166,10 @@ -- @'Control.Lens.Traversal.mapAccumLOf' l ≡ 'imapAccumLOf' l '.' 'const'@ -- -- @--- 'imapAccumLOf' :: 'Control.Lens.IndexedLens.IndexedLens' i a b c d -> (i -> s -> c -> (s, d)) -> s -> a -> (s, b)--- 'imapAccumLOf' :: 'IndexedTraversal' i a b c d -> (i -> s -> c -> (s, d)) -> s -> a -> (s, b)+-- 'imapAccumLOf' :: 'Control.Lens.IndexedLens.IndexedLens' i s t a b -> (i -> s -> a -> (s, b)) -> s -> s -> (s, t)+-- 'imapAccumLOf' :: 'IndexedTraversal' i s t a b -> (i -> s -> a -> (s, b)) -> s -> s -> (s, t) -- @-imapAccumLOf :: Overloaded (Index i) (Backwards (Lazy.State s)) a b c d -> (i -> s -> c -> (s, d)) -> s -> a -> (s, b)+imapAccumLOf :: Overloaded (Index i) (Backwards (Lazy.State s)) s t a b -> (i -> s -> a -> (s, b)) -> s -> s -> (s, t) imapAccumLOf l f s0 a = swap (Lazy.runState (forwards (withIndex l (\i c -> Backwards (Lazy.state (\s -> swap (f i s c)))) a)) s0) {-# INLINE imapAccumLOf #-} @@ -187,14 +187,14 @@ -- ["He","saw","desserts","O_o"] -- -- @--- 'iwhereOf' :: 'IndexedFold' i a b -> (i -> 'Bool') -> 'IndexedFold' i a b--- 'iwhereOf' :: 'IndexedGetter' i a b -> (i -> 'Bool') -> 'IndexedFold' i a b--- 'iwhereOf' :: 'SimpleIndexedLens' i a b -> (i -> 'Bool') -> 'SimpleIndexedTraversal' i a b--- 'iwhereOf' :: 'SimpleIndexedTraversal' i a b -> (i -> 'Bool') -> 'SimpleIndexedTraversal' i a b--- 'iwhereOf' :: 'SimpleIndexedSetter' i a b -> (i -> 'Bool') -> 'SimpleIndexedSetter' i a b+-- 'iwhereOf' :: 'IndexedFold' i s a -> (i -> 'Bool') -> 'IndexedFold' i s a+-- 'iwhereOf' :: 'IndexedGetter' i s a -> (i -> 'Bool') -> 'IndexedFold' i s a+-- 'iwhereOf' :: 'SimpleIndexedLens' i s a -> (i -> 'Bool') -> 'SimpleIndexedTraversal' i s a+-- 'iwhereOf' :: 'SimpleIndexedTraversal' i s a -> (i -> 'Bool') -> 'SimpleIndexedTraversal' i s a+-- 'iwhereOf' :: 'SimpleIndexedSetter' i s a -> (i -> 'Bool') -> 'SimpleIndexedSetter' i s a -- @-iwhereOf :: (Indexed i k, Applicative f) => Overloaded (Index i) f a b c c -> (i -> Bool) -> Overloaded k f a b c c-iwhereOf l p = index $ \f a -> withIndex l (\i c -> if p i then f i c else pure c) a+iwhereOf :: (Indexed i k, Applicative f) => Overloaded (Index i) f s t a a -> (i -> Bool) -> Overloaded k f s t a a+iwhereOf l p = index $ \f s -> withIndex l (\i a -> if p i then f i a else pure a) s {-# INLINE iwhereOf #-} -- | Traverse the value at a given key in a map@@ -257,7 +257,7 @@ ------------------------------------------------------------------------------ -- | Useful for storage.-newtype ReifiedIndexedTraversal i a b c d = ReifyIndexedTraversal { reflectIndexedTraversal :: IndexedTraversal i a b c d }+newtype ReifiedIndexedTraversal i s t a b = ReifyIndexedTraversal { reflectIndexedTraversal :: IndexedTraversal i s t a b } -- | @type 'SimpleIndexedTraversal' i = 'Simple' ('ReifiedIndexedTraversal' i)@-type SimpleReifiedIndexedTraversal i a b = ReifiedIndexedTraversal i a a b b+type SimpleReifiedIndexedTraversal i s a = ReifiedIndexedTraversal i s s a a
src/Control/Lens/Internal.hs view
@@ -80,52 +80,52 @@ ----------------------------------------------------------------------------- -- | Used by 'Control.Lens.Type.Zoom' to 'Control.Lens.Type.zoom' into 'Control.Monad.State.StateT'-newtype Focusing m c a = Focusing { unfocusing :: m (c, a) }+newtype Focusing m s a = Focusing { unfocusing :: m (s, a) } -instance Monad m => Functor (Focusing m c) where+instance Monad m => Functor (Focusing m s) where fmap f (Focusing m) = Focusing $ do- (c, a) <- m- return (c, f a)+ (s, a) <- m+ return (s, f a) -instance (Monad m, Monoid c) => Applicative (Focusing m c) where+instance (Monad m, Monoid s) => Applicative (Focusing m s) where pure a = Focusing (return (mempty, a)) Focusing mf <*> Focusing ma = Focusing $ do- (c, f) <- mf- (d, a) <- ma- return (mappend c d, f a)+ (s, f) <- mf+ (s', a) <- ma+ return (mappend s s', f a) -- | Used by 'Control.Lens.Type.Zoom' to 'Control.Lens.Type.zoom' into 'Control.Monad.RWS.RWST'-newtype FocusingWith w m c a = FocusingWith { unfocusingWith :: m (c, a, w) }+newtype FocusingWith w m s a = FocusingWith { unfocusingWith :: m (s, a, w) } -instance Monad m => Functor (FocusingWith w m c) where+instance Monad m => Functor (FocusingWith w m s) where fmap f (FocusingWith m) = FocusingWith $ do- (c, a, w) <- m- return (c, f a, w)+ (s, a, w) <- m+ return (s, f a, w) -instance (Monad m, Monoid c, Monoid w) => Applicative (FocusingWith w m c) where+instance (Monad m, Monoid s, Monoid w) => Applicative (FocusingWith w m s) where pure a = FocusingWith (return (mempty, a, mempty)) FocusingWith mf <*> FocusingWith ma = FocusingWith $ do- (c, f, w) <- mf- (d, a, w') <- ma- return (mappend c d, f a, mappend w w')+ (s, f, w) <- mf+ (s', a, w') <- ma+ return (mappend s s', f a, mappend w w') -- | Used by 'Control.Lens.Type.Zoom' to 'Control.Lens.Type.zoom' into 'Control.Monad.Writer.WriterT'.-newtype FocusingPlus w k c a = FocusingPlus { unfocusingPlus :: k (c, w) a }+newtype FocusingPlus w k s a = FocusingPlus { unfocusingPlus :: k (s, w) a } -instance Functor (k (c, w)) => Functor (FocusingPlus w k c) where+instance Functor (k (s, w)) => Functor (FocusingPlus w k s) where fmap f (FocusingPlus as) = FocusingPlus (fmap f as) -instance (Monoid w, Applicative (k (c, w))) => Applicative (FocusingPlus w k c) where+instance (Monoid w, Applicative (k (s, w))) => Applicative (FocusingPlus w k s) where pure = FocusingPlus . pure FocusingPlus kf <*> FocusingPlus ka = FocusingPlus (kf <*> ka) -- | Used by 'Control.Lens.Type.Zoom' to 'Control.Lens.Type.zoom' into 'Control.Monad.Trans.Maybe.MaybeT' or 'Control.Monad.Trans.List.ListT'-newtype FocusingOn f k c a = FocusingOn { unfocusingOn :: k (f c) a }+newtype FocusingOn f k s a = FocusingOn { unfocusingOn :: k (f s) a } -instance Functor (k (f c)) => Functor (FocusingOn f k c) where+instance Functor (k (f s)) => Functor (FocusingOn f k s) where fmap f (FocusingOn as) = FocusingOn (fmap f as) -instance Applicative (k (f c)) => Applicative (FocusingOn f k c) where+instance Applicative (k (f s)) => Applicative (FocusingOn f k s) where pure = FocusingOn . pure FocusingOn kf <*> FocusingOn ka = FocusingOn (kf <*> ka) @@ -139,12 +139,12 @@ May (Just a) `mappend` May (Just b) = May (Just (mappend a b)) -- | Used by 'Control.Lens.Type.Zoom' to 'Control.Lens.Type.zoom' into 'Control.Monad.Error.ErrorT'-newtype FocusingMay k c a = FocusingMay { unfocusingMay :: k (May c) a }+newtype FocusingMay k s a = FocusingMay { unfocusingMay :: k (May s) a } -instance Functor (k (May c)) => Functor (FocusingMay k c) where+instance Functor (k (May s)) => Functor (FocusingMay k s) where fmap f (FocusingMay as) = FocusingMay (fmap f as) -instance Applicative (k (May c)) => Applicative (FocusingMay k c) where+instance Applicative (k (May s)) => Applicative (FocusingMay k s) where pure = FocusingMay . pure FocusingMay kf <*> FocusingMay ka = FocusingMay (kf <*> ka) @@ -158,34 +158,34 @@ Err (Right a) `mappend` Err (Right b) = Err (Right (mappend a b)) -- | Used by 'Control.Lens.Type.Zoom' to 'Control.Lens.Type.zoom' into 'Control.Monad.Error.ErrorT'-newtype FocusingErr e k c a = FocusingErr { unfocusingErr :: k (Err e c) a }+newtype FocusingErr e k s a = FocusingErr { unfocusingErr :: k (Err e s) a } -instance Functor (k (Err e c)) => Functor (FocusingErr e k c) where+instance Functor (k (Err e s)) => Functor (FocusingErr e k s) where fmap f (FocusingErr as) = FocusingErr (fmap f as) -instance Applicative (k (Err e c)) => Applicative (FocusingErr e k c) where+instance Applicative (k (Err e s)) => Applicative (FocusingErr e k s) where pure = FocusingErr . pure FocusingErr kf <*> FocusingErr ka = FocusingErr (kf <*> ka) -- | The indexed store can be used to characterize a 'Control.Lens.Type.Lens' -- and is used by 'Control.Lens.Type.clone'-data Context c d a = Context (d -> a) c+data Context a b s = Context (b -> s) a -instance Functor (Context c d) where- fmap f (Context g c) = Context (f . g) c+instance Functor (Context a b) where+ fmap f (Context g s) = Context (f . g) s -instance (c ~ d) => Comonad (Context c d) where- extract (Context f c) = f c- duplicate (Context f c) = Context (Context f) c- extend g (Context f c) = Context (g . Context f) c+instance (a ~ b) => Comonad (Context a b) where+ extract (Context f s) = f s+ duplicate (Context f s) = Context (Context f) s+ extend g (Context f s) = Context (g . Context f) s -instance (c ~ d) => ComonadStore c (Context c d) where- pos (Context _ c) = c- peek c (Context g _) = g c- peeks f (Context g c) = g (f c)- seek c (Context g _) = Context g c- seeks f (Context g c) = Context g (f c)- experiment f (Context g c) = g <$> f c+instance (a ~ b) => ComonadStore a (Context a b) where+ pos (Context _ s) = s+ peek s (Context g _) = g s+ peeks f (Context g s) = g (f s)+ seek s (Context g _) = Context g s+ seeks f (Context g s) = Context g (f s)+ experiment f (Context g s) = g <$> f s -- | The result of 'Indexing' data IndexingResult f a = IndexingResult (f a) {-# UNPACK #-} !Int@@ -295,40 +295,42 @@ -- Mnemonically, a 'Bazaar' holds many stores and you can easily add more. -- -- This is a final encoding of 'Bazaar'.-newtype Bazaar c d a = Bazaar { _runBazaar :: forall f. Applicative f => (c -> f d) -> f a }+newtype Bazaar a b s = Bazaar { _runBazaar :: forall f. Applicative f => (a -> f b) -> f s } -instance Functor (Bazaar c d) where+instance Functor (Bazaar s t) where fmap f (Bazaar k) = Bazaar (fmap f . k) -instance Applicative (Bazaar c d) where+instance Applicative (Bazaar a b) where pure a = Bazaar (\_ -> pure a) {-# INLINE pure #-} Bazaar mf <*> Bazaar ma = Bazaar (\k -> mf k <*> ma k) {-# INLINE (<*>) #-} -instance (c ~ d) => Comonad (Bazaar c d) where+instance (a ~ b) => Comonad (Bazaar a b) where extract (Bazaar m) = runIdentity (m Identity) {-# INLINE extract #-} duplicate = duplicateBazaar {-# INLINE duplicate #-} -- | Given an action to run for each matched pair, traverse a bazaar.-bazaar :: Applicative f => (c -> f d) -> Bazaar c d b -> f b-bazaar cfd (Bazaar m) = m cfd+--+-- @'bazaar' :: 'Traversal' ('Bazaar' a b s) s a b@+bazaar :: Applicative f => (a -> f b) -> Bazaar a b s -> f s+bazaar afb (Bazaar m) = m afb {-# INLINE bazaar #-} -- | 'Bazaar' is an indexed 'Comonad'.-duplicateBazaar :: Bazaar c e a -> Bazaar c d (Bazaar d e a)+duplicateBazaar :: Bazaar a c s -> Bazaar a b (Bazaar b c s) duplicateBazaar (Bazaar m) = getCompose (m (Compose . fmap sell . sell)) {-# INLINE duplicateBazaar #-} -- duplicateBazaar' (Bazaar m) = Bazaar (\g -> getCompose (m (Compose . fmap sell . g))) -- | A trivial 'Bazaar'.-sell :: c -> Bazaar c d d+sell :: a -> Bazaar a b b sell i = Bazaar (\k -> k i) {-# INLINE sell #-} -instance (c ~ d) => ComonadApply (Bazaar c d) where+instance (s ~ t) => ComonadApply (Bazaar s t) where (<@>) = (<*>) -- | Wrap a monadic effect with a phantom type argument.@@ -346,25 +348,25 @@ Effect ma <*> Effect mb = Effect (liftM2 mappend ma mb) -- | Wrap a monadic effect with a phantom type argument. Used when magnifying RWST.-newtype EffectRWS w s m c a = EffectRWS { getEffectRWS :: s -> m (c,s,w) }+newtype EffectRWS w st m s a = EffectRWS { getEffectRWS :: st -> m (s,st,w) } -instance Functor (EffectRWS w s m c) where+instance Functor (EffectRWS w st m s) where fmap _ (EffectRWS m) = EffectRWS m -instance (Monoid c, Monoid w, Monad m) => Applicative (EffectRWS w s m c) where- pure _ = EffectRWS $ \s -> return (mempty, s, mempty)- EffectRWS m <*> EffectRWS n = EffectRWS $ \s -> m s >>= \ (c,t,w) -> n t >>= \ (c',u,w') -> return (mappend c c', u, mappend w w')+instance (Monoid s, Monoid w, Monad m) => Applicative (EffectRWS w st m s) where+ pure _ = EffectRWS $ \st -> return (mempty, st, mempty)+ EffectRWS m <*> EffectRWS n = EffectRWS $ \st -> m st >>= \ (s,t,w) -> n t >>= \ (s',u,w') -> return (mappend s s', u, mappend w w') {- -- | Wrap a monadic effect with a phantom type argument. Used when magnifying StateT.-newtype EffectS s k c a = EffectS { runEffect :: s -> k (c, s) a }+newtype EffectS st k s a = EffectS { runEffect :: st -> k (s, st) a } -instance Functor (k (c, s)) => Functor (EffectS s m c) where+instance Functor (k (s, st)) => Functor (EffectS st m s) where fmap f (EffectS m) = EffectS (fmap f . m) -instance (Monoid c, Monad m) => Applicative (EffectS s m c) where- pure _ = EffectS $ \s -> return (mempty, s)- EffectS m <*> EffectS n = EffectS $ \s -> m s >>= \ (c,t) -> n s >>= \ (d, u) -> return (mappend c d, u)+instance (Monoid s, Monad m) => Applicative (EffectS st m s) where+ pure _ = EffectS $ \st -> return (mempty, st)+ EffectS m <*> EffectS n = EffectS $ \st -> m st >>= \ (s,t) -> n st >>= \ (s', u) -> return (mappend s s', u) -} -------------------------------------------------------------------------------@@ -396,10 +398,10 @@ instance Gettable (Effect m r) where coerce (Effect m) = Effect m -instance Gettable (EffectRWS w s m c) where+instance Gettable (EffectRWS w st m s) where coerce (EffectRWS m) = EffectRWS m ---instance Gettable (EffectS s m c) where+--instance Gettable (EffectS st m s) where -- coerce (EffectS m) = EffectS m -- | This instance is a lie, but it is a useful lie.
src/Control/Lens/Iso.hs view
@@ -64,30 +64,31 @@ -- import Prelude hiding (('Prelude..'),'Prelude.id') -- @ ----- @type 'Iso' a b c d = forall k f. ('Isomorphic' k, 'Functor' f) => 'Overloaded' k f a b c d@-type Iso a b c d = forall k f. (Isomorphic k, Functor f) => k (c -> f d) (a -> f b)+-- @type 'Iso' s t a b = forall k f. ('Isomorphic' k, 'Functor' f) => 'Overloaded' k f s t a b@+type Iso s t a b = forall k f. (Isomorphic k, Functor f) => k (a -> f b) (s -> f t) -- | -- @type 'SimpleIso' = 'Control.Lens.Type.Simple' 'Iso'@-type SimpleIso a b = Iso a a b b+type SimpleIso s a = Iso s s a a -- | An commonly used infix alias for @'Control.Lens.Type.Simple' 'Iso'@-type a :<-> b = Iso a a b b+type s :<-> a = Iso s s a a -- | Build an isomorphism family from two pairs of inverse functions -- -- @--- 'view' ('isos' ac ca bd db) ≡ ac--- 'view' ('from' ('isos' ac ca bd db)) ≡ ca--- 'set' ('isos' ac ca bd db) cd ≡ db '.' cd '.' ac+-- 'view' ('isos' sa as tb bt) ≡ sa+-- 'view' ('from' ('isos' sa as tb bt)) ≡ as+-- 'set' ('isos' sa as tb bt) ab ≡ bt '.' ab '.' sa -- 'set' ('from' ('isos' ac ca bd db')) ab ≡ bd '.' ab '.' ca+-- 'set' ('from' ('isos' sa as tb bt')) s t ≡ tb '.' st '.' as -- @ ----- @isos :: (a -> c) -> (c -> a) -> (b -> d) -> (d -> b) -> 'Iso' a b c d@-isos :: (Isomorphic k, Functor f) => (a -> c) -> (c -> a) -> (b -> d) -> (d -> b) -> k (c -> f d) (a -> f b)-isos ac ca bd db = isomorphic- (\cfd a -> db <$> cfd (ac a))- (\afb c -> bd <$> afb (ca c))+-- @isos :: (s -> a) -> (a -> s) -> (t -> b) -> (b -> t) -> 'Iso' s t a b@+isos :: (Isomorphic k, Functor f) => (s -> a) -> (a -> s) -> (t -> b) -> (b -> t) -> k (a -> f b) (s -> f t)+isos sa as tb bt = isomorphic+ (\afb s -> bt <$> afb (sa s))+ (\sft a -> tb <$> sft (as a)) {-# INLINE isos #-} -- | Build a simple isomorphism from a pair of inverse functions@@ -100,9 +101,9 @@ -- 'set' ('from' ('iso' f g')) h ≡ f '.' h '.' g -- @ ----- @iso :: (a -> b) -> (b -> a) -> 'Control.Lens.Type.Simple' 'Iso' a b@-iso :: (Isomorphic k, Functor f) => (a -> b) -> (b -> a) -> k (b -> f b) (a -> f a)-iso ab ba = isos ab ba ab ba+-- @iso :: (s -> a) -> (a -> s) -> 'Control.Lens.Type.Simple' 'Iso' s a@+iso :: (Isomorphic k, Functor f) => (s -> a) -> (a -> s) -> k (a -> f a) (s -> f s)+iso sa as = isos sa as sa as {-# INLINE iso #-} -- | Based on @ala@ from Conor McBride's work on Epigram.@@ -110,7 +111,7 @@ -- >>> :m + Data.Monoid.Lens Data.Foldable -- >>> ala _sum foldMap [1,2,3,4] -- 10-ala :: Simple Iso a b -> ((a -> b) -> c -> b) -> c -> a+ala :: Simple Iso s a -> ((s -> a) -> e -> a) -> e -> s ala l f e = f (view l) e ^. from l {-# INLINE ala #-} @@ -119,7 +120,7 @@ -- -- Mnemonically, the German /auf/ plays a similar role to /à la/, and the combinator -- is 'ala' with an extra function argument.-auf :: Simple Iso a b -> ((d -> b) -> c -> b) -> (d -> a) -> c -> a+auf :: Simple Iso s a -> ((b -> a) -> e -> a) -> (b -> s) -> e -> s auf l f g e = f (view l . g) e ^. from l {-# INLINE auf #-} @@ -127,8 +128,8 @@ -- -- @'under' = 'over' '.' 'from'@ ----- @'under' :: 'Iso' a b c d -> (a -> b) -> c -> d@-under :: Isomorphism (c -> Mutator d) (a -> Mutator b) -> (a -> b) -> c -> d+-- @'under' :: 'Iso' s t a b -> (s -> t) -> a -> b@+under :: Isomorphism (a -> Mutator b) (s -> Mutator t) -> (s -> t) -> a -> b under = over . from {-# INLINE under #-} @@ -161,7 +162,7 @@ ----------------------------------------------------------------------------- -- | Useful for storing isomorphisms in containers.-newtype ReifiedIso a b c d = ReifyIso { reflectIso :: Iso a b c d }+newtype ReifiedIso s t a b = ReifyIso { reflectIso :: Iso s t a b } -- | @type 'SimpleReifiedIso' = 'Control.Lens.Type.Simple' 'ReifiedIso'@-type SimpleReifiedIso a b = ReifiedIso a a b b+type SimpleReifiedIso s a = ReifiedIso s s a a
src/Control/Lens/Plated.hs view
@@ -201,8 +201,8 @@ -- -- @'childrenOn' ≡ 'toListOf'@ ----- @'childrenOn' :: 'Fold' a c -> a -> [c]@-childrenOn :: Getting [c] a b c d -> a -> [c]+-- @'childrenOn' :: 'Fold' s a -> s -> [a]@+childrenOn :: Getting [a] s t a b -> s -> [a] childrenOn = toListOf {-# INLINE childrenOn #-} @@ -245,24 +245,24 @@ -- | Rewrite recursively over part of a larger structure. -- -- @--- 'rewriteOn' :: 'Plated' c => 'Simple' 'Control.Lens.Iso.Iso' a b -> (b -> 'Maybe' b) -> a -> a--- 'rewriteOn' :: 'Plated' c => 'Simple' 'Lens' a b -> (b -> 'Maybe' b) -> a -> a--- 'rewriteOn' :: 'Plated' c => 'Simple' 'Traversal' a b -> (b -> 'Maybe' b) -> a -> a--- 'rewriteOn' :: 'Plated' c => 'Simple' 'Setting' a b -> (b -> 'Maybe' b) -> a -> a+-- 'rewriteOn' :: 'Plated' a => 'Simple' 'Control.Lens.Iso.Iso' s a -> (a -> 'Maybe' a) -> s -> s+-- 'rewriteOn' :: 'Plated' a => 'Simple' 'Lens' s a -> (a -> 'Maybe' a) -> s -> s+-- 'rewriteOn' :: 'Plated' a => 'Simple' 'Traversal' s a -> (a -> 'Maybe' a) -> s -> s+-- 'rewriteOn' :: 'Plated' a => 'Simple' 'Setting' s a -> (a -> 'Maybe' a) -> s -> s -- @-rewriteOn :: Plated c => Setting a b c c -> (c -> Maybe c) -> a -> b+rewriteOn :: Plated a => Setting s t a a -> (a -> Maybe a) -> s -> t rewriteOn b = over b . rewrite {-# INLINE rewriteOn #-} -- | Rewrite recursively over part of a larger structure using a specified setter. -- -- @--- 'rewriteOnOf' :: 'Plated' b => 'Simple' 'Control.Lens.Iso.Iso' a b -> 'Simple' 'Control.Lens.Iso.Iso' b b -> (b -> 'Maybe' b) -> a -> a--- 'rewriteOnOf' :: 'Plated' b => 'Simple' 'Lens' a b -> 'Simple' 'Lens' b b -> (b -> 'Maybe' b) -> a -> a--- 'rewriteOnOf' :: 'Plated' b => 'Simple' 'Traversal' a b -> 'Simple' 'Traversal' b b -> (b -> 'Maybe' b) -> a -> a--- 'rewriteOnOf' :: 'Plated' b => 'Simple' 'Setter' a b -> 'Simple' 'Setter' b b -> (b -> 'Maybe' b) -> a -> a+-- 'rewriteOnOf' :: 'Plated' a => 'Simple' 'Control.Lens.Iso.Iso' s a -> 'Simple' 'Control.Lens.Iso.Iso' a a -> (a -> 'Maybe' a) -> s -> s+-- 'rewriteOnOf' :: 'Plated' a => 'Simple' 'Lens' s a -> 'Simple' 'Lens' a a -> (a -> 'Maybe' a) -> s -> s+-- 'rewriteOnOf' :: 'Plated' a => 'Simple' 'Traversal' s a -> 'Simple' 'Traversal' a a -> (a -> 'Maybe' a) -> s -> s+-- 'rewriteOnOf' :: 'Plated' a => 'Simple' 'Setter' s a -> 'Simple' 'Setter' a a -> (a -> 'Maybe' a) -> s -> s -- @-rewriteOnOf :: Setting a b c c -> SimpleSetting c c -> (c -> Maybe c) -> a -> b+rewriteOnOf :: Setting s t a a -> SimpleSetting a a -> (a -> Maybe a) -> s -> t rewriteOnOf b l = over b . rewriteOf l {-# INLINE rewriteOnOf #-} @@ -281,13 +281,13 @@ -- | Rewrite by applying a monadic rule everywhere inside of a structure located by a user-specified 'Traversal'. -- Ensures that the rule cannot be applied anywhere in the result.-rewriteMOn :: (Monad m, Plated c) => LensLike (WrappedMonad m) a b c c -> (c -> m (Maybe c)) -> a -> m b+rewriteMOn :: (Monad m, Plated a) => LensLike (WrappedMonad m) s t a a -> (a -> m (Maybe a)) -> s -> m t rewriteMOn b = mapMOf b . rewriteM {-# INLINE rewriteMOn #-} -- | Rewrite by applying a monadic rule everywhere inside of a structure located by a user-specified 'Traversal', -- using a user-specified 'Traversal' for recursion. Ensures that the rule cannot be applied anywhere in the result.-rewriteMOnOf :: Monad m => LensLike (WrappedMonad m) a b c c -> SimpleLensLike (WrappedMonad m) c c -> (c -> m (Maybe c)) -> a -> m b+rewriteMOnOf :: Monad m => LensLike (WrappedMonad m) s t a a -> SimpleLensLike (WrappedMonad m) a a -> (a -> m (Maybe a)) -> s -> m t rewriteMOnOf b l = mapMOf b . rewriteMOf l {-# INLINE rewriteMOnOf #-} @@ -309,7 +309,7 @@ {-# INLINE universeOf #-} -- | Given a 'Fold' that knows how to find 'Plated' parts of a container retrieve them and all of their descendants, recursively.-universeOn :: Plated c => Getting [c] a b c c -> a -> [c]+universeOn :: Plated a => Getting [a] s t a a -> s -> [a] universeOn b = universeOnOf b plate {-# INLINE universeOn #-} @@ -317,7 +317,7 @@ -- in a region indicated by another 'Fold'. -- -- @'toListOf' l ≡ 'universeOnOf' l 'ignored'@-universeOnOf :: Getting [c] a b c d -> Getting [c] c d c d -> a -> [c]+universeOnOf :: Getting [a] s t a b -> Getting [a] a b a b -> s -> [a] universeOnOf b = foldMapOf b . universeOf {-# INLINE universeOnOf #-} @@ -341,10 +341,10 @@ -- | Transform every element in the tree in a bottom-up manner over a region indicated by a 'Setter'. -- -- @--- 'transformOn' :: 'Plated' b => 'Simple' 'Traversal' a b -> (b -> b) -> a -> a--- 'transformOn' :: 'Plated' b => 'Simple' 'Setter' a b -> (b -> b) -> a -> a+-- 'transformOn' :: 'Plated' a => 'Simple' 'Traversal' s a -> (a -> a) -> s -> s+-- 'transformOn' :: 'Plated' a => 'Simple' 'Setter' s a -> (a -> a) -> s -> s -- @-transformOn :: Plated c => Setting a b c c -> (c -> c) -> a -> b+transformOn :: Plated a => Setting s t a a -> (a -> a) -> s -> t transformOn b = over b . transform {-# INLINE transformOn #-} @@ -363,10 +363,10 @@ -- in a bottom-up manner. -- -- @--- 'transformOnOf' :: 'Setter' a b -> 'Simple' 'Traversal' b b -> (b -> b) -> a -> a--- 'transformOnOf' :: 'Setter' a b -> 'Simple' 'Setter' b b -> (b -> b) -> a -> a+-- 'transformOnOf' :: 'Simple' 'Setter' s a -> 'Simple' 'Traversal' a a -> (a -> a) -> s -> s+-- 'transformOnOf' :: 'Simple' 'Setter' s a -> 'Simple' 'Setter' a a -> (a -> a) -> s -> s -- @-transformOnOf :: Setting a b c c -> SimpleSetting c c -> (c -> c) -> a -> b+transformOnOf :: Setting s t a a -> SimpleSetting a a -> (a -> a) -> s -> t transformOnOf b l = over b . transformOf l {-# INLINE transformOnOf #-} @@ -377,8 +377,8 @@ -- | Transform every element in the tree in a region indicated by a supplied 'Traversal', in a bottom-up manner, monadically. ----- @'transformMOn' :: ('Monad' m, 'Plated' c) => 'Simple' 'Traversal' a b -> (b -> m b) -> a -> m a@-transformMOn :: (Monad m, Plated c) => LensLike (WrappedMonad m) a b c c -> (c -> m c) -> a -> m b+-- @'transformMOn' :: ('Monad' m, 'Plated' a) => 'Simple' 'Traversal' s a -> (a -> m a) -> s -> m s@+transformMOn :: (Monad m, Plated a) => LensLike (WrappedMonad m) s t a a -> (a -> m a) -> s -> m t transformMOn b = mapMOf b . transformM {-# INLINE transformMOn #-} @@ -393,8 +393,8 @@ -- | Transform every element in a tree that lies in a region indicated by a supplied 'Traversal', walking with a user supplied 'Traversal' in -- a bottom-up manner with a monadic effect. ----- @'transformMOnOf' :: 'Monad' m => 'Simple' 'Traversal' a b -> 'Simple' 'Traversal' b b -> (b -> m b) -> a -> m a@-transformMOnOf :: Monad m => LensLike (WrappedMonad m) a b c c -> SimpleLensLike (WrappedMonad m) c c -> (c -> m c) -> a -> m b+-- @'transformMOnOf' :: 'Monad' m => 'Simple' 'Traversal' s a -> 'Simple' 'Traversal' a a -> (a -> m a) -> s -> m s@+transformMOnOf :: Monad m => LensLike (WrappedMonad m) s a a a -> SimpleLensLike (WrappedMonad m) a a -> (a -> m a) -> s -> m a transformMOnOf b l = mapMOf b . transformMOf l {-# INLINE transformMOnOf #-} @@ -415,10 +415,10 @@ -- @'descendOf' ≡ 'over'@ -- -- @--- 'descendOf' :: 'Simple' 'Setter' a b -> (b -> b) -> a -> a--- 'descendOf' :: 'Simple' 'Traversal' a b -> (b -> b) -> a -> a+-- 'descendOf' :: 'Simple' 'Setter' s a -> (a -> a) -> s -> s+-- 'descendOf' :: 'Simple' 'Traversal' s a -> (a -> a) -> s -> s -- @-descendOf :: Setting a b c d -> (c -> d) -> a -> b+descendOf :: Setting s t a b -> (a -> b) -> s -> t descendOf = over {-# INLINE descendOf #-} @@ -427,11 +427,11 @@ -- @'descendOnOf' b l ≡ 'over' (b '.' l)@ -- -- @--- 'descendOnOf' :: 'Simple' 'Setter' a b -> 'Simple' 'Setter' b b -> (b -> b) -> a -> a--- 'descendOnOf' :: 'Simple' 'Traversal' a b -> 'Simple' 'Traversal' b b -> (b -> b) -> a -> a+-- 'descendOnOf' :: 'Simple' 'Setter' s a -> 'Simple' 'Setter' a a -> (a -> a) -> s -> s+-- 'descendOnOf' :: 'Simple' 'Traversal' s a -> 'Simple' 'Traversal' a a -> (a -> a) -> s -> s -- @ ---descendOnOf :: Setting a b c d -> Setting c d e f -> (e -> f) -> a -> b+descendOnOf :: Setting s t a b -> Setting a b u v -> (u -> v) -> s -> t descendOnOf b l = over (b.l) {-# INLINE descendOnOf #-} @@ -439,8 +439,8 @@ -- -- @'descendOn' b ≡ 'over' (b '.' 'plate')@ ----- @'descendOn' :: 'Plated' c => 'Setter' a b -> (b -> b) -> a -> a@-descendOn :: Plated c => Setting a b c c -> (c -> c) -> a -> b+-- @'descendOn' :: 'Plated' a => 'Setter' s t -> (t -> t) -> s -> s@+descendOn :: Plated a => Setting s t a a -> (a -> a) -> s -> t descendOn b = over (b . plate) {-# INLINE descendOn #-} @@ -461,8 +461,8 @@ -- -- @'descendAOf' ≡ 'id'@ ----- @'descendAOf' :: 'Applicative' m => 'Simple' 'Traversal' a b => (b -> m b) -> a -> m a@-descendAOf :: Applicative f => LensLike f a b c d -> (c -> f d) -> a -> f b+-- @'descendAOf' :: 'Applicative' m => 'Simple' 'Traversal' s a => (a -> m a) -> s -> m s@+descendAOf :: Applicative f => LensLike f s t a b -> (a -> f b) -> s -> f t descendAOf = id {-# INLINE descendAOf #-} @@ -470,8 +470,8 @@ -- -- @'descendAOnOf' ≡ ('.')@ ----- @'descendAOnOf' :: 'Applicative' f => 'Simple' 'Traversal' a b -> 'Simple' 'Traversal' b b -> (b -> f b) -> a -> f a@-descendAOnOf :: Applicative g => LensLike g a b c d -> LensLike g c d e f -> (e -> g f) -> a -> g b+-- @'descendAOnOf' :: 'Applicative' f => 'Simple' 'Traversal' s a -> 'Simple' 'Traversal' a a -> (a -> f a) -> s -> f s@+descendAOnOf :: Applicative f => LensLike f u v s t -> LensLike f s t a b -> (a -> f b) -> u -> f v descendAOnOf = (.) {-# INLINE descendAOnOf #-} @@ -479,8 +479,8 @@ -- -- @'descendAOn' b ≡ b '.' 'plate'@ ----- @'descendAOn' :: ('Applicative' f, Plated' c) => 'Simple' 'Traversal' a b -> (b -> f b) -> a -> f a@-descendAOn :: (Applicative f, Plated c) => LensLike f a b c c -> (c -> f c) -> a -> f b+-- @'descendAOn' :: ('Applicative' f, Plated' a) => 'Simple' 'Traversal' s a -> (a -> f a) -> s -> f s@+descendAOn :: (Applicative f, Plated a) => LensLike f s t a a -> (a -> f a) -> s -> f t descendAOn b = b . plate {-# INLINE descendAOn #-} @@ -497,8 +497,8 @@ -- -- @'descendAOf_' ≡ 'traverseOf_'@ ----- @'descendAOf_' :: 'Applicative' f => 'Fold' a b => (b -> f b) -> a -> f ()@-descendAOf_ :: Applicative f => Getting (Traversed f) a b c d -> (c -> f e) -> a -> f ()+-- @'descendAOf_' :: 'Applicative' f => 'Fold' s a => (a -> f r) -> s -> f ()@+descendAOf_ :: Applicative f => Getting (Traversed f) s t a b -> (a -> f r) -> s -> f () descendAOf_ = traverseOf_ {-# INLINE descendAOf_ #-} @@ -506,8 +506,8 @@ -- -- @'descendAOnOf_' b l ≡ 'traverseOf_' (b '.' l)@ ----- @'descendAOnOf_' :: 'Applicative' f => 'Fold' a b -> 'Fold' b b -> (b -> f c) -> a -> f ()@-descendAOnOf_ :: Applicative f => Getting (Traversed f) a b c d -> Getting (Traversed f) c d c d -> (c -> f e) -> a -> f ()+-- @'descendAOnOf_' :: 'Applicative' f => 'Fold' s a -> 'Fold' a a -> (a -> f r) -> s -> f ()@+descendAOnOf_ :: Applicative f => Getting (Traversed f) s t a b -> Getting (Traversed f) a b a b -> (a -> f r) -> s -> f () descendAOnOf_ b l = traverseOf_ (b . l) {-# INLINE descendAOnOf_ #-} @@ -515,8 +515,8 @@ -- -- @'descendAOn_' b ≡ 'traverseOf_' (b '.' 'plate')@ ----- @'descendAOn_' :: ('Applicative' f, 'Plated' b) => 'Simple' 'Traversal' a b -> (b -> f c) -> a -> f ()@-descendAOn_ :: (Applicative f, Plated c) => Getting (Traversed f) a b c c -> (c -> f e) -> a -> f ()+-- @'descendAOn_' :: ('Applicative' f, 'Plated' a) => 'Simple' 'Traversal' s a -> (a -> f r) -> s -> f ()@+descendAOn_ :: (Applicative f, Plated a) => Getting (Traversed f) s t a a -> (a -> f r) -> s -> f () descendAOn_ b = traverseOf_ (b . plate) {-# INLINE descendAOn_ #-} @@ -536,8 +536,8 @@ -- -- @'descendMOf' ≡ 'mapMOf'@ ----- @'descendMOf' :: 'Monad' m => 'Simple' 'Traversal' a b => (b -> m b) -> a -> m a@-descendMOf :: Monad m => LensLike (WrappedMonad m) a b c d -> (c -> m d) -> a -> m b+-- @'descendMOf' :: 'Monad' m => 'Simple' 'Traversal' s a => (a -> m a) -> s -> m s@+descendMOf :: Monad m => LensLike (WrappedMonad m) s t a b -> (a -> m b) -> s -> m t descendMOf = mapMOf {-# INLINE descendMOf #-} @@ -545,8 +545,8 @@ -- -- @'descendMOnOf' b l ≡ 'mapMOf' (b '.' l)@ ----- @'descendMOnOf' :: 'Monad' m => 'Simple' 'Traversal' a b -> 'Simple' 'Traversal' b b -> (b -> m b) -> a -> m a@-descendMOnOf :: Monad m => LensLike (WrappedMonad m) a b c c -> SimpleLensLike (WrappedMonad m) c c -> (c -> m c) -> a -> m b+-- @'descendMOnOf' :: 'Monad' m => 'Simple' 'Traversal' s a -> 'Simple' 'Traversal' a a -> (a -> m a) -> s -> m s@+descendMOnOf :: Monad m => LensLike (WrappedMonad m) s t a a -> SimpleLensLike (WrappedMonad m) a a -> (a -> m a) -> s -> m t descendMOnOf b l = mapMOf (b . l) {-# INLINE descendMOnOf #-} @@ -554,8 +554,8 @@ -- -- @'descendMOn' b ≡ 'mapMOf' (b . 'plate')@ ----- @'descendMOn' :: ('Monad' m, 'Plated' c) => 'Simple' 'Traversal' a b -> (b -> m b) -> a -> m a@-descendMOn :: (Monad m, Plated c) => LensLike (WrappedMonad m) a b c c -> (c -> m c) -> a -> m b+-- @'descendMOn' :: ('Monad' m, 'Plated' a) => 'Simple' 'Traversal' s a -> (a -> m a) -> s -> m s@+descendMOn :: (Monad m, Plated a) => LensLike (WrappedMonad m) s t a a -> (a -> m a) -> s -> m t descendMOn b = mapMOf (b . plate) {-# INLINE descendMOn #-} @@ -570,8 +570,8 @@ -- -- @'descendMOf_' ≡ 'mapMOf_'@ ----- @'descendMOf_' :: 'Monad' m => 'Fold' a b => (b -> m b) -> a -> m ()@-descendMOf_ :: Monad m => Getting (Sequenced m) a b c d -> (c -> m e) -> a -> m ()+-- @'descendMOf_' :: 'Monad' m => 'Fold' s a => (a -> m a) -> s -> m ()@+descendMOf_ :: Monad m => Getting (Sequenced m) s t a b -> (a -> m r) -> s -> m () descendMOf_ = mapMOf_ {-# INLINE descendMOf_ #-} @@ -579,8 +579,8 @@ -- -- @'descendMOnOf_' b l ≡ 'mapMOf_' (b '.' l)@ ----- @'descendMOnOf_' :: 'Monad' m => 'Fold' a b -> 'Fold' b b -> (b -> m b) -> a -> m ()@-descendMOnOf_ :: Monad m => Getting (Sequenced m) a b c d -> Getting (Sequenced m) c d c d -> (c -> m e) -> a -> m ()+-- @'descendMOnOf_' :: 'Monad' m => 'Fold' s a -> 'Fold' a a -> (a -> m a) -> s -> m ()@+descendMOnOf_ :: Monad m => Getting (Sequenced m) s t a b -> Getting (Sequenced m) a b a b -> (a -> m r) -> s -> m () descendMOnOf_ b l = mapMOf_ (b . l) {-# INLINE descendMOnOf_ #-} @@ -588,8 +588,8 @@ -- -- @'descendMOn_' b ≡ 'mapMOf_' (b '.' 'plate')@ ----- @'descendMOn_' :: ('Monad' m, 'Plated' b) => 'Simple' 'Traversal' a b -> (b -> m c) -> a -> m ()@-descendMOn_ :: (Monad m, Plated c) => Getting (Sequenced m) a b c c -> (c -> m e) -> a -> m ()+-- @'descendMOn_' :: ('Monad' m, 'Plated' a) => 'Simple' 'Traversal' s a -> (a -> m r) -> b -> m ()@+descendMOn_ :: (Monad m, Plated a) => Getting (Sequenced m) s t a a -> (a -> m r) -> s -> m () descendMOn_ b = mapMOf_ (b . plate) {-# INLINE descendMOn_ #-} @@ -629,16 +629,16 @@ -- -- @'contextsOn' b ≡ 'contextsOnOf' b 'plate'@ ----- @'contextsOn' :: 'Plated' b => 'Simple' 'Traversal' a b -> a -> ['Context' b b a]@-contextsOn :: Plated c => LensLike (Bazaar c c) a b c c -> a -> [Context c c b]+-- @'contextsOn' :: 'Plated' a => 'Simple' 'Traversal' s a -> s -> ['Context' a a s]@+contextsOn :: Plated a => LensLike (Bazaar a a) s t a a -> s -> [Context a a t] contextsOn b = contextsOnOf b plate {-# INLINE contextsOn #-} -- | Return a list of all of the editable contexts for every location in the structure in an areas indicated by a user supplied 'Traversal', recursively using -- another user-supplied 'Traversal' to walk each layer. ----- @'contextsOnOf' :: 'Simple' 'Traversal' a b -> 'Simple' 'Traversal' b b -> a -> ['Context' b b a]@-contextsOnOf :: LensLike (Bazaar c c) a b c c -> SimpleLensLike (Bazaar c c) c c -> a -> [Context c c b]+-- @'contextsOnOf' :: 'Simple' 'Traversal' s a -> 'Simple' 'Traversal' a a -> s -> ['Context' a a s]@+contextsOnOf :: LensLike (Bazaar a a) s t a a -> SimpleLensLike (Bazaar a a) a a -> s -> [Context a a t] contextsOnOf b l = f . holesOf b where f xs = do Context ctx child <- xs@@ -670,11 +670,11 @@ -- @ -- -- @--- 'holesOf' :: 'Simple' 'Iso' a b -> a -> ['Context' b a]--- 'holesOf' :: 'Simple' 'Lens' a b -> a -> ['Context' b a]--- 'holesOf' :: 'Simple' 'Traversal' a b -> a -> ['Context' b a]+-- 'holesOf' :: 'Simple' 'Iso' s a -> s -> ['Context' a a s]+-- 'holesOf' :: 'Simple' 'Lens' s a -> s -> ['Context' a a s]+-- 'holesOf' :: 'Simple' 'Traversal' s a -> s -> ['Context' a a s] -- @-holesOf :: LensLike (Bazaar c c) a b c c -> a -> [Context c c b]+holesOf :: LensLike (Bazaar a a) s t a a -> s -> [Context a a t] holesOf l a = f (ins b) (outs b) where b = l sell a f [] _ = []@@ -687,11 +687,11 @@ -- @'holesOn' ≡ 'holesOf'@ -- -- @--- 'holesOn' :: 'Simple' 'Iso' a b -> a -> ['Context' b b a]--- 'holesOn' :: 'Simple' 'Lens' a b -> a -> ['Context' b b a]--- 'holesOn' :: 'Simple' 'Traversal' a b -> a -> ['Context' b b a]+-- 'holesOn' :: 'Simple' 'Iso' s a -> s -> ['Context' a a s]+-- 'holesOn' :: 'Simple' 'Lens' s a -> s -> ['Context' a a s]+-- 'holesOn' :: 'Simple' 'Traversal' s a -> s -> ['Context' a a s] -- @-holesOn :: LensLike (Bazaar c c) a b c c -> a -> [Context c c b]+holesOn :: LensLike (Bazaar a a) s t a a -> s -> [Context a a t] holesOn = holesOf {-# INLINE holesOn #-} @@ -700,11 +700,11 @@ -- @'holesOnOf' b l ≡ 'holesOf' (b '.' l)@ -- -- @--- 'holesOnOf' :: 'Simple' 'Iso' a b -> 'Simple' 'Iso' b b -> a -> ['Context' b a]--- 'holesOnOf' :: 'Simple' 'Lens' a b -> 'Simple' 'Lens' b b -> a -> ['Context' b a]--- 'holesOnOf' :: 'Simple' 'Traversal' a b -> 'Simple' 'Traversal' b b -> a -> ['Context' b a]+-- 'holesOnOf' :: 'Simple' 'Iso' s a -> 'Simple' 'Iso' a a -> s -> ['Context' a a s]+-- 'holesOnOf' :: 'Simple' 'Lens' s a -> 'Simple' 'Lens' a a -> s -> ['Context' a a s]+-- 'holesOnOf' :: 'Simple' 'Traversal' s a -> 'Simple' 'Traversal' a a -> s -> ['Context' a a s] -- @-holesOnOf :: LensLike (Bazaar e e) a b c d -> LensLike (Bazaar e e) c d e e -> a -> [Context e e b]+holesOnOf :: LensLike (Bazaar r r) s t a b -> LensLike (Bazaar r r) a b r r -> s -> [Context r r t] holesOnOf b l = holesOf (b.l) {-# INLINE holesOnOf #-} @@ -776,31 +776,31 @@ -- So technically, this is only a lens if you do not change the number of results it returns. -- -- @--- 'partsOf' :: 'Simple' 'Control.Lens.Iso.Iso' a b -> 'Simple' 'Lens' a [b]--- 'partsOf' :: 'Simple' 'Lens' a b -> 'Simple' 'Lens' a [b]--- 'partsOf' :: 'Simple' 'Traversal' a b -> 'Simple' 'Lens' a [b]+-- 'partsOf' :: 'Simple' 'Control.Lens.Iso.Iso' s a -> 'Simple' 'Lens' s [a]+-- 'partsOf' :: 'Simple' 'Lens' s a -> 'Simple' 'Lens' s [a]+-- 'partsOf' :: 'Simple' 'Traversal' s a -> 'Simple' 'Lens' s [a] -- @-partsOf :: LensLike (Bazaar c c) a b c c -> Lens a b [c] [c]+partsOf :: LensLike (Bazaar a a) s t a a -> Lens s t [a] [a] partsOf l f a = outs b <$> f (ins b) where b = l sell a {-# INLINE partsOf #-} -- | 'unsafePartsOf' turns a 'Traversal' into a @uniplate@ (or @biplate@) family. ----- If you do not need the types of @c@ and @d@ to be different, it is recommended that+-- If you do not need the types of @s@ and @t@ to be different, it is recommended that -- you use 'partsOf' -- -- It is generally safer to traverse with the 'Bazaar' rather than use this -- 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!+-- This is unsafe because if you don't supply at least as many @b@'s as you were+-- given @a@'s, then the reconstruction of @t@ /will/ result in an error! -- -- @--- 'unsafePartsOf' :: 'Control.Lens.Iso.Iso' a b c d -> 'Lens' a b [c] [d]--- 'unsafePartsOf' :: 'Lens' a b c d -> 'Lens' a b [c] [d]--- 'unsafePartsOf' :: 'Traversal' a b c d -> 'Lens' a b [c] [d]+-- 'unsafePartsOf' :: 'Control.Lens.Iso.Iso' s t a b -> 'Lens' s t [a] [b]+-- 'unsafePartsOf' :: 'Lens' s t a b -> 'Lens' s t [a] [b]+-- 'unsafePartsOf' :: 'Traversal' s t a b -> 'Lens' s t [a] [b] -- @-unsafePartsOf :: LensLike (Bazaar c d) a b c d -> Lens a b [c] [d]+unsafePartsOf :: LensLike (Bazaar a b) s t a b -> Lens s t [a] [b] unsafePartsOf l f a = unsafeOuts b <$> f (ins b) where b = l sell a {-# INLINE unsafePartsOf #-} @@ -808,18 +808,18 @@ -- Misc. ------------------------------------------------------------------------------- -ins :: Bazaar c d a -> [c]+ins :: Bazaar a b s -> [a] ins (Bazaar m) = getConst (m (Const . return)) {-# INLINE ins #-} -newtype Out c a = Out { withOut :: [c] -> (a, [c]) }+newtype Out s a = Out { withOut :: [s] -> (a, [s]) } -instance Functor (Out c) where+instance Functor (Out s) where fmap f (Out m) = Out $ \cs -> case m cs of (as, ds) -> (f as, ds) {-# INLINE fmap #-} -instance Applicative (Out c) where+instance Applicative (Out s) where pure a = Out $ \cs -> (a, cs) {-# INLINE pure #-} Out mf <*> Out ma = Out $ \cs -> case mf cs of@@ -827,13 +827,13 @@ (a, es) -> (f a, es) {-# INLINE (<*>) #-} -outs :: Bazaar c c a -> [c] -> a+outs :: Bazaar a a s -> [a] -> s outs (Bazaar m) = fst . withOut (m $ \c -> Out $ \cs -> case cs of [] -> (c, []) (d:ds) -> (d, ds)) {-# INLINE outs #-} -unsafeOuts :: Bazaar c d a -> [d] -> a+unsafeOuts :: Bazaar a b s -> [b] -> s unsafeOuts (Bazaar m) = fst . withOut (m $ \_ -> Out $ \cs -> case cs of (d:ds) -> (d, ds) [] -> error "unsafePartsOf: not enough elements were supplied")
src/Control/Lens/Projection.hs view
@@ -33,7 +33,7 @@ import Control.Lens.Iso -- | A 'Projection' is a 'Traversal' that can also be turned around with 'by' to obtain a 'Getter'-type Projection a b c d = forall k f. (Projective k a d, Applicative f) => k (c -> f d) (a -> f a)+type Projection s t a b = forall k f. (Projective k s b, Applicative f) => k (a -> f b) (s -> f s) -- | Used to provide overloading of projections. class Projective k a d where@@ -43,32 +43,32 @@ projective _ x = x -- | A concrete 'Projection', suitable for storing in a container or extracting an embedding.-data Project a d x y = Project (d -> a) (x -> y)+data Project s b x y = Project (b -> s) (x -> y) -- | Compose projections.-stereo :: Projective k a c => Project b c y z -> Project a b x y -> k x z+stereo :: Projective k s a => Project t a y z -> Project s t x y -> k x z stereo (Project g f) (Project i h) = projective (i.g) (f.h) -instance (a ~ a', d ~ d') => Projective (Project a d) a' d' where+instance (s ~ s', b ~ b') => Projective (Project s b) s' b' where projective = Project -- | Reflect a 'Projection'.-project :: Projective k a d => Overloaded (Project a d) f a a c d -> Overloaded k f a a c d+project :: Projective k s b => Overloaded (Project s b) f s s a b -> Overloaded k f s s a b project (Project f g) = projective f g -- | Turn a 'Projection' around to get an embedding-by :: Project a d (d -> Identity d) (a -> Identity a) -> Getter d a+by :: Project s b (b -> Identity b) (s -> Identity s) -> Getter b s by (Project g _) = to g -- | Build a 'Projection'-projection :: (d -> a) -> (a -> Maybe c) -> Projection a b c d-projection da amc = projective da (\cfd a -> maybe (pure a) (fmap da . cfd) (amc a))+projection :: (b -> s) -> (s -> Maybe a) -> Projection s t a b+projection bs sma = projective bs (\afb a -> maybe (pure a) (fmap bs . afb) (sma a)) -- | Convert an 'Iso' to a 'Projection'. -- -- Ideally we would be able to use an 'Iso' directly as a 'Projection', but this opens a can of worms.-mirror :: Projective k a c => Simple Iso a c -> Simple Projection a c+mirror :: Projective k s a => Simple Iso s a -> Simple Projection s a mirror l = projection (^.from l) (\a -> Just (a^.l)) -- | @type 'SimpleProjection' = 'Simple' 'Projection'@-type SimpleProjection a b = Projection a a b b+type SimpleProjection s a = Projection s s a a
src/Control/Lens/Setter.hs view
@@ -9,12 +9,12 @@ -- Stability : provisional -- Portability : Rank2Types ----- A @'Setter' a b c d@ is a generalization of 'fmap' from 'Functor'. It allows you to map into a+-- A @'Setter' s t a b@ is a generalization of 'fmap' from 'Functor'. It allows you to map into a -- structure and change out the contents, but it isn't strong enough to allow you to--- enumerate those contents. Starting with @fmap :: 'Functor' f => (c -> d) -> f c -> f d@--- we monomorphize the type to obtain @(c -> d) -> a -> b@ and then decorate it with 'Data.Functor.Identity.Identity' to obtain+-- enumerate those contents. Starting with @fmap :: 'Functor' f => (a -> b) -> f a -> f b@+-- we monomorphize the type to obtain @(a -> b) -> s -> t@ and then decorate it with 'Data.Functor.Identity.Identity' to obtain ----- @type 'Setter' a b c d = (c -> 'Data.Functor.Identity.Identity' d) -> a -> 'Data.Functor.Identity.Identity' b@+-- @type 'Setter' s t a b = (a -> 'Data.Functor.Identity.Identity' b) -> s -> 'Data.Functor.Identity.Identity' t@ -- -- Every 'Control.Lens.Traversal.Traversal' is a valid 'Setter', since 'Data.Functor.Identity.Identity' is 'Applicative'. --@@ -71,7 +71,7 @@ -- | -- The only 'Control.Lens.Type.Lens'-like law that can apply to a 'Setter' @l@ is that ----- @'set' l c ('set' l b a) ≡ 'set' l c a@+-- @'set' l y ('set' l x a) ≡ 'set' l x a@ -- -- You can't 'view' a 'Setter' in general, so the other two laws are irrelevant. --@@ -91,7 +91,7 @@ -- -- You can compose a 'Setter' with a 'Control.Lens.Type.Lens' or a 'Control.Lens.Traversal.Traversal' using ('.') from the Prelude -- and the result is always only a 'Setter' and nothing more.-type Setter a b c d = forall f. Settable f => (c -> f d) -> a -> f b+type Setter s t a b = forall f. Settable f => (a -> f b) -> s -> f t -- | -- Running a 'Setter' instantiates it to a concrete type.@@ -100,7 +100,7 @@ -- user code will not need to use this type. -- -- By choosing 'Mutator' rather than 'Data.Functor.Identity.Identity', we get nicer error messages.-type Setting a b c d = (c -> Mutator d) -> a -> Mutator b+type Setting s t a b = (a -> Mutator b) -> s -> Mutator t -- | --@@ -111,7 +111,7 @@ -- @'sets' Data.Text.map :: 'SimpleSetter' 'Data.Text.Internal.Text' 'Char'@ -- -- @type 'SimpleSetter' = 'Control.Lens.Type.Simple' 'Setter'@-type SimpleSetter a b = Setter a a b b+type SimpleSetter s a = Setter s s a a -- | -- This is a useful alias for use when consuming a 'SimpleSetter'.@@ -119,7 +119,7 @@ -- Most user code will never have to use this type. -- -- @type 'SimpleSetting' m = 'Control.Lens.Type.Simple' 'Setting'@-type SimpleSetting a b = Setting a a b b+type SimpleSetting s a = Setting s s a a ----------------------------------------------------------------------------- -- Setters@@ -166,7 +166,7 @@ -- -- Another way to view 'sets' is that it takes a \"semantic editor combinator\" -- and transforms it into a 'Setter'.-sets :: ((c -> d) -> a -> b) -> Setter a b c d+sets :: ((a -> b) -> s -> t) -> Setter s t a b sets f g = pure . f (untainted . g) {-# INLINE sets #-} @@ -193,8 +193,8 @@ -- Another way to view 'over' is to say that it transformers a 'Setter' into a -- \"semantic editor combinator\". ----- @'over' :: 'Setter' a b c d -> (c -> d) -> a -> b@-over :: Setting a b c d -> (c -> d) -> a -> b+-- @'over' :: 'Setter' s t a b -> (a -> b) -> s -> t@+over :: Setting s t a b -> (a -> b) -> s -> t over l f = runMutator . l (Mutator . f) {-# INLINE over #-} @@ -219,12 +219,12 @@ -- (2,3) -- -- @--- 'mapOf' :: 'Setter' a b c d -> (c -> d) -> a -> b--- 'mapOf' :: 'Control.Lens.Iso.Iso' a b c d -> (c -> d) -> a -> b--- 'mapOf' :: 'Control.Lens.Type.Lens' a b c d -> (c -> d) -> a -> b--- 'mapOf' :: 'Control.Lens.Traversal.Traversal' a b c d -> (c -> d) -> a -> b+-- 'mapOf' :: 'Setter' s t a b -> (a -> b) -> s -> t+-- 'mapOf' :: 'Control.Lens.Iso.Iso' s t a b -> (a -> b) -> s -> t+-- 'mapOf' :: 'Control.Lens.Type.Lens' s t a b -> (a -> b) -> s -> t+-- 'mapOf' :: 'Control.Lens.Traversal.Traversal' s t a b -> (a -> b) -> s -> t -- @-mapOf :: Setting a b c d -> (c -> d) -> a -> b+mapOf :: Setting s t a b -> (a -> b) -> s -> t mapOf = over {-# INLINE mapOf #-} @@ -243,13 +243,13 @@ -- relatively nice error message. -- -- @--- 'set' :: 'Setter' a b c d -> d -> a -> b--- 'set' :: 'Control.Lens.Iso.Iso' a b c d -> d -> a -> b--- 'set' :: 'Control.Lens.Type.Lens' a b c d -> d -> a -> b--- 'set' :: 'Control.Lens.Traversal.Traversal' a b c d -> d -> a -> b+-- 'set' :: 'Setter' s t a b -> b -> s -> t+-- 'set' :: 'Control.Lens.Iso.Iso' s t a b -> b -> s -> t+-- 'set' :: 'Control.Lens.Type.Lens' s t a b -> b -> s -> t+-- 'set' :: 'Control.Lens.Traversal.Traversal' s t a b -> b -> s -> t -- @-set :: Setting a b c d -> d -> a -> b-set l d = runMutator . l (\_ -> Mutator d)+set :: Setting s t a b -> b -> s -> t+set l b = runMutator . l (\_ -> Mutator b) {-# INLINE set #-} -- | Modifies the target of a 'Control.Lens.Type.Lens' or all of the targets of a 'Setter' or@@ -275,12 +275,12 @@ -- [[5,5],[3]] -- -- @--- ('%~') :: 'Setter' a b c d -> (c -> d) -> a -> b--- ('%~') :: 'Control.Lens.Iso.Iso' a b c d -> (c -> d) -> a -> b--- ('%~') :: 'Control.Lens.Type.Lens' a b c d -> (c -> d) -> a -> b--- ('%~') :: 'Control.Lens.Traversal.Traversal' a b c d -> (c -> d) -> a -> b+-- ('%~') :: 'Setter' s t a b -> (a -> b) -> s -> t+-- ('%~') :: 'Control.Lens.Iso.Iso' s t a b -> (a -> b) -> s -> t+-- ('%~') :: 'Control.Lens.Type.Lens' s t a b -> (a -> b) -> s -> t+-- ('%~') :: 'Control.Lens.Traversal.Traversal' s t a b -> (a -> b) -> s -> t -- @-(%~) :: Setting a b c d -> (c -> d) -> a -> b+(%~) :: Setting s t a b -> (a -> b) -> s -> t (%~) = over {-# INLINE (%~) #-} @@ -295,34 +295,34 @@ -- ("hello","world") -- -- @--- ('.~') :: 'Setter' a b c d -> d -> a -> b--- ('.~') :: 'Control.Lens.Iso.Iso' a b c d -> d -> a -> b--- ('.~') :: 'Control.Lens.Type.Lens' a b c d -> d -> a -> b--- ('.~') :: 'Control.Lens.Traversal.Traversal' a b c d -> d -> a -> b+-- ('.~') :: 'Setter' s t a b -> b -> s -> t+-- ('.~') :: 'Control.Lens.Iso.Iso' s t a b -> b -> s -> t+-- ('.~') :: 'Control.Lens.Type.Lens' s t a b -> b -> s -> t+-- ('.~') :: 'Control.Lens.Traversal.Traversal' s t a b -> b -> s -> t -- @-(.~) :: Setting a b c d -> d -> a -> b+(.~) :: Setting s t a b -> b -> s -> t (.~) = set {-# INLINE (.~) #-} -- | Set the target of a 'Control.Lens.Type.Lens', 'Control.Lens.Traversal.Traversal' or 'Setter' to 'Just' a value. ----- @l '?~' d ≡ 'set' l ('Just' d)@+-- @l '?~' t ≡ 'set' l ('Just' t)@ -- -- @--- ('?~') :: 'Setter' a b c ('Maybe' d) -> d -> a -> b--- ('?~') :: 'Control.Lens.Iso.Iso' a b c ('Maybe' d) -> d -> a -> b--- ('?~') :: 'Control.Lens.Type.Lens' a b c ('Maybe' d) -> d -> a -> b--- ('?~') :: 'Control.Lens.Traversal.Traversal' a b c ('Maybe' d) -> d -> a -> b+-- ('?~') :: 'Setter' s t a ('Maybe' b) -> b -> s -> t+-- ('?~') :: 'Control.Lens.Iso.Iso' s t a ('Maybe' b) -> b -> s -> t+-- ('?~') :: 'Control.Lens.Type.Lens' s t a ('Maybe' b) -> b -> s -> t+-- ('?~') :: 'Control.Lens.Traversal.Traversal' s t a ('Maybe' b) -> b -> s -> t -- @-(?~) :: Setting a b c (Maybe d) -> d -> a -> b-l ?~ d = set l (Just d)+(?~) :: Setting s t a (Maybe b) -> b -> s -> t+l ?~ b = set l (Just b) {-# INLINE (?~) #-} -- | Set with pass-through -- -- This is mostly present for consistency, but may be useful for for chaining assignments ----- If you do not need a copy of the intermediate result, then using @l '.~' d@ directly is a good idea.+-- If you do not need a copy of the intermediate result, then using @l '.~' t@ directly is a good idea. -- -- >>> _3 <.~ "world" $ ("good","morning","vietnam") -- ("world",("good","morning","world"))@@ -332,13 +332,13 @@ -- (Just "world",(42,fromList [("goodnight","gracie"),("hello","world")])) -- -- @--- ('<.~') :: 'Setter' a b c d -> d -> a -> (d, b)--- ('<.~') :: 'Control.Lens.Iso.Iso' a b c d -> d -> a -> (d, b)--- ('<.~') :: 'Control.Lens.Type.Lens' a b c d -> d -> a -> (d, b)--- ('<.~') :: 'Control.Lens.Traversal.Traversal' a b c d -> d -> a -> (d, b)+-- ('<.~') :: 'Setter' s t a b -> b -> s -> (b, t)+-- ('<.~') :: 'Control.Lens.Iso.Iso' s t a b -> b -> s -> (b, t)+-- ('<.~') :: 'Control.Lens.Type.Lens' s t a b -> b -> s -> (b, t)+-- ('<.~') :: 'Control.Lens.Traversal.Traversal' s t a b -> b -> s -> (b, t) -- @-(<.~) :: Setting a b c d -> d -> a -> (d, b)-l <.~ d = \a -> (d, set l d a)+(<.~) :: Setting s t a b -> b -> s -> (b, t)+l <.~ b = \s -> (b, set l b s) {-# INLINE (<.~) #-} -- | Set to 'Just' a value with pass-through@@ -352,13 +352,13 @@ -- ("world",(42,fromList [("goodnight","gracie"),("hello","world")])) -- -- @--- ('<?~') :: 'Setter' a b c d -> ('Maybe' d) -> a -> (d, b)--- ('<?~') :: 'Control.Lens.Iso.Iso' a b c ('Maybe' d) -> d -> a -> (d, b)--- ('<?~') :: 'Control.Lens.Type.Lens' a b c ('Maybe' d) -> d -> a -> (d, b)--- ('<?~') :: 'Control.Lens.Traversal.Traversal' a b c ('Maybe' d) -> d -> a -> (d, b)+-- ('<?~') :: 'Setter' s t a b -> ('Maybe' b) -> s -> (b, t)+-- ('<?~') :: 'Control.Lens.Iso.Iso' s t a ('Maybe' b) -> b -> s -> (b, t)+-- ('<?~') :: 'Control.Lens.Type.Lens' s t a ('Maybe' b) -> b -> s -> (b, t)+-- ('<?~') :: 'Control.Lens.Traversal.Traversal' s t a ('Maybe' b) -> b -> s -> (b, t) -- @-(<?~) :: Setting a b c (Maybe d) -> d -> a -> (d, b)-l <?~ d = \a -> (d, set l (Just d) a)+(<?~) :: Setting s t a (Maybe b) -> b -> s -> (b, t)+l <?~ b = \s -> (b, set l (Just b) s) {-# INLINE (<?~) #-} -- | Increment the target(s) of a numerically valued 'Control.Lens.Type.Lens', 'Setter' or 'Control.Lens.Traversal.Traversal'@@ -370,12 +370,12 @@ -- (7,8) -- -- @--- ('+~') :: Num b => 'Control.Lens.Type.Simple' 'Setter' a b -> b -> a -> a--- ('+~') :: Num b => 'Control.Lens.Type.Simple' 'Control.Lens.Iso.Iso' a b -> b -> a -> a--- ('+~') :: Num b => 'Control.Lens.Type.Simple' 'Control.Lens.Type.Lens' a b -> b -> a -> a--- ('+~') :: Num b => 'Control.Lens.Type.Simple' 'Control.Lens.Traversal.Traversal' a b -> b -> a -> a+-- ('+~') :: Num a => 'Control.Lens.Type.Simple' 'Setter' s a -> a -> s -> s+-- ('+~') :: Num a => 'Control.Lens.Type.Simple' 'Control.Lens.Iso.Iso' s a -> a -> s -> s+-- ('+~') :: Num a => 'Control.Lens.Type.Simple' 'Control.Lens.Type.Lens' s a -> a -> s -> s+-- ('+~') :: Num a => 'Control.Lens.Type.Simple' 'Control.Lens.Traversal.Traversal' s a -> a -> s -> s -- @-(+~) :: Num c => Setting a b c c -> c -> a -> b+(+~) :: Num a => Setting s t a a -> a -> s -> t l +~ n = over l (+ n) {-# INLINE (+~) #-} @@ -388,12 +388,12 @@ -- Just 48 -- -- @--- ('*~') :: 'Num' b => 'Control.Lens.Type.Simple' 'Setter' a b -> b -> a -> a--- ('*~') :: 'Num' b => 'Control.Lens.Type.Simple' 'Control.Lens.Iso.Iso' a b -> b -> a -> a--- ('*~') :: 'Num' b => 'Control.Lens.Type.Simple' 'Control.Lens.Type.Lens' a b -> b -> a -> a--- ('*~') :: 'Num' b => 'Control.Lens.Type.Simple' 'Control.Lens.Traversal.Traversal' a b -> b -> a -> a+-- ('*~') :: 'Num' a => 'Control.Lens.Type.Simple' 'Setter' s a -> a -> s -> s+-- ('*~') :: 'Num' a => 'Control.Lens.Type.Simple' 'Control.Lens.Iso.Iso' s a -> a -> s -> s+-- ('*~') :: 'Num' a => 'Control.Lens.Type.Simple' 'Control.Lens.Type.Lens' s a -> a -> s -> s+-- ('*~') :: 'Num' a => 'Control.Lens.Type.Simple' 'Control.Lens.Traversal.Traversal' s a -> a -> s -> s -- @-(*~) :: Num c => Setting a b c c -> c -> a -> b+(*~) :: Num a => Setting s t a a -> a -> s -> t l *~ n = over l (* n) {-# INLINE (*~) #-} @@ -406,12 +406,12 @@ -- [[3,4],[5,6]] -- -- @--- ('-~') :: 'Num' b => 'Control.Lens.Type.Simple' 'Setter' a b -> b -> a -> a--- ('-~') :: 'Num' b => 'Control.Lens.Type.Simple' 'Control.Lens.Iso.Iso' a b -> b -> a -> a--- ('-~') :: 'Num' b => 'Control.Lens.Type.Simple' 'Control.Lens.Type.Lens' a b -> b -> a -> a--- ('-~') :: 'Num' b => 'Control.Lens.Type.Simple' 'Control.Lens.Traversal.Traversal' a b -> b -> a -> a+-- ('-~') :: 'Num' a => 'Control.Lens.Type.Simple' 'Setter' s a -> a -> s -> s+-- ('-~') :: 'Num' a => 'Control.Lens.Type.Simple' 'Control.Lens.Iso.Iso' s a -> a -> s -> s+-- ('-~') :: 'Num' a => 'Control.Lens.Type.Simple' 'Control.Lens.Type.Lens' s a -> a -> s -> s+-- ('-~') :: 'Num' a => 'Control.Lens.Type.Simple' 'Control.Lens.Traversal.Traversal' s a -> a -> s -> s -- @-(-~) :: Num c => Setting a b c c -> c -> a -> b+(-~) :: Num a => Setting s t a a -> a -> s -> t l -~ n = over l (subtract n) {-# INLINE (-~) #-} @@ -421,12 +421,12 @@ -- ("Hawaii",5.0) -- -- @--- ('//~') :: 'Fractional' b => 'Control.Lens.Type.Simple' 'Setter' a b -> b -> a -> a--- ('//~') :: 'Fractional' b => 'Control.Lens.Type.Simple' 'Control.Lens.Iso.Iso' a b -> b -> a -> a--- ('//~') :: 'Fractional' b => 'Control.Lens.Type.Simple' 'Control.Lens.Type.Lens' a b -> b -> a -> a--- ('//~') :: 'Fractional' b => 'Control.Lens.Type.Simple' 'Control.Lens.Traversal.Traversal' a b -> b -> a -> a+-- ('//~') :: 'Fractional' a => 'Control.Lens.Type.Simple' 'Setter' s a -> a -> s -> s+-- ('//~') :: 'Fractional' a => 'Control.Lens.Type.Simple' 'Control.Lens.Iso.Iso' s a -> a -> s -> s+-- ('//~') :: 'Fractional' a => 'Control.Lens.Type.Simple' 'Control.Lens.Type.Lens' s a -> a -> s -> s+-- ('//~') :: 'Fractional' a => 'Control.Lens.Type.Simple' 'Control.Lens.Traversal.Traversal' s a -> a -> s -> s -- @-(//~) :: Fractional c => Setting a b c c -> c -> a -> b+(//~) :: Fractional s => Setting a b s s -> s -> a -> b l //~ n = over l (/ n) -- | Raise the target(s) of a numerically valued 'Control.Lens.Type.Lens', 'Setter' or 'Control.Lens.Traversal.Traversal' to a non-negative integral power@@ -435,12 +435,12 @@ -- (1,9) -- -- @--- ('^~') :: ('Num' b, 'Integral' c) => 'Control.Lens.Type.Simple' 'Setter' a b -> c -> a -> a--- ('^~') :: ('Num' b, 'Integral' c) => 'Control.Lens.Type.Simple' 'Control.Lens.Iso.Iso' a b -> c -> a -> a--- ('^~') :: ('Num' b, 'Integral' c) => 'Control.Lens.Type.Simple' 'Control.Lens.Type.Lens' a b -> c -> a -> a--- ('^~') :: ('Num' b, 'Integral' c) => 'Control.Lens.Type.Simple' 'Control.Lens.Traversal.Traversal' a b -> c -> a -> a+-- ('^~') :: ('Num' a, 'Integral' e) => 'Control.Lens.Type.Simple' 'Setter' s a -> e -> s -> s+-- ('^~') :: ('Num' a, 'Integral' e) => 'Control.Lens.Type.Simple' 'Control.Lens.Iso.Iso' s a -> e -> s -> s+-- ('^~') :: ('Num' a, 'Integral' e) => 'Control.Lens.Type.Simple' 'Control.Lens.Type.Lens' s a -> e -> s -> s+-- ('^~') :: ('Num' a, 'Integral' e) => 'Control.Lens.Type.Simple' 'Control.Lens.Traversal.Traversal' s a -> e -> s -> s -- @-(^~) :: (Num c, Integral e) => Setting a b c c -> e -> a -> b+(^~) :: (Num a, Integral e) => Setting s t a a -> e -> s -> t l ^~ n = over l (^ n) {-# INLINE (^~) #-} @@ -450,13 +450,13 @@ -- (1,0.5) -- -- @--- ('^^~') :: ('Fractional' b, 'Integral' c) => 'Control.Lens.Type.Simple' 'Setter' a b -> c -> a -> a--- ('^^~') :: ('Fractional' b, 'Integral' c) => 'Control.Lens.Type.Simple' 'Control.Lens.Iso.Iso' a b -> c -> a -> a--- ('^^~') :: ('Fractional' b, 'Integral' c) => 'Control.Lens.Type.Simple' 'Control.Lens.Type.Lens' a b -> c -> a -> a--- ('^^~') :: ('Fractional' b, 'Integral' c) => 'Control.Lens.Type.Simple' 'Control.Lens.Traversal.Traversal' a b -> c -> a -> a+-- ('^^~') :: ('Fractional' a, 'Integral' e) => 'Control.Lens.Type.Simple' 'Setter' s a -> e -> s -> s+-- ('^^~') :: ('Fractional' a, 'Integral' e) => 'Control.Lens.Type.Simple' 'Control.Lens.Iso.Iso' s a -> e -> s -> s+-- ('^^~') :: ('Fractional' a, 'Integral' e) => 'Control.Lens.Type.Simple' 'Control.Lens.Type.Lens' s a -> e -> s -> s+-- ('^^~') :: ('Fractional' a, 'Integral' e) => 'Control.Lens.Type.Simple' 'Control.Lens.Traversal.Traversal' s a -> e -> s -> s -- @ ---(^^~) :: (Fractional c, Integral e) => Setting a b c c -> e -> a -> b+(^^~) :: (Fractional a, Integral e) => Setting s t a a -> e -> s -> t l ^^~ n = over l (^^ n) {-# INLINE (^^~) #-} @@ -466,12 +466,12 @@ -- (1,31.54428070019754) -- -- @--- ('**~') :: 'Floating' b => 'Control.Lens.Type.Simple' 'Setter' a b -> b -> a -> a--- ('**~') :: 'Floating' b => 'Control.Lens.Type.Simple' 'Control.Lens.Iso.Iso' a b -> b -> a -> a--- ('**~') :: 'Floating' b => 'Control.Lens.Type.Simple' 'Control.Lens.Type.Lens' a b -> b -> a -> a--- ('**~') :: 'Floating' b => 'Control.Lens.Type.Simple' 'Control.Lens.Traversal.Traversal' a b -> b -> a -> a+-- ('**~') :: 'Floating' a => 'Control.Lens.Type.Simple' 'Setter' s a -> a -> s -> s+-- ('**~') :: 'Floating' a => 'Control.Lens.Type.Simple' 'Control.Lens.Iso.Iso' s a -> a -> s -> s+-- ('**~') :: 'Floating' a => 'Control.Lens.Type.Simple' 'Control.Lens.Type.Lens' s a -> a -> s -> s+-- ('**~') :: 'Floating' a => 'Control.Lens.Type.Simple' 'Control.Lens.Traversal.Traversal' s a -> a -> s -> s -- @-(**~) :: Floating c => Setting a b c c -> c -> a -> b+(**~) :: Floating a => Setting s t a a -> a -> s -> t l **~ n = over l (** n) {-# INLINE (**~) #-} @@ -484,12 +484,12 @@ -- (False,True) -- -- @--- ('||~') :: 'Control.Lens.Type.Simple' 'Setter' a 'Bool' -> 'Bool' -> a -> a--- ('||~') :: 'Control.Lens.Type.Simple' 'Control.Lens.Iso.Iso' a 'Bool' -> 'Bool' -> a -> a--- ('||~') :: 'Control.Lens.Type.Simple' 'Control.Lens.Type.Lens' a 'Bool' -> 'Bool' -> a -> a--- ('||~') :: 'Control.Lens.Type.Simple' 'Control.Lens.Traversal.Traversal' a 'Bool' -> 'Bool' -> a -> a+-- ('||~') :: 'Control.Lens.Type.Simple' 'Setter' s 'Bool' -> 'Bool' -> s -> s+-- ('||~') :: 'Control.Lens.Type.Simple' 'Control.Lens.Iso.Iso' s 'Bool' -> 'Bool' -> s -> s+-- ('||~') :: 'Control.Lens.Type.Simple' 'Control.Lens.Type.Lens' s 'Bool' -> 'Bool' -> s -> s+-- ('||~') :: 'Control.Lens.Type.Simple' 'Control.Lens.Traversal.Traversal' s 'Bool' -> 'Bool' -> s -> s -- @-(||~):: Setting a b Bool Bool -> Bool -> a -> b+(||~):: Setting s t Bool Bool -> Bool -> s -> t l ||~ n = over l (|| n) {-# INLINE (||~) #-} @@ -502,12 +502,12 @@ -- (False,False) -- -- @--- ('&&~') :: 'Control.Lens.Type.Simple' 'Setter' a 'Bool' -> 'Bool' -> a -> a--- ('&&~') :: 'Control.Lens.Type.Simple' 'Control.Lens.Iso.Iso' a 'Bool' -> 'Bool' -> a -> a--- ('&&~') :: 'Control.Lens.Type.Simple' 'Control.Lens.Type.Lens' a 'Bool' -> 'Bool' -> a -> a--- ('&&~') :: 'Control.Lens.Type.Simple' 'Control.Lens.Traversal.Traversal' a 'Bool' -> 'Bool' -> a -> a+-- ('&&~') :: 'Control.Lens.Type.Simple' 'Setter' s 'Bool' -> 'Bool' -> s -> s+-- ('&&~') :: 'Control.Lens.Type.Simple' 'Control.Lens.Iso.Iso' s 'Bool' -> 'Bool' -> s -> s+-- ('&&~') :: 'Control.Lens.Type.Simple' 'Control.Lens.Type.Lens' s 'Bool' -> 'Bool' -> s -> s+-- ('&&~') :: 'Control.Lens.Type.Simple' 'Control.Lens.Traversal.Traversal' s 'Bool' -> 'Bool' -> s -> s -- @-(&&~) :: Setting a b Bool Bool -> Bool -> a -> b+(&&~) :: Setting s t Bool Bool -> Bool -> s -> t l &&~ n = over l (&& n) {-# INLINE (&&~) #-} @@ -521,12 +521,12 @@ -- This is an alias for ('.='). -- -- @--- 'assign' :: 'MonadState' a m => 'Control.Lens.Type.Simple' 'Control.Lens.Iso.Iso' a b -> b -> m ()--- 'assign' :: 'MonadState' a m => 'Control.Lens.Type.Simple' 'Control.Lens.Type.Lens' a b -> b -> m ()--- 'assign' :: 'MonadState' a m => 'Control.Lens.Type.Simple' 'Control.Lens.Traversal.Traversal' a b -> b -> m ()--- 'assign' :: 'MonadState' a m => 'Control.Lens.Type.Simple' 'Setter' a b -> b -> m ()+-- 'assign' :: 'MonadState' s m => 'Control.Lens.Type.Simple' 'Control.Lens.Iso.Iso' s a -> a -> m ()+-- 'assign' :: 'MonadState' s m => 'Control.Lens.Type.Simple' 'Control.Lens.Type.Lens' s a -> a -> m ()+-- 'assign' :: 'MonadState' s m => 'Control.Lens.Type.Simple' 'Control.Lens.Traversal.Traversal' s a -> a -> m ()+-- 'assign' :: 'MonadState' s m => 'Control.Lens.Type.Simple' 'Setter' s a -> a -> m () -- @-assign :: MonadState a m => Setting a a c d -> d -> m ()+assign :: MonadState s m => Setting s s a b -> b -> m () assign l b = State.modify (set l b) {-# INLINE assign #-} @@ -536,26 +536,26 @@ -- This is an infix version of 'assign'. -- -- @--- ('.=') :: 'MonadState' a m => 'Control.Lens.Type.Simple' 'Control.Lens.Iso.Iso' a b -> b -> m ()--- ('.=') :: 'MonadState' a m => 'Control.Lens.Type.Simple' 'Control.Lens.Type.Lens' a b -> b -> m ()--- ('.=') :: 'MonadState' a m => 'Control.Lens.Type.Simple' 'Control.Lens.Traversal.Traversal' a b -> b -> m ()--- ('.=') :: 'MonadState' a m => 'Control.Lens.Type.Simple' 'Setter' a b -> b -> m ()+-- ('.=') :: 'MonadState' s m => 'Control.Lens.Type.Simple' 'Control.Lens.Iso.Iso' s a -> a -> m ()+-- ('.=') :: 'MonadState' s m => 'Control.Lens.Type.Simple' 'Control.Lens.Type.Lens' s a -> a -> m ()+-- ('.=') :: 'MonadState' s m => 'Control.Lens.Type.Simple' 'Control.Lens.Traversal.Traversal' s a -> a -> m ()+-- ('.=') :: 'MonadState' s m => 'Control.Lens.Type.Simple' 'Setter' s a -> a -> m () -- @ -- -- "It puts the state in the monad or it gets the hose again."-(.=) :: MonadState a m => Setting a a c d -> d -> m ()+(.=) :: MonadState s m => Setting s s a b -> b -> m () l .= b = State.modify (l .~ b) {-# INLINE (.=) #-} -- | Map over the target of a 'Control.Lens.Type.Lens' or all of the targets of a 'Setter' or 'Control.Lens.Traversal.Traversal' in our monadic state. -- -- @--- ('%=') :: 'MonadState' a m => 'Control.Lens.Type.Simple' 'Control.Lens.Iso.Iso' a b -> (b -> b) -> m ()--- ('%=') :: 'MonadState' a m => 'Control.Lens.Type.Simple' 'Control.Lens.Type.Lens' a b -> (b -> b) -> m ()--- ('%=') :: 'MonadState' a m => 'Control.Lens.Type.Simple' 'Control.Lens.Traversal.Traversal' a b -> (b -> b) -> m ()--- ('%=') :: 'MonadState' a m => 'Control.Lens.Type.Simple' 'Setter' a b -> (b -> b) -> m ()+-- ('%=') :: 'MonadState' s m => 'Control.Lens.Type.Simple' 'Control.Lens.Iso.Iso' s a -> (a -> a) -> m ()+-- ('%=') :: 'MonadState' s m => 'Control.Lens.Type.Simple' 'Control.Lens.Type.Lens' s a -> (a -> a) -> m ()+-- ('%=') :: 'MonadState' s m => 'Control.Lens.Type.Simple' 'Control.Lens.Traversal.Traversal' s a -> (a -> a) -> m ()+-- ('%=') :: 'MonadState' s m => 'Control.Lens.Type.Simple' 'Setter' s a -> (a -> a) -> m () -- @-(%=) :: MonadState a m => Setting a a c d -> (c -> d) -> m ()+(%=) :: MonadState s m => Setting s s a b -> (a -> b) -> m () l %= f = State.modify (l %~ f) {-# INLINE (%=) #-} @@ -563,12 +563,12 @@ -- state with 'Just' a new value, irrespective of the old. -- -- @--- ('?=') :: 'MonadState' a m => 'Control.Lens.Type.Simple' 'Control.Lens.Iso.Iso' a ('Maybe' b) -> b -> m ()--- ('?=') :: 'MonadState' a m => 'Control.Lens.Type.Simple' 'Control.Lens.Type.Lens' a ('Maybe' b) -> b -> m ()--- ('?=') :: 'MonadState' a m => 'Control.Lens.Type.Simple' 'Control.Lens.Traversal.Traversal' a ('Maybe' b) -> b -> m ()--- ('?=') :: 'MonadState' a m => 'Control.Lens.Type.Simple' 'Setter' a ('Maybe' b) -> b -> m ()+-- ('?=') :: 'MonadState' s m => 'Control.Lens.Type.Simple' 'Control.Lens.Iso.Iso' s ('Maybe' a) -> a -> m ()+-- ('?=') :: 'MonadState' s m => 'Control.Lens.Type.Simple' 'Control.Lens.Type.Lens' s ('Maybe' a) -> a -> m ()+-- ('?=') :: 'MonadState' s m => 'Control.Lens.Type.Simple' 'Control.Lens.Traversal.Traversal' s ('Maybe' a) -> a -> m ()+-- ('?=') :: 'MonadState' s m => 'Control.Lens.Type.Simple' 'Setter' s ('Maybe' a) -> a -> m () -- @-(?=) :: MonadState a m => Setting a a c (Maybe d) -> d -> m ()+(?=) :: MonadState s m => Setting s s a (Maybe b) -> b -> m () l ?= b = State.modify (l ?~ b) {-# INLINE (?=) #-} @@ -584,118 +584,118 @@ -- @ -- -- @--- ('+=') :: ('MonadState' a m, 'Num' b) => 'Control.Lens.Type.Simple' 'Setter' a b -> b -> m ()--- ('+=') :: ('MonadState' a m, 'Num' b) => 'Control.Lens.Type.Simple' 'Control.Lens.Iso.Iso' a b -> b -> m ()--- ('+=') :: ('MonadState' a m, 'Num' b) => 'Control.Lens.Type.Simple' 'Control.Lens.Type.Lens' a b -> b -> m ()--- ('+=') :: ('MonadState' a m, 'Num' b) => 'Control.Lens.Type.Simple' 'Control.Lens.Traversal.Traversal' a b -> b -> m ()+-- ('+=') :: ('MonadState' s m, 'Num' a) => 'Control.Lens.Type.Simple' 'Setter' s a -> a -> m ()+-- ('+=') :: ('MonadState' s m, 'Num' a) => 'Control.Lens.Type.Simple' 'Control.Lens.Iso.Iso' s a -> a -> m ()+-- ('+=') :: ('MonadState' s m, 'Num' a) => 'Control.Lens.Type.Simple' 'Control.Lens.Type.Lens' s a -> a -> m ()+-- ('+=') :: ('MonadState' s m, 'Num' a) => 'Control.Lens.Type.Simple' 'Control.Lens.Traversal.Traversal' s a -> a -> m () -- @-(+=) :: (MonadState a m, Num b) => SimpleSetting a b -> b -> m ()+(+=) :: (MonadState s m, Num a) => SimpleSetting s a -> a -> m () l += b = State.modify (l +~ b) {-# INLINE (+=) #-} -- | Modify the target(s) of a 'Control.Lens.Type.Simple' 'Control.Lens.Type.Lens', 'Control.Lens.Iso.Iso', 'Setter' or 'Control.Lens.Traversal.Traversal' by subtracting a value -- -- @--- ('-=') :: ('MonadState' a m, 'Num' b) => 'Control.Lens.Type.Simple' 'Setter' a b -> b -> m ()--- ('-=') :: ('MonadState' a m, 'Num' b) => 'Control.Lens.Type.Simple' 'Control.Lens.Iso.Iso' a b -> b -> m ()--- ('-=') :: ('MonadState' a m, 'Num' b) => 'Control.Lens.Type.Simple' 'Control.Lens.Type.Lens' a b -> b -> m ()--- ('-=') :: ('MonadState' a m, 'Num' b) => 'Control.Lens.Type.Simple' 'Control.Lens.Traversal.Traversal' a b -> b -> m ()+-- ('-=') :: ('MonadState' s m, 'Num' a) => 'Control.Lens.Type.Simple' 'Setter' s a -> a -> m ()+-- ('-=') :: ('MonadState' s m, 'Num' a) => 'Control.Lens.Type.Simple' 'Control.Lens.Iso.Iso' s a -> a -> m ()+-- ('-=') :: ('MonadState' s m, 'Num' a) => 'Control.Lens.Type.Simple' 'Control.Lens.Type.Lens' s a -> a -> m ()+-- ('-=') :: ('MonadState' s m, 'Num' a) => 'Control.Lens.Type.Simple' 'Control.Lens.Traversal.Traversal' s a -> a -> m () -- @-(-=) :: (MonadState a m, Num b) => SimpleSetting a b -> b -> m ()+(-=) :: (MonadState s m, Num a) => SimpleSetting s a -> a -> m () l -= b = State.modify (l -~ b) {-# INLINE (-=) #-} -- | Modify the target(s) of a 'Control.Lens.Type.Simple' 'Control.Lens.Type.Lens', 'Control.Lens.Iso.Iso', 'Setter' or 'Control.Lens.Traversal.Traversal' by multiplying by value. -- -- @--- ('*=') :: ('MonadState' a m, 'Num' b) => 'Control.Lens.Type.Simple' 'Setter' a b -> b -> m ()--- ('*=') :: ('MonadState' a m, 'Num' b) => 'Control.Lens.Type.Simple' 'Control.Lens.Iso.Iso' a b -> b -> m ()--- ('*=') :: ('MonadState' a m, 'Num' b) => 'Control.Lens.Type.Simple' 'Control.Lens.Type.Lens' a b -> b -> m ()--- ('*=') :: ('MonadState' a m, 'Num' b) => 'Control.Lens.Type.Simple' 'Control.Lens.Traversal.Traversal' a b -> b -> m ()+-- ('*=') :: ('MonadState' s m, 'Num' a) => 'Control.Lens.Type.Simple' 'Setter' s a -> a -> m ()+-- ('*=') :: ('MonadState' s m, 'Num' a) => 'Control.Lens.Type.Simple' 'Control.Lens.Iso.Iso' s a -> a -> m ()+-- ('*=') :: ('MonadState' s m, 'Num' a) => 'Control.Lens.Type.Simple' 'Control.Lens.Type.Lens' s a -> a -> m ()+-- ('*=') :: ('MonadState' s m, 'Num' a) => 'Control.Lens.Type.Simple' 'Control.Lens.Traversal.Traversal' s a -> a -> m () -- @-(*=) :: (MonadState a m, Num b) => SimpleSetting a b -> b -> m ()+(*=) :: (MonadState s m, Num a) => SimpleSetting s a -> a -> m () l *= b = State.modify (l *~ b) {-# INLINE (*=) #-} -- | Modify the target(s) of a 'Control.Lens.Type.Simple' 'Control.Lens.Type.Lens', 'Control.Lens.Iso.Iso', 'Setter' or 'Control.Lens.Traversal.Traversal' by dividing by a value. -- -- @--- ('//=') :: ('MonadState' a m, 'Fractional' b) => 'Control.Lens.Type.Simple' 'Setter' a b -> b -> m ()--- ('//=') :: ('MonadState' a m, 'Fractional' b) => 'Control.Lens.Type.Simple' 'Control.Lens.Iso.Iso' a b -> b -> m ()--- ('//=') :: ('MonadState' a m, 'Fractional' b) => 'Control.Lens.Type.Simple' 'Control.Lens.Type.Lens' a b -> b -> m ()--- ('//=') :: ('MonadState' a m, 'Fractional' b) => 'Control.Lens.Type.Simple' 'Control.Lens.Traversal.Traversal' a b -> b -> m ()+-- ('//=') :: ('MonadState' s m, 'Fractional' a) => 'Control.Lens.Type.Simple' 'Setter' s a -> a -> m ()+-- ('//=') :: ('MonadState' s m, 'Fractional' a) => 'Control.Lens.Type.Simple' 'Control.Lens.Iso.Iso' s a -> a -> m ()+-- ('//=') :: ('MonadState' s m, 'Fractional' a) => 'Control.Lens.Type.Simple' 'Control.Lens.Type.Lens' s a -> a -> m ()+-- ('//=') :: ('MonadState' s m, 'Fractional' a) => 'Control.Lens.Type.Simple' 'Control.Lens.Traversal.Traversal' s a -> a -> m () -- @-(//=) :: (MonadState a m, Fractional b) => SimpleSetting a b -> b -> m ()-l //= b = State.modify (l //~ b)+(//=) :: (MonadState s m, Fractional a) => SimpleSetting s a -> a -> m ()+l //= a = State.modify (l //~ a) {-# INLINE (//=) #-} -- | Raise the target(s) of a numerically valued 'Control.Lens.Type.Lens', 'Setter' or 'Control.Lens.Traversal.Traversal' to a non-negative integral power. -- -- @--- ('^=') :: ('MonadState' a m, 'Num' b, 'Integral' c) => 'Control.Lens.Type.Simple' 'Setter' a b -> c -> m ()--- ('^=') :: ('MonadState' a m, 'Num' b, 'Integral' c) => 'Control.Lens.Type.Simple' 'Control.Lens.Iso.Iso' a b -> c -> m ()--- ('^=') :: ('MonadState' a m, 'Num' b, 'Integral' c) => 'Control.Lens.Type.Simple' 'Control.Lens.Type.Lens' a b -> c -> m ()--- ('^=') :: ('MonadState' a m, 'Num' b, 'Integral' c) => 'Control.Lens.Type.Simple' 'Control.Lens.Traversal.Traversal' a b -> c -> m ()+-- ('^=') :: ('MonadState' s m, 'Num' a, 'Integral' e) => 'Control.Lens.Type.Simple' 'Setter' s a -> e -> m ()+-- ('^=') :: ('MonadState' s m, 'Num' a, 'Integral' e) => 'Control.Lens.Type.Simple' 'Control.Lens.Iso.Iso' s a -> e -> m ()+-- ('^=') :: ('MonadState' s m, 'Num' a, 'Integral' e) => 'Control.Lens.Type.Simple' 'Control.Lens.Type.Lens' s a -> e -> m ()+-- ('^=') :: ('MonadState' s m, 'Num' a, 'Integral' e) => 'Control.Lens.Type.Simple' 'Control.Lens.Traversal.Traversal' s a -> e -> m () -- @-(^=) :: (MonadState a m, Num b, Integral c) => SimpleSetting a b -> c -> m ()-l ^= c = State.modify (l ^~ c)+(^=) :: (MonadState s m, Num a, Integral e) => SimpleSetting s a -> e -> m ()+l ^= e = State.modify (l ^~ e) {-# INLINE (^=) #-} -- | Raise the target(s) of a numerically valued 'Control.Lens.Type.Lens', 'Setter' or 'Control.Lens.Traversal.Traversal' to an integral power. -- -- @--- ('^^=') :: ('MonadState' a m, 'Fractional' b, 'Integral' c) => 'Control.Lens.Type.Simple' 'Setter' a b -> c -> m ()--- ('^^=') :: ('MonadState' a m, 'Fractional' b, 'Integral' c) => 'Control.Lens.Type.Simple' 'Control.Lens.Iso.Iso' a b -> c -> m ()--- ('^^=') :: ('MonadState' a m, 'Fractional' b, 'Integral' c) => 'Control.Lens.Type.Simple' 'Control.Lens.Type.Lens' a b -> c -> m ()--- ('^^=') :: ('MonadState' a m, 'Fractional' b, 'Integral' c) => 'Control.Lens.Type.Simple' 'Control.Lens.Traversal.Traversal' a b -> c -> m ()+-- ('^^=') :: ('MonadState' s m, 'Fractional' a, 'Integral' e) => 'Control.Lens.Type.Simple' 'Setter' s a -> e -> m ()+-- ('^^=') :: ('MonadState' s m, 'Fractional' a, 'Integral' e) => 'Control.Lens.Type.Simple' 'Control.Lens.Iso.Iso' s a -> e -> m ()+-- ('^^=') :: ('MonadState' s m, 'Fractional' a, 'Integral' e) => 'Control.Lens.Type.Simple' 'Control.Lens.Type.Lens' s a -> e -> m ()+-- ('^^=') :: ('MonadState' s m, 'Fractional' a, 'Integral' e) => 'Control.Lens.Type.Simple' 'Control.Lens.Traversal.Traversal' s a -> e -> m () -- @-(^^=) :: (MonadState a m, Fractional b, Integral c) => SimpleSetting a b -> c -> m ()-l ^^= c = State.modify (l ^^~ c)+(^^=) :: (MonadState s m, Fractional a, Integral e) => SimpleSetting s a -> e -> m ()+l ^^= e = State.modify (l ^^~ e) {-# INLINE (^^=) #-} -- | Raise the target(s) of a numerically valued 'Control.Lens.Type.Lens', 'Setter' or 'Control.Lens.Traversal.Traversal' to an arbitrary power -- -- @--- ('**=') :: ('MonadState' a m, 'Floating' b) => 'Control.Lens.Type.Simple' 'Setter' a b -> b -> m ()--- ('**=') :: ('MonadState' a m, 'Floating' b) => 'Control.Lens.Type.Simple' 'Control.Lens.Iso.Iso' a b -> b -> m ()--- ('**=') :: ('MonadState' a m, 'Floating' b) => 'Control.Lens.Type.Simple' 'Control.Lens.Type.Lens' a b -> b -> m ()--- ('**=') :: ('MonadState' a m, 'Floating' b) => 'Control.Lens.Type.Simple' 'Control.Lens.Traversal.Traversal' a b -> b -> m ()+-- ('**=') :: ('MonadState' s m, 'Floating' a) => 'Control.Lens.Type.Simple' 'Setter' s a -> a -> m ()+-- ('**=') :: ('MonadState' s m, 'Floating' a) => 'Control.Lens.Type.Simple' 'Control.Lens.Iso.Iso' s a -> a -> m ()+-- ('**=') :: ('MonadState' s m, 'Floating' a) => 'Control.Lens.Type.Simple' 'Control.Lens.Type.Lens' s a -> a -> m ()+-- ('**=') :: ('MonadState' s m, 'Floating' a) => 'Control.Lens.Type.Simple' 'Control.Lens.Traversal.Traversal' s a -> a -> m () -- @-(**=) :: (MonadState a m, Floating b) => SimpleSetting a b -> b -> m ()-l **= b = State.modify (l **~ b)+(**=) :: (MonadState s m, Floating a) => SimpleSetting s a -> a -> m ()+l **= a = State.modify (l **~ a) {-# INLINE (**=) #-} -- | Modify the target(s) of a 'Control.Lens.Type.Simple' 'Control.Lens.Type.Lens', 'Control.Lens.Iso.Iso', 'Setter' or 'Control.Lens.Traversal.Traversal' by taking their logical '&&' with a value -- -- @--- ('&&=') :: 'MonadState' a m => 'Control.Lens.Type.Simple' 'Setter' a 'Bool' -> 'Bool' -> m ()--- ('&&=') :: 'MonadState' a m => 'Control.Lens.Type.Simple' 'Control.Lens.Iso.Iso' a 'Bool' -> 'Bool' -> m ()--- ('&&=') :: 'MonadState' a m => 'Control.Lens.Type.Simple' 'Control.Lens.Type.Lens' a 'Bool' -> 'Bool' -> m ()--- ('&&=') :: 'MonadState' a m => 'Control.Lens.Type.Simple' 'Control.Lens.Traversal.Traversal' a 'Bool' -> 'Bool' -> m ()+-- ('&&=') :: 'MonadState' s m => 'Control.Lens.Type.Simple' 'Setter' s 'Bool' -> 'Bool' -> m ()+-- ('&&=') :: 'MonadState' s m => 'Control.Lens.Type.Simple' 'Control.Lens.Iso.Iso' s 'Bool' -> 'Bool' -> m ()+-- ('&&=') :: 'MonadState' s m => 'Control.Lens.Type.Simple' 'Control.Lens.Type.Lens' s 'Bool' -> 'Bool' -> m ()+-- ('&&=') :: 'MonadState' s m => 'Control.Lens.Type.Simple' 'Control.Lens.Traversal.Traversal' s 'Bool' -> 'Bool' -> m () -- @-(&&=):: MonadState a m => SimpleSetting a Bool -> Bool -> m ()+(&&=):: MonadState s m => SimpleSetting s Bool -> Bool -> m () l &&= b = State.modify (l &&~ b) {-# INLINE (&&=) #-} -- | Modify the target(s) of a 'Control.Lens.Type.Simple' 'Control.Lens.Type.Lens', 'Iso, 'Setter' or 'Control.Lens.Traversal.Traversal' by taking their logical '||' with a value -- -- @--- ('||=') :: 'MonadState' a m => 'Control.Lens.Type.Simple' 'Setter' a 'Bool' -> 'Bool' -> m ()--- ('||=') :: 'MonadState' a m => 'Control.Lens.Type.Simple' 'Control.Lens.Iso.Iso' a 'Bool' -> 'Bool' -> m ()--- ('||=') :: 'MonadState' a m => 'Control.Lens.Type.Simple' 'Control.Lens.Type.Lens' a 'Bool' -> 'Bool' -> m ()--- ('||=') :: 'MonadState' a m => 'Control.Lens.Type.Simple' 'Control.Lens.Traversal.Traversal' a 'Bool' -> 'Bool' -> m ()+-- ('||=') :: 'MonadState' s m => 'Control.Lens.Type.Simple' 'Setter' s 'Bool' -> 'Bool' -> m ()+-- ('||=') :: 'MonadState' s m => 'Control.Lens.Type.Simple' 'Control.Lens.Iso.Iso' s 'Bool' -> 'Bool' -> m ()+-- ('||=') :: 'MonadState' s m => 'Control.Lens.Type.Simple' 'Control.Lens.Type.Lens' s 'Bool' -> 'Bool' -> m ()+-- ('||=') :: 'MonadState' s m => 'Control.Lens.Type.Simple' 'Control.Lens.Traversal.Traversal' s 'Bool' -> 'Bool' -> m () -- @-(||=) :: MonadState a m => SimpleSetting a Bool -> Bool -> m ()+(||=) :: MonadState s m => SimpleSetting s Bool -> Bool -> m () l ||= b = State.modify (l ||~ b) {-# INLINE (||=) #-} -- | Run a monadic action, and set all of the targets of a 'Control.Lens.Type.Lens', 'Setter' or 'Control.Lens.Traversal.Traversal' to its result. -- -- @--- ('<~') :: 'MonadState' a m => 'Control.Lens.Iso.Iso' a a c d -> m d -> m ()--- ('<~') :: 'MonadState' a m => 'Control.Lens.Type.Lens' a a c d -> m d -> m ()--- ('<~') :: 'MonadState' a m => 'Control.Lens.Traversal.Traversal' a a c d -> m d -> m ()--- ('<~') :: 'MonadState' a m => 'Setter' a a c d -> m d -> m ()+-- ('<~') :: 'MonadState' s m => 'Control.Lens.Iso.Iso' s s a b -> m b -> m ()+-- ('<~') :: 'MonadState' s m => 'Control.Lens.Type.Lens' s s a b -> m b -> m ()+-- ('<~') :: 'MonadState' s m => 'Control.Lens.Traversal.Traversal' s s a b -> m b -> m ()+-- ('<~') :: 'MonadState' s m => 'Setter' s s a b -> m b -> m () -- @ -- -- As a reasonable mnemonic, this lets you store the result of a monadic action in a lens rather than@@ -714,8 +714,8 @@ -- @ -- -- will store the result in a 'Control.Lens.Type.Lens', 'Setter', or 'Control.Lens.Traversal.Traversal'.-(<~) :: MonadState a m => Setting a a c d -> m d -> m ()-l <~ md = md >>= (l .=)+(<~) :: MonadState s m => Setting s s a b -> m b -> m ()+l <~ mb = mb >>= (l .=) {-# INLINE (<~) #-} -- | Set with pass-through@@ -727,15 +727,15 @@ -- If you do not need a copy of the intermediate result, then using @l .= d@ will avoid unused binding warnings -- -- @--- ('<.=') :: 'MonadState' a m => 'Setter' a a c d -> d -> m d--- ('<.=') :: 'MonadState' a m => 'Control.Lens.Iso.Iso' a a c d -> d -> m d--- ('<.=') :: 'MonadState' a m => 'Control.Lens.Type.Lens' a a c d -> d -> m d--- ('<.=') :: 'MonadState' a m => 'Control.Lens.Traversal.Traversal' a a c d -> d -> m d+-- ('<.=') :: 'MonadState' s m => 'Setter' s s a b -> b -> m b+-- ('<.=') :: 'MonadState' s m => 'Control.Lens.Iso.Iso' s s a b -> b -> m b+-- ('<.=') :: 'MonadState' s m => 'Control.Lens.Type.Lens' s s a b -> b -> m b+-- ('<.=') :: 'MonadState' s m => 'Control.Lens.Traversal.Traversal' s s a b -> b -> m b -- @-(<.=) :: MonadState a m => Setting a a c d -> d -> m d-l <.= d = do- l .= d- return d+(<.=) :: MonadState s m => Setting s s a b -> b -> m b+l <.= b = do+ l .= b+ return b {-# INLINE (<.=) #-} -- | Set 'Just' a value with pass-through@@ -747,20 +747,20 @@ -- If you do not need a copy of the intermediate result, then using @l ?= d@ will avoid unused binding warnings -- -- @--- ('<?=') :: 'MonadState' a m => 'Setter' a a c ('Maybe' d) -> d -> m d--- ('<?=') :: 'MonadState' a m => 'Control.Lens.Iso.Iso' a a c ('Maybe' d) -> d -> m d--- ('<?=') :: 'MonadState' a m => 'Control.Lens.Type.Lens' a a c ('Maybe' d) -> d -> m d--- ('<?=') :: 'MonadState' a m => 'Control.Lens.Traversal.Traversal' a a c ('Maybe' d) -> d -> m d+-- ('<?=') :: 'MonadState' s m => 'Setter' s s a ('Maybe' b) -> b -> m b+-- ('<?=') :: 'MonadState' s m => 'Control.Lens.Iso.Iso' s s a ('Maybe' b) -> b -> m b+-- ('<?=') :: 'MonadState' s m => 'Control.Lens.Type.Lens' s s a ('Maybe' b) -> b -> m b+-- ('<?=') :: 'MonadState' s m => 'Control.Lens.Traversal.Traversal' s s a ('Maybe' b) -> b -> m b -- @-(<?=) :: MonadState a m => Setting a a c (Maybe d) -> d -> m d-l <?= d = do- l ?= d- return d+(<?=) :: MonadState s m => Setting s s a (Maybe b) -> b -> m b+l <?= b = do+ l ?= b+ return b {-# INLINE (<?=) #-} -- | Reify a setter so it can be stored safely in a container.-newtype ReifiedSetter a b c d = ReifySetter { reflectSetter :: Setter a b c d }+newtype ReifiedSetter s t a b = ReifySetter { reflectSetter :: Setter s t a b } -- | @type 'SimpleReifiedSetter' = 'Control.Lens.Type.Simple' 'ReifiedSetter'@-type SimpleReifiedSetter a b = ReifiedSetter a a b b+type SimpleReifiedSetter s a = ReifiedSetter s s a a
src/Control/Lens/Traversal.hs view
@@ -10,15 +10,15 @@ -- Stability : provisional -- Portability : Rank2Types ----- A @'Traversal' a b c d@ is a generalization of 'traverse' from+-- A @'Traversal' s t a b@ is a generalization of 'traverse' from -- 'Traversable'. It allows you to traverse over a structure and change out -- its contents with monadic or applicative side-effects. Starting from ----- @'traverse' :: ('Traversable' t, 'Applicative' f) => (c -> f d) -> t c -> f (t d)@,+-- @'traverse' :: ('Traversable' t, 'Applicative' f) => (a -> f b) -> t a -> f (t b)@, -- -- we monomorphize the contents and result to obtain ----- > type Traversal a b c d = forall f. Applicative f => (c -> f d) -> a -> f b+-- > type Traversal s t a b = forall f. Applicative f => (a -> f b) -> s -> f t -- -- While a 'Traversal' isn't quite a 'Fold', it _can_ be used for 'Getting' -- like a 'Fold', because given a 'Monoid' @m@, we have an 'Applicative'@@ -49,6 +49,8 @@ , traverseLeft , traverseRight , both+ , taking+ , dropping -- * Cloning Traversals , cloneTraversal@@ -102,13 +104,13 @@ -- is that the caveat expressed in section 5.5 of the \"Essence of the Iterator Pattern\" about exotic -- 'Traversable' instances that 'traverse' the same entry multiple times was actually already ruled out by the -- second law in that same paper!-type Traversal a b c d = forall f. Applicative f => (c -> f d) -> a -> f b+type Traversal s t a b = forall f. Applicative f => (a -> f b) -> s -> f t -- | @type SimpleTraversal = 'Simple' 'Traversal'@-type SimpleTraversal a b = Traversal a a b b+type SimpleTraversal s a = Traversal s s a a -- | This is a commonly-used infix alias for a @'Simple' 'Traversal'@.-type a :=> b = forall f. Applicative f => (b -> f b) -> a -> f a+type s :=> a = forall f. Applicative f => (a -> f a) -> s -> f s -------------------------- -- Traversal Combinators@@ -127,11 +129,11 @@ -- @'traverse' ≡ 'traverseOf' 'traverse'@ -- -- @--- 'traverseOf' :: 'Control.Lens.Iso.Iso' a b c d -> (c -> f d) -> a -> f b--- 'traverseOf' :: 'Lens' a b c d -> (c -> f d) -> a -> f b--- 'traverseOf' :: 'Traversal' a b c d -> (c -> f d) -> a -> f b+-- 'traverseOf' :: 'Control.Lens.Iso.Iso' s t a b -> (a -> f b) -> s -> f t+-- 'traverseOf' :: 'Lens' s t a b -> (a -> f b) -> s -> f t+-- 'traverseOf' :: 'Traversal' s t a b -> (a -> f b) -> s -> f t -- @-traverseOf :: LensLike f a b c d -> (c -> f d) -> a -> f b+traverseOf :: LensLike f s t a b -> (a -> f b) -> s -> f t traverseOf = id {-# INLINE traverseOf #-} @@ -150,11 +152,11 @@ -- @ -- -- @--- 'forOf' :: 'Control.Lens.Iso.Iso' a b c d -> a -> (c -> f d) -> f b--- 'forOf' :: 'Lens' a b c d -> a -> (c -> f d) -> f b--- 'forOf' :: 'Traversal' a b c d -> a -> (c -> f d) -> f b+-- 'forOf' :: 'Control.Lens.Iso.Iso' s t a b -> s -> (a -> f b) -> f t+-- 'forOf' :: 'Lens' s t a b -> s -> (a -> f b) -> f t+-- 'forOf' :: 'Traversal' s t a b -> s -> (a -> f b) -> f t -- @-forOf :: LensLike f a b c d -> a -> (c -> f d) -> f b+forOf :: LensLike f s t a b -> s -> (a -> f b) -> f t forOf = flip {-# INLINE forOf #-} @@ -168,11 +170,11 @@ -- @ -- -- @--- 'sequenceAOf' :: 'Control.Lens.Iso.Iso' a b (f c) c -> a -> f b--- 'sequenceAOf' :: 'Lens' a b (f c) c -> a -> f b--- 'sequenceAOf' :: 'Applicative' f => 'Traversal' a b (f c) c -> a -> f b+-- 'sequenceAOf' :: 'Control.Lens.Iso.Iso' s t (f b) b -> s -> f t+-- 'sequenceAOf' :: 'Lens' s t (f b) b -> s -> f t+-- 'sequenceAOf' :: 'Applicative' f => 'Traversal' s t (f b) b -> s -> f t -- @-sequenceAOf :: LensLike f a b (f c) c -> a -> f b+sequenceAOf :: LensLike f s t (f b) b -> s -> f t sequenceAOf l = l id {-# INLINE sequenceAOf #-} @@ -182,11 +184,11 @@ -- @'mapM' ≡ 'mapMOf' 'traverse'@ -- -- @--- 'mapMOf' :: 'Control.Lens.Iso.Iso' a b c d -> (c -> m d) -> a -> m b--- 'mapMOf' :: 'Lens' a b c d -> (c -> m d) -> a -> m b--- 'mapMOf' :: 'Monad' m => 'Traversal' a b c d -> (c -> m d) -> a -> m b+-- 'mapMOf' :: 'Control.Lens.Iso.Iso' s t a b -> (a -> m b) -> s -> m t+-- 'mapMOf' :: 'Lens' s t a b -> (a -> m b) -> s -> m t+-- 'mapMOf' :: 'Monad' m => 'Traversal' s t a b -> (a -> m b) -> s -> m t -- @-mapMOf :: LensLike (WrappedMonad m) a b c d -> (c -> m d) -> a -> m b+mapMOf :: LensLike (WrappedMonad m) s t a b -> (a -> m b) -> s -> m t mapMOf l cmd = unwrapMonad . l (WrapMonad . cmd) {-# INLINE mapMOf #-} @@ -197,11 +199,11 @@ -- @ -- -- @--- 'forMOf' :: 'Control.Lens.Iso.Iso' a b c d -> a -> (c -> m d) -> m b--- 'forMOf' :: 'Lens' a b c d -> a -> (c -> m d) -> m b--- 'forMOf' :: 'Monad' m => 'Traversal' a b c d -> a -> (c -> m d) -> m b+-- 'forMOf' :: 'Control.Lens.Iso.Iso' s t a b -> s -> (a -> m b) -> m t+-- 'forMOf' :: 'Lens' s t a b -> s -> (a -> m b) -> m t+-- 'forMOf' :: 'Monad' m => 'Traversal' s t a b -> s -> (a -> m b) -> m t -- @-forMOf :: LensLike (WrappedMonad m) a b c d -> a -> (c -> m d) -> m b+forMOf :: LensLike (WrappedMonad m) s t a b -> s -> (a -> m b) -> m t forMOf l a cmd = unwrapMonad (l (WrapMonad . cmd) a) {-# INLINE forMOf #-} @@ -214,11 +216,11 @@ -- @ -- -- @--- 'sequenceOf' :: 'Control.Lens.Iso.Iso' a b (m c) c -> a -> m b--- 'sequenceOf' :: 'Lens' a b (m c) c -> a -> m b--- 'sequenceOf' :: 'Monad' m => 'Traversal' a b (m c) c -> a -> m b+-- 'sequenceOf' :: 'Control.Lens.Iso.Iso' s t (m b) b -> s -> m t+-- 'sequenceOf' :: 'Lens' s t (m b) b -> s -> m t+-- 'sequenceOf' :: 'Monad' m => 'Traversal' s t (m b) b -> s -> m t -- @-sequenceOf :: LensLike (WrappedMonad m) a b (m c) c -> a -> m b+sequenceOf :: LensLike (WrappedMonad m) s t (m b) b -> s -> m t sequenceOf l = unwrapMonad . l WrapMonad {-# INLINE sequenceOf #-} @@ -235,7 +237,7 @@ -- monadic strength as well: -- -- @'transposeOf' '_2' :: (b, [a]) -> [(b, a)]@-transposeOf :: LensLike ZipList a b [c] c -> a -> [b]+transposeOf :: LensLike ZipList s t [a] a -> s -> [t] transposeOf l = getZipList . l ZipList {-# INLINE transposeOf #-} @@ -246,11 +248,11 @@ -- 'mapAccumROf' accumulates state from right to left. -- -- @--- 'mapAccumROf' :: 'Control.Lens.Iso.Iso' a b c d -> (s -> c -> (s, d)) -> s -> a -> (s, b)--- 'mapAccumROf' :: 'Lens' a b c d -> (s -> c -> (s, d)) -> s -> a -> (s, b)--- 'mapAccumROf' :: 'Traversal' a b c d -> (s -> c -> (s, d)) -> s -> a -> (s, b)+-- 'mapAccumROf' :: 'Control.Lens.Iso.Iso' s t a b -> (acc -> a -> (acc, b)) -> acc -> s -> (acc, t)+-- 'mapAccumROf' :: 'Lens' s t a b -> (acc -> a -> (acc, b)) -> acc -> s -> (acc, t)+-- 'mapAccumROf' :: 'Traversal' s t a b -> (acc -> a -> (acc, b)) -> acc -> s -> (acc, t) -- @-mapAccumROf :: LensLike (Lazy.State s) a b c d -> (s -> c -> (s, d)) -> s -> a -> (s, b)+mapAccumROf :: LensLike (Lazy.State acc) s t a b -> (acc -> a -> (acc, b)) -> acc -> s -> (acc, t) mapAccumROf l f s0 a = swap (Lazy.runState (l (\c -> State.state (\s -> swap (f s c))) a) s0) {-# INLINE mapAccumROf #-} @@ -261,11 +263,11 @@ -- 'mapAccumLOf' accumulates state from left to right. -- -- @--- 'mapAccumLOf' :: 'Control.Lens.Iso.Iso' a b c d -> (s -> c -> (s, d)) -> s -> a -> (s, b)--- 'mapAccumLOf' :: 'Lens' a b c d -> (s -> c -> (s, d)) -> s -> a -> (s, b)--- 'mapAccumLOf' :: 'Traversal' a b c d -> (s -> c -> (s, d)) -> s -> a -> (s, b)+-- 'mapAccumLOf' :: 'Control.Lens.Iso.Iso' s t a b -> (acc -> a -> (acc, b)) -> acc -> s -> (acc, t)+-- 'mapAccumLOf' :: 'Lens' s t a b -> (acc -> a -> (acc, b)) -> acc -> s -> (acc, t)+-- 'mapAccumLOf' :: 'Traversal' s t a b -> (acc -> a -> (acc, b)) -> acc -> s -> (acc, t) -- @-mapAccumLOf :: LensLike (Backwards (Lazy.State s)) a b c d -> (s -> c -> (s, d)) -> s -> a -> (s, b)+mapAccumLOf :: LensLike (Backwards (Lazy.State acc)) s t a b -> (acc -> a -> (acc, b)) -> acc -> s -> (acc, t) mapAccumLOf = mapAccumROf . backwards {-# INLINE mapAccumLOf #-} @@ -278,14 +280,14 @@ -- @'scanr1' ≡ 'scanr1Of' 'traverse'@ -- -- @--- 'scanr1Of' :: 'Control.Lens.Iso.Iso' a b c c -> (c -> c -> c) -> a -> b--- 'scanr1Of' :: 'Lens' a b c c -> (c -> c -> c) -> a -> b--- 'scanr1Of' :: 'Traversal' a b c c -> (c -> c -> c) -> a -> b+-- 'scanr1Of' :: 'Control.Lens.Iso.Iso' s t a a -> (a -> a -> a) -> s -> t+-- 'scanr1Of' :: 'Lens' s t a a -> (a -> a -> a) -> s -> t+-- 'scanr1Of' :: 'Traversal' s t a a -> (a -> a -> a) -> s -> t -- @-scanr1Of :: LensLike (Lazy.State (Maybe c)) a b c c -> (c -> c -> c) -> a -> b+scanr1Of :: LensLike (Lazy.State (Maybe a)) s t a a -> (a -> a -> a) -> s -> t scanr1Of l f = snd . mapAccumROf l step Nothing where- step Nothing c = (Just c, c)- step (Just s) c = (Just r, r) where r = f c s+ step Nothing a = (Just a, a)+ step (Just s) a = (Just r, r) where r = f a s {-# INLINE scanr1Of #-} -- | This permits the use of 'scanl1' over an arbitrary 'Traversal' or 'Lens'.@@ -293,14 +295,14 @@ -- @'scanl1' ≡ 'scanl1Of' 'traverse'@ -- -- @--- 'scanr1Of' :: 'Control.Lens.Iso.Iso' a b c c -> (c -> c -> c) -> a -> b--- 'scanr1Of' :: 'Lens' a b c c -> (c -> c -> c) -> a -> b--- 'scanr1Of' :: 'Traversal' a b c c -> (c -> c -> c) -> a -> b+-- 'scanr1Of' :: 'Control.Lens.Iso.Iso' s t a a -> (a -> a -> a) -> s -> t+-- 'scanr1Of' :: 'Lens' s t a a -> (a -> a -> a) -> s -> t+-- 'scanr1Of' :: 'Traversal' s t a a -> (a -> a -> a) -> s -> t -- @-scanl1Of :: LensLike (Backwards (Lazy.State (Maybe c))) a b c c -> (c -> c -> c) -> a -> b+scanl1Of :: LensLike (Backwards (Lazy.State (Maybe a))) s t a a -> (a -> a -> a) -> s -> t scanl1Of l f = snd . mapAccumLOf l step Nothing where- step Nothing c = (Just c, c)- step (Just s) c = (Just r, r) where r = f s c+ step Nothing a = (Just a, a)+ step (Just s) a = (Just r, r) where r = f s a {-# INLINE scanl1Of #-} ------------------------------------------------------------------------------@@ -313,13 +315,13 @@ -- -- >>> [[1],[3,4]]^.elementOf (traverse.traverse) 1 -- 3-elementOf :: Functor f => LensLike (ElementOf f) a b c c -> Int -> LensLike f a b c c-elementOf l i f a = case getElementOf (l go a) 0 of- Found _ fb -> fb+elementOf :: Functor f => LensLike (ElementOf f) s t a a -> Int -> LensLike f s t a a+elementOf l i f s = case getElementOf (l go s) 0 of+ Found _ ft -> ft Searching _ _ -> error "elementOf: index out of range" NotFound e -> error $ "elementOf: " ++ e where- go c = ElementOf $ \j -> if i == j then Found (j + 1) (f c) else Searching (j + 1) c+ go a = ElementOf $ \j -> if i == j then Found (j + 1) (f a) else Searching (j + 1) a -- | Access the /nth/ element of a 'Traversable' container. --@@ -335,10 +337,10 @@ -- | This is the trivial empty traversal. ----- @'ignored' :: 'Applicative' f => (c -> f d) -> a -> f a@+-- @'ignored' :: 'Applicative' f => (a -> f b) -> s -> f s@ -- -- @'ignored' ≡ 'const' 'pure'@-ignored :: Traversal a a c d+ignored :: Traversal s s a b ignored _ = pure {-# INLINE ignored #-} @@ -394,7 +396,18 @@ traverseRight f (Right a) = Right <$> f a {-# INLINE traverseRight #-} +-- | Visit the first /n/ targets of a 'Traversal', 'Fold', 'Getter' or 'Lens'.+taking :: Applicative f => Int -> SimpleLensLike (Indexing f) s a -> SimpleLensLike f s a+taking n l f s = case runIndexing (l (\a -> Indexing $ \i -> IndexingResult (if i < n then f a else pure a) (i + 1)) s) 0 of+ IndexingResult r _ -> r+{-# INLINE taking #-} +-- | Visit all but the first /n/ targets of a 'Traversal', 'Fold', 'Getter' or 'Lens'.+dropping :: Applicative f => Int -> SimpleLensLike (Indexing f) s a -> SimpleLensLike f s a+dropping n l f s = case runIndexing (l (\a -> Indexing $ \i -> IndexingResult (if i >= n then f a else pure a) (i + 1)) s) 0 of+ IndexingResult r _ -> r+{-# INLINE dropping #-}+ ------------------------------------------------------------------------------ -- Cloning Traversals ------------------------------------------------------------------------------@@ -416,13 +429,13 @@ -- >>> foo both ("hello","world") -- ("helloworld",(10,10)) ----- @'cloneTraversal' :: 'LensLike' ('Bazaar' c d) a b c d -> 'Traversal' a b c d@-cloneTraversal :: Applicative f => ((c -> Bazaar c d d) -> a -> Bazaar c d b) -> (c -> f d) -> a -> f b+-- @'cloneTraversal' :: 'LensLike' ('Bazaar' a b) s t a b -> 'Traversal' s t a b@+cloneTraversal :: Applicative f => ((a -> Bazaar a b b) -> s -> Bazaar a b t) -> (a -> f b) -> s -> f t cloneTraversal l f = bazaar f . l sell {-# INLINE cloneTraversal #-} -- | A form of 'Traversal' that can be stored monomorphically in a container.-data ReifiedTraversal a b c d = ReifyTraversal { reflectTraversal :: Traversal a b c d }+data ReifiedTraversal s t a b = ReifyTraversal { reflectTraversal :: Traversal s t a b } -- | @type SimpleReifiedTraversal = 'Simple' 'ReifiedTraversal'@-type SimpleReifiedTraversal a b = ReifiedTraversal a a b b+type SimpleReifiedTraversal s a = ReifiedTraversal s s a a
src/Control/Lens/Tuple.hs view
@@ -35,7 +35,7 @@ -- >>> import Control.Lens -- | Provides access to 1st field of a tuple.-class Field1 a b c d | a -> c, b -> d, a d -> b, b c -> a where+class Field1 s t a b | s -> a, t -> b, s b -> t, t a -> s where -- | Access the 1st field of a tuple (and possibly change its type). -- -- >>> (1,2)^._1@@ -56,7 +56,7 @@ -- ... -- _1 :: 'Lens' (a,c,d,e,f,g,h,i) (a',b,c,d,e,f,g,h,i) a a' -- @- _1 :: Lens a b c d+ _1 :: Lens s t a b instance Field1 (a,b) (a',b) a a' where _1 k (a,b) = (\a' -> (a',b)) <$> k a@@ -91,18 +91,18 @@ {-# INLINE _1 #-} -- | Provides access to the 2nd field of a tuple-class Field2 a b c d | a -> c, b -> d, a d -> b, b c -> a where+class Field2 s t a b | s -> a, t -> b, s b -> t, t a -> s where -- | Access the 2nd field of a tuple -- -- >>> _2 .~ "hello" $ (1,(),3,4) -- (1,"hello",3,4) -- -- @- -- 'Control.Lens.Fold.anyOf' '_2' :: (c -> 'Bool') -> (a, c) -> 'Bool'- -- 'Data.Traversable.traverse' '.' '_2' :: ('Applicative' f, 'Data.Traversable.Traversable' t) => (a -> f b) -> t (c, a) -> f (t (c, b))- -- 'Control.Lens.Fold.foldMapOf' ('Data.Traversable.traverse' '.' '_2') :: ('Data.Traversable.Traversable' t, 'Data.Monoid.Monoid' m) => (c -> m) -> t (b, c) -> m+ -- 'Control.Lens.Fold.anyOf' '_2' :: (s -> 'Bool') -> (a, s) -> 'Bool'+ -- 'Data.Traversable.traverse' '.' '_2' :: ('Applicative' f, 'Data.Traversable.Traversable' t) => (a -> f b) -> t (s, a) -> f (t (s, b))+ -- 'Control.Lens.Fold.foldMapOf' ('Data.Traversable.traverse' '.' '_2') :: ('Data.Traversable.Traversable' t, 'Data.Monoid.Monoid' m) => (s -> m) -> t (b, s) -> m -- @- _2 :: Lens a b c d+ _2 :: Lens s t a b instance Field2 (a,b) (a,b') b b' where _2 k (a,b) = (\b' -> (a,b')) <$> k b@@ -137,9 +137,9 @@ {-# INLINE _2 #-} -- | Provides access to the 3rd field of a tuple-class Field3 a b c d | a -> c, b -> d, a d -> b, b c -> a where+class Field3 s t a b | s -> a, t -> b, s b -> t, t a -> s where -- | Access the 3rd field of a tuple- _3 :: Lens a b c d+ _3 :: Lens s t a b instance Field3 (a,b,c) (a,b,c') c c' where _3 k (a,b,c) = (\c' -> (a,b,c')) <$> k c@@ -170,9 +170,9 @@ {-# INLINE _3 #-} -- | Provide access to the 4th field of a tuple-class Field4 a b c d | a -> c, b -> d, a d -> b, b c -> a where+class Field4 s t a b | s -> a, t -> b, s b -> t, t a -> s where -- | Access the 4th field of a tuple- _4 :: Lens a b c d+ _4 :: Lens s t a b instance Field4 (a,b,c,d) (a,b,c,d') d d' where _4 k (a,b,c,d) = (\d' -> (a,b,c,d')) <$> k d@@ -199,9 +199,9 @@ {-# INLINE _4 #-} -- | Provides access to the 5th field of a tuple-class Field5 a b c d | a -> c, b -> d, a d -> b, b c -> a where+class Field5 s t a b | s -> a, t -> b, s b -> t, t a -> s where -- | Access the 5th field of a tuple- _5 :: Lens a b c d+ _5 :: Lens s t a b instance Field5 (a,b,c,d,e) (a,b,c,d,e') e e' where _5 k (a,b,c,d,e) = (\e' -> (a,b,c,d,e')) <$> k e@@ -224,9 +224,9 @@ {-# INLINE _5 #-} -- | Provides access to the 6th element of a tuple-class Field6 a b c d | a -> c, b -> d, a d -> b, b c -> a where+class Field6 s t a b | s -> a, t -> b, s b -> t, t a -> s where -- | Access the 6th field of a tuple- _6 :: Lens a b c d+ _6 :: Lens s t a b instance Field6 (a,b,c,d,e,f) (a,b,c,d,e,f') f f' where _6 k (a,b,c,d,e,f) = (\f' -> (a,b,c,d,e,f')) <$> k f@@ -245,9 +245,9 @@ {-# INLINE _6 #-} -- | Provide access to the 7th field of a tuple-class Field7 a b c d | a -> c, b -> d, a d -> b, b c -> a where+class Field7 s t a b | s -> a, t -> b, s b -> t, t a -> s where -- | Access the 7th field of a tuple- _7 :: Lens a b c d+ _7 :: Lens s t a b instance Field7 (a,b,c,d,e,f,g) (a,b,c,d,e,f,g') g g' where _7 k (a,b,c,d,e,f,g) = (\g' -> (a,b,c,d,e,f,g')) <$> k g@@ -262,9 +262,9 @@ {-# INLINE _7 #-} -- | Provide access to the 8th field of a tuple-class Field8 a b c d | a -> c, b -> d, a d -> b, b c -> a where+class Field8 s t a b | s -> a, t -> b, s b -> t, t a -> s where -- | Access the 8th field of a tuple- _8 :: Lens a b c d+ _8 :: Lens s t a b instance Field8 (a,b,c,d,e,f,g,h) (a,b,c,d,e,f,g,h') h h' where _8 k (a,b,c,d,e,f,g,h) = (\h' -> (a,b,c,d,e,f,g,h')) <$> k h@@ -275,9 +275,9 @@ {-# INLINE _8 #-} -- | Provides access to the 9th field of a tuple-class Field9 a b c d | a -> c, b -> d, a d -> b, b c -> a where+class Field9 s t a b | s -> a, t -> b, s b -> t, t a -> s where -- | Access the 9th field of a tuple- _9 :: Lens a b c d+ _9 :: Lens s t a b instance Field9 (a,b,c,d,e,f,g,h,i) (a,b,c,d,e,f,g,h,i') i i' where _9 k (a,b,c,d,e,f,g,h,i) = (\i' -> (a,b,c,d,e,f,g,h,i')) <$> k i
src/Control/Lens/Type.hs view
@@ -20,7 +20,7 @@ -- Stability : provisional -- Portability : Rank2Types ----- A @'Lens' a b c d@ is a purely functional reference.+-- A @'Lens' s t a b@ is a purely functional reference. -- -- While a 'Control.Lens.Traversal.Traversal' could be used for -- 'Control.Lens.Getter.Getting' like a valid 'Control.Lens.Fold.Fold',@@ -29,7 +29,7 @@ -- -- 'Functor', however is the superclass of both. ----- @type 'Lens' a b c d = forall f. 'Functor' f => (c -> f d) -> a -> f b@+-- @type 'Lens' s t a b = forall f. 'Functor' f => (a -> f b) -> s -> f t@ -- -- Every 'Lens' is a valid 'Control.Lens.Setter.Setter'. --@@ -120,7 +120,7 @@ -- | A 'Lens' is actually a lens family as described in -- <http://comonad.com/reader/2012/mirrored-lenses/>. ----- With great power comes great responsibility and a 'Lens'is subject to the+-- With great power comes great responsibility and a 'Lens' is subject to the -- three common sense lens laws: -- -- 1) You get back what you put in:@@ -154,8 +154,8 @@ -- 'fmap' (l f) '.' l g ≡ 'Data.Functor.Compose.getCompose' '.' l ('Data.Functor.Compose.Compose' '.' 'fmap' f '.' g) -- @ ----- @type 'Lens' a b c d = forall f. 'Functor' f => 'LensLike' f a b c d@-type Lens a b c d = forall f. Functor f => (c -> f d) -> a -> f b+-- @type 'Lens' s t a b = forall f. 'Functor' f => 'LensLike' f s t a b@+type Lens s t a b = forall f. Functor f => (a -> f b) -> s -> f t -- | A 'Simple' 'Lens', 'Simple' 'Control.Lens.Traversal.Traversal', ... can -- be used instead of a 'Lens','Control.Lens.Traversal.Traversal', ...@@ -168,16 +168,16 @@ -- -- Note: To use this alias in your own code with @'LensLike' f@ or -- 'Control.Lens.Setter.Setter', you may have to turn on @LiberalTypeSynonyms@.-type Simple f a b = f a a b b+type Simple f s a = f s s a a -- | This is a commonly used infix alias for a @'Simple' 'Lens'@.-type a :-> b = forall f. Functor f => (b -> f b) -> a -> f a+type s :-> a = forall f. Functor f => (a -> f a) -> s -> f s -- | @type 'SimpleLens' = 'Simple' 'Lens'@-type SimpleLens a b = Lens a a b b+type SimpleLens s a = Lens s s a a -- | @type 'SimpleLensLike' f = 'Simple' ('LensLike' f)@-type SimpleLensLike f a b = LensLike f a a b b+type SimpleLensLike f s a = LensLike f s s a a -------------------------- -- Constructing Lenses@@ -185,15 +185,15 @@ -- | Build a 'Lens' from a getter and a setter. ----- @'lens' :: 'Functor' f => (a -> c) -> (a -> d -> b) -> (c -> f d) -> a -> f b@-lens :: (a -> c) -> (a -> d -> b) -> Lens a b c d-lens ac adb cfd a = adb a <$> cfd (ac a)+-- @'lens' :: 'Functor' f => (s -> a) -> (s -> b -> t) -> (a -> f b) -> s -> f t@+lens :: (s -> a) -> (s -> b -> t) -> Lens s t a b+lens sa sbt afb s = sbt s <$> afb (sa s) {-# INLINE lens #-} -- | This is occasionally useful when your 'Lens' (or 'Control.Lens.Traversal.Traversal') -- has a constraint on an unused argument to force that argument to agree with the -- type of a used argument and avoid @ScopedTypeVariables@ or other ugliness.-simple :: SimpleLensLike f a b -> SimpleLensLike f a b+simple :: SimpleLensLike f s a -> SimpleLensLike f s a simple l = l -------------------------------------------------------------------------------@@ -207,12 +207,12 @@ -- They do so by specializing the type of 'Functor' that they require of the -- caller. ----- If a function accepts a @'LensLike' f a b c d@ for some 'Functor' @f@,+-- If a function accepts a @'LensLike' f s t a b@ for some 'Functor' @f@, -- then they may be passed a 'Lens'. -- -- Further, if @f@ is an 'Applicative', they may also be passed a -- 'Control.Lens.Traversal.Traversal'.-type LensLike f a b c d = (c -> f d) -> a -> f b+type LensLike f s t a b = (a -> f b) -> s -> f t -- | ('%%~') can be used in one of two scenarios: --@@ -228,9 +228,9 @@ -- @('%%~') ≡ 'id'@ -- -- @--- ('%%~') :: 'Functor' f => 'Control.Lens.Iso.Iso' a b c d -> (c -> f d) -> a -> f b--- ('%%~') :: 'Functor' f => 'Lens' a b c d -> (c -> f d) -> a -> f b--- ('%%~') :: 'Applicative' f => 'Control.Lens.Traversal.Traversal' a b c d -> (c -> f d) -> a -> f b+-- ('%%~') :: 'Functor' f => 'Control.Lens.Iso.Iso' s t a b -> (a -> f b) -> s -> f t+-- ('%%~') :: 'Functor' f => 'Lens' s t a b -> (a -> f b) -> s -> f t+-- ('%%~') :: 'Applicative' f => 'Control.Lens.Traversal.Traversal' s t a b -> (a -> f b) -> s -> f t -- @ -- -- It may be beneficial to think about it as if it had these even more@@ -241,18 +241,18 @@ -- of its actions, by choosing @f = ((,) m)@ -- -- @--- ('%%~') :: 'Control.Lens.Iso.Iso' a b c d -> (c -> (e, d)) -> a -> (e, b)--- ('%%~') :: 'Lens' a b c d -> (c -> (e, d)) -> a -> (e, b)--- ('%%~') :: 'Monoid' m => 'Control.Lens.Traversal.Traversal' a b c d -> (c -> (m, d)) -> a -> (m, b)+-- ('%%~') :: 'Control.Lens.Iso.Iso' s t a b -> (a -> (r, b)) -> s -> (r, t)+-- ('%%~') :: 'Lens' s t a b -> (a -> (r, b)) -> s -> (r, t)+-- ('%%~') :: 'Monoid' m => 'Control.Lens.Traversal.Traversal' s t a b -> (a -> (m, b)) -> s -> (m, t) -- @-(%%~) :: LensLike f a b c d -> (c -> f d) -> a -> f b+(%%~) :: LensLike f s t a b -> (a -> f b) -> s -> f t (%%~) = id {-# INLINE (%%~) #-} -- | Modify the target of a 'Lens' in the current state returning some extra--- information of @c@ or modify all targets of a+-- information of type @r@ or modify all targets of a -- 'Control.Lens.Traversal.Traversal' in the current state, extracting extra--- information of type @c@ and return a monoidal summary of the changes.+-- information of type @r@ and return a monoidal summary of the changes. -- -- @('%%=') ≡ ('state' '.')@ --@@ -260,18 +260,18 @@ -- following more restricted type signatures: -- -- @--- ('%%=') :: 'MonadState' a m => 'Control.Lens.Iso.Iso' a a c d -> (c -> (e, d)) -> m e--- ('%%=') :: 'MonadState' a m => 'Lens' a a c d -> (c -> (e, d)) -> m e--- ('%%=') :: ('MonadState' a m, 'Monoid' e) => 'Control.Lens.Traversal.Traversal' a a c d -> (c -> (e, d)) -> m e+-- ('%%=') :: 'MonadState' s m => 'Control.Lens.Iso.Iso' s s a b -> (a -> (r, b)) -> m r+-- ('%%=') :: 'MonadState' s m => 'Lens' s s a b -> (a -> (r, b)) -> m r+-- ('%%=') :: ('MonadState' s m, 'Monoid' r) => 'Control.Lens.Traversal.Traversal' s s a b -> (a -> (r, b)) -> m r -- @-(%%=) :: MonadState a m => LensLike ((,) e) a a c d -> (c -> (e, d)) -> m e+(%%=) :: MonadState s m => LensLike ((,) r) s s a b -> (a -> (r, b)) -> m r #if MIN_VERSION_mtl(2,1,1) l %%= f = State.state (l f) #else l %%= f = do- (e, b) <- State.gets (l f)- State.put b- return e+ (r, s) <- State.gets (l f)+ State.put s+ return r #endif {-# INLINE (%%=) #-} @@ -293,16 +293,16 @@ -- @'chosen' ≡ 'choosing' 'id' 'id'@ -- -- @--- 'choosing' :: 'Control.Lens.Getter.Getter' a c -> 'Control.Lens.Getter.Getter' b c -> 'Control.Lens.Getter.Getter' ('Either' a b) c--- 'choosing' :: 'Control.Lens.Fold.Fold' a c -> 'Control.Lens.Fold.Fold' b c -> 'Control.Lens.Fold.Fold' ('Either' a b) c--- 'choosing' :: 'Simple' 'Lens' a c -> 'Simple' 'Lens' b c -> 'Simple' 'Lens' ('Either' a b) c--- 'choosing' :: 'Simple' 'Control.Lens.Traversal.Traversal' a c -> 'Simple' 'Control.Lens.Traversal.Traversal' b c -> 'Simple' 'Control.Lens.Traversal.Traversal' ('Either' a b) c--- 'choosing' :: 'Simple' 'Control.Lens.Setter.Setter' a c -> 'Simple' 'Control.Lens.Setter.Setter' b c -> 'Simple' 'Control.Lens.Setter.Setter' ('Either' a b) c+-- 'choosing' :: 'Control.Lens.Getter.Getter' s a -> 'Control.Lens.Getter.Getter' s' a -> 'Control.Lens.Getter.Getter' ('Either' s s') a+-- 'choosing' :: 'Control.Lens.Fold.Fold' s a -> 'Control.Lens.Fold.Fold' s' a -> 'Control.Lens.Fold.Fold' ('Either' s s') a+-- 'choosing' :: 'Simple' 'Lens' s a -> 'Simple' 'Lens' s' a -> 'Simple' 'Lens' ('Either' s s') a+-- 'choosing' :: 'Simple' 'Control.Lens.Traversal.Traversal' s a -> 'Simple' 'Control.Lens.Traversal.Traversal' s' a -> 'Simple' 'Control.Lens.Traversal.Traversal' ('Either' s s') a+-- 'choosing' :: 'Simple' 'Control.Lens.Setter.Setter' s a -> 'Simple' 'Control.Lens.Setter.Setter' s' a -> 'Simple' 'Control.Lens.Setter.Setter' ('Either' s s') a -- @ choosing :: Functor f- => LensLike f a b c c- -> LensLike f a' b' c c- -> LensLike f (Either a a') (Either b b') c c+ => LensLike f s t a a+ -> LensLike f s' t' a a+ -> LensLike f (Either s s') (Either t t') a a choosing l _ f (Left a) = Left <$> l f a choosing _ r f (Right a') = Right <$> r f a' {-# INLINE choosing #-}@@ -324,13 +324,13 @@ -- | 'alongside' makes a 'Lens' from two other lenses. ----- @'alongside' :: 'Lens' a b c d -> 'Lens' a' b' c' d' -> 'Lens' (a,a') (b,b') (c,c') (d,d')@-alongside :: LensLike (Context c d) a b c d- -> LensLike (Context c' d') a' b' c' d'- -> Lens (a,a') (b,b') (c,c') (d,d')-alongside l r f (a, a') = case l (Context id) a of- Context db c -> case r (Context id) a' of- Context db' c' -> (\(d,d') -> (db d, db' d')) <$> f (c,c')+-- @'alongside' :: 'Lens' s t a b -> 'Lens' s' t' a' b' -> 'Lens' (s,s') (t,t') (a,a') (b,b')@+alongside :: LensLike (Context a b) s t a b+ -> LensLike (Context a' b') s' t' a' b'+ -> Lens (s,s') (t,t') (a,a') (b,b')+alongside l r f (s, s') = case l (Context id) s of+ Context bt a -> case r (Context id) s' of+ Context bt' a' -> (\(b,b') -> (bt b, bt' b')) <$> f (a,a') {-# INLINE alongside #-} -------------------------------------------------------------------------------@@ -346,21 +346,21 @@ -- -- /\"Costate Comonad Coalgebra is equivalent of Java's member variable update technology for Haskell\"/ -- \@PLT_Borat on Twitter cloneLens :: Functor f- => LensLike (Context c d) a b c d- -> (c -> f d) -> a -> f b-cloneLens f cfd a = case f (Context id) a of- Context db c -> db <$> cfd c+ => LensLike (Context a b) s t a b+ -> (a -> f b) -> s -> f t+cloneLens f afb s = case f (Context id) s of+ Context bt a -> bt <$> afb a {-# INLINE cloneLens #-} ------------------------------------------------------------------------------- -- Overloading function application ------------------------------------------------------------------------------- --- | @type 'LensLike' f a b c d = 'Overloaded' (->) f a b c d@-type Overloaded k f a b c d = k (c -> f d) (a -> f b)+-- | @type 'LensLike' f s t a b = 'Overloaded' (->) f s t a b@+type Overloaded k f s t a b = k (a -> f b) (s -> f t) --- | @type 'SimpleOverloaded' k f a b = 'Simple' ('Overloaded' k f) a b@-type SimpleOverloaded k f a b = Overloaded k f a a b b+-- | @type 'SimpleOverloaded' k f s a = 'Simple' ('Overloaded' k f) s a@+type SimpleOverloaded k f s a = Overloaded k f s s a a ------------------------------------------------------------------------------- -- Setting and Remembering@@ -371,12 +371,12 @@ -- When you do not need the result of the addition, ('Control.Lens.Setter.%~') is more flexible. -- -- @--- ('<%~') :: 'Lens' a b c d -> (c -> d) -> a -> (d, b)--- ('<%~') :: 'Control.Lens.Iso.Iso' a b c d -> (c -> d) -> a -> (d, b)--- ('<%~') :: 'Monoid' d => 'Control.Lens.Traversal.Traversal' a b c d -> (c -> d) -> a -> (d, b)+-- ('<%~') :: 'Lens' s t a b -> (a -> b) -> s -> (b, t)+-- ('<%~') :: 'Control.Lens.Iso.Iso' s t a b -> (a -> b) -> s -> (b, t)+-- ('<%~') :: 'Monoid' b => 'Control.Lens.Traversal.Traversal' s t a b -> (a -> b) -> s -> (b, t) -- @-(<%~) :: LensLike ((,)d) a b c d -> (c -> d) -> a -> (d, b)-l <%~ f = l $ \c -> let d = f c in (d, d)+(<%~) :: LensLike ((,)b) s t a b -> (a -> b) -> s -> (b, t)+l <%~ f = l $ \s -> let t = f s in (t, t) {-# INLINE (<%~) #-} -- | Increment the target of a numerically valued 'Lens' and return the result@@ -384,11 +384,11 @@ -- When you do not need the result of the addition, ('Control.Lens.Setter.+~') is more flexible. -- -- @--- ('<+~') :: 'Num' b => 'Simple' 'Lens' a b -> b -> a -> (b, a)--- ('<+~') :: 'Num' b => 'Simple' 'Control.Lens.Iso.Iso' a b -> b -> a -> (b, a)+-- ('<+~') :: 'Num' a => 'Simple' 'Lens' s a -> a -> s -> (a, s)+-- ('<+~') :: 'Num' a => 'Simple' 'Control.Lens.Iso.Iso' s a -> a -> s -> (a, s) -- @-(<+~) :: Num c => LensLike ((,)c) a b c c -> c -> a -> (c, b)-l <+~ c = l <%~ (+ c)+(<+~) :: Num a => LensLike ((,)a) s t a a -> a -> s -> (a, t)+l <+~ a = l <%~ (+ a) {-# INLINE (<+~) #-} -- | Decrement the target of a numerically valued 'Lens' and return the result@@ -396,11 +396,11 @@ -- When you do not need the result of the subtraction, ('Control.Lens.Setter.-~') is more flexible. -- -- @--- ('<-~') :: 'Num' b => 'Simple' 'Lens' a b -> b -> a -> (b, a)--- ('<-~') :: 'Num' b => 'Simple' 'Control.Lens.Iso.Iso' a b -> b -> a -> (b, a)+-- ('<-~') :: 'Num' a => 'Simple' 'Lens' s a -> a -> s -> (a, s)+-- ('<-~') :: 'Num' a => 'Simple' 'Control.Lens.Iso.Iso' s a -> a -> s -> (a, s) -- @-(<-~) :: Num c => LensLike ((,)c) a b c c -> c -> a -> (c, b)-l <-~ c = l <%~ subtract c+(<-~) :: Num a => LensLike ((,)a) s t a a -> a -> s -> (a, t)+l <-~ a = l <%~ subtract a {-# INLINE (<-~) #-} -- | Multiply the target of a numerically valued 'Lens' and return the result@@ -409,11 +409,11 @@ -- flexible. -- -- @--- ('<*~') :: 'Num' b => 'Simple' 'Lens' a b -> b -> a -> (b, a)--- ('<*~') :: 'Num' b => 'Simple' 'Control.Lens.Iso.Iso' a b -> b -> a -> (b, a)+-- ('<*~') :: 'Num' b => 'Simple' 'Lens' s a -> a -> a -> (s, a)+-- ('<*~') :: 'Num' b => 'Simple' 'Control.Lens.Iso.Iso' s a -> a -> a -> (s, a)) -- @-(<*~) :: Num c => LensLike ((,)c) a b c c -> c -> a -> (c, b)-l <*~ c = l <%~ (* c)+(<*~) :: Num a => LensLike ((,)a) s t a a -> a -> s -> (a, t)+l <*~ a = l <%~ (* a) {-# INLINE (<*~) #-} -- | Divide the target of a fractionally valued 'Lens' and return the result.@@ -421,11 +421,11 @@ -- When you do not need the result of the division, ('Control.Lens.Setter.//~') is more flexible. -- -- @--- ('<//~') :: 'Fractional' b => 'Simple' 'Lens' a b -> b -> a -> (b, a)--- ('<//~') :: 'Fractional' b => 'Simple' 'Control.Lens.Iso.Iso' a b -> b -> a -> (b, a)+-- ('<//~') :: 'Fractional' b => 'Simple' 'Lens' s a -> a -> a -> (s, a)+-- ('<//~') :: 'Fractional' b => 'Simple' 'Control.Lens.Iso.Iso' s a -> a -> a -> (s, a)) -- @-(<//~) :: Fractional c => LensLike ((,)c) a b c c -> c -> a -> (c, b)-l <//~ c = l <%~ (/ c)+(<//~) :: Fractional a => LensLike ((,)a) s t a a -> a -> s -> (a, t)+l <//~ a = l <%~ (/ a) {-# INLINE (<//~) #-} -- | Raise the target of a numerically valued 'Lens' to a non-negative@@ -434,11 +434,11 @@ -- When you do not need the result of the division, ('Control.Lens.Setter.^~') is more flexible. -- -- @--- ('<^~') :: ('Num' b, 'Integral' c) => 'Simple' 'Lens' a b -> c -> a -> (b, a)--- ('<^~') :: ('Num' b, 'Integral' c) => 'Simple' 'Control.Lens.Iso.Iso' a b -> c -> a -> (b, a)+-- ('<^~') :: ('Num' b, 'Integral' e) => 'Simple' 'Lens' s a -> e -> a -> (a, s)+-- ('<^~') :: ('Num' b, 'Integral' e) => 'Simple' 'Control.Lens.Iso.Iso' s a -> e -> a -> (a, s) -- @-(<^~) :: (Num c, Integral d) => LensLike ((,)c) a b c c -> d -> a -> (c, b)-l <^~ d = l <%~ (^ d)+(<^~) :: (Num a, Integral e) => LensLike ((,)a) s t a a -> e -> s -> (a, t)+l <^~ e = l <%~ (^ e) {-# INLINE (<^~) #-} -- | Raise the target of a fractionally valued 'Lens' to an 'Integral' power@@ -447,11 +447,11 @@ -- When you do not need the result of the division, ('Control.Lens.Setter.^^~') is more flexible. -- -- @--- ('<^^~') :: ('Fractional' b, 'Integral' c) => 'Simple' 'Lens' a b -> c -> a -> (b, a)--- ('<^^~') :: ('Fractional' b, 'Integral' c) => 'Simple' 'Control.Lens.Iso.Iso' a b -> c -> a -> (b, a)+-- ('<^^~') :: ('Fractional' b, 'Integral' e) => 'Simple' 'Lens' s a -> e -> a -> (a, s)+-- ('<^^~') :: ('Fractional' b, 'Integral' e) => 'Simple' 'Control.Lens.Iso.Iso' s a -> e -> a -> (a, s) -- @-(<^^~) :: (Fractional c, Integral d) => LensLike ((,)c) a b c c -> d -> a -> (c, b)-l <^^~ d = l <%~ (^^ d)+(<^^~) :: (Fractional a, Integral e) => LensLike ((,)a) s t a a -> e -> s -> (a, t)+l <^^~ e = l <%~ (^^ e) {-# INLINE (<^^~) #-} -- | Raise the target of a floating-point valued 'Lens' to an arbitrary power@@ -460,11 +460,11 @@ -- When you do not need the result of the division, ('Control.Lens.Setter.**~') is more flexible. -- -- @--- ('<**~') :: 'Floating' b => 'Simple' 'Lens' a b -> b -> a -> (b, a)--- ('<**~') :: 'Floating' b => 'Simple' 'Control.Lens.Iso.Iso' a b -> b -> a -> (b, a)+-- ('<**~') :: 'Floating' a => 'Simple' 'Lens' s a -> a -> s -> (a, s)+-- ('<**~') :: 'Floating' a => 'Simple' 'Control.Lens.Iso.Iso' s a -> a -> s -> (a, s) -- @-(<**~) :: Floating c => LensLike ((,)c) a b c c -> c -> a -> (c, b)-l <**~ c = l <%~ (** c)+(<**~) :: Floating a => LensLike ((,)a) s t a a -> a -> s -> (a, t)+l <**~ a = l <%~ (** a) {-# INLINE (<**~) #-} -- | Logically '||' a Boolean valued 'Lens' and return the result@@ -472,11 +472,11 @@ -- When you do not need the result of the operation, ('Control.Lens.Setter.||~') is more flexible. -- -- @--- ('<||~') :: 'Simple' 'Lens' a 'Bool' -> 'Bool' -> a -> ('Bool', a)--- ('<||~') :: 'Simple' 'Control.Lens.Iso.Iso' a 'Bool' -> 'Bool' -> a -> ('Bool', a)+-- ('<||~') :: 'Simple' 'Lens' s 'Bool' -> 'Bool' -> s -> ('Bool', s)+-- ('<||~') :: 'Simple' 'Control.Lens.Iso.Iso' s 'Bool' -> 'Bool' -> s -> ('Bool', s) -- @-(<||~) :: LensLike ((,)Bool) a b Bool Bool -> Bool -> a -> (Bool, b)-l <||~ c = l <%~ (|| c)+(<||~) :: LensLike ((,)Bool) s t Bool Bool -> Bool -> s -> (Bool, t)+l <||~ b = l <%~ (|| b) {-# INLINE (<||~) #-} -- | Logically '&&' a Boolean valued 'Lens' and return the result@@ -484,11 +484,11 @@ -- When you do not need the result of the operation, ('Control.Lens.Setter.&&~') is more flexible. -- -- @--- ('<&&~') :: 'Simple' 'Lens' a 'Bool' -> 'Bool' -> a -> ('Bool', a)--- ('<&&~') :: 'Simple' 'Control.Lens.Iso.Iso' a 'Bool' -> 'Bool' -> a -> ('Bool', a)+-- ('<&&~') :: 'Simple' 'Lens' s 'Bool' -> 'Bool' -> s -> ('Bool', s)+-- ('<&&~') :: 'Simple' 'Control.Lens.Iso.Iso' s 'Bool' -> 'Bool' -> s -> ('Bool', s) -- @-(<&&~) :: LensLike ((,)Bool) a b Bool Bool -> Bool -> a -> (Bool, b)-l <&&~ c = l <%~ (&& c)+(<&&~) :: LensLike ((,)Bool) s t Bool Bool -> Bool -> s -> (Bool, t)+l <&&~ b = l <%~ (&& b) {-# INLINE (<&&~) #-} -- | Modify the target of a 'Lens', but return the old value.@@ -496,12 +496,12 @@ -- When you do not need the result of the addition, ('Control.Lens.Setter.%~') is more flexible. -- -- @--- ('<<%~') :: 'Lens' a b c d -> (c -> d) -> a -> (d, b)--- ('<<%~') :: 'Control.Lens.Iso.Iso' a b c d -> (c -> d) -> a -> (d, b)--- ('<<%~') :: 'Monoid' d => 'Control.Lens.Traversal.Traversal' a b c d -> (c -> d) -> a -> (d, b)+-- ('<<%~') :: 'Lens' s t a b -> (a -> b) -> s -> (b, t)+-- ('<<%~') :: 'Control.Lens.Iso.Iso' s t a b -> (a -> b) -> s -> (b, t)+-- ('<<%~') :: 'Monoid' b => 'Control.Lens.Traversal.Traversal' s t a b -> (a -> b) -> s -> (b, t) -- @-(<<%~) :: LensLike ((,)c) a b c d -> (c -> d) -> a -> (c, b)-l <<%~ f = l $ \c -> (c, f c)+(<<%~) :: LensLike ((,)a) s t a b -> (a -> b) -> s -> (a, t)+l <<%~ f = l $ \a -> (a, f a) {-# INLINE (<<%~) #-} -- | Modify the target of a 'Lens', but return the old value.@@ -509,12 +509,12 @@ -- When you do not need the old value, ('Control.Lens.Setter.%~') is more flexible. -- -- @--- ('<<%~') :: 'Lens' a b c d -> d -> a -> (c, b)--- ('<<%~') :: 'Control.Lens.Iso.Iso' a b c d -> d -> a -> (c, b)--- ('<<%~') :: 'Monoid' d => 'Control.Lens.Traversal.Traversal' a b c d -> d -> a -> (c, b)+-- ('<<%~') :: 'Lens' s t a b -> b -> s -> (a, t)+-- ('<<%~') :: 'Control.Lens.Iso.Iso' s t a b -> b -> s -> (a, t)+-- ('<<%~') :: 'Monoid' b => 'Control.Lens.Traversal.Traversal' s t a b -> b -> s -> (a, t) -- @-(<<.~) :: LensLike ((,)c) a b c d -> d -> a -> (c, b)-l <<.~ d = l $ \c -> (c, d)+(<<.~) :: LensLike ((,)a) s t a b -> b -> s -> (a, t)+l <<.~ b = l $ \a -> (a, b) {-# INLINE (<<.~) #-} -------------------------------------------------------------------------------@@ -530,12 +530,12 @@ -- When you do not need the result of the operation, ('Control.Lens.Setter.%=') is more flexible. -- -- @--- ('<%=') :: 'MonadState' a m => 'Simple' 'Lens' a b -> (b -> b) -> m b--- ('<%=') :: 'MonadState' a m => 'Simple' 'Control.Lens.Iso.Iso' a b -> (b -> b) -> m b--- ('<%=') :: ('MonadState' a m, 'Monoid' b) => 'Simple' 'Traveral' a b -> (b -> b) -> m b+-- ('<%=') :: 'MonadState' s m => 'Simple' 'Lens' s a -> (a -> a) -> m a+-- ('<%=') :: 'MonadState' s m => 'Simple' 'Control.Lens.Iso.Iso' s a -> (a -> a) -> m a+-- ('<%=') :: ('MonadState' s m, 'Monoid' a) => 'Simple' 'Traveral' s a -> (a -> a) -> m a -- @-(<%=) :: MonadState a m => LensLike ((,)d) a a c d -> (c -> d) -> m d-l <%= f = l %%= \c -> let d = f c in (d,d)+(<%=) :: MonadState s m => LensLike ((,)b) s s a b -> (a -> b) -> m b+l <%= f = l %%= \a -> let b = f a in (b,b) {-# INLINE (<%=) #-} @@ -546,11 +546,11 @@ -- flexible. -- -- @--- ('<+=') :: ('MonadState' a m, 'Num' b) => 'Simple' 'Lens' a b -> b -> m b--- ('<+=') :: ('MonadState' a m, 'Num' b) => 'Simple' 'Control.Lens.Iso.Iso' a b -> b -> m b+-- ('<+=') :: ('MonadState' s m, 'Num' a) => 'Simple' 'Lens' s a -> a -> m a+-- ('<+=') :: ('MonadState' s m, 'Num' a) => 'Simple' 'Control.Lens.Iso.Iso' s a -> a -> m a -- @-(<+=) :: (MonadState a m, Num b) => SimpleLensLike ((,)b) a b -> b -> m b-l <+= b = l <%= (+ b)+(<+=) :: (MonadState s m, Num a) => SimpleLensLike ((,)a) s a -> a -> m a+l <+= a = l <%= (+ a) {-# INLINE (<+=) #-} -- | Subtract from the target of a numerically valued 'Lens' into your monad's@@ -560,11 +560,11 @@ -- flexible. -- -- @--- ('<-=') :: ('MonadState' a m, 'Num' b) => 'Simple' 'Lens' a b -> b -> m b--- ('<-=') :: ('MonadState' a m, 'Num' b) => 'Simple' 'Control.Lens.Iso.Iso' a b -> b -> m b+-- ('<-=') :: ('MonadState' s m, 'Num' a) => 'Simple' 'Lens' s a -> a -> m a+-- ('<-=') :: ('MonadState' s m, 'Num' a) => 'Simple' 'Control.Lens.Iso.Iso' s a -> a -> m a -- @-(<-=) :: (MonadState a m, Num b) => SimpleLensLike ((,)b) a b -> b -> m b-l <-= b = l <%= subtract b+(<-=) :: (MonadState s m, Num a) => SimpleLensLike ((,)a) s a -> a -> m a+l <-= a = l <%= subtract a {-# INLINE (<-=) #-} -- | Multiply the target of a numerically valued 'Lens' into your monad's@@ -574,11 +574,11 @@ -- flexible. -- -- @--- ('<*=') :: ('MonadState' a m, 'Num' b) => 'Simple' 'Lens' a b -> b -> m b--- ('<*=') :: ('MonadState' a m, 'Num' b) => 'Simple' 'Control.Lens.Iso.Iso' a b -> b -> m b+-- ('<*=') :: ('MonadState' s m, 'Num' a) => 'Simple' 'Lens' s a -> a -> m a+-- ('<*=') :: ('MonadState' s m, 'Num' a) => 'Simple' 'Control.Lens.Iso.Iso' s a -> a -> m a -- @-(<*=) :: (MonadState a m, Num b) => SimpleLensLike ((,)b) a b -> b -> m b-l <*= b = l <%= (* b)+(<*=) :: (MonadState s m, Num a) => SimpleLensLike ((,)a) s a -> a -> m a+l <*= a = l <%= (* a) {-# INLINE (<*=) #-} -- | Divide the target of a fractionally valued 'Lens' into your monad's state@@ -587,11 +587,11 @@ -- When you do not need the result of the division, ('Control.Lens.Setter.//=') is more flexible. -- -- @--- ('<//=') :: ('MonadState' a m, 'Fractional' b) => 'Simple' 'Lens' a b -> b -> m b--- ('<//=') :: ('MonadState' a m, 'Fractional' b) => 'Simple' 'Control.Lens.Iso.Iso' a b -> b -> m b+-- ('<//=') :: ('MonadState' s m, 'Fractional' a) => 'Simple' 'Lens' s a -> a -> m a+-- ('<//=') :: ('MonadState' s m, 'Fractional' a) => 'Simple' 'Control.Lens.Iso.Iso' s a -> a -> m a -- @-(<//=) :: (MonadState a m, Fractional b) => SimpleLensLike ((,)b) a b -> b -> m b-l <//= b = l <%= (/ b)+(<//=) :: (MonadState s m, Fractional a) => SimpleLensLike ((,)a) s a -> a -> m a+l <//= a = l <%= (/ a) {-# INLINE (<//=) #-} -- | Raise the target of a numerically valued 'Lens' into your monad's state@@ -600,11 +600,11 @@ -- When you do not need the result of the operation, ('Control.Lens.Setter.**=') is more flexible. -- -- @--- ('<^=') :: ('MonadState' a m, 'Num' b, 'Integral' c) => 'Simple' 'Lens' a b -> c -> m b--- ('<^=') :: ('MonadState' a m, 'Num' b, 'Integral' c) => 'Simple' 'Control.Lens.Iso.Iso' a b -> c -> m b+-- ('<^=') :: ('MonadState' s m, 'Num' a, 'Integral' e) => 'Simple' 'Lens' s a -> e -> m a+-- ('<^=') :: ('MonadState' s m, 'Num' a, 'Integral' e) => 'Simple' 'Control.Lens.Iso.Iso' s a -> e -> m a -- @-(<^=) :: (MonadState a m, Num b, Integral c) => SimpleLensLike ((,)b) a b -> c -> m b-l <^= c = l <%= (^ c)+(<^=) :: (MonadState s m, Num a, Integral e) => SimpleLensLike ((,)a) s a -> e -> m a+l <^= e = l <%= (^ e) {-# INLINE (<^=) #-} -- | Raise the target of a fractionally valued 'Lens' into your monad's state@@ -613,11 +613,11 @@ -- When you do not need the result of the operation, ('Control.Lens.Setter.^^=') is more flexible. -- -- @--- ('<^^=') :: ('MonadState' a m, 'Fractional' b, 'Integral' c) => 'Simple' 'Lens' a b -> c -> m b--- ('<^^=') :: ('MonadState' a m, 'Fractional' b, 'Integral' c) => 'Simple' 'Control.Lens.Iso.Iso' a b -> c -> m b+-- ('<^^=') :: ('MonadState' s m, 'Fractional' b, 'Integral' e) => 'Simple' 'Lens' s a -> e -> m a+-- ('<^^=') :: ('MonadState' s m, 'Fractional' b, 'Integral' e) => 'Simple' 'Control.Lens.Iso.Iso' s a -> e -> m a -- @-(<^^=) :: (MonadState a m, Fractional b, Integral c) => SimpleLensLike ((,)b) a b -> c -> m b-l <^^= c = l <%= (^^ c)+(<^^=) :: (MonadState s m, Fractional a, Integral e) => SimpleLensLike ((,)a) s a -> e -> m a+l <^^= e = l <%= (^^ e) {-# INLINE (<^^=) #-} -- | Raise the target of a floating-point valued 'Lens' into your monad's@@ -626,11 +626,11 @@ -- When you do not need the result of the operation, ('Control.Lens.Setter.**=') is more flexible. -- -- @--- ('<**=') :: ('MonadState' a m, 'Floating' b) => 'Simple' 'Lens' a b -> b -> m b--- ('<**=') :: ('MonadState' a m, 'Floating' b) => 'Simple' 'Control.Lens.Iso.Iso' a b -> b -> m b+-- ('<**=') :: ('MonadState' s m, 'Floating' a) => 'Simple' 'Lens' s a -> a -> m a+-- ('<**=') :: ('MonadState' s m, 'Floating' a) => 'Simple' 'Control.Lens.Iso.Iso' s a -> a -> m a -- @-(<**=) :: (MonadState a m, Floating b) => SimpleLensLike ((,)b) a b -> b -> m b-l <**= b = l <%= (** b)+(<**=) :: (MonadState s m, Floating a) => SimpleLensLike ((,)a) s a -> a -> m a+l <**= a = l <%= (** a) {-# INLINE (<**=) #-} -- | Logically '||' a Boolean valued 'Lens' into your monad's state and return@@ -639,10 +639,10 @@ -- When you do not need the result of the operation, ('Control.Lens.Setter.||=') is more flexible. -- -- @--- ('<||=') :: 'MonadState' a m => 'Simple' 'Lens' a 'Bool' -> 'Bool' -> m 'Bool'--- ('<||=') :: 'MonadState' a m => 'Simple' 'Control.Lens.Iso.Iso' a 'Bool' -> 'Bool' -> m 'Bool'+-- ('<||=') :: 'MonadState' s m => 'Simple' 'Lens' s 'Bool' -> 'Bool' -> m 'Bool'+-- ('<||=') :: 'MonadState' s m => 'Simple' 'Control.Lens.Iso.Iso' s 'Bool' -> 'Bool' -> m 'Bool' -- @-(<||=) :: MonadState a m => SimpleLensLike ((,)Bool) a Bool -> Bool -> m Bool+(<||=) :: MonadState s m => SimpleLensLike ((,)Bool) s Bool -> Bool -> m Bool l <||= b = l <%= (|| b) {-# INLINE (<||=) #-} @@ -652,10 +652,10 @@ -- When you do not need the result of the operation, ('Control.Lens.Setter.&&=') is more flexible. -- -- @--- ('<&&=') :: 'MonadState' a m => 'Simple' 'Lens' a 'Bool' -> 'Bool' -> m 'Bool'--- ('<&&=') :: 'MonadState' a m => 'Simple' 'Control.Lens.Iso.Iso' a 'Bool' -> 'Bool' -> m 'Bool'+-- ('<&&=') :: 'MonadState' s m => 'Simple' 'Lens' s 'Bool' -> 'Bool' -> m 'Bool'+-- ('<&&=') :: 'MonadState' s m => 'Simple' 'Control.Lens.Iso.Iso' s 'Bool' -> 'Bool' -> m 'Bool' -- @-(<&&=) :: MonadState a m => SimpleLensLike ((,)Bool) a Bool -> Bool -> m Bool+(<&&=) :: MonadState s m => SimpleLensLike ((,)Bool) s Bool -> Bool -> m Bool l <&&= b = l <%= (&& b) {-# INLINE (<&&=) #-} @@ -668,12 +668,12 @@ -- When you do not need the result of the operation, ('Control.Lens.Setter.%=') is more flexible. -- -- @--- ('<<%=') :: 'MonadState' a m => 'Simple' 'Lens' a b -> (b -> b) -> m b--- ('<<%=') :: 'MonadState' a m => 'Simple' 'Control.Lens.Iso.Iso' a b -> (b -> b) -> m b--- ('<<%=') :: ('MonadState' a m, 'Monoid' b) => 'Simple' 'Traveral' a b -> (b -> b) -> m b+-- ('<<%=') :: 'MonadState' s m => 'Simple' 'Lens' s a -> (a -> a) -> m a+-- ('<<%=') :: 'MonadState' s m => 'Simple' 'Control.Lens.Iso.Iso' s a -> (a -> a) -> m a+-- ('<<%=') :: ('MonadState' s m, 'Monoid' b) => 'Simple' 'Traveral' s a -> (a -> a) -> m a -- @-(<<%=) :: MonadState a m => LensLike ((,)c) a a c d -> (c -> d) -> m c-l <<%= f = l %%= \c -> (c, f c)+(<<%=) :: MonadState s m => LensLike ((,)a) s s a b -> (a -> b) -> m a+l <<%= f = l %%= \a -> (a, f a) {-# INLINE (<<%=) #-} -- | Modify the target of a 'Lens' into your monad's state by a user supplied@@ -685,32 +685,32 @@ -- When you do not need the result of the operation, ('Control.Lens.Setter.%=') is more flexible. -- -- @--- ('<<%=') :: 'MonadState' a m => 'Simple' 'Lens' a b -> (b -> b) -> m b--- ('<<%=') :: 'MonadState' a m => 'Simple' 'Control.Lens.Iso.Iso' a b -> (b -> b) -> m b--- ('<<%=') :: ('MonadState' a m, 'Monoid' b) => 'Simple' 'Traveral' a b -> (b -> b) -> m b+-- ('<<%=') :: 'MonadState' s m => 'Simple' 'Lens' s a -> (a -> a) -> m a+-- ('<<%=') :: 'MonadState' s m => 'Simple' 'Control.Lens.Iso.Iso' s a -> (a -> a) -> m a+-- ('<<%=') :: ('MonadState' s m, 'Monoid' t) => 'Simple' 'Traveral' s a -> (a -> a) -> m a -- @-(<<.=) :: MonadState a m => LensLike ((,)c) a a c d -> d -> m c-l <<.= d = l %%= \c -> (c,d)+(<<.=) :: MonadState s m => LensLike ((,)a) s s a b -> b -> m a+l <<.= b = l %%= \a -> (a,b) {-# INLINE (<<.=) #-} -- | Run a monadic action, and set the target of 'Lens' to its result. -- -- @--- ('<<~') :: 'MonadState' a m => 'Control.Lens.Iso.Iso' a a c d -> m d -> m d--- ('<<~') :: 'MonadState' a m => 'Control.Lens.Type.Lens' a a c d -> m d -> m d+-- ('<<~') :: 'MonadState' s m => 'Control.Lens.Iso.Iso' s s a b -> m b -> m b+-- ('<<~') :: 'MonadState' s m => 'Control.Lens.Type.Lens' s s a b -> m b -> m b -- @ -- -- NB: This is limited to taking an actual 'Lens' than admitting a 'Control.Lens.Traversal.Traversal' because -- there are potential loss of state issues otherwise.-(<<~) :: MonadState a m => LensLike (Context c d) a a c d -> m d -> m d-l <<~ md = do- d <- md- modify $ \a -> case l (Context id) a of Context f _ -> f d- return d+(<<~) :: MonadState s m => LensLike (Context a b) s s a b -> m b -> m b+l <<~ mb = do+ b <- mb+ modify $ \s -> case l (Context id) s of Context f _ -> f b+ return b {-# INLINE (<<~) #-} -- | Useful for storing lenses in containers.-newtype ReifiedLens a b c d = ReifyLens { reflectLens :: Lens a b c d }+newtype ReifiedLens s t a b = ReifyLens { reflectLens :: Lens s t a b } -- | @type 'SimpleReifiedLens' = 'Simple' 'ReifiedLens'@-type SimpleReifiedLens a b = ReifiedLens a a b b+type SimpleReifiedLens s a = ReifiedLens s s a a
src/Control/Lens/Zoom.hs view
@@ -60,12 +60,12 @@ -- This can be used to edit pretty much any monad transformer stack with a state in it! -- -- @- -- 'zoom' :: 'Monad' m => 'Simple' 'Lens' a b -> 'StateT' b m c -> 'StateT' a m c- -- 'zoom' :: ('Monad' m, 'Monoid' c) => 'Simple' 'Control.Lens.Traversal.Traversal' a b -> 'StateT' b m c -> 'StateT' a m c- -- 'zoom' :: 'Monad' m => 'Simple' 'Lens' a b -> 'RWST' r w b m c -> 'RWST' r w a m c- -- 'zoom' :: ('Monad' m, 'Monoid' c) => 'Simple' 'Control.Lens.Traversal.Traversal' a b -> 'RWST' r w b m c -> 'RWST' r w a m c- -- 'zoom' :: 'Monad' m => 'Simple' 'Lens' a b -> 'ErrorT' e ('RWST' r w b m c) -> 'ErrorT' e ('RWST' r w a m c)- -- 'zoom' :: ('Monad' m, 'Monoid' c) => 'Simple' 'Control.Lens.Traversal.Traversal' a b -> 'ErrorT' e ('RWST' r w b m c) -> 'ErrorT' e ('RWST' r w a m c)+ -- 'zoom' :: 'Monad' m => 'Simple' 'Lens' s t -> 'StateT' t m a -> 'StateT' s m a+ -- 'zoom' :: ('Monad' m, 'Monoid' c) => 'Simple' 'Control.Lens.Traversal.Traversal' s t -> 'StateT' t m c -> 'StateT' s m c+ -- 'zoom' :: 'Monad' m => 'Simple' 'Lens' s t -> 'RWST' r w t m c -> 'RWST' r w s m c+ -- 'zoom' :: ('Monad' m, 'Monoid' c) => 'Simple' 'Control.Lens.Traversal.Traversal' s t -> 'RWST' r w t m c -> 'RWST' r w s m c+ -- 'zoom' :: 'Monad' m => 'Simple' 'Lens' s t -> 'ErrorT' e ('RWST' r w t m c) -> 'ErrorT' e ('RWST' r w s m c)+ -- 'zoom' :: ('Monad' m, 'Monoid' c) => 'Simple' 'Control.Lens.Traversal.Traversal' s t -> 'ErrorT' e ('RWST' r w t m c) -> 'ErrorT' e ('RWST' r w s m c) -- ... -- @ zoom :: Monad m => SimpleLensLike (k c) t s -> m c -> n c@@ -118,9 +118,9 @@ -- | This class allows us to use 'magnify' part of the environment, changing the environment supplied by--- many different monad transformers. Unlike 'focus' this can change the environment of a deeply nested monad transformer.+-- many different monad transformers. Unlike 'zoom' this can change the environment of a deeply nested monad transformer. ----- Also, unlike 'focus', this can be used with any valid 'Getter', but cannot be used with a 'Traversal' or 'Fold'.+-- Also, unlike 'zoom', this can be used with any valid 'Getter', but cannot be used with a 'Traversal' or 'Fold'. class (MonadReader b m, MonadReader a n) => Magnify m n k b a | m -> b, n -> a, m a -> n, n b -> m where -- | Run a monadic action in a larger environment than it was defined in, using a 'Getter'. --@@ -131,10 +131,10 @@ -- This can be used to edit pretty much any monad transformer stack with an environment in it: -- -- @- -- 'magnify' :: 'Getter' a b -> (b -> c) -> a -> c- -- 'magnify' :: 'Monoid' c => 'Fold' a b -> (b -> c) -> a -> c- -- 'magnify' :: 'Monoid' w 'Getter' a b -> 'RWST' a w s c -> 'RWST' b w s c- -- 'magnify' :: ('Monoid' w, 'Monoid' c) => 'Fold' a b -> 'RWST' a w s c -> 'RWST' b w s c+ -- 'magnify' :: 'Getter' s a -> (a -> r) -> s -> r+ -- 'magnify' :: 'Monoid' c => 'Fold' s a -> (a -> r) -> s -> r+ -- 'magnify' :: 'Monoid' w 'Getter' s t -> 'RWST' s w st c -> 'RWST' t w st c+ -- 'magnify' :: ('Monoid' w, 'Monoid' c) => 'Fold' s t -> 'RWST' s w st c -> 'RWST' t w st c -- ... -- @ magnify :: ((b -> k c b) -> a -> k c a) -> m c -> n c
src/Control/Parallel/Strategies/Lens.hs view
@@ -30,11 +30,11 @@ -- @ -- -- @--- 'evalOf' :: 'Simple' 'Lens' a b -> 'Strategy' b -> 'Strategy' a--- 'evalOf' :: 'Simple' 'Traversal' a b -> 'Strategy' b -> 'Strategy' a--- 'evalOf' :: (b -> 'Eval' b) -> a -> 'Eval' a) -> 'Strategy' b -> 'Strategy' a+-- 'evalOf' :: 'Simple' 'Lens' s a -> 'Strategy' a -> 'Strategy' s+-- 'evalOf' :: 'Simple' 'Traversal' s a -> 'Strategy' a -> 'Strategy' s+-- 'evalOf' :: (a -> 'Eval' a) -> s -> 'Eval' s) -> 'Strategy' a -> 'Strategy' s -- @-evalOf :: SimpleLensLike Eval a b -> Strategy b -> Strategy a+evalOf :: SimpleLensLike Eval s a -> Strategy a -> Strategy s evalOf l = l {-# INLINE evalOf #-} @@ -44,11 +44,11 @@ -- @'parTraversable' = 'parOf' 'traverse'@ -- -- @--- 'parOf' :: 'Simple' 'Lens' a b -> 'Strategy' b -> 'Strategy' a--- 'parOf' :: 'Simple' 'Traversal' a b -> 'Strategy' b -> 'Strategy' a--- 'parOf' :: ((b -> 'Eval' b) -> a -> 'Eval' a) -> 'Strategy' b -> 'Strategy' a+-- 'parOf' :: 'Simple' 'Lens' s a -> 'Strategy' a -> 'Strategy' s+-- 'parOf' :: 'Simple' 'Traversal' s a -> 'Strategy' a -> 'Strategy' s+-- 'parOf' :: ((a -> 'Eval' a) -> s -> 'Eval' s) -> 'Strategy' a -> 'Strategy' s -- @-parOf :: SimpleLensLike Eval a b -> Strategy b -> Strategy a+parOf :: SimpleLensLike Eval s a -> Strategy a -> Strategy s parOf l s = l (rparWith s) {-# INLINE parOf #-} @@ -58,7 +58,7 @@ -- @ -- 'after' 'rdeepseq' 'traverse' :: 'Traversable' t => 'Strategy' a -> 'Strategy' [a] -- @-after :: Strategy a -> LensLike f a b c d -> LensLike f a b c d+after :: Strategy s -> LensLike f s t a b -> LensLike f s t a b after s l f = l f $| s {-# INLINE after #-} @@ -68,6 +68,6 @@ -- @ -- 'throughout' 'rdeepseq' 'traverse' :: 'Traversable' t => 'Strategy' a -> 'Strategy' [a] -- @-throughout :: Strategy a -> LensLike f a b c d -> LensLike f a b c d+throughout :: Strategy s -> LensLike f s t a b -> LensLike f s t a b throughout s l f = l f $|| s {-# INLINE throughout #-}
src/Control/Seq/Lens.hs view
@@ -20,6 +20,6 @@ -- 'Getter' or 'Fold' according to the given strategy. -- -- @'seqFoldable' = 'seqOf' 'folded'@-seqOf :: Getting [c] a b c d -> Strategy c -> Strategy a+seqOf :: Getting [a] s t a b -> Strategy a -> Strategy s seqOf l s = seqList s . toListOf l {-# INLINE seqOf #-}
src/Data/Array/Lens.hs view
@@ -59,6 +59,6 @@ -- index into the array as the index of the traversal. -- -- @'amap' ≡ 'over' 'traverseArray'@-traverseArray :: (IArray a c, IArray a d, Ix i) => IndexedTraversal i (a i c) (a i d) c d+traverseArray :: (IArray arr a, IArray arr b, Ix i) => IndexedTraversal i (arr i a) (arr i b) a b traverseArray = index $ \f arr -> array (bounds arr) <$> traverse (\(i,a) -> (,) i <$> f i a) (assocs arr) {-# INLINE traverseArray #-}
src/Data/Bits/Lens.hs view
@@ -32,12 +32,12 @@ -- ("hello",7) -- -- @--- ('|~') :: 'Bits' c => 'Setter' a b c c -> c -> a -> b--- ('|~') :: 'Bits' c => 'Iso' a b c c -> c -> a -> b--- ('|~') :: 'Bits' c => 'Lens' a b c c -> c -> a -> b--- ('|~') :: ('Monoid c', 'Bits' c) => 'Traversal' a b c c -> c -> a -> b+-- ('|~') :: 'Bits' a => 'Setter' s t a a -> a -> s -> t+-- ('|~') :: 'Bits' a => 'Iso' s t a a -> a -> s -> t+-- ('|~') :: 'Bits' a => 'Lens' s t a a -> a -> s -> t+-- ('|~') :: ('Monoid a', 'Bits' a) => 'Traversal' s t a a -> a -> s -> t -- @-(|~):: Bits c => Setting a b c c -> c -> a -> b+(|~):: Bits a => Setting s t a a -> a -> s -> t l |~ n = over l (.|. n) {-# INLINE (|~) #-} @@ -47,37 +47,37 @@ -- ("hello",6) -- -- @--- ('&~') :: 'Bits' c => 'Setter' a b c c -> c -> a -> b--- ('&~') :: 'Bits' c => 'Iso' a b c c -> c -> a -> b--- ('&~') :: 'Bits' c => 'Lens' a b c c -> c -> a -> b--- ('&~') :: ('Monoid c', 'Bits' c) => 'Traversal' a b c c -> c -> a -> b+-- ('&~') :: 'Bits' a => 'Setter' s t a a -> a -> s -> t+-- ('&~') :: 'Bits' a => 'Iso' s t a a -> a -> s -> t+-- ('&~') :: 'Bits' a => 'Lens' s t a a -> a -> s -> t+-- ('&~') :: ('Monoid a', 'Bits' a) => 'Traversal' s t a a -> a -> s -> t -- @-(&~) :: Bits c => Setting a b c c -> c -> a -> b+(&~) :: Bits a => Setting s t a a -> a -> s -> t l &~ n = over l (.&. n) {-# INLINE (&~) #-} -- | Modify the target(s) of a 'Simple' 'Lens', 'Setter' or 'Traversal' by computing its bitwise '.&.' with another value. -- -- @--- ('&=') :: ('MonadState' a m, 'Bits' b) => 'Simple' 'Setter' a b -> b -> m ()--- ('&=') :: ('MonadState' a m, 'Bits' b) => 'Simple' 'Iso' a b -> b -> m ()--- ('&=') :: ('MonadState' a m, 'Bits' b) => 'Simple' 'Lens' a b -> b -> m ()--- ('&=') :: ('MonadState' a m, 'Bits' b) => 'Simple' 'Traversal' a b -> b -> m ()+-- ('&=') :: ('MonadState' s m, 'Bits' a) => 'Simple' 'Setter' s a -> a -> m ()+-- ('&=') :: ('MonadState' s m, 'Bits' a) => 'Simple' 'Iso' s a -> a -> m ()+-- ('&=') :: ('MonadState' s m, 'Bits' a) => 'Simple' 'Lens' s a -> a -> m ()+-- ('&=') :: ('MonadState' s m, 'Bits' a) => 'Simple' 'Traversal' s a -> a -> m () -- @-(&=):: (MonadState a m, Bits b) => Simple Setting a b -> b -> m ()-l &= b = modify (l &~ b)+(&=):: (MonadState s m, Bits a) => Simple Setting s a -> a -> m ()+l &= a = modify (l &~ a) {-# INLINE (&=) #-} -- | Modify the target(s) of a 'Simple' 'Lens', 'Setter' or 'Traversal' by computing its bitwise '.|.' with another value. -- -- @--- ('|=') :: ('MonadState' a m, 'Bits' b) => 'Simple' 'Setter' a b -> b -> m ()--- ('|=') :: ('MonadState' a m, 'Bits' b) => 'Simple' 'Iso' a b -> b -> m ()--- ('|=') :: ('MonadState' a m, 'Bits' b) => 'Simple' 'Lens' a b -> b -> m ()--- ('|=') :: ('MonadState' a m, 'Bits' b) => 'Simple' 'Traversal' a b -> b -> m ()+-- ('|=') :: ('MonadState' s m, 'Bits' a) => 'Simple' 'Setter' s a -> a -> m ()+-- ('|=') :: ('MonadState' s m, 'Bits' a) => 'Simple' 'Iso' s a -> a -> m ()+-- ('|=') :: ('MonadState' s m, 'Bits' a) => 'Simple' 'Lens' s a -> a -> m ()+-- ('|=') :: ('MonadState' s m, 'Bits' a) => 'Simple' 'Traversal' s a -> a -> m () -- @-(|=) :: (MonadState a m, Bits b) => Simple Setting a b -> b -> m ()-l |= b = modify (l |~ b)+(|=) :: (MonadState s m, Bits a) => Simple Setting s a -> a -> m ()+l |= a = modify (l |~ a) {-# INLINE (|=) #-} -- | Bitwise '.|.' the target(s) of a 'Lens' (or 'Traversal'), returning the result@@ -87,11 +87,11 @@ -- (7,("hello",7)) -- -- @--- ('<|~') :: 'Bits' c => 'Iso' a b c c -> c -> a -> (c, b)--- ('<|~') :: 'Bits' c => 'Lens' a b c c -> c -> a -> (c, b)--- ('<|~') :: ('Bits' c, 'Monoid c) => 'Traversal' a b c c -> c -> a -> (c, b)+-- ('<|~') :: 'Bits' a => 'Iso' s t a a -> a -> s -> (a, t)+-- ('<|~') :: 'Bits' a => 'Lens' s t a a -> a -> s -> (a, t)+-- ('<|~') :: ('Bits' a, 'Monoid a) => 'Traversal' s t a a -> a -> s -> (a, t) -- @-(<|~):: Bits c => LensLike ((,) c) a b c c -> c -> a -> (c, b)+(<|~):: Bits a => LensLike ((,) a) s t a a -> a -> s -> (a, t) l <|~ n = l <%~ (.|. n) {-# INLINE (<|~) #-} @@ -102,11 +102,11 @@ -- (6,("hello",6)) -- -- @--- ('<&~') :: 'Bits' c => 'Iso' a b c c -> c -> a -> (c, b)--- ('<&~') :: 'Bits' c => 'Lens' a b c c -> c -> a -> (c, b)--- ('<&~') :: ('Bits' c, 'Monoid c) => 'Traversal' a b c c -> c -> a -> (c, b)+-- ('<&~') :: 'Bits' a => 'Iso' s t a a -> a -> s -> (a, t)+-- ('<&~') :: 'Bits' a => 'Lens' s t a a -> a -> s -> (a, t)+-- ('<&~') :: ('Bits' a, 'Monoid a) => 'Traversal' s t a a -> a -> s -> (a, t) -- @-(<&~) :: Bits c => LensLike ((,) c) a b c c -> c -> a -> (c, b)+(<&~) :: Bits a => LensLike ((,) a) s t a a -> a -> s -> (a, t) l <&~ n = l <%~ (.&. n) {-# INLINE (<&~) #-} @@ -114,10 +114,10 @@ -- returning the result (or a monoidal summary of all of the results traversed) -- -- @--- ('<&=') :: ('MonadState' a m, 'Bits' b) => 'Simple' 'Lens' a b -> b -> m b--- ('<&=') :: ('MonadState' a m, 'Bits' b, 'Monoid' b) => 'Simple' 'Traversal' a b -> b -> m b+-- ('<&=') :: ('MonadState' s m, 'Bits' a) => 'Simple' 'Lens' s a -> a -> m a+-- ('<&=') :: ('MonadState' s m, 'Bits' a, 'Monoid' a) => 'Simple' 'Traversal' s a -> a -> m a -- @-(<&=):: (MonadState a m, Bits b) => SimpleLensLike ((,)b) a b -> b -> m b+(<&=):: (MonadState s m, Bits a) => SimpleLensLike ((,)a) s a -> a -> m a l <&= b = l <%= (.&. b) {-# INLINE (<&=) #-} @@ -125,10 +125,10 @@ -- returning the result (or a monoidal summary of all of the results traversed) -- -- @--- ('<|=') :: ('MonadState' a m, 'Bits' b) => 'Simple' 'Lens' a b -> b -> m b--- ('<|=') :: ('MonadState' a m, 'Bits' b, 'Monoid' b) => 'Simple' 'Traversal' a b -> b -> m b+-- ('<|=') :: ('MonadState' s m, 'Bits' a) => 'Simple' 'Lens' s a -> a -> m a+-- ('<|=') :: ('MonadState' s m, 'Bits' a, 'Monoid' a) => 'Simple' 'Traversal' s a -> a -> m a -- @-(<|=) :: (MonadState a m, Bits b) => SimpleLensLike ((,)b) a b -> b -> m b+(<|=) :: (MonadState s m, Bits a) => SimpleLensLike ((,)a) s a -> a -> m a l <|= b = l <%= (.|. b) {-# INLINE (<|=) #-}
src/Data/Data/Lens.hs view
@@ -67,32 +67,28 @@ -- | Naïve 'Traversal' using 'Data'. This does not attempt to optimize the traversal. -- -- This is primarily useful when the children are immediately obvious, and for benchmarking.------ @--- 'tinplate' :: ('Data' a, 'Typeable' b) => 'Simple' 'Traversal' a b--- @-tinplate :: (Data a, Typeable b) => Simple Traversal a b+tinplate :: (Data s, Typeable a) => Simple Traversal s a tinplate f = gfoldl (step f) pure {-# INLINE tinplate #-} -step :: (Applicative f, Typeable b, Data d) => (b -> f b) -> f (d -> e) -> d -> f e-step f w d = w <*> case cast d of- Just b -> unsafeCoerce <$> f b- Nothing -> tinplate f d+step :: (Applicative f, Typeable a, Data s) => (a -> f a) -> f (s -> r) -> s -> f r+step f w s = w <*> case cast s of+ Just a -> unsafeCoerce <$> f a+ Nothing -> tinplate f s {-# INLINE step #-} ------------------------------------------------------------------------------- -- Smart Traversal ------------------------------------------------------------------------------- --- | Find every occurence of a given type @b@ recursively that doesn't require--- passing through something of type @b@ using 'Data', while avoiding traversal--- of areas that cannot contain a value of type @b@.+-- | Find every occurence of a given type @a@ recursively that doesn't require+-- passing through something of type @a@ using 'Data', while avoiding traversal+-- of areas that cannot contain a value of type @a@. -- -- This is 'uniplate' with a more liberal signature.-template :: forall a b. (Data a, Typeable b) => Simple Traversal a b+template :: forall s a. (Data s, Typeable a) => Simple Traversal s a template = uniplateData (fromOracle answer) where- answer = hitTest (undefined :: a) (undefined :: b)+ answer = hitTest (undefined :: s) (undefined :: a) {-# INLINE template #-} -- | Find descendants of type @a@ non-transitively, while avoiding computation of areas that cannot contain values of@@ -103,10 +99,10 @@ uniplate = template {-# INLINE uniplate #-} --- | 'biplate' performs like 'template', except when @a ~ b@, it returns itself and nothing else.-biplate :: forall a b. (Data a, Typeable b) => Simple Traversal a b+-- | 'biplate' performs like 'template', except when @s ~ a@, it returns itself and nothing else.+biplate :: forall s a. (Data s, Typeable a) => Simple Traversal s a biplate = biplateData (fromOracle answer) where- answer = hitTest (undefined :: a) (undefined :: b)+ answer = hitTest (undefined :: s) (undefined :: a) {-# INLINE biplate #-} -------------------------------------------------------------------------------@@ -246,26 +242,26 @@ ------------------------------------------------------------------------------- -biplateData :: forall f a b. (Applicative f, Data a, Typeable b) => (forall c. Typeable c => c -> Answer b) -> (b -> f b) -> a -> f a+biplateData :: forall f s a. (Applicative f, Data s, Typeable a) => (forall c. Typeable c => c -> Answer a) -> (a -> f a) -> s -> f s biplateData o f a0 = go2 a0 where go :: Data d => d -> f d- go a = gfoldl (\x y -> x <*> go2 y) pure a+ go s = gfoldl (\x y -> x <*> go2 y) pure s go2 :: Data d => d -> f d- go2 a = case o a of- Hit b -> Unsafe.unsafeCoerce <$> f b- Follow -> go a- Miss -> pure a+ go2 s = case o s of+ Hit a -> Unsafe.unsafeCoerce <$> f a+ Follow -> go s+ Miss -> pure s {-# INLINE biplateData #-} -uniplateData :: forall f a b. (Applicative f, Data a, Typeable b) => (forall c. Typeable c => c -> Answer b) -> (b -> f b) -> a -> f a+uniplateData :: forall f s a. (Applicative f, Data s, Typeable a) => (forall c. Typeable c => c -> Answer a) -> (a -> f a) -> s -> f s uniplateData o f a0 = go a0 where go :: Data d => d -> f d- go a = gfoldl (\x y -> x <*> go2 y) pure a+ go s = gfoldl (\x y -> x <*> go2 y) pure s go2 :: Data d => d -> f d- go2 a = case o a of- Hit b -> Unsafe.unsafeCoerce <$> f b- Follow -> go a- Miss -> pure a+ go2 s = case o s of+ Hit a -> Unsafe.unsafeCoerce <$> f a+ Follow -> go s+ Miss -> pure s {-# INLINE uniplateData #-} -------------------------------------------------------------------------------
src/Data/HashSet/Lens.hs view
@@ -27,7 +27,7 @@ -- the elements to new values. -- -- Sadly, you can't create a valid 'Control.Lens.Traversal.Traversal' for a 'Set', but you can--- manipulate it by reading using 'folded' and reindexing it via 'setmap'.+-- manipulate it by reading using 'folded' and reindexing it via 'setmapped'. -- -- >>> over setmapped (+1) (fromList [1,2,3,4]) -- fromList [2,3,4,5]@@ -41,12 +41,12 @@ -- fromList [1,2,3] -- -- @--- 'setOf' :: 'Hashable' c => 'Getter' a c -> a -> 'HashSet' c--- 'setOf' :: ('Eq' c, 'Hashable' c) => 'Control.Lens.Fold.Fold' a c -> a -> 'HashSet' c--- 'setOf' :: 'Hashable' c => 'Control.Lens.Type.Simple' 'Control.Lens.Iso.Iso' a c -> a -> 'HashSet' c--- 'setOf' :: 'Hashable' c => 'Control.Lens.Type.Simple' 'Control.Lens.Type.Lens' a c -> a -> 'HashSet' c--- 'setOf' :: ('Eq' c, 'Hashable' c) => 'Control.Lens.Type.Simple' 'Control.Lens.Traversal.Traversal' a c -> a -> 'HashSet' c+-- 'setOf' :: 'Hashable' a => 'Getter' s a -> s -> 'HashSet' a+-- 'setOf' :: ('Eq' a, 'Hashable' a) => 'Control.Lens.Fold.Fold' s a -> s -> 'HashSet' a+-- 'setOf' :: 'Hashable' a => 'Control.Lens.Type.Simple' 'Control.Lens.Iso.Iso' s a -> s -> 'HashSet' a+-- 'setOf' :: 'Hashable' a => 'Control.Lens.Type.Simple' 'Control.Lens.Type.Lens' s a -> s -> 'HashSet' a+-- 'setOf' :: ('Eq' a, 'Hashable' a) => 'Control.Lens.Type.Simple' 'Control.Lens.Traversal.Traversal' s a -> s -> 'HashSet' a -- @-setOf :: Hashable c => Getting (HashSet c) a b c d -> a -> HashSet c+setOf :: Hashable a => Getting (HashSet a) s t a b -> s -> HashSet a setOf l = runAccessor . l (Accessor . HashSet.singleton) {-# INLINE setOf #-}
src/Data/IntSet/Lens.hs view
@@ -49,12 +49,12 @@ -- fromList [1,2,3] -- -- @--- 'setOf' :: 'Getter' a 'Int' -> a -> 'IntSet'--- 'setOf' :: 'Fold' a 'Int' -> a -> 'IntSet'--- 'setOf' :: 'Simple' 'Iso' a 'Int' -> a -> 'IntSet'--- 'setOf' :: 'Simple' 'Lens' a 'Int' -> a -> 'IntSet'--- 'setOf' :: 'Simple' 'Traversal' a 'Int' -> a -> 'IntSet'+-- 'setOf' :: 'Getter' s 'Int' -> s -> 'IntSet'+-- 'setOf' :: 'Fold' s 'Int' -> s -> 'IntSet'+-- 'setOf' :: 'Simple' 'Iso' s 'Int' -> s -> 'IntSet'+-- 'setOf' :: 'Simple' 'Lens' s 'Int' -> s -> 'IntSet'+-- 'setOf' :: 'Simple' 'Traversal' s 'Int' -> s -> 'IntSet' -- @-setOf :: Getting IntSet a b Int d -> a -> IntSet+setOf :: Getting IntSet s t Int b -> s -> IntSet setOf l = runAccessor . l (Accessor . IntSet.singleton) {-# INLINE setOf #-}
src/Data/List/Lens.hs view
@@ -173,24 +173,24 @@ -- ("hello","world") -- -- @--- ('~:') :: b -> 'Simple' 'Setter' a [b] -> a -> a--- ('~:') :: b -> 'Simple' 'Traversal' a [b] -> a -> a--- ('~:') :: b -> 'Simple' 'Lens' a [b] -> a -> a--- ('~:') :: b -> 'Simple' 'Iso' a [b] -> a -> a+-- ('~:') :: b -> 'Simple' 'Setter' s [a] -> s -> s+-- ('~:') :: b -> 'Simple' 'Traversal' s [a] -> s -> s+-- ('~:') :: b -> 'Simple' 'Lens' s [a] -> s -> s+-- ('~:') :: b -> 'Simple' 'Iso' s [a] -> s -> s -- @-(~:) :: c -> Setting a b [c] [c] -> a -> b+(~:) :: a -> Setting s t [a] [a] -> s -> t n ~: l = over l (n :) {-# INLINE (~:) #-} -- | Cons onto the list(s) referenced by a 'Setter' in your monad state -- -- @--- ('=:') :: 'MonadState' a m => c -> 'Simple' 'Setter' a [c] -> m ()--- ('=:') :: 'MonadState' a m => c -> 'Simple' 'Traversal' a [c] -> m ()--- ('=:') :: 'MonadState' a m => c -> 'Simple' 'Lens' a [c] -> m ()--- ('=:') :: 'MonadState' a m => c -> 'Simple' 'Iso' a [c] -> m ()+-- ('=:') :: 'MonadState' s m => a -> 'Simple' 'Setter' s [a] -> m ()+-- ('=:') :: 'MonadState' s m => a -> 'Simple' 'Traversal' s [a] -> m ()+-- ('=:') :: 'MonadState' s m => a -> 'Simple' 'Lens' s [a] -> m ()+-- ('=:') :: 'MonadState' s m => a -> 'Simple' 'Iso' s [a] -> m () -- @-(=:) :: MonadState a m => c -> SimpleSetting a [c] -> m ()+(=:) :: MonadState s m => a -> SimpleSetting s [a] -> m () n =: l = modify (n ~: l) {-# INLINE (=:) #-} @@ -203,11 +203,11 @@ -- ("hello",("hello","world")) -- -- @--- ('<~:') :: b -> 'Simple' 'Lens' a [b] -> a -> ([b], a)--- ('<~:') :: b -> 'Simple' 'Iso' a [b] -> a -> ([b], a)--- ('<~:') :: b -> 'Simple' 'Traversal' a [b] -> a -> ([b], a)+-- ('<~:') :: b -> 'Simple' 'Lens' s [a] -> s -> ([a], s)+-- ('<~:') :: b -> 'Simple' 'Iso' s [a] -> s -> ([a], s)+-- ('<~:') :: b -> 'Simple' 'Traversal' s [a] -> s -> ([a], s) -- @-(<~:) :: c -> LensLike ((,)[c]) a b [c] [c] -> a -> ([c], b)+(<~:) :: a -> LensLike ((,)[a]) s t [a] [a] -> s -> ([a], t) n <~: l = l <%~ (n :) {-# INLINE (<~:) #-} @@ -218,11 +218,11 @@ -- of the resulting lists instead of an individual result. -- -- @--- ('<=:') :: 'MonadState' a m => 'Simple' 'Lens' a [c] -> c -> m [c]--- ('<=:') :: 'MonadState' a m => 'Simple' 'Iso' a [c] -> c -> m [c]--- ('<=:') :: 'MonadState' a m => 'Simple' 'Traversal' a [c] -> c -> m [c]+-- ('<=:') :: 'MonadState' s m => 'Simple' 'Lens' s [a] -> a -> m [a]+-- ('<=:') :: 'MonadState' s m => 'Simple' 'Iso' s [a] -> a -> m [a]+-- ('<=:') :: 'MonadState' s m => 'Simple' 'Traversal' s [a] -> a -> m [a] -- @-(<=:) :: MonadState a m => c -> SimpleLensLike ((,)[c]) a [c] -> m [c]+(<=:) :: MonadState s m => a -> SimpleLensLike ((,)[a]) s [a] -> m [a] n <=: l = l <%= (n :) {-# INLINE (<=:) #-} @@ -236,12 +236,12 @@ -- ("hello!!!","world!!!") -- -- @--- ('++~') :: 'Simple' 'Setter' a [b] -> [b] -> a -> a--- ('++~') :: 'Simple' 'Iso' a [b] -> [b] -> a -> a--- ('++~') :: 'Simple' 'Lens' a [b] -> [b] -> a -> a--- ('++~') :: 'Simple' 'Traversal' a [b] -> [b] -> a -> a+-- ('++~') :: 'Simple' 'Setter' s [a] -> [a] -> s -> s+-- ('++~') :: 'Simple' 'Iso' s [a] -> [a] -> s -> s+-- ('++~') :: 'Simple' 'Lens' s [a] -> [a] -> s -> s+-- ('++~') :: 'Simple' 'Traversal' s [a] -> [a] -> s -> s -- @-(++~) :: Setting a b [c] [c] -> [c] -> a -> b+(++~) :: Setting s t [a] [a] -> [a] -> s -> t l ++~ n = over l (++ n) {-# INLINE (++~) #-} @@ -250,12 +250,12 @@ -- ('Data.Monoid.<>=') generalizes this operation to an arbitrary 'Monoid'. -- -- @--- ('++=') :: 'MonadState' a m => 'Simple' 'Setter' a [b] -> [b] -> m ()--- ('++=') :: 'MonadState' a m => 'Simple' 'Iso' a [b] -> [b] -> m ()--- ('++=') :: 'MonadState' a m => 'Simple' 'Lens' a [b] -> [b] -> m ()--- ('++=') :: 'MonadState' a m => 'Simple' 'Traversal' a [b] -> [b] -> m ()+-- ('++=') :: 'MonadState' s m => 'Simple' 'Setter' s [a] -> [a] -> m ()+-- ('++=') :: 'MonadState' s m => 'Simple' 'Iso' s [a] -> [a] -> m ()+-- ('++=') :: 'MonadState' s m => 'Simple' 'Lens' s [a] -> [a] -> m ()+-- ('++=') :: 'MonadState' s m => 'Simple' 'Traversal' s [a] -> [a] -> m () -- @-(++=) :: MonadState a m => SimpleSetting a [b] -> [b] -> m ()+(++=) :: MonadState s m => SimpleSetting s [a] -> [a] -> m () l ++= b = State.modify (l ++~ b) {-# INLINE (++=) #-} @@ -266,7 +266,7 @@ -- When using a 'Traversal', the result returned is actually the concatenation of all of the results. -- -- When you do not need the result of the operation, ('++~') is more flexible.-(<++~) :: LensLike ((,)[c]) a b [c] [c] -> [c] -> a -> ([c], b)+(<++~) :: LensLike ((,)[a]) s t [a] [a] -> [a] -> s -> ([a], t) l <++~ m = l <%~ (++ m) {-# INLINE (<++~) #-} @@ -277,6 +277,6 @@ -- When using a 'Traversal', the result returned is actually the concatenation of all of the results. -- -- When you do not need the result of the operation, ('++=') is more flexible.-(<++=) :: MonadState a m => SimpleLensLike ((,)[b]) a [b] -> [b] -> m [b]+(<++=) :: MonadState s m => SimpleLensLike ((,)[a]) s [a] -> [a] -> m [a] l <++= m = l <%= (++ m) {-# INLINE (<++=) #-}
src/Data/Monoid/Lens.hs view
@@ -28,25 +28,25 @@ -- ("hello!!!","world!!!") -- -- @--- ('<>~') :: 'Monoid' c => 'Setter' a b c c -> c -> a -> b--- ('<>~') :: 'Monoid' c => 'Iso' a b c c -> c -> a -> b--- ('<>~') :: 'Monoid' c => 'Lens' a b c c -> c -> a -> b--- ('<>~') :: 'Monoid' c => 'Traversal' a b c c -> c -> a -> b+-- ('<>~') :: 'Monoid' a => 'Setter' s t a a -> a -> s -> t+-- ('<>~') :: 'Monoid' a => 'Iso' s t a a -> a -> s -> t+-- ('<>~') :: 'Monoid' a => 'Lens' s t a a -> a -> s -> t+-- ('<>~') :: 'Monoid' a => 'Traversal' s t a a -> a -> s -> t -- @-(<>~) :: Monoid c => Setting a b c c -> c -> a -> b+(<>~) :: Monoid a => Setting s t a a -> a -> s -> t l <>~ n = over l (`mappend` n) {-# INLINE (<>~) #-} -- | Modify the target(s) of a 'Simple' 'Lens', 'Iso', 'Setter' or 'Traversal' by 'mappend'ing a value. -- -- @--- ('<>=') :: ('MonadState' a m, 'Monoid' b) => 'Simple' 'Setter' a b -> b -> m ()--- ('<>=') :: ('MonadState' a m, 'Monoid' b) => 'Simple' 'Iso' a b -> b -> m ()--- ('<>=') :: ('MonadState' a m, 'Monoid' b) => 'Simple' 'Lens' a b -> b -> m ()--- ('<>=') :: ('MonadState' a m, 'Monoid' b) => 'Simple' 'Traversal' a b -> b -> m ()+-- ('<>=') :: ('MonadState' s m, 'Monoid' a) => 'Simple' 'Setter' s a -> a -> m ()+-- ('<>=') :: ('MonadState' s m, 'Monoid' a) => 'Simple' 'Iso' s a -> a -> m ()+-- ('<>=') :: ('MonadState' s m, 'Monoid' a) => 'Simple' 'Lens' s a -> a -> m ()+-- ('<>=') :: ('MonadState' s m, 'Monoid' a) => 'Simple' 'Traversal' s a -> a -> m () -- @-(<>=) :: (MonadState a m, Monoid b) => SimpleSetting a b -> b -> m ()-l <>= b = State.modify (l <>~ b)+(<>=) :: (MonadState s m, Monoid a) => SimpleSetting s a -> a -> m ()+l <>= a = State.modify (l <>~ a) {-# INLINE (<>=) #-} @@ -54,7 +54,7 @@ -- return the result -- -- When you do not need the result of the operation, ('<>~') is more flexible.-(<<>~) :: Monoid m => LensLike ((,)m) a b m m -> m -> a -> (m, b)+(<<>~) :: Monoid m => LensLike ((,)m) s t m m -> m -> s -> (m, t) l <<>~ m = l <%~ (`mappend` m) {-# INLINE (<<>~) #-} @@ -62,7 +62,7 @@ -- your monad's state and return the result. -- -- When you do not need the result of the operation, ('<>=') is more flexible.-(<<>=) :: (MonadState a m, Monoid r) => SimpleLensLike ((,)r) a r -> r -> m r+(<<>=) :: (MonadState s m, Monoid r) => SimpleLensLike ((,)r) s r -> r -> m r l <<>= r = l <%= (`mappend` r) {-# INLINE (<<>=) #-}
src/Data/Set/Lens.hs view
@@ -40,12 +40,12 @@ -- fromList [1,2,3] -- -- @--- 'setOf' :: 'Getter' a c -> a -> 'Set' c--- 'setOf' :: 'Ord' c => 'Control.Lens.Fold.Fold' a c -> a -> 'Set' c--- 'setOf' :: 'Control.Lens.Type.Simple' 'Control.Lens.Iso.Iso' a c -> a -> 'Set' c--- 'setOf' :: 'Control.Lens.Type.Simple' 'Control.Lens.Type.Lens' a c -> a -> 'Set' c--- 'setOf' :: 'Ord' c => 'Control.Lens.Type.Simple' 'Control.Lens.Traversal.Traversal' a c -> a -> 'Set' c+-- 'setOf' :: 'Getter' s a -> s -> 'Set' a+-- 'setOf' :: 'Ord' a => 'Control.Lens.Fold.Fold' s a -> s -> 'Set' a+-- 'setOf' :: 'Control.Lens.Type.Simple' 'Control.Lens.Iso.Iso' s a -> s -> 'Set' a+-- 'setOf' :: 'Control.Lens.Type.Simple' 'Control.Lens.Type.Lens' s a -> s -> 'Set' a+-- 'setOf' :: 'Ord' a => 'Control.Lens.Type.Simple' 'Control.Lens.Traversal.Traversal' s a -> s -> 'Set' a -- @-setOf :: Getting (Set c) a b c d -> a -> Set c+setOf :: Getting (Set a) s t a b -> s -> Set a setOf l = runAccessor . l (Accessor . Set.singleton) {-# INLINE setOf #-}
src/Data/Typeable/Lens.hs view
@@ -20,15 +20,15 @@ import Unsafe.Coerce as Unsafe -- | A 'Simple' 'Traversal' for working with a 'cast' of a 'Typeable' value.-_cast :: (Typeable a, Typeable b) => Simple Traversal a b-_cast f a = case cast a of- Just b -> Unsafe.unsafeCoerce <$> f b- Nothing -> pure a+_cast :: (Typeable s, Typeable a) => Simple Traversal s a+_cast f s = case cast s of+ Just a -> Unsafe.unsafeCoerce <$> f a+ Nothing -> pure s {-# INLINE _cast #-} -- | A 'Simple' 'Traversal' for working with a 'gcast' of a 'Typeable' value.-_gcast :: (Typeable a, Typeable b) => Simple Traversal (c a) (c b)-_gcast f a = case gcast a of- Just b -> Unsafe.unsafeCoerce <$> f b- Nothing -> pure a+_gcast :: (Typeable s, Typeable a) => Simple Traversal (c s) (c a)+_gcast f s = case gcast s of+ Just a -> Unsafe.unsafeCoerce <$> f a+ Nothing -> pure s {-# INLINE _gcast #-}
src/System/FilePath/Lens.hs view
@@ -35,12 +35,12 @@ -- ("hello/!!!","world/!!!") -- -- @--- ('</>~') :: 'Setter' a b 'FilePath' 'FilePath' -> 'FilePath' -> a -> b--- ('</>~') :: 'Iso' a b 'FilePath' 'FilePath' -> 'FilePath' -> a -> b--- ('</>~') :: 'Lens' a b 'FilePath' 'FilePath' -> 'FilePath' -> a -> b--- ('</>~') :: 'Traversal' a b 'FilePath' 'FilePath' -> 'FilePath' -> a -> b+-- ('</>~') :: 'Setter' s a 'FilePath' 'FilePath' -> 'FilePath' -> s -> a+-- ('</>~') :: 'Iso' s a 'FilePath' 'FilePath' -> 'FilePath' -> s -> a+-- ('</>~') :: 'Lens' s a 'FilePath' 'FilePath' -> 'FilePath' -> s -> a+-- ('</>~') :: 'Traversal' s a 'FilePath' 'FilePath' -> 'FilePath' -> s -> a -- @-(</>~) :: Setting a b FilePath FilePath -> FilePath -> a -> b+(</>~) :: Setting s t FilePath FilePath -> FilePath -> s -> t l </>~ n = over l (</> n) {-# INLINE (</>~) #-} @@ -48,12 +48,12 @@ -- | Modify the target(s) of a 'Simple' 'Lens', 'Iso', 'Setter' or 'Traversal' by adding a path. -- -- @--- ('</>=') :: 'MonadState' a m => 'Simple' 'Setter' a 'FilePath' -> 'FilePath' -> m ()--- ('</>=') :: 'MonadState' a m => 'Simple' 'Iso' a 'FilePath' -> 'FilePath' -> m ()--- ('</>=') :: 'MonadState' a m => 'Simple' 'Lens' a 'FilePath' -> 'FilePath' -> m ()--- ('</>=') :: 'MonadState' a m => 'Simple' 'Traversal' a 'FilePath' -> 'FilePath' -> m ()+-- ('</>=') :: 'MonadState' s m => 'Simple' 'Setter' s 'FilePath' -> 'FilePath' -> m ()+-- ('</>=') :: 'MonadState' s m => 'Simple' 'Iso' s 'FilePath' -> 'FilePath' -> m ()+-- ('</>=') :: 'MonadState' s m => 'Simple' 'Lens' s 'FilePath' -> 'FilePath' -> m ()+-- ('</>=') :: 'MonadState' s m => 'Simple' 'Traversal' s 'FilePath' -> 'FilePath' -> m () -- @-(</>=) :: MonadState a m => SimpleSetting a FilePath -> FilePath -> m ()+(</>=) :: MonadState s m => SimpleSetting s FilePath -> FilePath -> m () l </>= b = State.modify (l </>~ b) {-# INLINE (</>=) #-} @@ -61,7 +61,7 @@ -- | Add a path onto the end of the target of a 'Lens' and return the result -- -- When you do not need the result of the operation, ('</>~') is more flexible.-(<</>~) :: LensLike ((,)FilePath) a b FilePath FilePath -> FilePath -> a -> (FilePath, b)+(<</>~) :: LensLike ((,)FilePath) s a FilePath FilePath -> FilePath -> s -> (FilePath, a) l <</>~ m = l <%~ (</> m) {-# INLINE (<</>~) #-} @@ -70,7 +70,7 @@ -- your monad's state and return the result. -- -- When you do not need the result of the operation, ('</>=') is more flexible.-(<</>=) :: MonadState a m => SimpleLensLike ((,)FilePath) a FilePath -> FilePath -> m FilePath+(<</>=) :: MonadState s m => SimpleLensLike ((,)FilePath) s FilePath -> FilePath -> m FilePath l <</>= r = l <%= (</> r) {-# INLINE (<</>=) #-} @@ -82,12 +82,12 @@ -- ("hello.!!!","world.!!!") -- -- @--- ('<.>~') :: 'Setter' a b 'FilePath' 'FilePath' -> 'String' -> a -> b--- ('<.>~') :: 'Iso' a b 'FilePath' 'FilePath' -> 'String' -> a -> b--- ('<.>~') :: 'Lens' a b 'FilePath' 'FilePath' -> 'String' -> a -> b--- ('<.>~') :: 'Traversal' a b 'FilePath' 'FilePath' -> 'String' -> a -> b+-- ('<.>~') :: 'Setter' s a 'FilePath' 'FilePath' -> 'String' -> s -> a+-- ('<.>~') :: 'Iso' s a 'FilePath' 'FilePath' -> 'String' -> s -> a+-- ('<.>~') :: 'Lens' s a 'FilePath' 'FilePath' -> 'String' -> s -> a+-- ('<.>~') :: 'Traversal' s a 'FilePath' 'FilePath' -> 'String' -> s -> a -- @-(<.>~) :: Setting a b FilePath FilePath -> String -> a -> b+(<.>~) :: Setting s a FilePath FilePath -> String -> s -> a l <.>~ n = over l (<.> n) {-# INLINE (<.>~) #-} @@ -95,12 +95,12 @@ -- | Modify the target(s) of a 'Simple' 'Lens', 'Iso', 'Setter' or 'Traversal' by adding an extension. -- -- @--- ('<.>=') :: 'MonadState' a m => 'Simple' 'Setter' a 'FilePath' -> 'String' -> m ()--- ('<.>=') :: 'MonadState' a m => 'Simple' 'Iso' a 'FilePath' -> 'String' -> m ()--- ('<.>=') :: 'MonadState' a m => 'Simple' 'Lens' a 'FilePath' -> 'String' -> m ()--- ('<.>=') :: 'MonadState' a m => 'Simple' 'Traversal' a 'FilePath' -> 'String' -> m ()+-- ('<.>=') :: 'MonadState' s m => 'Simple' 'Setter' s 'FilePath' -> 'String' -> m ()+-- ('<.>=') :: 'MonadState' s m => 'Simple' 'Iso' s 'FilePath' -> 'String' -> m ()+-- ('<.>=') :: 'MonadState' s m => 'Simple' 'Lens' s 'FilePath' -> 'String' -> m ()+-- ('<.>=') :: 'MonadState' s m => 'Simple' 'Traversal' s 'FilePath' -> 'String' -> m () -- @-(<.>=) :: MonadState a m => SimpleSetting a FilePath -> String -> m ()+(<.>=) :: MonadState s m => SimpleSetting s FilePath -> String -> m () l <.>= b = State.modify (l <.>~ b) {-# INLINE (<.>=) #-} @@ -108,7 +108,7 @@ -- | Add an extension onto the end of the target of a 'Lens' and return the result -- -- When you do not need the result of the operation, ('<.>~') is more flexible.-(<<.>~) :: LensLike ((,)FilePath) a b FilePath FilePath -> String -> a -> (FilePath, b)+(<<.>~) :: LensLike ((,)FilePath) s a FilePath FilePath -> String -> s -> (FilePath, a) l <<.>~ m = l <%~ (<.> m) {-# INLINE (<<.>~) #-} @@ -117,7 +117,7 @@ -- your monad's state and return the result. -- -- When you do not need the result of the operation, ('<.>=') is more flexible.-(<<.>=) :: MonadState a m => SimpleLensLike ((,)FilePath) a FilePath -> String -> m FilePath+(<<.>=) :: MonadState s m => SimpleLensLike ((,)FilePath) s FilePath -> String -> m FilePath l <<.>= r = l <%= (<.> r) {-# INLINE (<<.>=) #-}
tests/properties.hs view
@@ -14,41 +14,41 @@ import Test.QuickCheck.Function import Data.Text.Strict.Lens -setter_id :: Eq a => Simple Setter a b -> a -> Bool-setter_id l a = runIdentity (l Identity a) == a+setter_id :: Eq s => Simple Setter s a -> s -> Bool+setter_id l s = runIdentity (l Identity s) == s -setter_composition :: Eq a => Simple Setter a b -> a -> Fun b b -> Fun b b -> Bool-setter_composition l a (Fun _ f) (Fun _ g) = mapOf l f (mapOf l g a) == mapOf l (f . g) a+setter_composition :: Eq s => Simple Setter s a -> s -> Fun a a -> Fun a a -> Bool+setter_composition l s (Fun _ f) (Fun _ g) = mapOf l f (mapOf l g s) == mapOf l (f . g) s -lens_set_view :: Eq a => Simple Lens a b -> a -> Bool-lens_set_view l a = set l (view l a) a == a+lens_set_view :: Eq s => Simple Lens s a -> s -> Bool+lens_set_view l s = set l (view l s) s == s -lens_view_set :: Eq b => Simple Lens a b -> a -> b -> Bool-lens_view_set l a b = view l (set l b a) == b+lens_view_set :: Eq a => Simple Lens s a -> s -> a -> Bool+lens_view_set l s a = view l (set l a s) == a -setter_set_set :: Eq a => Simple Setter a b -> a -> b -> b -> Bool-setter_set_set l a b c = set l c (set l b a) == set l c a+setter_set_set :: Eq s => Simple Setter s a -> s -> a -> a -> Bool+setter_set_set l s a b = set l b (set l a s) == set l b s -iso_hither :: Eq a => Simple Iso a b -> a -> Bool-iso_hither l a = a ^.l.from l == a+iso_hither :: Eq s => Simple Iso s a -> s -> Bool+iso_hither l s = s ^.l.from l == s -iso_yon :: Eq b => Simple Iso a b -> b -> Bool-iso_yon l b = b^.from l.l == b+iso_yon :: Eq a => Simple Iso s a -> a -> Bool+iso_yon l a = a^.from l.l == a -isSetter :: (Arbitrary a, Arbitrary b, CoArbitrary b, Show a, Show b, Eq a, Function b)- => Simple Setter a b -> Property+isSetter :: (Arbitrary s, Arbitrary a, CoArbitrary a, Show s, Show a, Eq s, Function a)+ => Simple Setter s a -> Property isSetter l = setter_id l .&. setter_composition l .&. setter_set_set l -isTraversal :: (Arbitrary a, Arbitrary b, CoArbitrary b, Show a, Show b, Eq a, Function b)- => Simple Traversal a b -> Property+isTraversal :: (Arbitrary s, Arbitrary a, CoArbitrary a, Show s, Show a, Eq s, Function a)+ => Simple Traversal s a -> Property isTraversal l = isSetter l -isLens :: (Arbitrary a, Arbitrary b, CoArbitrary b, Show a, Show b, Eq a, Eq b, Function b)- => Simple Lens a b -> Property+isLens :: (Arbitrary s, Arbitrary a, CoArbitrary a, Show s, Show a, Eq s, Eq a, Function a)+ => Simple Lens s a -> Property isLens l = lens_set_view l .&. lens_view_set l .&. isTraversal l -isIso :: (Arbitrary a, Arbitrary b, CoArbitrary a, CoArbitrary b, Show a, Show b, Eq a, Eq b, Function a, Function b)- => Simple Iso a b -> Property+isIso :: (Arbitrary s, Arbitrary a, CoArbitrary s, CoArbitrary a, Show s, Show a, Eq s, Eq a, Function s, Function a)+ => Simple Iso s a -> Property isIso l = iso_hither l .&. iso_yon l .&. isLens l .&. isLens (from l) -- an illegal lens