    {-# OPTIONS_HADDOCK not-home #-}

    -- | Internal implementation details of indexed folds.
    --
    -- This module is intended for internal use only, and may change without warning
    -- in subsequent releases.
    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

    -- | Internal implementation of 'Optics.IxFold.ifoldVL'.
    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 (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 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) -> p j a b -> p (i -> j) s t
    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 i a b s t j.
    (forall (f :: * -> *).
     Applicative f =>
     (i -> a -> f b) -> s -> f t)
    -> p j a b -> p (i -> j) s t
    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 (i -> a -> f u) -> s -> f v
    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__ #-}

    -- | Internal implementation of 'Optics.IxFold.ifolded'.
    ifolded__
      :: (Bicontravariant p, Traversing p, FoldableWithIndex i f)
      => Optic__ p j (i -> j) (f a) t a b
    ifolded__ :: forall (p :: * -> * -> * -> *) i (f :: * -> *) j a t b.
    (Bicontravariant p, Traversing p, FoldableWithIndex i f) =>
    Optic__ p j (i -> j) (f a) t a b
    ifolded__ = (p j a b -> p j (f a) t)
    -> (p j a b -> p (i -> j) (f a) t) -> p j a b -> p (i -> j) (f a) t
    forall i a b s t j.
    (p i a b -> p i s t) -> (p i a b -> p j s t) -> p i a b -> p j s t
    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 (ZonkAny 0)) -> 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__ (a -> f (ZonkAny 0)) -> f a -> f ()
    forall (f :: * -> *).
    Applicative f =>
    (a -> f (ZonkAny 0)) -> 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 (ZonkAny 1)) -> f a -> f ())
    -> p j a b -> p (i -> j) (f a) t
    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__ (i -> a -> f (ZonkAny 1)) -> f a -> f ()
    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 (ZonkAny 1)) -> f a -> f ()
    itraverse_)
    {-# INLINE ifolded__ #-}

    -- | Internal implementation of 'Optics.IxFold.ifoldring'.
    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 (p :: * -> * -> * -> *) i a u v s w j t b.
    (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
    fr = (forall (f :: * -> *).
     Applicative f =>
     (i -> a -> f (ZonkAny 2)) -> 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 (ZonkAny 2)) -> s -> f ())
     -> Optic__ p j (i -> j) s t a b)
    -> (forall (f :: * -> *).
        Applicative f =>
        (i -> a -> f (ZonkAny 2)) -> s -> f ())
    -> Optic__ p j (i -> j) s t a b
    forall a b. (a -> b) -> a -> b
    $ \i -> a -> f (ZonkAny 2)
    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 (ZonkAny 2)
    f i
    i a
    a f (ZonkAny 2) -> f u -> f u
    forall a b. f a -> f b -> f b
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
    *>)) (v -> f v
    forall a. a -> f a
    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__ #-}