{-# OPTIONS_HADDOCK not-home #-}
module Optics.Internal.IxFold where
import Data.Functor
import Data.Foldable
import Data.Profunctor.Indexed
import Optics.Internal.Bi
import Optics.Internal.Indexed.Classes
import Optics.Internal.Optic
import Optics.Internal.Fold
ifoldVL__
:: (Bicontravariant p, Traversing p)
=> (forall f. Applicative f => (i -> a -> f u) -> s -> f v)
-> Optic__ p j (i -> j) s t a b
ifoldVL__ :: (forall (f :: * -> *).
Applicative f =>
(i -> a -> f u) -> s -> f v)
-> Optic__ p j (i -> j) s t a b
ifoldVL__ forall (f :: * -> *). Applicative f => (i -> a -> f u) -> s -> f v
f = p (i -> j) s v -> p (i -> j) s t
forall (p :: * -> * -> * -> *) i c a b.
(Profunctor p, Bicontravariant p) =>
p i c a -> p i c b
rphantom (p (i -> j) s v -> p (i -> j) s t)
-> (p j a b -> p (i -> j) s v) -> Optic__ p j (i -> j) s t a b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (forall (f :: * -> *).
Applicative f =>
(i -> a -> f u) -> s -> f v)
-> p j a u -> p (i -> j) s v
forall (p :: * -> * -> * -> *) i a b s t j.
Traversing p =>
(forall (f :: * -> *).
Applicative f =>
(i -> a -> f b) -> s -> f t)
-> p j a b -> p (i -> j) s t
iwander forall (f :: * -> *). Applicative f => (i -> a -> f u) -> s -> f v
f (p j a u -> p (i -> j) s v)
-> (p j a b -> p j a u) -> p j a b -> p (i -> j) s v
forall b c a. (b -> c) -> (a -> b) -> a -> c
. p j a b -> p j a u
forall (p :: * -> * -> * -> *) i c a b.
(Profunctor p, Bicontravariant p) =>
p i c a -> p i c b
rphantom
{-# INLINE ifoldVL__ #-}
ifolded__
:: (Bicontravariant p, Traversing p, FoldableWithIndex i f)
=> Optic__ p j (i -> j) (f a) t a b
ifolded__ :: Optic__ p j (i -> j) (f a) t a b
ifolded__ = (p j a b -> p j (f a) t)
-> Optic__ p j (i -> j) (f a) t a b
-> Optic__ p j (i -> j) (f a) t a b
forall (p :: * -> * -> * -> *) i a b s t j.
Profunctor p =>
(p i a b -> p i s t) -> (p i a b -> p j s t) -> p i a b -> p j s t
conjoined__ ((forall (f :: * -> *).
Applicative f =>
(a -> f Any) -> f a -> f ())
-> p j a b -> p j (f a) t
forall (p :: * -> * -> * -> *) a u s v i t b.
(Bicontravariant p, Traversing p) =>
(forall (f :: * -> *). Applicative f => (a -> f u) -> s -> f v)
-> Optic__ p i i s t a b
foldVL__ forall (f :: * -> *). Applicative f => (a -> f Any) -> f a -> f ()
forall (t :: * -> *) (f :: * -> *) a b.
(Foldable t, Applicative f) =>
(a -> f b) -> t a -> f ()
traverse_) ((forall (f :: * -> *).
Applicative f =>
(i -> a -> f Any) -> f a -> f ())
-> Optic__ p j (i -> j) (f a) t a b
forall (p :: * -> * -> * -> *) i a u s v j t b.
(Bicontravariant p, Traversing p) =>
(forall (f :: * -> *).
Applicative f =>
(i -> a -> f u) -> s -> f v)
-> Optic__ p j (i -> j) s t a b
ifoldVL__ forall i (t :: * -> *) (f :: * -> *) a b.
(FoldableWithIndex i t, Applicative f) =>
(i -> a -> f b) -> t a -> f ()
forall (f :: * -> *).
Applicative f =>
(i -> a -> f Any) -> f a -> f ()
itraverse_)
{-# INLINE ifolded__ #-}
ifoldring__
:: (Bicontravariant p, Traversing p)
=> (forall f. Applicative f => (i -> a -> f u -> f u) -> f v -> s -> f w)
-> Optic__ p j (i -> j) s t a b
ifoldring__ :: (forall (f :: * -> *).
Applicative f =>
(i -> a -> f u -> f u) -> f v -> s -> f w)
-> Optic__ p j (i -> j) s t a b
ifoldring__ forall (f :: * -> *).
Applicative f =>
(i -> a -> f u -> f u) -> f v -> s -> f w
fr = (forall (f :: * -> *).
Applicative f =>
(i -> a -> f Any) -> s -> f ())
-> Optic__ p j (i -> j) s t a b
forall (p :: * -> * -> * -> *) i a u s v j t b.
(Bicontravariant p, Traversing p) =>
(forall (f :: * -> *).
Applicative f =>
(i -> a -> f u) -> s -> f v)
-> Optic__ p j (i -> j) s t a b
ifoldVL__ ((forall (f :: * -> *).
Applicative f =>
(i -> a -> f Any) -> s -> f ())
-> Optic__ p j (i -> j) s t a b)
-> (forall (f :: * -> *).
Applicative f =>
(i -> a -> f Any) -> s -> f ())
-> Optic__ p j (i -> j) s t a b
forall a b. (a -> b) -> a -> b
$ \i -> a -> f Any
f -> f w -> f ()
forall (f :: * -> *) a. Functor f => f a -> f ()
void (f w -> f ()) -> (s -> f w) -> s -> f ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (i -> a -> f u -> f u) -> f v -> s -> f w
forall (f :: * -> *).
Applicative f =>
(i -> a -> f u -> f u) -> f v -> s -> f w
fr (\i
i a
a -> (i -> a -> f Any
f i
i a
a f Any -> f u -> f u
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*>)) (v -> f v
forall (f :: * -> *) a. Applicative f => a -> f a
pure v
forall a. a
v)
where
v :: a
v = [Char] -> a
forall a. HasCallStack => [Char] -> a
error [Char]
"ifoldring__: value used"
{-# INLINE ifoldring__ #-}