Browse files

Overloaded -> Optic, Overloading -> Optical. We now have laws for

arbtirary Optics that hold across the entire ecosystem, so it behooves
us to give them a better name.
  • Loading branch information...
1 parent b663d6f commit 44272e065835cebea581732641bd400d960937a2 @ekmett committed Oct 12, 2013
View
58 src/Control/Exception/Lens.hs
@@ -351,7 +351,7 @@ class AsIOException p f t where
--
-- Many combinators for working with an 'IOException' are available
-- in "System.IO.Error.Lens".
- _IOException :: Overloaded' p f t IOException
+ _IOException :: Optic' p f t IOException
instance AsIOException p f IOException where
_IOException = id
@@ -369,7 +369,7 @@ instance (Choice p, Applicative f) => AsIOException p f SomeException where
class AsArithException p f t where
-- '_ArithException' :: 'Equality'' 'ArithException' 'ArithException'
-- '_ArithException' :: 'Prism'' 'SomeException' 'ArithException'
- _ArithException :: Overloaded' p f t ArithException
+ _ArithException :: Optic' p f t ArithException
instance AsArithException p f ArithException where
_ArithException = id
@@ -389,7 +389,7 @@ instance (Choice p, Applicative f) => AsArithException p f SomeException where
-- '_Overflow' :: 'Prism'' 'ArithException' 'ArithException'
-- '_Overflow' :: 'Prism'' 'SomeException' 'ArithException'
-- @
-_Overflow :: (AsArithException p f t, Choice p, Applicative f) => Overloaded' p f t ()
+_Overflow :: (AsArithException p f t, Choice p, Applicative f) => Optic' p f t ()
_Overflow = _ArithException . dimap seta (either id id) . right' . rmap (Overflow <$) where
seta Overflow = Right ()
seta t = Left (pure t)
@@ -405,7 +405,7 @@ _Overflow = _ArithException . dimap seta (either id id) . right' . rmap (Overflo
-- '_Underflow' :: 'Prism'' 'ArithException' 'ArithException'
-- '_Underflow' :: 'Prism'' 'SomeException' 'ArithException'
-- @
-_Underflow :: (AsArithException p f t, Choice p, Applicative f) => Overloaded' p f t ()
+_Underflow :: (AsArithException p f t, Choice p, Applicative f) => Optic' p f t ()
_Underflow = _ArithException . dimap seta (either id id) . right' . rmap (Underflow <$) where
seta Underflow = Right ()
seta t = Left (pure t)
@@ -421,7 +421,7 @@ _Underflow = _ArithException . dimap seta (either id id) . right' . rmap (Underf
-- '_LossOfPrecision' :: 'Prism'' 'ArithException' 'ArithException'
-- '_LossOfPrecision' :: 'Prism'' 'SomeException' 'ArithException'
-- @
-_LossOfPrecision :: (AsArithException p f t, Choice p, Applicative f) => Overloaded' p f t ()
+_LossOfPrecision :: (AsArithException p f t, Choice p, Applicative f) => Optic' p f t ()
_LossOfPrecision = _ArithException . dimap seta (either id id) . right' . rmap (LossOfPrecision <$) where
seta LossOfPrecision = Right ()
seta t = Left (pure t)
@@ -437,7 +437,7 @@ _LossOfPrecision = _ArithException . dimap seta (either id id) . right' . rmap (
-- '_DivideByZero' :: 'Prism'' 'ArithException' 'ArithException'
-- '_DivideByZero' :: 'Prism'' 'SomeException' 'ArithException'
-- @
-_DivideByZero :: (AsArithException p f t, Choice p, Applicative f) => Overloaded' p f t ()
+_DivideByZero :: (AsArithException p f t, Choice p, Applicative f) => Optic' p f t ()
_DivideByZero = _ArithException . dimap seta (either id id) . right' . rmap (DivideByZero <$) where
seta DivideByZero = Right ()
seta t = Left (pure t)
@@ -453,7 +453,7 @@ _DivideByZero = _ArithException . dimap seta (either id id) . right' . rmap (Div
-- '_Denormal' :: 'Prism'' 'ArithException' 'ArithException'
-- '_Denormal' :: 'Prism'' 'SomeException' 'ArithException'
-- @
-_Denormal :: (AsArithException p f t, Choice p, Applicative f) => Overloaded' p f t ()
+_Denormal :: (AsArithException p f t, Choice p, Applicative f) => Optic' p f t ()
_Denormal = _ArithException . dimap seta (either id id) . right' . rmap (Denormal <$) where
seta Denormal = Right ()
seta t = Left (pure t)
@@ -472,7 +472,7 @@ _Denormal = _ArithException . dimap seta (either id id) . right' . rmap (Denorma
-- '_RatioZeroDenominator' :: 'Prism'' 'ArithException' 'ArithException'
-- '_RatioZeroDenominator' :: 'Prism'' 'SomeException' 'ArithException'
-- @
-_RatioZeroDenominator :: (AsArithException p f t, Choice p, Applicative f) => Overloaded' p f t ()
+_RatioZeroDenominator :: (AsArithException p f t, Choice p, Applicative f) => Optic' p f t ()
_RatioZeroDenominator = _ArithException . dimap seta (either id id) . right' . rmap (RatioZeroDenominator <$) where
seta RatioZeroDenominator = Right ()
seta t = Left (pure t)
@@ -492,7 +492,7 @@ class AsArrayException p f t where
-- '_ArrayException' :: 'Equality'' 'ArrayException' 'ArrayException'
-- '_ArrayException' :: 'Prism'' 'SomeException' 'ArrayException'
-- @
- _ArrayException :: Overloaded' p f t ArrayException
+ _ArrayException :: Optic' p f t ArrayException
instance AsArrayException p f ArrayException where
_ArrayException = id
@@ -512,7 +512,7 @@ instance (Choice p, Applicative f) => AsArrayException p f SomeException where
-- '_IndexOutOfBounds' :: 'Prism'' 'ArrayException' 'String'
-- '_IndexOutOfBounds' :: 'Prism'' 'SomeException' 'String'
-- @
-_IndexOutOfBounds :: (AsArrayException p f t, Choice p, Applicative f) => Overloaded' p f t String
+_IndexOutOfBounds :: (AsArrayException p f t, Choice p, Applicative f) => Optic' p f t String
_IndexOutOfBounds = _ArrayException . dimap seta (either id id) . right' . rmap (fmap IndexOutOfBounds) where
seta (IndexOutOfBounds r) = Right r
seta t = Left (pure t)
@@ -528,7 +528,7 @@ _IndexOutOfBounds = _ArrayException . dimap seta (either id id) . right' . rmap
-- '_UndefinedElement' :: 'Prism'' 'ArrayException' 'String'
-- '_UndefinedElement' :: 'Prism'' 'SomeException' 'String'
-- @
-_UndefinedElement :: (AsArrayException p f t, Choice p, Applicative f) => Overloaded' p f t String
+_UndefinedElement :: (AsArrayException p f t, Choice p, Applicative f) => Optic' p f t String
_UndefinedElement = _ArrayException . dimap seta (either id id) . right' . rmap (fmap UndefinedElement) where
seta (UndefinedElement r) = Right r
seta t = Left (pure t)
@@ -549,7 +549,7 @@ class AsAssertionFailed p f t where
-- '_AssertionFailed' :: 'Iso'' 'AssertionFailed' 'String'
-- '_AssertionFailed' :: 'Prism'' 'SomeException' 'String'
-- @
- _AssertionFailed :: Overloaded' p f t String
+ _AssertionFailed :: Optic' p f t String
instance (Profunctor p, Functor f) => AsAssertionFailed p f AssertionFailed where
_AssertionFailed = unwrapping AssertionFailed
@@ -571,7 +571,7 @@ class AsAsyncException p f t where
-- '_AsyncException' :: 'Equality'' 'AsyncException' 'AsyncException'
-- '_AsyncException' :: 'Prism'' 'SomeException' 'AsyncException'
-- @
- _AsyncException :: Overloaded' p f t AsyncException
+ _AsyncException :: Optic' p f t AsyncException
instance AsAsyncException p f AsyncException where
_AsyncException = id
@@ -589,7 +589,7 @@ instance (Choice p, Applicative f) => AsAsyncException p f SomeException where
-- '_StackOverflow' :: 'Prism'' 'AsyncException' ()
-- '_StackOverflow' :: 'Prism'' 'SomeException' ()
-- @
-_StackOverflow :: (AsAsyncException p f t, Choice p, Applicative f) => Overloaded' p f t ()
+_StackOverflow :: (AsAsyncException p f t, Choice p, Applicative f) => Optic' p f t ()
_StackOverflow = _AsyncException . dimap seta (either id id) . right' . rmap (StackOverflow <$) where
seta StackOverflow = Right ()
seta t = Left (pure t)
@@ -608,7 +608,7 @@ _StackOverflow = _AsyncException . dimap seta (either id id) . right' . rmap (St
-- '_HeapOverflow' :: 'Prism'' 'AsyncException' ()
-- '_HeapOverflow' :: 'Prism'' 'SomeException' ()
-- @
-_HeapOverflow :: (AsAsyncException p f t, Choice p, Applicative f) => Overloaded' p f t ()
+_HeapOverflow :: (AsAsyncException p f t, Choice p, Applicative f) => Optic' p f t ()
_HeapOverflow = _AsyncException . dimap seta (either id id) . right' . rmap (HeapOverflow <$) where
seta HeapOverflow = Right ()
seta t = Left (pure t)
@@ -622,7 +622,7 @@ _HeapOverflow = _AsyncException . dimap seta (either id id) . right' . rmap (Hea
-- '_ThreadKilled' :: 'Prism'' 'AsyncException' ()
-- '_ThreadKilled' :: 'Prism'' 'SomeException' ()
-- @
-_ThreadKilled :: (AsAsyncException p f t, Choice p, Applicative f) => Overloaded' p f t ()
+_ThreadKilled :: (AsAsyncException p f t, Choice p, Applicative f) => Optic' p f t ()
_ThreadKilled = _AsyncException . dimap seta (either id id) . right' . rmap (ThreadKilled <$) where
seta ThreadKilled = Right ()
seta t = Left (pure t)
@@ -636,7 +636,7 @@ _ThreadKilled = _AsyncException . dimap seta (either id id) . right' . rmap (Thr
-- '_UserInterrupt' :: 'Prism'' 'AsyncException' ()
-- '_UserInterrupt' :: 'Prism'' 'SomeException' ()
-- @
-_UserInterrupt :: (AsAsyncException p f t, Choice p, Applicative f) => Overloaded' p f t ()
+_UserInterrupt :: (AsAsyncException p f t, Choice p, Applicative f) => Optic' p f t ()
_UserInterrupt = _AsyncException . dimap seta (either id id) . right' . rmap (UserInterrupt <$) where
seta UserInterrupt = Right ()
seta t = Left (pure t)
@@ -656,7 +656,7 @@ class (Profunctor p, Functor f) => AsNonTermination p f t where
-- '_NonTermination' :: 'Iso'' 'NonTermination' ()
-- '_NonTermination' :: 'Prism'' 'SomeException' ()
-- @
- _NonTermination :: Overloaded' p f t ()
+ _NonTermination :: Optic' p f t ()
instance (Profunctor p, Functor f) => AsNonTermination p f NonTermination where
_NonTermination = trivial NonTermination
@@ -679,7 +679,7 @@ class (Profunctor p, Functor f) => AsNestedAtomically p f t where
-- '_NestedAtomically' :: 'Iso'' 'NestedAtomically' ()
-- '_NestedAtomically' :: 'Prism'' 'SomeException' ()
-- @
- _NestedAtomically :: Overloaded' p f t ()
+ _NestedAtomically :: Optic' p f t ()
instance (Profunctor p, Functor f) => AsNestedAtomically p f NestedAtomically where
_NestedAtomically = trivial NestedAtomically
@@ -703,7 +703,7 @@ class (Profunctor p, Functor f) => AsBlockedIndefinitelyOnMVar p f t where
-- '_BlockedIndefinitelyOnMVar' :: 'Iso'' 'BlockedIndefinitelyOnMVar' ()
-- '_BlockedIndefinitelyOnMVar' :: 'Prism'' 'SomeException' ()
-- @
- _BlockedIndefinitelyOnMVar :: Overloaded' p f t ()
+ _BlockedIndefinitelyOnMVar :: Optic' p f t ()
instance (Profunctor p, Functor f) => AsBlockedIndefinitelyOnMVar p f BlockedIndefinitelyOnMVar where
_BlockedIndefinitelyOnMVar = trivial BlockedIndefinitelyOnMVar
@@ -727,7 +727,7 @@ class (Profunctor p, Functor f) => AsBlockedIndefinitelyOnSTM p f t where
-- '_BlockedIndefinitelyOnSTM' :: 'Iso'' 'BlockedIndefinitelyOnSTM' ()
-- '_BlockedIndefinitelyOnSTM' :: 'Prism'' 'SomeException' ()
-- @
- _BlockedIndefinitelyOnSTM :: Overloaded' p f t ()
+ _BlockedIndefinitelyOnSTM :: Optic' p f t ()
instance (Profunctor p, Functor f) => AsBlockedIndefinitelyOnSTM p f BlockedIndefinitelyOnSTM where
_BlockedIndefinitelyOnSTM = trivial BlockedIndefinitelyOnSTM
@@ -750,7 +750,7 @@ class (Profunctor p, Functor f) => AsDeadlock p f t where
-- '_Deadlock' :: 'Iso'' 'Deadlock' ()
-- '_Deadlock' :: 'Prism'' 'SomeException' ()
-- @
- _Deadlock :: Overloaded' p f t ()
+ _Deadlock :: Optic' p f t ()
instance (Profunctor p, Functor f) => AsDeadlock p f Deadlock where
_Deadlock = trivial Deadlock
@@ -773,7 +773,7 @@ class (Profunctor p, Functor f) => AsNoMethodError p f t where
-- '_NoMethodError' :: 'Iso'' 'NoMethodError' 'String'
-- '_NoMethodError' :: 'Prism'' 'SomeException' 'String'
-- @
- _NoMethodError :: Overloaded' p f t String
+ _NoMethodError :: Optic' p f t String
instance (Profunctor p, Functor f) => AsNoMethodError p f NoMethodError where
_NoMethodError = unwrapping NoMethodError
@@ -795,7 +795,7 @@ class (Profunctor p, Functor f) => AsPatternMatchFail p f t where
-- '_PatternMatchFail' :: 'Iso'' 'PatternMatchFail' 'String'
-- '_PatternMatchFail' :: 'Prism'' 'SomeException' 'String'
-- @
- _PatternMatchFail :: Overloaded' p f t String
+ _PatternMatchFail :: Optic' p f t String
instance (Profunctor p, Functor f) => AsPatternMatchFail p f PatternMatchFail where
_PatternMatchFail = unwrapping PatternMatchFail
@@ -818,7 +818,7 @@ class (Profunctor p, Functor f) => AsRecConError p f t where
-- '_RecConError' :: 'Iso'' 'RecConError' 'String'
-- '_RecConError' :: 'Prism'' 'SomeException' 'String'
-- @
- _RecConError :: Overloaded' p f t String
+ _RecConError :: Optic' p f t String
instance (Profunctor p, Functor f) => AsRecConError p f RecConError where
_RecConError = unwrapping RecConError
@@ -837,7 +837,7 @@ instance (Choice p, Applicative f) => AsRecConError p f SomeException where
-- where some fields are in one constructor but not another.
class (Profunctor p, Functor f) => AsRecSelError p f t where
-- | Information about the source location where the record selection occurred.
- _RecSelError :: Overloaded' p f t String
+ _RecSelError :: Optic' p f t String
instance (Profunctor p, Functor f) => AsRecSelError p f RecSelError where
_RecSelError = unwrapping RecSelError
@@ -856,7 +856,7 @@ instance (Choice p, Applicative f) => AsRecSelError p f SomeException where
-- constructors, where some fields are in one constructor but not another.
class (Profunctor p, Functor f) => AsRecUpdError p f t where
-- | Information about the source location where the record was updated.
- _RecUpdError :: Overloaded' p f t String
+ _RecUpdError :: Optic' p f t String
instance (Profunctor p, Functor f) => AsRecUpdError p f RecUpdError where
_RecUpdError = unwrapping RecUpdError
@@ -878,7 +878,7 @@ class (Profunctor p, Functor f) => AsErrorCall p f t where
--
-- >>> catching _ErrorCall (error "touch down!") return
-- "touch down!"
- _ErrorCall :: Overloaded' p f t String
+ _ErrorCall :: Optic' p f t String
instance (Profunctor p, Functor f) => AsErrorCall p f ErrorCall where
_ErrorCall = unwrapping ErrorCall
@@ -901,7 +901,7 @@ class (Profunctor p, Functor f) => AsHandlingException p f t where
-- '_HandlingException' :: 'Iso'' 'HandlingException' ()
-- '_HandlingException' :: 'Prism'' 'SomeException' ()
-- @
- _HandlingException :: Overloaded' p f t ()
+ _HandlingException :: Optic' p f t ()
instance (Profunctor p, Functor f) => AsHandlingException p f HandlingException where
_HandlingException = trivial HandlingException
View
4 src/Control/Lens/Cons.hs
@@ -92,7 +92,7 @@ class (Profunctor p, Functor f) => Cons p f s t a b | s -> a, t -> b, s b -> t,
--
-- However, by including @p@ and @f@ in the class you can write instances that only permit 'uncons'
-- or which only permit 'cons', or where '_head' and '_tail' are lenses and not traversals.
- _Cons :: Overloaded p f s t (a,s) (b,t)
+ _Cons :: Optic p f s t (a,s) (b,t)
instance (Choice p, Applicative f) => Cons p f [a] [b] a b where
_Cons = prism (uncurry (:)) $ \ aas -> case aas of
@@ -320,7 +320,7 @@ class (Profunctor p, Functor f) => Snoc p f s t a b | s -> a, t -> b, s b -> t,
--
-- However, by including @p@ and @f@ in the class you can write instances that only permit 'unsnoc'
-- or which only permit 'snoc' or where '_init' and '_last' are lenses and not traversals.
- _Snoc :: Overloaded p f s t (s,a) (t,b)
+ _Snoc :: Optic p f s t (s,a) (t,b)
instance (Choice p, Applicative f) => Snoc p f [a] [b] a b where
_Snoc = prism (\(as,a) -> as Prelude.++ [a]) $ \aas -> if Prelude.null aas
View
2 src/Control/Lens/Equality.hs
@@ -71,6 +71,6 @@ fromEq l = substEq l id
-- | This is an adverb that can be used to modify many other 'Lens' combinators to make them require
-- simple lenses, simple traversals, simple prisms or simple isos as input.
-simply :: (Overloaded' p f s a -> r) -> Overloaded' p f s a -> r
+simply :: (Optic' p f s a -> r) -> Optic' p f s a -> r
simply = id
{-# INLINE simply #-}
View
18 src/Control/Lens/Fold.hs
@@ -298,7 +298,7 @@ iterated f g a0 = go a0 where
-- [2,4,6,8,10]
--
-- This will preserve an index if it is present.
-filtered :: (Choice p, Pointed f, Functor f) => (a -> Bool) -> Overloaded' p f a a
+filtered :: (Choice p, Pointed f, Functor f) => (a -> Bool) -> Optic' p f a a
filtered p = dimap (\x -> if p x then Right x else Left x) (either point id) . right'
{-# INLINE filtered #-}
@@ -388,8 +388,8 @@ takingWhile p l pafb = fmap runMagma . traverse (corep pafb) . runTakingWhile .
-- and 'Traversal' fusion is not sound.
droppingWhile :: (Conjoined p, Profunctor q, Applicative f)
=> (a -> Bool)
- -> Overloading p q (Compose (State Bool) f) s t a a
- -> Overloading p q f s t a a
+ -> Optical p q (Compose (State Bool) f) s t a a
+ -> Optical p q f s t a a
droppingWhile p l f = (flip evalState True .# getCompose) `rmap` l g where
g = cotabulate $ \wa -> Compose $ state $ \b -> let
a = extract wa
@@ -1890,7 +1890,7 @@ ipreuses l f = gets (ipreviews l f)
--
-- /NB:/ To write back through an 'Iso', you want to use 'Control.Lens.Isomorphic.from'.
-- Similarly, to write back through an 'Prism', you want to use 'Control.Lens.Review.re'.
-backwards :: (Profunctor p, Profunctor q) => Overloading p q (Backwards f) s t a b -> Overloading p q f s t a b
+backwards :: (Profunctor p, Profunctor q) => Optical p q (Backwards f) s t a b -> Optical p q f s t a b
backwards l f = forwards #. l (Backwards #. f)
{-# INLINE backwards #-}
@@ -2303,7 +2303,7 @@ s ^@?! l = ifoldrOf l (\i x _ -> (i,x)) (error "(^@?!): empty Fold") s
-- access to both the value and the index.
--
-- Note: As with 'filtered', this is /not/ a legal 'IndexedTraversal', unless you are very careful not to invalidate the predicate on the target!
-ifiltered :: (Indexable i p, Applicative f) => (i -> a -> Bool) -> Overloading' p (Indexed i) f a a
+ifiltered :: (Indexable i p, Applicative f) => (i -> a -> Bool) -> Optical' p (Indexed i) f a a
ifiltered p f = Indexed $ \i a -> if p i a then indexed f i a else pure a
{-# INLINE ifiltered #-}
@@ -2320,8 +2320,8 @@ ifiltered p f = Indexed $ \i a -> if p i a then indexed f i a else pure a
-- @
itakingWhile :: (Indexable i p, Profunctor q, Contravariant f, Applicative f)
=> (i -> a -> Bool)
- -> Overloading (Indexed i) q (Const (Endo (f s))) s s a a
- -> Overloading p q f s s a a
+ -> Optical (Indexed i) q (Const (Endo (f s))) s s a a
+ -> Optical p q f s s a a
itakingWhile p l f = (flip appEndo noEffect .# getConst) `rmap` l g where
g = Indexed $ \i a -> Const . Endo $ if p i a then (indexed f i a *>) else const noEffect
{-# INLINE itakingWhile #-}
@@ -2342,8 +2342,8 @@ itakingWhile p l f = (flip appEndo noEffect .# getConst) `rmap` l g where
-- 'True', then you will break the 'Traversal' laws and 'Traversal' fusion will no longer be sound.
idroppingWhile :: (Indexable i p, Profunctor q, Applicative f)
=> (i -> a -> Bool)
- -> Overloading (Indexed i) q (Compose (State Bool) f) s t a a
- -> Overloading p q f s t a a
+ -> Optical (Indexed i) q (Compose (State Bool) f) s t a a
+ -> Optical p q f s t a a
idroppingWhile p l f = (flip evalState True .# getCompose) `rmap` l g where
g = Indexed $ \ i a -> Compose $ state $ \b -> let
b' = b && p i a
View
4 src/Control/Lens/Getter.hs
@@ -234,7 +234,7 @@ view l = Reader.asks (getConst #. l Const)
-- @
-- 'views' :: 'MonadReader' s m => 'Getting' r s a -> (a -> r) -> m r
-- @
-views :: (Profunctor p, MonadReader s m) => Overloading p (->) (Const r) s s a a -> p a r -> m r
+views :: (Profunctor p, MonadReader s m) => Optical p (->) (Const r) s s a a -> p a r -> m r
views l f = Reader.asks (getConst #. l (Const #. f))
{-# INLINE views #-}
@@ -313,7 +313,7 @@ use l = State.gets (view l)
-- @
-- 'uses' :: 'MonadState' s m => 'Getting' r s t a b -> (a -> r) -> m r
-- @
-uses :: (Profunctor p, MonadState s m) => Overloading p (->) (Const r) s s a a -> p a r -> m r
+uses :: (Profunctor p, MonadState s m) => Optical p (->) (Const r) s s a a -> p a r -> m r
uses l f = State.gets (views l f)
{-# INLINE uses #-}
View
8 src/Control/Lens/Indexed.hs
@@ -152,13 +152,13 @@ icompose ijk istr jabst cab = istr . Indexed $ \i -> jabst . Indexed $ \j -> ind
--
-- The result is only valid to compose in a 'Traversal', if you don't edit the
-- index as edits to the index have no effect.
-withIndex :: (Indexable i p, Functor f) => Overloading p (Indexed i) f s t (i, s) (j, t)
+withIndex :: (Indexable i p, Functor f) => Optical p (Indexed i) f s t (i, s) (j, t)
withIndex f = Indexed $ \i a -> snd <$> indexed f i (i, a)
{-# INLINE withIndex #-}
-- | When composed with an 'IndexedFold' or 'IndexedTraversal' this yields an
-- ('Indexed') 'Fold' of the indices.
-asIndex :: (Indexable i p, Contravariant f, Functor f) => Overloading' p (Indexed i) f s i
+asIndex :: (Indexable i p, Contravariant f, Functor f) => Optical' p (Indexed i) f s i
asIndex f = Indexed $ \i _ -> coerce (indexed f i i)
{-# INLINE asIndex #-}
@@ -174,15 +174,15 @@ asIndex f = Indexed $ \i _ -> coerce (indexed f i i)
--
-- >>> over (traversed.indices (>0)) Prelude.reverse $ ["He","was","stressed","o_O"]
-- ["He","saw","desserts","O_o"]
-indices :: (Indexable i p, Applicative f) => (i -> Bool) -> Overloading' p (Indexed i) f a a
+indices :: (Indexable i p, Applicative f) => (i -> Bool) -> Optical' p (Indexed i) f a a
indices p f = Indexed $ \i a -> if p i then indexed f i a else pure a
{-# INLINE indices #-}
-- | This allows you to filter an 'IndexedFold', 'IndexedGetter', 'IndexedTraversal' or 'IndexedLens' based on an index.
--
-- >>> ["hello","the","world","!!!"]^?traversed.index 2
-- Just "world"
-index :: (Indexable i p, Eq i, Applicative f) => i -> Overloading' p (Indexed i) f a a
+index :: (Indexable i p, Eq i, Applicative f) => i -> Optical' p (Indexed i) f a a
index j f = Indexed $ \i a -> if j == i then indexed f i a else pure a
{-# INLINE index #-}
View
4 src/Control/Lens/Internal/Indexed.hs
@@ -263,7 +263,7 @@ instance Contravariant f => Contravariant (Indexing f) where
-- 'indexing' :: 'Control.Lens.Type.Getter' s a -> 'Control.Lens.Type.IndexedGetter' 'Int' s a
-- @
--
--- @'indexing' :: 'Indexable' 'Int' p => 'Control.Lens.Type.LensLike' ('Indexing' f) s t a b -> 'Control.Lens.Type.Overloading' p (->) f s t a b@
+-- @'indexing' :: 'Indexable' 'Int' p => 'Control.Lens.Type.LensLike' ('Indexing' f) s t a b -> 'Control.Lens.Type.Optical' p (->) f s t a b@
indexing :: Indexable Int p => ((a -> Indexing f b) -> s -> Indexing f t) -> p a (f b) -> s -> f t
indexing l iafb s = snd $ runIndexing (l (\a -> Indexing (\i -> i `seq` (i + 1, indexed iafb i a))) s) 0
{-# INLINE indexing #-}
@@ -314,7 +314,7 @@ instance Contravariant f => Contravariant (Indexing64 f) where
-- 'indexing64' :: 'Control.Lens.Type.Getter' s a -> 'Control.Lens.Type.IndexedGetter' 'Int64' s a
-- @
--
--- @'indexing64' :: 'Indexable' 'Int64' p => 'Control.Lens.Type.LensLike' ('Indexing64' f) s t a b -> 'Control.Lens.Type.Overloading' p (->) f s t a b@
+-- @'indexing64' :: 'Indexable' 'Int64' p => 'Control.Lens.Type.LensLike' ('Indexing64' f) s t a b -> 'Control.Lens.Type.Over' p f s t a b@
indexing64 :: Indexable Int64 p => ((a -> Indexing64 f b) -> s -> Indexing64 f t) -> p a (f b) -> s -> f t
indexing64 l iafb s = snd $ runIndexing64 (l (\a -> Indexing64 (\i -> i `seq` (i + 1, indexed iafb i a))) s) 0
{-# INLINE indexing64 #-}
View
2 src/Control/Lens/Iso.hs
@@ -417,7 +417,7 @@ magma l = iso (runMafic `rmap` l sell) runMagma
-- | This isomorphism can be used to inspect an 'IndexedTraversal' to see how it associates
-- the structure and it can also be used to bake the 'IndexedTraversal' into a 'Magma' so
-- that you can traverse over it multiple times with access to the original indices.
-imagma :: Overloading (Indexed i) (->) (Molten i a b) s t a b -> Iso s t' (Magma i t b a) (Magma j t' c c)
+imagma :: Over (Indexed i) (Molten i a b) s t a b -> Iso s t' (Magma i t b a) (Magma j t' c c)
imagma l = iso (runMolten #. l sell) (iextract .# Molten)
{-# INLINE imagma #-}
View
60 src/Control/Lens/Lens.hs
@@ -165,7 +165,7 @@ type ALens s t a b = LensLike (Pretext (->) a b) s t a b
type ALens' s a = ALens s s a a
-- | When you see this as an argument to a function, it expects an 'IndexedLens'
-type AnIndexedLens i s t a b = Overloading (Indexed i) (->) (Pretext (Indexed i) a b) s t a b
+type AnIndexedLens i s t a b = Optical (Indexed i) (->) (Pretext (Indexed i) a b) s t a b
-- | @
-- type 'AnIndexedLens'' = 'Simple' ('AnIndexedLens' i)
@@ -243,7 +243,7 @@ ilens sia sbt iafb s = sbt s <$> uncurry (indexed iafb) (sia s)
-- ('%%~') :: '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)
-- @
-(%%~) :: Overloading p q f s t a b -> p a (f b) -> q s (f t)
+(%%~) :: Optical p q f s t a b -> p a (f b) -> q s (f t)
(%%~) = id
{-# INLINE (%%~) #-}
@@ -267,7 +267,7 @@ ilens sia sbt iafb s = sbt s <$> uncurry (indexed iafb) (sia s)
-- ('%%=') :: '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 s m => Overloading p (->) ((,) r) s s a b -> p a (r, b) -> m r
+(%%=) :: MonadState s m => Over p ((,) r) s s a b -> p a (r, b) -> m r
#if MIN_VERSION_mtl(2,1,1)
l %%= f = State.state (l f)
#else
@@ -418,7 +418,7 @@ cloneIndexedLens l f s = runPretext (l sell s) (Indexed (indexed f))
-- ('<%~') :: '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)
-- @
-(<%~) :: Profunctor p => Overloading p q ((,) b) s t a b -> p a b -> q s (b, t)
+(<%~) :: Profunctor p => Optical p q ((,) b) s t a b -> p a b -> q s (b, t)
l <%~ f = l $ rmap (\t -> (t, t)) f
{-# INLINE (<%~) #-}
@@ -430,7 +430,7 @@ l <%~ f = l $ rmap (\t -> (t, t)) f
-- ('<+~') :: 'Num' a => 'Lens'' s a -> a -> s -> (a, s)
-- ('<+~') :: 'Num' a => 'Control.Lens.Iso.Iso'' s a -> a -> s -> (a, s)
-- @
-(<+~) :: Num a => Overloading (->) q ((,)a) s t a a -> a -> q s (a, t)
+(<+~) :: Num a => Optical (->) q ((,)a) s t a a -> a -> q s (a, t)
l <+~ a = l <%~ (+ a)
{-# INLINE (<+~) #-}
@@ -442,7 +442,7 @@ l <+~ a = l <%~ (+ a)
-- ('<-~') :: 'Num' a => 'Lens'' s a -> a -> s -> (a, s)
-- ('<-~') :: 'Num' a => 'Control.Lens.Iso.Iso'' s a -> a -> s -> (a, s)
-- @
-(<-~) :: Num a => Overloading (->) q ((,)a) s t a a -> a -> q s (a, t)
+(<-~) :: Num a => Optical (->) q ((,)a) s t a a -> a -> q s (a, t)
l <-~ a = l <%~ subtract a
{-# INLINE (<-~) #-}
@@ -455,7 +455,7 @@ l <-~ a = l <%~ subtract a
-- ('<*~') :: 'Num' a => 'Lens'' s a -> a -> s -> (a, s)
-- ('<*~') :: 'Num' a => 'Control.Lens.Iso.Iso'' s a -> a -> s -> (a, s)
-- @
-(<*~) :: Num a => Overloading (->) q ((,)a) s t a a -> a -> q s (a, t)
+(<*~) :: Num a => Optical (->) q ((,)a) s t a a -> a -> q s (a, t)
l <*~ a = l <%~ (* a)
{-# INLINE (<*~) #-}
@@ -467,7 +467,7 @@ l <*~ a = l <%~ (* a)
-- ('<//~') :: 'Fractional' a => 'Lens'' s a -> a -> s -> (a, s)
-- ('<//~') :: 'Fractional' a => 'Control.Lens.Iso.Iso'' s a -> a -> s -> (a, s)
-- @
-(<//~) :: Fractional a => Overloading (->) q ((,)a) s t a a -> a -> q s (a, t)
+(<//~) :: Fractional a => Optical (->) q ((,)a) s t a a -> a -> q s (a, t)
l <//~ a = l <%~ (/ a)
{-# INLINE (<//~) #-}
@@ -480,7 +480,7 @@ l <//~ a = l <%~ (/ a)
-- ('<^~') :: ('Num' a, 'Integral' e) => 'Lens'' s a -> e -> s -> (a, s)
-- ('<^~') :: ('Num' a, 'Integral' e) => 'Control.Lens.Iso.Iso'' s a -> e -> s -> (a, s)
-- @
-(<^~) :: (Num a, Integral e) => Overloading (->) q ((,)a) s t a a -> e -> q s (a, t)
+(<^~) :: (Num a, Integral e) => Optical (->) q ((,)a) s t a a -> e -> q s (a, t)
l <^~ e = l <%~ (^ e)
{-# INLINE (<^~) #-}
@@ -493,7 +493,7 @@ l <^~ e = l <%~ (^ e)
-- ('<^^~') :: ('Fractional' a, 'Integral' e) => 'Lens'' s a -> e -> s -> (a, s)
-- ('<^^~') :: ('Fractional' a, 'Integral' e) => 'Control.Lens.Iso.Iso'' s a -> e -> s -> (a, s)
-- @
-(<^^~) :: (Fractional a, Integral e) => Overloading (->) q ((,)a) s t a a -> e -> q s (a, t)
+(<^^~) :: (Fractional a, Integral e) => Optical (->) q ((,)a) s t a a -> e -> q s (a, t)
l <^^~ e = l <%~ (^^ e)
{-# INLINE (<^^~) #-}
@@ -506,7 +506,7 @@ l <^^~ e = l <%~ (^^ e)
-- ('<**~') :: 'Floating' a => 'Lens'' s a -> a -> s -> (a, s)
-- ('<**~') :: 'Floating' a => 'Control.Lens.Iso.Iso'' s a -> a -> s -> (a, s)
-- @
-(<**~) :: Floating a => Overloading (->) q ((,)a) s t a a -> a -> q s (a, t)
+(<**~) :: Floating a => Optical (->) q ((,)a) s t a a -> a -> q s (a, t)
l <**~ a = l <%~ (** a)
{-# INLINE (<**~) #-}
@@ -518,7 +518,7 @@ l <**~ a = l <%~ (** a)
-- ('<||~') :: 'Lens'' s 'Bool' -> 'Bool' -> s -> ('Bool', s)
-- ('<||~') :: 'Control.Lens.Iso.Iso'' s 'Bool' -> 'Bool' -> s -> ('Bool', s)
-- @
-(<||~) :: Overloading (->) q ((,)Bool) s t Bool Bool -> Bool -> q s (Bool, t)
+(<||~) :: Optical (->) q ((,)Bool) s t Bool Bool -> Bool -> q s (Bool, t)
l <||~ b = l <%~ (|| b)
{-# INLINE (<||~) #-}
@@ -530,7 +530,7 @@ l <||~ b = l <%~ (|| b)
-- ('<&&~') :: 'Lens'' s 'Bool' -> 'Bool' -> s -> ('Bool', s)
-- ('<&&~') :: 'Control.Lens.Iso.Iso'' s 'Bool' -> 'Bool' -> s -> ('Bool', s)
-- @
-(<&&~) :: Overloading (->) q ((,)Bool) s t Bool Bool -> Bool -> q s (Bool, t)
+(<&&~) :: Optical (->) q ((,)Bool) s t Bool Bool -> Bool -> q s (Bool, t)
l <&&~ b = l <%~ (&& b)
{-# INLINE (<&&~) #-}
@@ -543,7 +543,7 @@ l <&&~ b = l <%~ (&& b)
-- ('<<%~') :: 'Control.Lens.Iso.Iso' s t a b -> (a -> b) -> s -> (a, t)
-- ('<<%~') :: 'Monoid' a => 'Control.Lens.Traversal.Traversal' s t a b -> (a -> b) -> s -> (a, t)
-- @
-(<<%~) :: Strong p => Overloading p q ((,)a) s t a b -> p a b -> q s (a, t)
+(<<%~) :: Strong p => Optical p q ((,)a) s t a b -> p a b -> q s (a, t)
(<<%~) l = l . lmap (\a -> (a, a)) . second'
{-# INLINE (<<%~) #-}
@@ -556,47 +556,47 @@ l <&&~ b = l <%~ (&& b)
-- ('<<.~') :: 'Control.Lens.Iso.Iso' s t a b -> b -> s -> (a, t)
-- ('<<.~') :: 'Monoid' a => 'Control.Lens.Traversal.Traversal' s t a b -> b -> s -> (a, t)
-- @
-(<<.~) :: Overloading (->) q ((,)a) s t a b -> b -> q s (a, t)
+(<<.~) :: Optical (->) q ((,)a) s t a b -> b -> q s (a, t)
l <<.~ b = l $ \a -> (a, b)
{-# INLINE (<<.~) #-}
-(<<+~) :: Num a => Overloading' (->) q ((,) a) s a -> a -> q s (a, s)
+(<<+~) :: Num a => Optical' (->) q ((,) a) s a -> a -> q s (a, s)
l <<+~ b = l $ \a -> (a, a + b)
{-# INLINE (<<+~) #-}
-(<<-~) :: Num a => Overloading' (->) q ((,) a) s a -> a -> q s (a, s)
+(<<-~) :: Num a => Optical' (->) q ((,) a) s a -> a -> q s (a, s)
l <<-~ b = l $ \a -> (a, a - b)
{-# INLINE (<<-~) #-}
-(<<*~) :: Num a => Overloading' (->) q ((,) a) s a -> a -> q s (a, s)
+(<<*~) :: Num a => Optical' (->) q ((,) a) s a -> a -> q s (a, s)
l <<*~ b = l $ \a -> (a, a * b)
{-# INLINE (<<*~) #-}
-(<<//~) :: Fractional a => Overloading' (->) q ((,) a) s a -> a -> q s (a, s)
+(<<//~) :: Fractional a => Optical' (->) q ((,) a) s a -> a -> q s (a, s)
l <<//~ b = l $ \a -> (a, a / b)
{-# INLINE (<<//~) #-}
-(<<^~) :: (Num a, Integral e) => Overloading' (->) q ((,) a) s a -> e -> q s (a, s)
+(<<^~) :: (Num a, Integral e) => Optical' (->) q ((,) a) s a -> e -> q s (a, s)
l <<^~ e = l $ \a -> (a, a ^ e)
{-# INLINE (<<^~) #-}
-(<<^^~) :: (Fractional a, Integral e) => Overloading' (->) q ((,) a) s a -> e -> q s (a, s)
+(<<^^~) :: (Fractional a, Integral e) => Optical' (->) q ((,) a) s a -> e -> q s (a, s)
l <<^^~ e = l $ \a -> (a, a ^^ e)
{-# INLINE (<<^^~) #-}
-(<<**~) :: Floating a => Overloading' (->) q ((,) a) s a -> a -> q s (a, s)
+(<<**~) :: Floating a => Optical' (->) q ((,) a) s a -> a -> q s (a, s)
l <<**~ e = l $ \a -> (a, a ** e)
{-# INLINE (<<**~) #-}
-(<<||~) :: Overloading' (->) q ((,) Bool) s Bool -> Bool -> q s (Bool, s)
+(<<||~) :: Optical' (->) q ((,) Bool) s Bool -> Bool -> q s (Bool, s)
l <<||~ b = l $ \a -> (a, b || a)
{-# INLINE (<<||~) #-}
-(<<&&~) :: Overloading' (->) q ((,) Bool) s Bool -> Bool -> q s (Bool, s)
+(<<&&~) :: Optical' (->) q ((,) Bool) s Bool -> Bool -> q s (Bool, s)
l <<&&~ b = l $ \a -> (a, b && a)
{-# INLINE (<<&&~) #-}
-(<<<>~) :: Monoid r => Overloading' (->) q ((,) r) s r -> r -> q s (r, s)
+(<<<>~) :: Monoid r => Optical' (->) q ((,) r) s r -> r -> q s (r, s)
l <<<>~ b = l $ \a -> (a, a `mappend` b)
{-# INLINE (<<<>~) #-}
@@ -617,7 +617,7 @@ l <<<>~ b = l $ \a -> (a, a `mappend` b)
-- ('<%=') :: 'MonadState' s m => 'Control.Lens.Iso.Iso'' s a -> (a -> a) -> m a
-- ('<%=') :: ('MonadState' s m, 'Monoid' a) => 'Control.Lens.Traversal.Traversal'' s a -> (a -> a) -> m a
-- @
-(<%=) :: (Profunctor p, MonadState s m) => Overloading p (->) ((,)b) s s a b -> p a b -> m b
+(<%=) :: (Profunctor p, MonadState s m) => Over p ((,)b) s s a b -> p a b -> m b
l <%= f = l %%= rmap (\b -> (b, b)) f
{-# INLINE (<%=) #-}
@@ -757,7 +757,7 @@ l <&&= b = l <%= (&& b)
-- @
--
-- @('<<%=') :: 'MonadState' s m => 'LensLike' ((,)a) s s a b -> (a -> b) -> m a@
-(<<%=) :: (Strong p, MonadState s m) => Overloading p (->) ((,)a) s s a b -> p a b -> m a
+(<<%=) :: (Strong p, MonadState s m) => Over p ((,)a) s s a b -> p a b -> m a
l <<%= f = l %%= lmap (\a -> (a,a)) (second' f)
{-# INLINE (<<%=) #-}
@@ -838,7 +838,7 @@ l <<~ mb = do
-- return the result.
--
-- When you do not need the result of the operation, ('Control.Lens.Setter.<>~') is more flexible.
-(<<>~) :: Monoid m => Overloading (->) q ((,)m) s t m m -> m -> q s (m, t)
+(<<>~) :: Monoid m => Optical (->) q ((,)m) s t m m -> m -> q s (m, t)
l <<>~ m = l <%~ (`mappend` m)
{-# INLINE (<<>~) #-}
@@ -868,7 +868,7 @@ l <<>= r = l <%= (`mappend` r)
-- ('<%@~') :: 'IndexedLens' i s t a b -> (i -> a -> b) -> s -> (b, t)
-- ('<%@~') :: 'Monoid' b => 'Control.Lens.Traversal.IndexedTraversal' i s t a b -> (i -> a -> b) -> s -> (b, t)
-- @
-(<%@~) :: Overloading (Indexed i) q ((,) b) s t a b -> (i -> a -> b) -> q s (b, t)
+(<%@~) :: Optical (Indexed i) q ((,) b) s t a b -> (i -> a -> b) -> q s (b, t)
l <%@~ f = l (Indexed $ \i a -> let b = f i a in (b, b))
{-# INLINE (<%@~) #-}
@@ -880,7 +880,7 @@ l <%@~ f = l (Indexed $ \i a -> let b = f i a in (b, b))
-- ('<<%@~') :: 'IndexedLens' i s t a b -> (i -> a -> b) -> s -> (a, t)
-- ('<<%@~') :: 'Monoid' a => 'Control.Lens.Traversal.IndexedTraversal' i s t a b -> (i -> a -> b) -> s -> (a, t)
-- @
-(<<%@~) :: Overloading (Indexed i) q ((,) a) s t a b -> (i -> a -> b) -> q s (a, t)
+(<<%@~) :: Optical (Indexed i) q ((,) a) s t a b -> (i -> a -> b) -> q s (a, t)
l <<%@~ f = l $ Indexed $ \i a -> second' (f i) (a,a)
{-# INLINE (<<%@~) #-}
View
4 src/Control/Lens/Plated.hs
@@ -529,7 +529,7 @@ holes = holesOf plate
-- 'holesOn' :: 'IndexedLens'' i s a -> s -> ['Pretext' ('Control.Lens.Internal.Indexed.Indexed' i) a a s]
-- 'holesOn' :: 'IndexedTraversal'' i s a -> s -> ['Pretext' ('Control.Lens.Internal.Indexed.Indexed' i) a a s]
-- @
-holesOn :: Conjoined p => Overloading p (->) (Bazaar p a a) s t a a -> s -> [Pretext p a a t]
+holesOn :: Conjoined p => Optical p (->) (Bazaar p a a) s t a a -> s -> [Pretext p a a t]
holesOn = holesOf
{-# INLINE holesOn #-}
@@ -548,7 +548,7 @@ holesOn = holesOf
-- @
holesOnOf :: Conjoined p
=> LensLike (Bazaar p r r) s t a b
- -> Overloading p (->) (Bazaar p r r) a b r r
+ -> Optical p (->) (Bazaar p r r) a b r r
-> s -> [Pretext p r r t]
holesOnOf b l = holesOf (b . l)
{-# INLINE holesOnOf #-}
View
8 src/Control/Lens/Review.hs
@@ -63,14 +63,14 @@ infixr 8 #
--
-- You can generate a 'Review' by using 'unto'. You can also use any 'Prism' or 'Iso'
-- directly as a 'Review'.
-type Review s t a b = forall p f. (Profunctor p, Bifunctor p, Settable f) => Overloaded p f s t a b
+type Review s t a b = forall p f. (Profunctor p, Bifunctor p, Settable f) => Optic p f s t a b
-- | A 'Simple' 'Review'
type Review' t b = Review t t b b
-- | If you see this in a signature for a function, the function is expecting a 'Review'
-- (in practice, this usually means a 'Prism').
-type AReview s t a b = Overloaded Tagged Identity s t a b
+type AReview s t a b = Optic Tagged Identity s t a b
-- | A 'Simple' 'AReview'
type AReview' t b = AReview t t b b
@@ -84,7 +84,7 @@ type AReview' t b = AReview t t b b
-- @
-- 'unto' = 'un' . 'to'
-- @
-unto :: (Profunctor p, Bifunctor p, Functor f) => (b -> t) -> Overloaded p f s t a b
+unto :: (Profunctor p, Bifunctor p, Functor f) => (b -> t) -> Optic p f s t a b
unto f = first absurd . lmap absurd . rmap (fmap f)
{-# INLINE unto #-}
@@ -97,7 +97,7 @@ unto f = first absurd . lmap absurd . rmap (fmap f)
--
-- >>> un (to length) # [1,2,3]
-- 3
-un :: (Profunctor p, Bifunctor p, Functor f) => Getting a s a -> Overloaded' p f a s
+un :: (Profunctor p, Bifunctor p, Functor f) => Getting a s a -> Optic' p f a s
un = unto . view
-- | Turn a 'Prism' or 'Control.Lens.Iso.Iso' around to build a 'Getter'.
View
2 src/Control/Lens/Setter.hs
@@ -284,7 +284,7 @@ setting l pafb = cotabulate $ \ws -> pure $ l (\a -> untainted (corep pafb (a <$
-- @
-- 'sets' :: ((a -> b) -> s -> t) -> 'Setter' s t a b
-- @
-sets :: (Profunctor p, Profunctor q, Settable f) => (p a b -> q s t) -> Overloading p q f s t a b
+sets :: (Profunctor p, Profunctor q, Settable f) => (p a b -> q s t) -> Optical p q f s t a b
sets f g = taintedDot (f (untaintedDot g))
{-# INLINE sets #-}
View
6 src/Control/Lens/Traversal.hs
@@ -748,9 +748,9 @@ both f = bitraverse f f
-- >>> ("hello",["world","!!!"])^..beside id traverse
-- ["hello","world","!!!"]
beside :: (Representable q, Applicative (Rep q), Applicative f, Bitraversable r)
- => Overloading p q f s t a b
- -> Overloading p q f s' t' a b
- -> Overloading p q f (r s s') (r t t') a b
+ => Optical p q f s t a b
+ -> Optical p q f s' t' a b
+ -> Optical p q f (r s s') (r t t') a b
beside l r f = tabulate $ getCompose #. bitraverse (Compose #. rep (l f)) (Compose #. rep (r f))
{-# INLINE beside #-}
View
22 src/Control/Lens/Type.hs
@@ -56,8 +56,8 @@ module Control.Lens.Type
, LensLike, LensLike'
, Over, Over'
, IndexedLensLike, IndexedLensLike'
- , Overloading, Overloading'
- , Overloaded, Overloaded'
+ , Optical, Optical'
+ , Optic, Optic'
) where
import Control.Applicative
@@ -69,7 +69,7 @@ import Data.Functor.Apply
import Data.Profunctor
-- $setup
--- >>> :set -XNoOverloadedStrings
+-- >>> :set -XNoOpticStrings
-- >>> import Control.Lens
-- >>> import Debug.SimpleReflect.Expr
-- >>> import Debug.SimpleReflect.Vars as Vars hiding (f,g,h)
@@ -538,24 +538,24 @@ type IndexPreservingRelevantMonadicFold m s a = forall p f r. (Conjoined p, Effe
type Simple f s a = f s s a a
-- | @
--- type 'LensLike' f s t a b = 'Overloading' (->) (->) f s t a b
+-- type 'LensLike' f s t a b = 'Optical' (->) (->) f s t a b
-- @
-type Overloading p q f s t a b = p a (f b) -> q s (f t)
+type Optical p q f s t a b = p a (f b) -> q s (f t)
-- | @
--- type 'Overloading'' p q f s a = 'Simple' ('Overloading' p q f) s a
+-- type 'Optical'' p q f s a = 'Simple' ('Optical' p q f) s a
-- @
-type Overloading' p q f s a = Overloading p q f s s a a
+type Optical' p q f s a = Optical p q f s s a a
-- | @
--- type 'LensLike' f s t a b = 'Overloaded' (->) f s t a b
+-- type 'LensLike' f s t a b = 'Optic' (->) f s t a b
-- @
-type Overloaded p f s t a b = p a (f b) -> p s (f t)
+type Optic p f s t a b = p a (f b) -> p s (f t)
-- | @
--- type 'Overloaded'' p q f s a = 'Simple' ('Overloaded' p q f) s a
+-- type 'Optic'' p q f s a = 'Simple' ('Optic' p q f) s a
-- @
-type Overloaded' p f s a = Overloaded p f s s a a
+type Optic' p f s a = Optic p f s s a a
-- | Many combinators that accept a 'Lens' can also accept a
-- 'Traversal' in limited situations.
View
6 src/System/Exit/Lens.hs
@@ -30,7 +30,7 @@ class AsExitCode p f t where
-- '_ExitCode' :: 'Equality'' 'ExitCode' 'ExitCode'
-- '_ExitCode' :: 'Prism'' 'SomeException' 'ExitCode'
-- @
- _ExitCode :: Overloaded' p f t ExitCode
+ _ExitCode :: Optic' p f t ExitCode
instance AsExitCode p f ExitCode where
_ExitCode = id
@@ -46,7 +46,7 @@ instance (Choice p, Applicative f) => AsExitCode p f SomeException where
-- '_ExitSuccess' :: 'Prism'' 'ExitCode' ()
-- '_ExitSuccess' :: 'Prism'' 'SomeException' ()
-- @
-_ExitSuccess :: (AsExitCode p f t, Choice p, Applicative f) => Overloaded' p f t ()
+_ExitSuccess :: (AsExitCode p f t, Choice p, Applicative f) => Optic' p f t ()
_ExitSuccess = _ExitCode . dimap seta (either id id) . right' . rmap (ExitSuccess <$) where
seta ExitSuccess = Right ()
seta t = Left (pure t)
@@ -58,7 +58,7 @@ _ExitSuccess = _ExitCode . dimap seta (either id id) . right' . rmap (ExitSucces
-- '_ExitFailure' :: 'Prism'' 'ExitCode' 'Int'
-- '_ExitFailure' :: 'Prism'' 'SomeException' 'Int'
-- @
-_ExitFailure :: (AsExitCode p f t, Choice p, Applicative f) => Overloaded' p f t Int
+_ExitFailure :: (AsExitCode p f t, Choice p, Applicative f) => Optic' p f t Int
_ExitFailure = _ExitCode . dimap seta (either id id) . right' . rmap (fmap ExitFailure) where
seta (ExitFailure i) = Right i
seta t = Left (pure t)

0 comments on commit 44272e0

Please sign in to comment.