    module Control.Lens.Internal.Profunctor
      ( WrappedPafb (..)
      ) where

    import Prelude ()
    import Control.Lens.Internal.Prelude

    newtype WrappedPafb f p a b = WrapPafb { forall (f :: * -> *) (p :: * -> * -> *) a b.
    WrappedPafb f p a b -> p a (f b)
    unwrapPafb :: p a (f b) }

    instance (Functor f, Profunctor p) => Profunctor (WrappedPafb f p) where
      dimap :: forall a b c d.
    (a -> b) -> (c -> d) -> WrappedPafb f p b c -> WrappedPafb f p a d
    dimap a -> b
    f c -> d
    g (WrapPafb p b (f c)
    p) = p a (f d) -> WrappedPafb f p a d
    forall (f :: * -> *) (p :: * -> * -> *) a b.
    p a (f b) -> WrappedPafb f p a b
    WrapPafb (p a (f d) -> WrappedPafb f p a d)
    -> p a (f d) -> WrappedPafb f p a d
    forall a b. (a -> b) -> a -> b
    $ (a -> b) -> (f c -> f d) -> p b (f c) -> p a (f d)
    forall a b c d. (a -> b) -> (c -> d) -> p b c -> p a d
    forall (p :: * -> * -> *) a b c d.
    Profunctor p =>
    (a -> b) -> (c -> d) -> p b c -> p a d
    dimap a -> b
    f ((c -> d) -> f c -> f d
    forall a b. (a -> b) -> f a -> f b
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    fmap c -> d
    g) p b (f c)
    p

    instance (Applicative f, Choice p) => Choice (WrappedPafb f p) where
      left' :: forall a b c.
    WrappedPafb f p a b -> WrappedPafb f p (Either a c) (Either b c)
    left' (WrapPafb p a (f b)
    p) = p (Either a c) (f (Either b c))
    -> WrappedPafb f p (Either a c) (Either b c)
    forall (f :: * -> *) (p :: * -> * -> *) a b.
    p a (f b) -> WrappedPafb f p a b
    WrapPafb (p (Either a c) (f (Either b c))
     -> WrappedPafb f p (Either a c) (Either b c))
    -> p (Either a c) (f (Either b c))
    -> WrappedPafb f p (Either a c) (Either b c)
    forall a b. (a -> b) -> a -> b
    $ (Either (f b) c -> f (Either b c))
    -> p (Either a c) (Either (f b) c)
    -> p (Either a c) (f (Either b c))
    forall b c a. (b -> c) -> p a b -> p a c
    forall (p :: * -> * -> *) b c a.
    Profunctor p =>
    (b -> c) -> p a b -> p a c
    rmap Either (f b) c -> f (Either b c)
    forall {f :: * -> *} {a} {b}.
    Applicative f =>
    Either (f a) b -> f (Either a b)
    sequenceL (p (Either a c) (Either (f b) c)
     -> p (Either a c) (f (Either b c)))
    -> p (Either a c) (Either (f b) c)
    -> p (Either a c) (f (Either b c))
    forall a b. (a -> b) -> a -> b
    $ p a (f b) -> p (Either a c) (Either (f b) c)
    forall a b c. p a b -> p (Either a c) (Either b c)
    forall (p :: * -> * -> *) a b c.
    Choice p =>
    p a b -> p (Either a c) (Either b c)
    left' p a (f b)
    p
        where
          sequenceL :: Either (f a) b -> f (Either a b)
    sequenceL (Left f a
    a) = (a -> Either a b) -> f a -> f (Either a b)
    forall a b. (a -> b) -> f a -> f b
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    fmap a -> Either a b
    forall a b. a -> Either a b
    Left f a
    a
          sequenceL (Right b
    a) = Either a b -> f (Either a b)
    forall a. a -> f a
    forall (f :: * -> *) a. Applicative f => a -> f a
    pure (Either a b -> f (Either a b)) -> Either a b -> f (Either a b)
    forall a b. (a -> b) -> a -> b
    $ b -> Either a b
    forall a b. b -> Either a b
    Right b
    a