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) = forall (f :: * -> *) (p :: * -> * -> *) a b. p a (f b) -> WrappedPafb f p a b WrapPafb forall a b. (a -> b) -> a -> b $ forall (p :: * -> * -> *) a b c d. Profunctor p => (a -> b) -> (c -> d) -> p b c -> p a d dimap a -> b f (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) = forall (f :: * -> *) (p :: * -> * -> *) a b. p a (f b) -> WrappedPafb f p a b WrapPafb forall a b. (a -> b) -> a -> b $ forall (p :: * -> * -> *) b c a. Profunctor p => (b -> c) -> p a b -> p a c rmap forall {f :: * -> *} {a} {b}. Applicative f => Either (f a) b -> f (Either a b) sequenceL forall a b. (a -> b) -> a -> b $ 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) = forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b fmap forall a b. a -> Either a b Left f a a sequenceL (Right b a) = forall (f :: * -> *) a. Applicative f => a -> f a pure forall a b. (a -> b) -> a -> b $ forall a b. b -> Either a b Right b a