Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Removed more q Profunctor references

  • Loading branch information...
commit 3fe8e0b9bed044d6b5ac8d9c5c5c202d3329c1c5 1 parent fc73503
Edward Kmett authored
10 src/Control/Lens/At.hs
View
@@ -68,7 +68,7 @@ import Data.Vector.Storable as Storable
-- >>> let g :: Expr -> Expr; g = Debug.SimpleReflect.Vars.g
-- | A deprecated alias for 'ix'
-contains, _at, resultAt :: (Indexable (IxKey m) p, Ixed f m) => IxKey m -> IndexedLensLike' p f m (IxValue m)
+contains, _at, resultAt :: Ixed f m => IxKey m -> IndexedLensLike' (IxKey m) f m (IxValue m)
contains = ix
_at = ix
resultAt = ix
@@ -107,20 +107,20 @@ class Ixed f m where
-- >>> IntSet.fromList [1,2,3,4] ^. ix 5
-- False
- ix :: Indexable (IxKey m) p => IxKey m -> IndexedLensLike' p f m (IxValue m)
+ ix :: IxKey m -> IndexedLensLike' (IxKey m) f m (IxValue m)
#ifdef DEFAULT_SIGNATURES
- default ix :: (Indexable (IxKey m) p, Applicative f, At m) => IxKey m -> IndexedLensLike' p f m (IxValue m)
+ default ix :: (Applicative f, At m) => IxKey m -> IndexedLensLike' (IxKey m) f m (IxValue m)
ix = ixAt
#endif
-- | A definition of 'ix' for types with an 'At' instance. This is the default
-- if you don't specify a definition for 'ix'.
-ixAt :: (Indexable (IxKey m) p, Applicative f, At m) => IxKey m -> IndexedLensLike' p f m (IxValue m)
+ixAt :: (Applicative f, At m) => IxKey m -> IndexedLensLike' (IxKey m) f m (IxValue m)
ixAt i = at i <. traverse
{-# INLINE ixAt #-}
-- | A definition of 'ix' for types with an 'Each' instance.
-ixEach :: (Indexable (IxKey m) p, Applicative f, Eq (IxKey m), Each (IxKey m) f m m (IxValue m) (IxValue m)) => IxKey m -> IndexedLensLike' p f m (IxValue m)
+ixEach :: (Applicative f, Eq (IxKey m), Each (IxKey m) f m m (IxValue m) (IxValue m)) => IxKey m -> IndexedLensLike' (IxKey m) f m (IxValue m)
ixEach i = each . Lens.index i
{-# INLINE ixEach #-}
4 src/Control/Lens/Each.hs
View
@@ -80,9 +80,9 @@ import Data.Array.IArray as IArray
-- >>> ("hello","world") & each.each %~ Char.toUpper
-- ("HELLO","WORLD")
class Functor f => Each i f s t a b | s -> i a, t -> i b, s b -> t, t a -> s where
- each :: Indexable i p => IndexedLensLike p f s t a b
+ each :: IndexedLensLike i f s t a b
#ifdef DEFAULT_SIGNATURES
- default each :: (Indexable Int p, Applicative f, Traversable g, s ~ g a, t ~ g b) => IndexedLensLike p f s t a b
+ default each :: (Applicative f, Traversable g, s ~ g a, t ~ g b) => IndexedLensLike Int f s t a b
each = traversed
{-# INLINE each #-}
#endif
6 src/Control/Lens/Lens.hs
View
@@ -774,7 +774,7 @@ l <%@~ f = l (Indexed $ \i a -> let b = f i a in (b, b))
-- ('%%@~') :: 'IndexedLens' i s t a b -> (i -> a -> (r, b)) -> s -> (r, t)
-- ('%%@~') :: 'Monoid' r => 'Control.Lens.Traversal.IndexedTraversal' i s t a b -> (i -> a -> (r, b)) -> s -> (r, t)
-- @
-(%%@~) :: Overloading (Indexed i) q f s t a b -> (i -> a -> f b) -> q s (f t)
+(%%@~) :: Lensing (Indexed i) f s t a b -> (i -> a -> f b) -> s -> f t
(%%@~) l = l .# Indexed
{-# INLINE (%%@~) #-}
@@ -788,7 +788,7 @@ l <%@~ f = l (Indexed $ \i a -> let b = f i a in (b, b))
-- ('%%@=') :: 'MonadState' s m 'IndexedLens' i s s a b -> (i -> a -> (r, b)) -> s -> m r
-- ('%%@=') :: ('MonadState' s m, 'Monoid' r) => 'Control.Lens.Traversal.IndexedTraversal' i s s a b -> (i -> a -> (r, b)) -> s -> m r
-- @
-(%%@=) :: MonadState s m => IndexedLensLike (Indexed i) ((,) r) s s a b -> (i -> a -> (r, b)) -> m r
+(%%@=) :: MonadState s m => Lensing (Indexed 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
@@ -807,7 +807,7 @@ l %%@= f = do
-- ('<%@=') :: 'MonadState' s m 'IndexedLens' i s s a b -> (i -> a -> b) -> m b
-- ('<%@=') :: ('MonadState' s m, 'Monoid' b) => 'Control.Lens.Traversal.IndexedTraversal' i s s a b -> (i -> a -> b) -> m b
-- @
-(<%@=) :: MonadState s m => IndexedLensLike (Indexed i) ((,) b) s s a b -> (i -> a -> b) -> m b
+(<%@=) :: MonadState s m => Lensing (Indexed 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 (<%@=) #-}
10 src/Control/Lens/Traversal.hs
View
@@ -143,7 +143,7 @@ type ATraversal s t a b = LensLike (Bazaar (->) (->) a b) s t a b
type ATraversal' s a = ATraversal s s a a
-- | When you see this as an argument to a function, it expects an 'IndexedTraversal'.
-type AnIndexedTraversal i s t a b = IndexedLensLike (Indexed i) (Bazaar (Indexed i) (->) a b) s t a b
+type AnIndexedTraversal i s t a b = Lensing (Indexed i) (Bazaar (Indexed i) (->) a b) s t a b
-- | @type 'AnIndexedTraversal'' = 'Simple' ('AnIndexedTraversal' i)@
type AnIndexedTraversal' i s a = AnIndexedTraversal i s s a a
@@ -922,10 +922,10 @@ instance Ord k => TraverseMax k (Map k) where
-- 'elementOf' :: 'Traversal'' s a -> 'Int' -> 'IndexedTraversal'' 'Int' s a
-- 'elementOf' :: 'Fold' s a -> 'Int' -> 'IndexedFold' 'Int' s a
-- @
-elementOf :: (Applicative f, Indexable Int p)
+elementOf :: Applicative f
=> LensLike (Indexing f) s t a a
-> Int
- -> IndexedLensLike p f s t a a
+ -> IndexedLensLike Int f s t a a
elementOf l p = elementsOf l (p ==)
{-# INLINE elementOf #-}
@@ -942,10 +942,10 @@ element = elementOf traverse
-- 'elementsOf' :: 'Traversal'' s a -> ('Int' -> 'Bool') -> 'IndexedTraversal'' 'Int' s a
-- 'elementsOf' :: 'Fold' s a -> ('Int' -> 'Bool') -> 'IndexedFold' 'Int' s a
-- @
-elementsOf :: (Applicative f, Indexable Int p)
+elementsOf :: Applicative f
=> LensLike (Indexing f) s t a a
-> (Int -> Bool)
- -> IndexedLensLike p f s t a a
+ -> IndexedLensLike Int f s t a a
elementsOf l p iafb s = snd $ runIndexing (l (\a -> Indexing (\i -> i `seq` (i + 1, if p i then indexed iafb i a else pure a))) s) 0
{-# INLINE elementsOf #-}
9 src/Control/Lens/Type.hs
View
@@ -46,6 +46,7 @@ module Control.Lens.Type
-- * Common
, Simple
, LensLike, LensLike'
+ , Lensing, Lensing'
, IndexedLensLike, IndexedLensLike'
, Overloading, Overloading'
, Overloaded, Overloaded'
@@ -498,7 +499,11 @@ type LensLike f s t a b = (a -> f b) -> s -> f t
type LensLike' f s a = LensLike f s s a a
-- | Convenient alias for constructing indexed lenses and their ilk.
-type IndexedLensLike p f s t a b = p a (f b) -> s -> f t
+type IndexedLensLike i f s t a b = forall p. Indexable i p => p a (f b) -> s -> f t
-- | Convenient alias for constructing simple indexed lenses and their ilk.
-type IndexedLensLike' p f s a = p a (f a) -> s -> f s
+type IndexedLensLike' i f s a = IndexedLensLike i f s s a a
+
+type Lensing p f s t a b = p a (f b) -> s -> f t
+
+type Lensing' p f s a = Lensing p f s s a a
Please sign in to comment.
Something went wrong with that request. Please try again.