module Optics.IxAffineTraversal
(
IxAffineTraversal
, IxAffineTraversal'
, iatraversal
, An_AffineTraversal
, IxAffineTraversalVL
, IxAffineTraversalVL'
, iatraversalVL
, toIxAtraversalVL
) where
import Data.Profunctor.Indexed
import Optics.Internal.Indexed
import Optics.Internal.Optic
type IxAffineTraversal i s t a b = Optic An_AffineTraversal (WithIx i) s t a b
type IxAffineTraversal' i s a = Optic' An_AffineTraversal (WithIx i) s a
type IxAffineTraversalVL i s t a b =
forall f. Functor f => (forall r. r -> f r) -> (i -> a -> f b) -> s -> f t
type IxAffineTraversalVL' i s a = IxAffineTraversalVL i s s a a
iatraversal :: (s -> Either t (i, a)) -> (s -> b -> t) -> IxAffineTraversal i s t a b
iatraversal :: (s -> Either t (i, a))
-> (s -> b -> t) -> IxAffineTraversal i s t a b
iatraversal match :: s -> Either t (i, a)
match update :: s -> b -> t
update = IxAffineTraversalVL i s t a b -> IxAffineTraversal i s t a b
forall i s t a b.
IxAffineTraversalVL i s t a b -> IxAffineTraversal i s t a b
iatraversalVL (IxAffineTraversalVL i s t a b -> IxAffineTraversal i s t a b)
-> IxAffineTraversalVL i s t a b -> IxAffineTraversal i s t a b
forall a b. (a -> b) -> a -> b
$ \point :: forall r. r -> f r
point f :: i -> a -> f b
f s :: s
s ->
(t -> f t) -> ((i, a) -> f t) -> Either t (i, a) -> f t
forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
either t -> f t
forall r. r -> f r
point (\a :: (i, a)
a -> s -> b -> t
update s
s (b -> t) -> f b -> f t
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (i -> a -> f b) -> (i, a) -> f b
forall a b c. (a -> b -> c) -> (a, b) -> c
uncurry i -> a -> f b
f (i, a)
a) (s -> Either t (i, a)
match s
s)
{-# INLINE iatraversal #-}
iatraversalVL :: IxAffineTraversalVL i s t a b -> IxAffineTraversal i s t a b
iatraversalVL :: IxAffineTraversalVL i s t a b -> IxAffineTraversal i s t a b
iatraversalVL f :: IxAffineTraversalVL i s t a b
f = (forall (p :: * -> * -> * -> *) i.
Profunctor p =>
Optic_ An_AffineTraversal p i (Curry (WithIx i) i) s t a b)
-> IxAffineTraversal i s t a b
forall k (is :: IxList) s t a b.
(forall (p :: * -> * -> * -> *) i.
Profunctor p =>
Optic_ k p i (Curry is i) s t a b)
-> Optic k is s t a b
Optic (IxAffineTraversalVL i s t a b -> p i a b -> p (i -> i) s t
forall (p :: * -> * -> * -> *) i a b s t j.
Visiting p =>
(forall (f :: * -> *).
Functor f =>
(forall r. r -> f r) -> (i -> a -> f b) -> s -> f t)
-> p j a b -> p (i -> j) s t
ivisit IxAffineTraversalVL i s t a b
f)
{-# INLINE iatraversalVL #-}
toIxAtraversalVL
:: (Is k An_AffineTraversal, is `HasSingleIndex` i)
=> Optic k is s t a b
-> IxAffineTraversalVL i s t a b
toIxAtraversalVL :: Optic k is s t a b -> IxAffineTraversalVL i s t a b
toIxAtraversalVL o :: Optic k is s t a b
o point :: forall r. r -> f r
point = \f :: i -> a -> f b
f ->
IxStarA f (i -> i) s t -> (i -> i) -> s -> f t
forall (f :: * -> *) i a b. IxStarA f i a b -> i -> a -> f b
runIxStarA (Optic An_AffineTraversal is s t a b
-> Optic__ (IxStarA f) i (Curry is i) s t a b
forall k (is :: IxList) s t a b.
Optic k is s t a b
-> forall (p :: * -> * -> * -> *) i.
Profunctor p =>
Optic_ k p i (Curry is i) s t a b
getOptic (Optic k is s t a b -> Optic An_AffineTraversal is s t a b
forall destKind srcKind (is :: IxList) s t a b.
Is srcKind destKind =>
Optic srcKind is s t a b -> Optic destKind is s t a b
castOptic @An_AffineTraversal Optic k is s t a b
o) ((forall r. r -> f r) -> (i -> a -> f b) -> IxStarA f i a b
forall (f :: * -> *) i a b.
(forall r. r -> f r) -> (i -> a -> f b) -> IxStarA f i a b
IxStarA forall r. r -> f r
point i -> a -> f b
f)) i -> i
forall a. a -> a
id
{-# INLINE toIxAtraversalVL #-}