-- | Import this module qualified, like this:
-- 
-- > import qualified Rank2
-- 
-- This will bring into scope the standard classes 'Functor', 'Applicative', 'Foldable', and 'Traversable', but with a
-- @Rank2.@ prefix and a twist that their methods operate on a heterogenous collection. The same property is shared by
-- the less standard classes 'Apply', 'Distributive', and 'Logistic'.
{-# LANGUAGE DefaultSignatures, InstanceSigs, KindSignatures, PolyKinds, Rank2Types #-}
{-# LANGUAGE ScopedTypeVariables, StandaloneDeriving, TypeOperators, UndecidableInstances #-}
{-# LANGUAGE EmptyCase #-}
{-# LANGUAGE TypeApplications #-}
module Rank2 (
-- * Rank 2 classes
   Functor(..), Apply(..), Applicative(..),
   Foldable(..), Traversable(..), Distributive(..), DistributiveTraversable(..), Logistic(..), distributeJoin,
-- * Rank 2 data types
   Compose(..), Empty(..), Only(..), Flip(..), Identity(..), Product(..), Sum(..), Arrow(..), type (~>),
-- * Method synonyms and helper functions
   ($), fst, snd, ap, fmap, liftA4, liftA5,
   fmapTraverse, liftA2Traverse1, liftA2Traverse2, liftA2TraverseBoth,
   distributeWith, distributeWithTraversable,
   getters, setters)
where

import qualified Control.Applicative as Rank1
import qualified Control.Monad as Rank1
import qualified Data.Foldable as Rank1
import qualified Data.Traversable as Rank1
import qualified Data.Functor.Compose as Rank1
import qualified Data.Functor.Contravariant as Rank1
import qualified Data.Functor.Logistic as Rank1
import qualified Data.Distributive as Rank1
import Data.Coerce (coerce)
import Data.Semigroup (Semigroup(..))
import Data.Monoid (Monoid(..))
import Data.Functor.Const (Const(..))
import Data.Functor.Product (Product(Pair))
import Data.Functor.Sum (Sum(InL, InR))
import Data.Kind (Type)
import Data.Proxy (Proxy(..))
import qualified GHC.Generics as Generics

import Prelude hiding (Foldable(..), Traversable(..), Functor(..), Applicative(..), ($), (<$>), fst, snd)

-- | Helper function for accessing the first field of a 'Pair'
fst :: Product g h p -> g p
fst :: forall {k} (g :: k -> *) (h :: k -> *) (p :: k).
Product g h p -> g p
fst (Pair g p
x h p
_) = g p
x

-- | Helper function for accessing the second field of a 'Pair'
snd :: Product g h p -> h p
snd :: forall {k} (g :: k -> *) (h :: k -> *) (p :: k).
Product g h p -> h p
snd (Pair g p
_ h p
y) = h p
y

-- | Equivalent of 'Rank1.Functor' for rank 2 data types, satisfying the usual functor laws
--
-- > id <$> g == g
-- > (p . q) <$> g == p <$> (q <$> g)
class Functor g where
   (<$>) :: (forall a. p a -> q a) -> g p -> g q
infixl 4 <$>

-- | Alphabetical synonym for '<$>'
fmap :: Functor g => (forall a. p a -> q a) -> g p -> g q
fmap :: forall {k} (g :: (k -> *) -> *) (p :: k -> *) (q :: k -> *).
Functor g =>
(forall (a :: k). p a -> q a) -> g p -> g q
fmap forall (a :: k). p a -> q a
f g p
g = forall (a :: k). p a -> q a
f forall {k} (g :: (k -> *) -> *) (p :: k -> *) (q :: k -> *).
Functor g =>
(forall (a :: k). p a -> q a) -> g p -> g q
<$> g p
g
{-# INLINE fmap #-}

-- | Equivalent of 'Rank1.Foldable' for rank 2 data types
class Foldable g where
   foldMap :: Monoid m => (forall a. p a -> m) -> g p -> m

-- | Equivalent of 'Rank1.Traversable' for rank 2 data types
class (Functor g, Foldable g) => Traversable g where
   {-# MINIMAL traverse | sequence #-}
   traverse :: Rank1.Applicative m => (forall a. p a -> m (q a)) -> g p -> m (g q)
   sequence :: Rank1.Applicative m => g (Rank1.Compose m p) -> m (g p)
   traverse forall (a :: k). p a -> m (q a)
f = forall {k} (g :: (k -> *) -> *) (m :: * -> *) (p :: k -> *).
(Traversable g, Applicative m) =>
g (Compose m p) -> m (g p)
sequence forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall {k} (g :: (k -> *) -> *) (p :: k -> *) (q :: k -> *).
Functor g =>
(forall (a :: k). p a -> q a) -> g p -> g q
fmap (forall {k} {k1} (f :: k -> *) (g :: k1 -> k) (a :: k1).
f (g a) -> Compose f g a
Rank1.Compose forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (a :: k). p a -> m (q a)
f)
   sequence = forall {k} (g :: (k -> *) -> *) (m :: * -> *) (p :: k -> *)
       (q :: k -> *).
(Traversable g, Applicative m) =>
(forall (a :: k). p a -> m (q a)) -> g p -> m (g q)
traverse forall {k1} {k2} (f :: k1 -> *) (g :: k2 -> k1) (a :: k2).
Compose f g a -> f (g a)
Rank1.getCompose
-- | Wrapper for functions that map the argument constructor type
newtype Arrow p q a = Arrow{forall {k} (p :: k -> *) (q :: k -> *) (a :: k).
Arrow p q a -> p a -> q a
apply :: p a -> q a}

type (~>) = Arrow
($) :: Arrow p q a -> p a -> q a
$ :: forall {k} (p :: k -> *) (q :: k -> *) (a :: k).
Arrow p q a -> p a -> q a
($) = forall {k} (p :: k -> *) (q :: k -> *) (a :: k).
Arrow p q a -> p a -> q a
apply
infixr 0 ~>
infixr 0 $

-- | Subclass of 'Functor' halfway to 'Applicative', satisfying
--
-- > (.) <$> u <*> v <*> w == u <*> (v <*> w)
class Functor g => Apply g where
   {-# MINIMAL liftA2 | (<*>) #-}
   -- | Equivalent of 'Rank1.<*>' for rank 2 data types
   (<*>) :: g (p ~> q) -> g p -> g q
   -- | Equivalent of 'Rank1.liftA2' for rank 2 data types
   liftA2 :: (forall a. p a -> q a -> r a) -> g p -> g q -> g r
   -- | Equivalent of 'Rank1.liftA3' for rank 2 data types
   liftA3 :: (forall a. p a -> q a -> r a -> s a) -> g p -> g q -> g r -> g s

   (<*>) = forall {k} (g :: (k -> *) -> *) (p :: k -> *) (q :: k -> *)
       (r :: k -> *).
Apply g =>
(forall (a :: k). p a -> q a -> r a) -> g p -> g q -> g r
liftA2 forall {k} (p :: k -> *) (q :: k -> *) (a :: k).
Arrow p q a -> p a -> q a
apply
   liftA2 forall (a :: k). p a -> q a -> r a
f g p
g g q
h = (forall {k} (p :: k -> *) (q :: k -> *) (a :: k).
(p a -> q a) -> Arrow p q a
Arrow forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (a :: k). p a -> q a -> r a
f) forall {k} (g :: (k -> *) -> *) (p :: k -> *) (q :: k -> *).
Functor g =>
(forall (a :: k). p a -> q a) -> g p -> g q
<$> g p
g forall {k} (g :: (k -> *) -> *) (p :: k -> *) (q :: k -> *).
Apply g =>
g (p ~> q) -> g p -> g q
<*> g q
h
   liftA3 forall (a :: k). p a -> q a -> r a -> s a
f g p
g g q
h g r
i = forall {k} (g :: (k -> *) -> *) (p :: k -> *) (q :: k -> *)
       (r :: k -> *).
Apply g =>
(forall (a :: k). p a -> q a -> r a) -> g p -> g q -> g r
liftA2 (\p a
p q a
q-> forall {k} (p :: k -> *) (q :: k -> *) (a :: k).
(p a -> q a) -> Arrow p q a
Arrow (forall (a :: k). p a -> q a -> r a -> s a
f p a
p q a
q)) g p
g g q
h forall {k} (g :: (k -> *) -> *) (p :: k -> *) (q :: k -> *).
Apply g =>
g (p ~> q) -> g p -> g q
<*> g r
i
infixl 4 <*>

liftA4 :: Apply g => (forall a. p a -> q a -> r a -> s a -> t a) -> g p -> g q -> g r -> g s -> g t
liftA4 :: forall {k} (g :: (k -> *) -> *) (p :: k -> *) (q :: k -> *)
       (r :: k -> *) (s :: k -> *) (t :: k -> *).
Apply g =>
(forall (a :: k). p a -> q a -> r a -> s a -> t a)
-> g p -> g q -> g r -> g s -> g t
liftA4 forall (a :: k). p a -> q a -> r a -> s a -> t a
f g p
g g q
h g r
i g s
j = forall {k} (g :: (k -> *) -> *) (p :: k -> *) (q :: k -> *)
       (r :: k -> *) (s :: k -> *).
Apply g =>
(forall (a :: k). p a -> q a -> r a -> s a)
-> g p -> g q -> g r -> g s
liftA3 (\p a
p q a
q r a
r-> forall {k} (p :: k -> *) (q :: k -> *) (a :: k).
(p a -> q a) -> Arrow p q a
Arrow (forall (a :: k). p a -> q a -> r a -> s a -> t a
f p a
p q a
q r a
r)) g p
g g q
h g r
i forall {k} (g :: (k -> *) -> *) (p :: k -> *) (q :: k -> *).
Apply g =>
g (p ~> q) -> g p -> g q
<*> g s
j

liftA5 :: Apply g => (forall a. p a -> q a -> r a -> s a -> t a -> u a) -> g p -> g q -> g r -> g s -> g t -> g u
liftA5 :: forall {k} (g :: (k -> *) -> *) (p :: k -> *) (q :: k -> *)
       (r :: k -> *) (s :: k -> *) (t :: k -> *) (u :: k -> *).
Apply g =>
(forall (a :: k). p a -> q a -> r a -> s a -> t a -> u a)
-> g p -> g q -> g r -> g s -> g t -> g u
liftA5 forall (a :: k). p a -> q a -> r a -> s a -> t a -> u a
f g p
g1 g q
g2 g r
g3 g s
g4 g t
g5 = forall {k} (g :: (k -> *) -> *) (p :: k -> *) (q :: k -> *)
       (r :: k -> *) (s :: k -> *) (t :: k -> *).
Apply g =>
(forall (a :: k). p a -> q a -> r a -> s a -> t a)
-> g p -> g q -> g r -> g s -> g t
liftA4 (\p a
p q a
q r a
r s a
s-> forall {k} (p :: k -> *) (q :: k -> *) (a :: k).
(p a -> q a) -> Arrow p q a
Arrow (forall (a :: k). p a -> q a -> r a -> s a -> t a -> u a
f p a
p q a
q r a
r s a
s)) g p
g1 g q
g2 g r
g3 g s
g4 forall {k} (g :: (k -> *) -> *) (p :: k -> *) (q :: k -> *).
Apply g =>
g (p ~> q) -> g p -> g q
<*> g t
g5

-- | Alphabetical synonym for '<*>'
ap :: Apply g => g (p ~> q) -> g p -> g q
ap :: forall {k} (g :: (k -> *) -> *) (p :: k -> *) (q :: k -> *).
Apply g =>
g (p ~> q) -> g p -> g q
ap = forall {k} (g :: (k -> *) -> *) (p :: k -> *) (q :: k -> *).
Apply g =>
g (p ~> q) -> g p -> g q
(<*>)

-- | Equivalent of 'Rank1.Applicative' for rank 2 data types
class Apply g => Applicative g where
   pure :: (forall a. f a) -> g f

-- | Equivalent of 'Rank1.Distributive' for rank 2 data types
class DistributiveTraversable g => Distributive g where
   {-# MINIMAL cotraverse|distribute #-}
   collect :: Rank1.Functor p => (a -> g q) -> p a -> g (Rank1.Compose p q)
   distribute :: Rank1.Functor p => p (g q) -> g (Rank1.Compose p q)
   -- | Dual of 'traverse', equivalent of 'Rank1.cotraverse' for rank 2 data types 
   cotraverse :: Rank1.Functor m => (forall a. m (p a) -> q a) -> m (g p) -> g q

   collect a -> g q
f = forall {k1} (g :: (k1 -> *) -> *) (p :: * -> *) (q :: k1 -> *).
(Distributive g, Functor p) =>
p (g q) -> g (Compose p q)
distribute forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Rank1.fmap a -> g q
f
   distribute = forall {k1} (g :: (k1 -> *) -> *) (m :: * -> *) (p :: k1 -> *)
       (q :: k1 -> *).
(Distributive g, Functor m) =>
(forall (a :: k1). m (p a) -> q a) -> m (g p) -> g q
cotraverse forall {k} {k1} (f :: k -> *) (g :: k1 -> k) (a :: k1).
f (g a) -> Compose f g a
Rank1.Compose
   cotraverse forall (a :: k1). m (p a) -> q a
f = forall {k} (g :: (k -> *) -> *) (p :: k -> *) (q :: k -> *).
Functor g =>
(forall (a :: k). p a -> q a) -> g p -> g q
fmap (forall (a :: k1). m (p a) -> q a
f forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall {k1} {k2} (f :: k1 -> *) (g :: k2 -> k1) (a :: k2).
Compose f g a -> f (g a)
Rank1.getCompose) forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall {k1} (g :: (k1 -> *) -> *) (p :: * -> *) (q :: k1 -> *).
(Distributive g, Functor p) =>
p (g q) -> g (Compose p q)
distribute

-- | A weaker 'Distributive' that requires 'Rank1.Traversable' to use, not just a 'Rank1.Functor'.
class Functor g => DistributiveTraversable (g :: (k -> Type) -> Type) where
   collectTraversable :: Rank1.Traversable f1 => (a -> g f2) -> f1 a -> g (Rank1.Compose f1 f2)   
   distributeTraversable :: Rank1.Traversable f1 => f1 (g f2) -> g (Rank1.Compose f1 f2)
   cotraverseTraversable :: Rank1.Traversable f1 => (forall x. f1 (f2 x) -> f x) -> f1 (g f2) -> g f

   collectTraversable a -> g f2
f = forall k (g :: (k -> *) -> *) (f1 :: * -> *) (f2 :: k -> *).
(DistributiveTraversable g, Traversable f1) =>
f1 (g f2) -> g (Compose f1 f2)
distributeTraversable forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Rank1.fmap a -> g f2
f
   distributeTraversable = forall k (g :: (k -> *) -> *) (f1 :: * -> *) (f2 :: k -> *)
       (f :: k -> *).
(DistributiveTraversable g, Traversable f1) =>
(forall (x :: k). f1 (f2 x) -> f x) -> f1 (g f2) -> g f
cotraverseTraversable forall {k} {k1} (f :: k -> *) (g :: k1 -> k) (a :: k1).
f (g a) -> Compose f g a
Rank1.Compose
   
   default cotraverseTraversable :: (Rank1.Traversable m, Distributive g) => 
                                    (forall a. m (p a) -> q a) -> m (g p) -> g q
   cotraverseTraversable = forall {k1} (g :: (k1 -> *) -> *) (m :: * -> *) (p :: k1 -> *)
       (q :: k1 -> *).
(Distributive g, Functor m) =>
(forall (a :: k1). m (p a) -> q a) -> m (g p) -> g q
cotraverse

-- | Equivalent of 'Rank1.Logistic' for rank 2 data types
class Functor g => Logistic g where
   deliver :: Rank1.Contravariant p => p (g q -> g q) -> g (Rank1.Compose p (q ~> q))

-- | A variant of 'distribute' convenient with 'Rank1.Monad' instances
distributeJoin :: (Distributive g, Rank1.Monad f) => f (g f) -> g f
distributeJoin :: forall (g :: (* -> *) -> *) (f :: * -> *).
(Distributive g, Monad f) =>
f (g f) -> g f
distributeJoin = forall {k1} (g :: (k1 -> *) -> *) (m :: * -> *) (p :: k1 -> *)
       (q :: k1 -> *).
(Distributive g, Functor m) =>
(forall (a :: k1). m (p a) -> q a) -> m (g p) -> g q
cotraverse forall (m :: * -> *) a. Monad m => m (m a) -> m a
Rank1.join

-- | Like 'fmap', but traverses over its argument
fmapTraverse :: (DistributiveTraversable g, Rank1.Traversable f) => (forall a. f (t a) -> u a) -> f (g t) -> g u
fmapTraverse :: forall {k} (g :: (k -> *) -> *) (f :: * -> *) (t :: k -> *)
       (u :: k -> *).
(DistributiveTraversable g, Traversable f) =>
(forall (a :: k). f (t a) -> u a) -> f (g t) -> g u
fmapTraverse forall (a :: k). f (t a) -> u a
f f (g t)
x = forall {k} (g :: (k -> *) -> *) (p :: k -> *) (q :: k -> *).
Functor g =>
(forall (a :: k). p a -> q a) -> g p -> g q
fmap (forall (a :: k). f (t a) -> u a
f forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall {k1} {k2} (f :: k1 -> *) (g :: k2 -> k1) (a :: k2).
Compose f g a -> f (g a)
Rank1.getCompose) (forall k (g :: (k -> *) -> *) (f1 :: * -> *) (f2 :: k -> *).
(DistributiveTraversable g, Traversable f1) =>
f1 (g f2) -> g (Compose f1 f2)
distributeTraversable f (g t)
x)

-- | Like 'liftA2', but traverses over its first argument
liftA2Traverse1 :: (Apply g, DistributiveTraversable g, Rank1.Traversable f) =>
                   (forall a. f (t a) -> u a -> v a) -> f (g t) -> g u -> g v
liftA2Traverse1 :: forall {k} (g :: (k -> *) -> *) (f :: * -> *) (t :: k -> *)
       (u :: k -> *) (v :: k -> *).
(Apply g, DistributiveTraversable g, Traversable f) =>
(forall (a :: k). f (t a) -> u a -> v a) -> f (g t) -> g u -> g v
liftA2Traverse1 forall (a :: k). f (t a) -> u a -> v a
f f (g t)
x = forall {k} (g :: (k -> *) -> *) (p :: k -> *) (q :: k -> *)
       (r :: k -> *).
Apply g =>
(forall (a :: k). p a -> q a -> r a) -> g p -> g q -> g r
liftA2 (forall (a :: k). f (t a) -> u a -> v a
f forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall {k1} {k2} (f :: k1 -> *) (g :: k2 -> k1) (a :: k2).
Compose f g a -> f (g a)
Rank1.getCompose) (forall k (g :: (k -> *) -> *) (f1 :: * -> *) (f2 :: k -> *).
(DistributiveTraversable g, Traversable f1) =>
f1 (g f2) -> g (Compose f1 f2)
distributeTraversable f (g t)
x)

-- | Like 'liftA2', but traverses over its second argument
liftA2Traverse2 :: (Apply g, DistributiveTraversable g, Rank1.Traversable f) => 
                   (forall a. t a -> f (u a) -> v a) -> g t -> f (g u) -> g v
liftA2Traverse2 :: forall {k} (g :: (k -> *) -> *) (f :: * -> *) (t :: k -> *)
       (u :: k -> *) (v :: k -> *).
(Apply g, DistributiveTraversable g, Traversable f) =>
(forall (a :: k). t a -> f (u a) -> v a) -> g t -> f (g u) -> g v
liftA2Traverse2 forall (a :: k). t a -> f (u a) -> v a
f g t
x f (g u)
y = forall {k} (g :: (k -> *) -> *) (p :: k -> *) (q :: k -> *)
       (r :: k -> *).
Apply g =>
(forall (a :: k). p a -> q a -> r a) -> g p -> g q -> g r
liftA2 (\t a
x' Compose f u a
y' -> forall (a :: k). t a -> f (u a) -> v a
f t a
x' (forall {k1} {k2} (f :: k1 -> *) (g :: k2 -> k1) (a :: k2).
Compose f g a -> f (g a)
Rank1.getCompose Compose f u a
y')) g t
x (forall k (g :: (k -> *) -> *) (f1 :: * -> *) (f2 :: k -> *).
(DistributiveTraversable g, Traversable f1) =>
f1 (g f2) -> g (Compose f1 f2)
distributeTraversable f (g u)
y)

-- | Like 'liftA2', but traverses over both its arguments
liftA2TraverseBoth :: forall f1 f2 g t u v.
                      (Apply g, DistributiveTraversable g, Rank1.Traversable f1, Rank1.Traversable f2) =>
                      (forall a. f1 (t a) -> f2 (u a) -> v a) -> f1 (g t) -> f2 (g u) -> g v
liftA2TraverseBoth :: forall {k} (f1 :: * -> *) (f2 :: * -> *) (g :: (k -> *) -> *)
       (t :: k -> *) (u :: k -> *) (v :: k -> *).
(Apply g, DistributiveTraversable g, Traversable f1,
 Traversable f2) =>
(forall (a :: k). f1 (t a) -> f2 (u a) -> v a)
-> f1 (g t) -> f2 (g u) -> g v
liftA2TraverseBoth forall (a :: k). f1 (t a) -> f2 (u a) -> v a
f f1 (g t)
x f2 (g u)
y = forall {k} (g :: (k -> *) -> *) (p :: k -> *) (q :: k -> *)
       (r :: k -> *).
Apply g =>
(forall (a :: k). p a -> q a -> r a) -> g p -> g q -> g r
liftA2 forall (a :: k). Compose f1 t a -> Compose f2 u a -> v a
applyCompose (forall k (g :: (k -> *) -> *) (f1 :: * -> *) (f2 :: k -> *).
(DistributiveTraversable g, Traversable f1) =>
f1 (g f2) -> g (Compose f1 f2)
distributeTraversable f1 (g t)
x) (forall k (g :: (k -> *) -> *) (f1 :: * -> *) (f2 :: k -> *).
(DistributiveTraversable g, Traversable f1) =>
f1 (g f2) -> g (Compose f1 f2)
distributeTraversable f2 (g u)
y)
   where applyCompose :: forall a. Rank1.Compose f1 t a -> Rank1.Compose f2 u a -> v a
         applyCompose :: forall (a :: k). Compose f1 t a -> Compose f2 u a -> v a
applyCompose Compose f1 t a
x' Compose f2 u a
y' = forall (a :: k). f1 (t a) -> f2 (u a) -> v a
f (forall {k1} {k2} (f :: k1 -> *) (g :: k2 -> k1) (a :: k2).
Compose f g a -> f (g a)
Rank1.getCompose Compose f1 t a
x') (forall {k1} {k2} (f :: k1 -> *) (g :: k2 -> k1) (a :: k2).
Compose f g a -> f (g a)
Rank1.getCompose Compose f2 u a
y')

-- | Enumerate getters for each element
getters :: Distributive g => g (Rank1.Compose ((->) (g f)) f)
getters :: forall {k1} (g :: (k1 -> *) -> *) (f :: k1 -> *).
Distributive g =>
g (Compose ((->) (g f)) f)
getters = forall {k1} (g :: (k1 -> *) -> *) (p :: * -> *) (q :: k1 -> *).
(Distributive g, Functor p) =>
p (g q) -> g (Compose p q)
distribute forall a. a -> a
id

-- | Enumerate setters for each element
setters :: Logistic g => g ((f ~> f) ~> Const (g f -> g f))
setters :: forall {k1} (g :: (k1 -> *) -> *) (f :: k1 -> *).
Logistic g =>
g ((f ~> f) ~> Const (g f -> g f))
setters = forall {k} (p :: k -> *) (q :: k -> *) (a :: k).
(p a -> q a) -> Arrow p q a
Arrow forall b c a. (b -> c) -> (a -> b) -> a -> c
. (forall {k} a (b :: k). a -> Const a b
Const forall b c a. (b -> c) -> (a -> b) -> a -> c
.) forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a b. Op a b -> b -> a
Rank1.getOp forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall {k1} {k2} (f :: k1 -> *) (g :: k2 -> k1) (a :: k2).
Compose f g a -> f (g a)
Rank1.getCompose forall {k} (g :: (k -> *) -> *) (p :: k -> *) (q :: k -> *).
Functor g =>
(forall (a :: k). p a -> q a) -> g p -> g q
<$> forall {k1} (g :: (k1 -> *) -> *) (p :: * -> *) (q :: k1 -> *).
(Logistic g, Contravariant p) =>
p (g q -> g q) -> g (Compose p (q ~> q))
deliver (forall a b. (b -> a) -> Op a b
Rank1.Op forall a. a -> a
id)

{-# DEPRECATED distributeWith "Use cotraverse instead." #-}
-- | Synonym for 'cotraverse'
distributeWith :: (Distributive g, Rank1.Functor f) => (forall i. f (a i) -> b i) -> f (g a) -> g b
distributeWith :: forall {k1} (g :: (k1 -> *) -> *) (f :: * -> *) (a :: k1 -> *)
       (b :: k1 -> *).
(Distributive g, Functor f) =>
(forall (i :: k1). f (a i) -> b i) -> f (g a) -> g b
distributeWith = forall {k1} (g :: (k1 -> *) -> *) (m :: * -> *) (p :: k1 -> *)
       (q :: k1 -> *).
(Distributive g, Functor m) =>
(forall (a :: k1). m (p a) -> q a) -> m (g p) -> g q
cotraverse

{-# DEPRECATED distributeWithTraversable "Use cotraverseTraversable instead." #-}
-- | Synonym for 'cotraverseTraversable'
distributeWithTraversable :: (DistributiveTraversable g, Rank1.Traversable m) =>
                             (forall a. m (p a) -> q a) -> m (g p) -> g q
distributeWithTraversable :: forall {k} (g :: (k -> *) -> *) (f :: * -> *) (t :: k -> *)
       (u :: k -> *).
(DistributiveTraversable g, Traversable f) =>
(forall (a :: k). f (t a) -> u a) -> f (g t) -> g u
distributeWithTraversable = forall k (g :: (k -> *) -> *) (f1 :: * -> *) (f2 :: k -> *)
       (f :: k -> *).
(DistributiveTraversable g, Traversable f1) =>
(forall (x :: k). f1 (f2 x) -> f x) -> f1 (g f2) -> g f
cotraverseTraversable

-- | A rank-2 equivalent of @()@, a zero-element tuple
data Empty f = Empty deriving (Empty f -> Empty f -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
forall k (f :: k). Empty f -> Empty f -> Bool
/= :: Empty f -> Empty f -> Bool
$c/= :: forall k (f :: k). Empty f -> Empty f -> Bool
== :: Empty f -> Empty f -> Bool
$c== :: forall k (f :: k). Empty f -> Empty f -> Bool
Eq, Empty f -> Empty f -> Bool
Empty f -> Empty f -> Ordering
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
forall k (f :: k). Eq (Empty f)
forall k (f :: k). Empty f -> Empty f -> Bool
forall k (f :: k). Empty f -> Empty f -> Ordering
forall k (f :: k). Empty f -> Empty f -> Empty f
min :: Empty f -> Empty f -> Empty f
$cmin :: forall k (f :: k). Empty f -> Empty f -> Empty f
max :: Empty f -> Empty f -> Empty f
$cmax :: forall k (f :: k). Empty f -> Empty f -> Empty f
>= :: Empty f -> Empty f -> Bool
$c>= :: forall k (f :: k). Empty f -> Empty f -> Bool
> :: Empty f -> Empty f -> Bool
$c> :: forall k (f :: k). Empty f -> Empty f -> Bool
<= :: Empty f -> Empty f -> Bool
$c<= :: forall k (f :: k). Empty f -> Empty f -> Bool
< :: Empty f -> Empty f -> Bool
$c< :: forall k (f :: k). Empty f -> Empty f -> Bool
compare :: Empty f -> Empty f -> Ordering
$ccompare :: forall k (f :: k). Empty f -> Empty f -> Ordering
Ord, Int -> Empty f -> ShowS
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
forall k (f :: k). Int -> Empty f -> ShowS
forall k (f :: k). [Empty f] -> ShowS
forall k (f :: k). Empty f -> String
showList :: [Empty f] -> ShowS
$cshowList :: forall k (f :: k). [Empty f] -> ShowS
show :: Empty f -> String
$cshow :: forall k (f :: k). Empty f -> String
showsPrec :: Int -> Empty f -> ShowS
$cshowsPrec :: forall k (f :: k). Int -> Empty f -> ShowS
Show)

-- | A rank-2 tuple of only one element
newtype Only a f = Only {forall {k} (a :: k) (f :: k -> *). Only a f -> f a
fromOnly :: f a} deriving (Only a f -> Only a f -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
forall k (a :: k) (f :: k -> *).
Eq (f a) =>
Only a f -> Only a f -> Bool
/= :: Only a f -> Only a f -> Bool
$c/= :: forall k (a :: k) (f :: k -> *).
Eq (f a) =>
Only a f -> Only a f -> Bool
== :: Only a f -> Only a f -> Bool
$c== :: forall k (a :: k) (f :: k -> *).
Eq (f a) =>
Only a f -> Only a f -> Bool
Eq, Only a f -> Only a f -> Bool
Only a f -> Only a f -> Ordering
Only a f -> Only a f -> Only a f
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
forall {k} {a :: k} {f :: k -> *}. Ord (f a) => Eq (Only a f)
forall k (a :: k) (f :: k -> *).
Ord (f a) =>
Only a f -> Only a f -> Bool
forall k (a :: k) (f :: k -> *).
Ord (f a) =>
Only a f -> Only a f -> Ordering
forall k (a :: k) (f :: k -> *).
Ord (f a) =>
Only a f -> Only a f -> Only a f
min :: Only a f -> Only a f -> Only a f
$cmin :: forall k (a :: k) (f :: k -> *).
Ord (f a) =>
Only a f -> Only a f -> Only a f
max :: Only a f -> Only a f -> Only a f
$cmax :: forall k (a :: k) (f :: k -> *).
Ord (f a) =>
Only a f -> Only a f -> Only a f
>= :: Only a f -> Only a f -> Bool
$c>= :: forall k (a :: k) (f :: k -> *).
Ord (f a) =>
Only a f -> Only a f -> Bool
> :: Only a f -> Only a f -> Bool
$c> :: forall k (a :: k) (f :: k -> *).
Ord (f a) =>
Only a f -> Only a f -> Bool
<= :: Only a f -> Only a f -> Bool
$c<= :: forall k (a :: k) (f :: k -> *).
Ord (f a) =>
Only a f -> Only a f -> Bool
< :: Only a f -> Only a f -> Bool
$c< :: forall k (a :: k) (f :: k -> *).
Ord (f a) =>
Only a f -> Only a f -> Bool
compare :: Only a f -> Only a f -> Ordering
$ccompare :: forall k (a :: k) (f :: k -> *).
Ord (f a) =>
Only a f -> Only a f -> Ordering
Ord, Int -> Only a f -> ShowS
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
forall k (a :: k) (f :: k -> *).
Show (f a) =>
Int -> Only a f -> ShowS
forall k (a :: k) (f :: k -> *). Show (f a) => [Only a f] -> ShowS
forall k (a :: k) (f :: k -> *). Show (f a) => Only a f -> String
showList :: [Only a f] -> ShowS
$cshowList :: forall k (a :: k) (f :: k -> *). Show (f a) => [Only a f] -> ShowS
show :: Only a f -> String
$cshow :: forall k (a :: k) (f :: k -> *). Show (f a) => Only a f -> String
showsPrec :: Int -> Only a f -> ShowS
$cshowsPrec :: forall k (a :: k) (f :: k -> *).
Show (f a) =>
Int -> Only a f -> ShowS
Show)

-- | Equivalent of 'Data.Functor.Identity' for rank 2 data types
newtype Identity g f = Identity {forall {k} (g :: k -> *) (f :: k). Identity g f -> g f
runIdentity :: g f} deriving (Identity g f -> Identity g f -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
forall k (g :: k -> *) (f :: k).
Eq (g f) =>
Identity g f -> Identity g f -> Bool
/= :: Identity g f -> Identity g f -> Bool
$c/= :: forall k (g :: k -> *) (f :: k).
Eq (g f) =>
Identity g f -> Identity g f -> Bool
== :: Identity g f -> Identity g f -> Bool
$c== :: forall k (g :: k -> *) (f :: k).
Eq (g f) =>
Identity g f -> Identity g f -> Bool
Eq, Identity g f -> Identity g f -> Bool
Identity g f -> Identity g f -> Ordering
Identity g f -> Identity g f -> Identity g f
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
forall {k} {g :: k -> *} {f :: k}. Ord (g f) => Eq (Identity g f)
forall k (g :: k -> *) (f :: k).
Ord (g f) =>
Identity g f -> Identity g f -> Bool
forall k (g :: k -> *) (f :: k).
Ord (g f) =>
Identity g f -> Identity g f -> Ordering
forall k (g :: k -> *) (f :: k).
Ord (g f) =>
Identity g f -> Identity g f -> Identity g f
min :: Identity g f -> Identity g f -> Identity g f
$cmin :: forall k (g :: k -> *) (f :: k).
Ord (g f) =>
Identity g f -> Identity g f -> Identity g f
max :: Identity g f -> Identity g f -> Identity g f
$cmax :: forall k (g :: k -> *) (f :: k).
Ord (g f) =>
Identity g f -> Identity g f -> Identity g f
>= :: Identity g f -> Identity g f -> Bool
$c>= :: forall k (g :: k -> *) (f :: k).
Ord (g f) =>
Identity g f -> Identity g f -> Bool
> :: Identity g f -> Identity g f -> Bool
$c> :: forall k (g :: k -> *) (f :: k).
Ord (g f) =>
Identity g f -> Identity g f -> Bool
<= :: Identity g f -> Identity g f -> Bool
$c<= :: forall k (g :: k -> *) (f :: k).
Ord (g f) =>
Identity g f -> Identity g f -> Bool
< :: Identity g f -> Identity g f -> Bool
$c< :: forall k (g :: k -> *) (f :: k).
Ord (g f) =>
Identity g f -> Identity g f -> Bool
compare :: Identity g f -> Identity g f -> Ordering
$ccompare :: forall k (g :: k -> *) (f :: k).
Ord (g f) =>
Identity g f -> Identity g f -> Ordering
Ord, Int -> Identity g f -> ShowS
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
forall k (g :: k -> *) (f :: k).
Show (g f) =>
Int -> Identity g f -> ShowS
forall k (g :: k -> *) (f :: k).
Show (g f) =>
[Identity g f] -> ShowS
forall k (g :: k -> *) (f :: k).
Show (g f) =>
Identity g f -> String
showList :: [Identity g f] -> ShowS
$cshowList :: forall k (g :: k -> *) (f :: k).
Show (g f) =>
[Identity g f] -> ShowS
show :: Identity g f -> String
$cshow :: forall k (g :: k -> *) (f :: k).
Show (g f) =>
Identity g f -> String
showsPrec :: Int -> Identity g f -> ShowS
$cshowsPrec :: forall k (g :: k -> *) (f :: k).
Show (g f) =>
Int -> Identity g f -> ShowS
Show)

-- | Equivalent of 'Data.Functor.Compose' for rank 2 data types
newtype Compose g p q = Compose {forall {k1} {k} (g :: (k1 -> *) -> *) (p :: k -> *) (q :: k1 -> k).
Compose g p q -> g (Compose p q)
getCompose :: g (Rank1.Compose p q)}

deriving instance Eq (g (Rank1.Compose p q)) => Eq (Compose g p q)
deriving instance Ord (g (Rank1.Compose p q)) => Ord (Compose g p q)
deriving instance Show (g (Rank1.Compose p q)) => Show (Compose g p q)

-- | A nested parametric type represented as a rank-2 type
newtype Flip g a f = Flip {forall {k} {k} (g :: k -> *) (a :: k) (f :: k -> k).
Flip g a f -> g (f a)
unFlip :: g (f a)} deriving (Flip g a f -> Flip g a f -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
forall k (g :: k -> *) k (a :: k) (f :: k -> k).
Eq (g (f a)) =>
Flip g a f -> Flip g a f -> Bool
/= :: Flip g a f -> Flip g a f -> Bool
$c/= :: forall k (g :: k -> *) k (a :: k) (f :: k -> k).
Eq (g (f a)) =>
Flip g a f -> Flip g a f -> Bool
== :: Flip g a f -> Flip g a f -> Bool
$c== :: forall k (g :: k -> *) k (a :: k) (f :: k -> k).
Eq (g (f a)) =>
Flip g a f -> Flip g a f -> Bool
Eq, Flip g a f -> Flip g a f -> Bool
Flip g a f -> Flip g a f -> Ordering
Flip g a f -> Flip g a f -> Flip g a f
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
forall {k} {g :: k -> *} {k} {a :: k} {f :: k -> k}.
Ord (g (f a)) =>
Eq (Flip g a f)
forall k (g :: k -> *) k (a :: k) (f :: k -> k).
Ord (g (f a)) =>
Flip g a f -> Flip g a f -> Bool
forall k (g :: k -> *) k (a :: k) (f :: k -> k).
Ord (g (f a)) =>
Flip g a f -> Flip g a f -> Ordering
forall k (g :: k -> *) k (a :: k) (f :: k -> k).
Ord (g (f a)) =>
Flip g a f -> Flip g a f -> Flip g a f
min :: Flip g a f -> Flip g a f -> Flip g a f
$cmin :: forall k (g :: k -> *) k (a :: k) (f :: k -> k).
Ord (g (f a)) =>
Flip g a f -> Flip g a f -> Flip g a f
max :: Flip g a f -> Flip g a f -> Flip g a f
$cmax :: forall k (g :: k -> *) k (a :: k) (f :: k -> k).
Ord (g (f a)) =>
Flip g a f -> Flip g a f -> Flip g a f
>= :: Flip g a f -> Flip g a f -> Bool
$c>= :: forall k (g :: k -> *) k (a :: k) (f :: k -> k).
Ord (g (f a)) =>
Flip g a f -> Flip g a f -> Bool
> :: Flip g a f -> Flip g a f -> Bool
$c> :: forall k (g :: k -> *) k (a :: k) (f :: k -> k).
Ord (g (f a)) =>
Flip g a f -> Flip g a f -> Bool
<= :: Flip g a f -> Flip g a f -> Bool
$c<= :: forall k (g :: k -> *) k (a :: k) (f :: k -> k).
Ord (g (f a)) =>
Flip g a f -> Flip g a f -> Bool
< :: Flip g a f -> Flip g a f -> Bool
$c< :: forall k (g :: k -> *) k (a :: k) (f :: k -> k).
Ord (g (f a)) =>
Flip g a f -> Flip g a f -> Bool
compare :: Flip g a f -> Flip g a f -> Ordering
$ccompare :: forall k (g :: k -> *) k (a :: k) (f :: k -> k).
Ord (g (f a)) =>
Flip g a f -> Flip g a f -> Ordering
Ord, Int -> Flip g a f -> ShowS
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
forall k (g :: k -> *) k (a :: k) (f :: k -> k).
Show (g (f a)) =>
Int -> Flip g a f -> ShowS
forall k (g :: k -> *) k (a :: k) (f :: k -> k).
Show (g (f a)) =>
[Flip g a f] -> ShowS
forall k (g :: k -> *) k (a :: k) (f :: k -> k).
Show (g (f a)) =>
Flip g a f -> String
showList :: [Flip g a f] -> ShowS
$cshowList :: forall k (g :: k -> *) k (a :: k) (f :: k -> k).
Show (g (f a)) =>
[Flip g a f] -> ShowS
show :: Flip g a f -> String
$cshow :: forall k (g :: k -> *) k (a :: k) (f :: k -> k).
Show (g (f a)) =>
Flip g a f -> String
showsPrec :: Int -> Flip g a f -> ShowS
$cshowsPrec :: forall k (g :: k -> *) k (a :: k) (f :: k -> k).
Show (g (f a)) =>
Int -> Flip g a f -> ShowS
Show)

instance Semigroup (g (f a)) => Semigroup (Flip g a f) where
   Flip g (f a)
x <> :: Flip g a f -> Flip g a f -> Flip g a f
<> Flip g (f a)
y = forall {k} {k} (g :: k -> *) (a :: k) (f :: k -> k).
g (f a) -> Flip g a f
Flip (g (f a)
x forall a. Semigroup a => a -> a -> a
<> g (f a)
y)

instance Monoid (g (f a)) => Monoid (Flip g a f) where
   mempty :: Flip g a f
mempty = forall {k} {k} (g :: k -> *) (a :: k) (f :: k -> k).
g (f a) -> Flip g a f
Flip forall a. Monoid a => a
mempty
   mappend :: Flip g a f -> Flip g a f -> Flip g a f
mappend = forall a. Semigroup a => a -> a -> a
(<>)

instance Rank1.Functor g => Rank2.Functor (Flip g a) where
   forall (a :: k). p a -> q a
f <$> :: forall (p :: k -> *) (q :: k -> *).
(forall (a :: k). p a -> q a) -> Flip g a p -> Flip g a q
<$> Flip g (p a)
g = forall {k} {k} (g :: k -> *) (a :: k) (f :: k -> k).
g (f a) -> Flip g a f
Flip (forall (a :: k). p a -> q a
f forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Rank1.<$> g (p a)
g)

instance Rank1.Applicative g => Rank2.Apply (Flip g a) where
   Flip g ((~>) p q a)
g <*> :: forall (p :: k -> *) (q :: k -> *).
Flip g a (p ~> q) -> Flip g a p -> Flip g a q
<*> Flip g (p a)
h = forall {k} {k} (g :: k -> *) (a :: k) (f :: k -> k).
g (f a) -> Flip g a f
Flip (forall {k} (p :: k -> *) (q :: k -> *) (a :: k).
Arrow p q a -> p a -> q a
apply forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Rank1.<$> g ((~>) p q a)
g forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Rank1.<*> g (p a)
h)

instance Rank1.Applicative g => Rank2.Applicative (Flip g a) where
   pure :: forall (f :: k -> *). (forall (a :: k). f a) -> Flip g a f
pure forall (a :: k). f a
f = forall {k} {k} (g :: k -> *) (a :: k) (f :: k -> k).
g (f a) -> Flip g a f
Flip (forall (f :: * -> *) a. Applicative f => a -> f a
Rank1.pure forall (a :: k). f a
f)

instance Rank1.Foldable g => Rank2.Foldable (Flip g a) where
   foldMap :: forall m (p :: k -> *).
Monoid m =>
(forall (a :: k). p a -> m) -> Flip g a p -> m
foldMap forall (a :: k). p a -> m
f (Flip g (p a)
g) = forall (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
Rank1.foldMap forall (a :: k). p a -> m
f g (p a)
g

instance Rank1.Traversable g => Rank2.Traversable (Flip g a) where
   traverse :: forall (m :: * -> *) (p :: k -> *) (q :: k -> *).
Applicative m =>
(forall (a :: k). p a -> m (q a)) -> Flip g a p -> m (Flip g a q)
traverse forall (a :: k). p a -> m (q a)
f (Flip g (p a)
g) = forall {k} {k} (g :: k -> *) (a :: k) (f :: k -> k).
g (f a) -> Flip g a f
Flip forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Rank1.<$> forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
Rank1.traverse forall (a :: k). p a -> m (q a)
f g (p a)
g

instance Functor Empty where
   forall (a :: k). p a -> q a
_ <$> :: forall (p :: k -> *) (q :: k -> *).
(forall (a :: k). p a -> q a) -> Empty p -> Empty q
<$> Empty p
_ = forall {k} (f :: k). Empty f
Empty

instance Functor Proxy where
   forall (a :: k). p a -> q a
_ <$> :: forall (p :: k -> *) (q :: k -> *).
(forall (a :: k). p a -> q a) -> Proxy p -> Proxy q
<$> Proxy p
_ = forall {k} (t :: k). Proxy t
Proxy

instance Functor (Const a) where
   forall (a :: k). p a -> q a
_ <$> :: forall (p :: k -> *) (q :: k -> *).
(forall (a :: k). p a -> q a) -> Const a p -> Const a q
<$> Const a
a = forall {k} a (b :: k). a -> Const a b
Const a
a

instance Functor (Only a) where
   forall (a :: k). p a -> q a
f <$> :: forall (p :: k -> *) (q :: k -> *).
(forall (a :: k). p a -> q a) -> Only a p -> Only a q
<$> Only p a
a = forall {k} (a :: k) (f :: k -> *). f a -> Only a f
Only (forall (a :: k). p a -> q a
f p a
a)

instance Functor g => Functor (Identity g) where
   forall (a :: k). p a -> q a
f <$> :: forall (p :: k -> *) (q :: k -> *).
(forall (a :: k). p a -> q a) -> Identity g p -> Identity g q
<$> Identity g p
g = forall {k} (g :: k -> *) (f :: k). g f -> Identity g f
Identity (forall (a :: k). p a -> q a
f forall {k} (g :: (k -> *) -> *) (p :: k -> *) (q :: k -> *).
Functor g =>
(forall (a :: k). p a -> q a) -> g p -> g q
<$> g p
g)

instance (Functor g, Rank1.Functor p) => Functor (Compose g p) where
   (<$>) :: forall q r. (forall a. q a -> r a) -> Compose g p q -> Compose g p r
   forall (a :: k). q a -> r a
f <$> :: forall (p :: k -> *) (q :: k -> *).
(forall (a :: k). p a -> q a) -> Compose g p p -> Compose g p q
<$> Compose g (Compose p q)
g = forall {k1} {k} (g :: (k1 -> *) -> *) (p :: k -> *) (q :: k1 -> k).
g (Compose p q) -> Compose g p q
Compose (forall (a :: k). Compose p q a -> Compose p r a
f' forall {k} (g :: (k -> *) -> *) (p :: k -> *) (q :: k -> *).
Functor g =>
(forall (a :: k). p a -> q a) -> g p -> g q
<$> g (Compose p q)
g)
      where f' :: forall a. Rank1.Compose p q a -> Rank1.Compose p r a
            f' :: forall (a :: k). Compose p q a -> Compose p r a
f' (Rank1.Compose p (q a)
q) = forall {k} {k1} (f :: k -> *) (g :: k1 -> k) (a :: k1).
f (g a) -> Compose f g a
Rank1.Compose (forall (a :: k). q a -> r a
f forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Rank1.<$> p (q a)
q)

instance (Functor g, Functor h) => Functor (Product g h) where
   forall (a :: k). p a -> q a
f <$> :: forall (p :: k -> *) (q :: k -> *).
(forall (a :: k). p a -> q a) -> Product g h p -> Product g h q
<$> Pair g p
a h p
b = forall {k} (f :: k -> *) (g :: k -> *) (a :: k).
f a -> g a -> Product f g a
Pair (forall (a :: k). p a -> q a
f forall {k} (g :: (k -> *) -> *) (p :: k -> *) (q :: k -> *).
Functor g =>
(forall (a :: k). p a -> q a) -> g p -> g q
<$> g p
a) (forall (a :: k). p a -> q a
f forall {k} (g :: (k -> *) -> *) (p :: k -> *) (q :: k -> *).
Functor g =>
(forall (a :: k). p a -> q a) -> g p -> g q
<$> h p
b)

instance (Functor g, Functor h) => Functor (Sum g h) where
   forall (a :: k). p a -> q a
f <$> :: forall (p :: k -> *) (q :: k -> *).
(forall (a :: k). p a -> q a) -> Sum g h p -> Sum g h q
<$> InL g p
g = forall {k} (f :: k -> *) (g :: k -> *) (a :: k). f a -> Sum f g a
InL (forall (a :: k). p a -> q a
f forall {k} (g :: (k -> *) -> *) (p :: k -> *) (q :: k -> *).
Functor g =>
(forall (a :: k). p a -> q a) -> g p -> g q
<$> g p
g)
   forall (a :: k). p a -> q a
f <$> InR h p
h = forall {k} (f :: k -> *) (g :: k -> *) (a :: k). g a -> Sum f g a
InR (forall (a :: k). p a -> q a
f forall {k} (g :: (k -> *) -> *) (p :: k -> *) (q :: k -> *).
Functor g =>
(forall (a :: k). p a -> q a) -> g p -> g q
<$> h p
h)

instance Functor Generics.V1 where
   <$> :: forall (p :: k -> *) (q :: k -> *).
(forall (a :: k). p a -> q a) -> V1 p -> V1 q
(<$>) forall (a :: k). p a -> q a
_ = coerce :: forall a b. Coercible a b => a -> b
coerce
   
instance Functor Generics.U1 where
   <$> :: forall (p :: k -> *) (q :: k -> *).
(forall (a :: k). p a -> q a) -> U1 p -> U1 q
(<$>) forall (a :: k). p a -> q a
_ = coerce :: forall a b. Coercible a b => a -> b
coerce

instance Functor (Generics.K1 i c) where
   <$> :: forall (p :: k -> *) (q :: k -> *).
(forall (a :: k). p a -> q a) -> K1 i c p -> K1 i c q
(<$>) forall (a :: k). p a -> q a
_ = coerce :: forall a b. Coercible a b => a -> b
coerce

instance Functor f => Functor (Generics.M1 i c f) where
   forall (a :: k). p a -> q a
f <$> :: forall (p :: k -> *) (q :: k -> *).
(forall (a :: k). p a -> q a) -> M1 i c f p -> M1 i c f q
<$> Generics.M1 f p
x = forall k i (c :: Meta) (f :: k -> *) (p :: k). f p -> M1 i c f p
Generics.M1 (forall (a :: k). p a -> q a
f forall {k} (g :: (k -> *) -> *) (p :: k -> *) (q :: k -> *).
Functor g =>
(forall (a :: k). p a -> q a) -> g p -> g q
<$> f p
x)

instance Functor f => Functor (Generics.Rec1 f) where
   forall (a :: k). p a -> q a
f <$> :: forall (p :: k -> *) (q :: k -> *).
(forall (a :: k). p a -> q a) -> Rec1 f p -> Rec1 f q
<$> Generics.Rec1 f p
x = forall k (f :: k -> *) (p :: k). f p -> Rec1 f p
Generics.Rec1 (forall (a :: k). p a -> q a
f forall {k} (g :: (k -> *) -> *) (p :: k -> *) (q :: k -> *).
Functor g =>
(forall (a :: k). p a -> q a) -> g p -> g q
<$> f p
x)

-- instance (Rank1.Functor f, Functor g) => Functor ((Generics.:.:) f g) where
--    f <$> Generics.Comp1 x = Generics.Comp1 (Rank1.fmap (f <$>) x)

instance (Functor f, Functor g) => Functor ((Generics.:+:) f g) where
   forall (a :: k). p a -> q a
f <$> :: forall (p :: k -> *) (q :: k -> *).
(forall (a :: k). p a -> q a) -> (:+:) f g p -> (:+:) f g q
<$> Generics.L1 f p
x = forall k (f :: k -> *) (g :: k -> *) (p :: k). f p -> (:+:) f g p
Generics.L1 (forall (a :: k). p a -> q a
f forall {k} (g :: (k -> *) -> *) (p :: k -> *) (q :: k -> *).
Functor g =>
(forall (a :: k). p a -> q a) -> g p -> g q
<$> f p
x)
   forall (a :: k). p a -> q a
f <$> Generics.R1 g p
x = forall k (f :: k -> *) (g :: k -> *) (p :: k). g p -> (:+:) f g p
Generics.R1 (forall (a :: k). p a -> q a
f forall {k} (g :: (k -> *) -> *) (p :: k -> *) (q :: k -> *).
Functor g =>
(forall (a :: k). p a -> q a) -> g p -> g q
<$> g p
x)

instance (Functor f, Functor g) => Functor ((Generics.:*:) f g) where
   forall (a :: k). p a -> q a
f <$> :: forall (p :: k -> *) (q :: k -> *).
(forall (a :: k). p a -> q a) -> (:*:) f g p -> (:*:) f g q
<$> (f p
x Generics.:*: g p
y) = (forall (a :: k). p a -> q a
f forall {k} (g :: (k -> *) -> *) (p :: k -> *) (q :: k -> *).
Functor g =>
(forall (a :: k). p a -> q a) -> g p -> g q
<$> f p
x) forall k (f :: k -> *) (g :: k -> *) (p :: k).
f p -> g p -> (:*:) f g p
Generics.:*: (forall (a :: k). p a -> q a
f forall {k} (g :: (k -> *) -> *) (p :: k -> *) (q :: k -> *).
Functor g =>
(forall (a :: k). p a -> q a) -> g p -> g q
<$> g p
y)

instance Foldable Empty where
   foldMap :: forall m (p :: k -> *).
Monoid m =>
(forall (a :: k). p a -> m) -> Empty p -> m
foldMap forall (a :: k). p a -> m
_ Empty p
_ = forall a. Monoid a => a
mempty

instance Foldable Proxy where
   foldMap :: forall m (p :: k -> *).
Monoid m =>
(forall (a :: k). p a -> m) -> Proxy p -> m
foldMap forall (a :: k). p a -> m
_ Proxy p
_ = forall a. Monoid a => a
mempty

instance Foldable (Const x) where
   foldMap :: forall m (p :: k -> *).
Monoid m =>
(forall (a :: k). p a -> m) -> Const x p -> m
foldMap forall (a :: k). p a -> m
_ Const x p
_ = forall a. Monoid a => a
mempty

instance Foldable (Only x) where
   foldMap :: forall m (p :: k -> *).
Monoid m =>
(forall (a :: k). p a -> m) -> Only x p -> m
foldMap forall (a :: k). p a -> m
f (Only p x
x) = forall (a :: k). p a -> m
f p x
x

instance Foldable g => Foldable (Identity g) where
   foldMap :: forall m (p :: k -> *).
Monoid m =>
(forall (a :: k). p a -> m) -> Identity g p -> m
foldMap forall (a :: k). p a -> m
f (Identity g p
g) = forall {k} (g :: (k -> *) -> *) m (p :: k -> *).
(Foldable g, Monoid m) =>
(forall (a :: k). p a -> m) -> g p -> m
foldMap forall (a :: k). p a -> m
f g p
g

instance (Foldable g, Rank1.Foldable p) => Foldable (Compose g p) where
   foldMap :: forall m (p :: k -> *).
Monoid m =>
(forall (a :: k). p a -> m) -> Compose g p p -> m
foldMap forall (a :: k). p a -> m
f (Compose g (Compose p p)
g) = forall {k} (g :: (k -> *) -> *) m (p :: k -> *).
(Foldable g, Monoid m) =>
(forall (a :: k). p a -> m) -> g p -> m
foldMap (forall (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
Rank1.foldMap forall (a :: k). p a -> m
f forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall {k1} {k2} (f :: k1 -> *) (g :: k2 -> k1) (a :: k2).
Compose f g a -> f (g a)
Rank1.getCompose) g (Compose p p)
g

instance (Foldable g, Foldable h) => Foldable (Product g h) where
   foldMap :: forall m (p :: k -> *).
Monoid m =>
(forall (a :: k). p a -> m) -> Product g h p -> m
foldMap forall (a :: k). p a -> m
f (Pair g p
g h p
h) = forall {k} (g :: (k -> *) -> *) m (p :: k -> *).
(Foldable g, Monoid m) =>
(forall (a :: k). p a -> m) -> g p -> m
foldMap forall (a :: k). p a -> m
f g p
g forall a. Monoid a => a -> a -> a
`mappend` forall {k} (g :: (k -> *) -> *) m (p :: k -> *).
(Foldable g, Monoid m) =>
(forall (a :: k). p a -> m) -> g p -> m
foldMap forall (a :: k). p a -> m
f h p
h

instance (Foldable g, Foldable h) => Foldable (Sum g h) where
   foldMap :: forall m (p :: k -> *).
Monoid m =>
(forall (a :: k). p a -> m) -> Sum g h p -> m
foldMap forall (a :: k). p a -> m
f (InL g p
g) = forall {k} (g :: (k -> *) -> *) m (p :: k -> *).
(Foldable g, Monoid m) =>
(forall (a :: k). p a -> m) -> g p -> m
foldMap forall (a :: k). p a -> m
f g p
g
   foldMap forall (a :: k). p a -> m
f (InR h p
h) = forall {k} (g :: (k -> *) -> *) m (p :: k -> *).
(Foldable g, Monoid m) =>
(forall (a :: k). p a -> m) -> g p -> m
foldMap forall (a :: k). p a -> m
f h p
h

instance Foldable Generics.V1 where
   foldMap :: forall m (p :: k -> *).
Monoid m =>
(forall (a :: k). p a -> m) -> V1 p -> m
foldMap forall (a :: k). p a -> m
_ V1 p
v = case V1 p
v of {}
   
instance Foldable Generics.U1 where
   foldMap :: forall m (p :: k -> *).
Monoid m =>
(forall (a :: k). p a -> m) -> U1 p -> m
foldMap forall (a :: k). p a -> m
_ U1 p
_ = forall a. Monoid a => a
mempty

instance Foldable (Generics.K1 i c) where
   foldMap :: forall m (p :: k -> *).
Monoid m =>
(forall (a :: k). p a -> m) -> K1 i c p -> m
foldMap forall (a :: k). p a -> m
_ K1 i c p
_ = forall a. Monoid a => a
mempty

instance Foldable f => Foldable (Generics.M1 i c f) where
   foldMap :: forall m (p :: k -> *).
Monoid m =>
(forall (a :: k). p a -> m) -> M1 i c f p -> m
foldMap forall (a :: k). p a -> m
f (Generics.M1 f p
x) = forall {k} (g :: (k -> *) -> *) m (p :: k -> *).
(Foldable g, Monoid m) =>
(forall (a :: k). p a -> m) -> g p -> m
foldMap forall (a :: k). p a -> m
f f p
x

instance Foldable f => Foldable (Generics.Rec1 f) where
   foldMap :: forall m (p :: k -> *).
Monoid m =>
(forall (a :: k). p a -> m) -> Rec1 f p -> m
foldMap forall (a :: k). p a -> m
f (Generics.Rec1 f p
x) = forall {k} (g :: (k -> *) -> *) m (p :: k -> *).
(Foldable g, Monoid m) =>
(forall (a :: k). p a -> m) -> g p -> m
foldMap forall (a :: k). p a -> m
f f p
x

instance (Foldable f, Foldable g) => Foldable ((Generics.:+:) f g) where
   foldMap :: forall m (p :: k -> *).
Monoid m =>
(forall (a :: k). p a -> m) -> (:+:) f g p -> m
foldMap forall (a :: k). p a -> m
f (Generics.L1 f p
x) = forall {k} (g :: (k -> *) -> *) m (p :: k -> *).
(Foldable g, Monoid m) =>
(forall (a :: k). p a -> m) -> g p -> m
foldMap forall (a :: k). p a -> m
f f p
x
   foldMap forall (a :: k). p a -> m
f (Generics.R1 g p
x) = forall {k} (g :: (k -> *) -> *) m (p :: k -> *).
(Foldable g, Monoid m) =>
(forall (a :: k). p a -> m) -> g p -> m
foldMap forall (a :: k). p a -> m
f g p
x

instance (Foldable f, Foldable g) => Foldable ((Generics.:*:) f g) where
   foldMap :: forall m (p :: k -> *).
Monoid m =>
(forall (a :: k). p a -> m) -> (:*:) f g p -> m
foldMap forall (a :: k). p a -> m
f (f p
x Generics.:*: g p
y) = forall {k} (g :: (k -> *) -> *) m (p :: k -> *).
(Foldable g, Monoid m) =>
(forall (a :: k). p a -> m) -> g p -> m
foldMap forall (a :: k). p a -> m
f f p
x forall a. Monoid a => a -> a -> a
`mappend` forall {k} (g :: (k -> *) -> *) m (p :: k -> *).
(Foldable g, Monoid m) =>
(forall (a :: k). p a -> m) -> g p -> m
foldMap forall (a :: k). p a -> m
f g p
y

instance Traversable Empty where
   traverse :: forall (m :: * -> *) (p :: k -> *) (q :: k -> *).
Applicative m =>
(forall (a :: k). p a -> m (q a)) -> Empty p -> m (Empty q)
traverse forall (a :: k). p a -> m (q a)
_ Empty p
_ = forall (f :: * -> *) a. Applicative f => a -> f a
Rank1.pure forall {k} (f :: k). Empty f
Empty

instance Traversable Proxy where
   traverse :: forall (m :: * -> *) (p :: k -> *) (q :: k -> *).
Applicative m =>
(forall (a :: k). p a -> m (q a)) -> Proxy p -> m (Proxy q)
traverse forall (a :: k). p a -> m (q a)
_ Proxy p
_ = forall (f :: * -> *) a. Applicative f => a -> f a
Rank1.pure forall {k} (t :: k). Proxy t
Proxy

instance Traversable (Const x) where
   traverse :: forall (m :: * -> *) (p :: k -> *) (q :: k -> *).
Applicative m =>
(forall (a :: k). p a -> m (q a)) -> Const x p -> m (Const x q)
traverse forall (a :: k). p a -> m (q a)
_ (Const x
x) = forall (f :: * -> *) a. Applicative f => a -> f a
Rank1.pure (forall {k} a (b :: k). a -> Const a b
Const x
x)

instance Traversable (Only x) where
   traverse :: forall (m :: * -> *) (p :: k -> *) (q :: k -> *).
Applicative m =>
(forall (a :: k). p a -> m (q a)) -> Only x p -> m (Only x q)
traverse forall (a :: k). p a -> m (q a)
f (Only p x
x) = forall {k} (a :: k) (f :: k -> *). f a -> Only a f
Only forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Rank1.<$> forall (a :: k). p a -> m (q a)
f p x
x

instance Traversable g => Traversable (Identity g) where
   traverse :: forall (m :: * -> *) (p :: k -> *) (q :: k -> *).
Applicative m =>
(forall (a :: k). p a -> m (q a))
-> Identity g p -> m (Identity g q)
traverse forall (a :: k). p a -> m (q a)
f (Identity g p
g) = forall {k} (g :: k -> *) (f :: k). g f -> Identity g f
Identity forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Rank1.<$> forall {k} (g :: (k -> *) -> *) (m :: * -> *) (p :: k -> *)
       (q :: k -> *).
(Traversable g, Applicative m) =>
(forall (a :: k). p a -> m (q a)) -> g p -> m (g q)
traverse forall (a :: k). p a -> m (q a)
f g p
g

instance (Traversable g, Rank1.Traversable p) => Traversable (Compose g p) where
   traverse :: forall m q r. Rank1.Applicative m => (forall a. q a -> m (r a)) -> Compose g p q -> m (Compose g p r)
   traverse :: forall (m :: * -> *) (p :: k -> *) (q :: k -> *).
Applicative m =>
(forall (a :: k). p a -> m (q a))
-> Compose g p p -> m (Compose g p q)
traverse forall (a :: k). q a -> m (r a)
f (Compose g (Compose p q)
g) = forall {k1} {k} (g :: (k1 -> *) -> *) (p :: k -> *) (q :: k1 -> k).
g (Compose p q) -> Compose g p q
Compose forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Rank1.<$> forall {k} (g :: (k -> *) -> *) (m :: * -> *) (p :: k -> *)
       (q :: k -> *).
(Traversable g, Applicative m) =>
(forall (a :: k). p a -> m (q a)) -> g p -> m (g q)
traverse forall (a :: k). Compose p q a -> m (Compose p r a)
f' g (Compose p q)
g
      where f' :: forall a. Rank1.Compose p q a -> m (Rank1.Compose p r a)
            f' :: forall (a :: k). Compose p q a -> m (Compose p r a)
f' (Rank1.Compose p (q a)
q) = forall {k} {k1} (f :: k -> *) (g :: k1 -> k) (a :: k1).
f (g a) -> Compose f g a
Rank1.Compose forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Rank1.<$> forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
Rank1.traverse forall (a :: k). q a -> m (r a)
f p (q a)
q

instance (Traversable g, Traversable h) => Traversable (Product g h) where
   traverse :: forall (m :: * -> *) (p :: k -> *) (q :: k -> *).
Applicative m =>
(forall (a :: k). p a -> m (q a))
-> Product g h p -> m (Product g h q)
traverse forall (a :: k). p a -> m (q a)
f (Pair g p
g h p
h) = forall (f :: * -> *) a b c.
Applicative f =>
(a -> b -> c) -> f a -> f b -> f c
Rank1.liftA2 forall {k} (f :: k -> *) (g :: k -> *) (a :: k).
f a -> g a -> Product f g a
Pair (forall {k} (g :: (k -> *) -> *) (m :: * -> *) (p :: k -> *)
       (q :: k -> *).
(Traversable g, Applicative m) =>
(forall (a :: k). p a -> m (q a)) -> g p -> m (g q)
traverse forall (a :: k). p a -> m (q a)
f g p
g) (forall {k} (g :: (k -> *) -> *) (m :: * -> *) (p :: k -> *)
       (q :: k -> *).
(Traversable g, Applicative m) =>
(forall (a :: k). p a -> m (q a)) -> g p -> m (g q)
traverse forall (a :: k). p a -> m (q a)
f h p
h)

instance (Traversable g, Traversable h) => Traversable (Sum g h) where
   traverse :: forall (m :: * -> *) (p :: k -> *) (q :: k -> *).
Applicative m =>
(forall (a :: k). p a -> m (q a)) -> Sum g h p -> m (Sum g h q)
traverse forall (a :: k). p a -> m (q a)
f (InL g p
g) = forall {k} (f :: k -> *) (g :: k -> *) (a :: k). f a -> Sum f g a
InL forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Rank1.<$> forall {k} (g :: (k -> *) -> *) (m :: * -> *) (p :: k -> *)
       (q :: k -> *).
(Traversable g, Applicative m) =>
(forall (a :: k). p a -> m (q a)) -> g p -> m (g q)
traverse forall (a :: k). p a -> m (q a)
f g p
g
   traverse forall (a :: k). p a -> m (q a)
f (InR h p
h) = forall {k} (f :: k -> *) (g :: k -> *) (a :: k). g a -> Sum f g a
InR forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Rank1.<$> forall {k} (g :: (k -> *) -> *) (m :: * -> *) (p :: k -> *)
       (q :: k -> *).
(Traversable g, Applicative m) =>
(forall (a :: k). p a -> m (q a)) -> g p -> m (g q)
traverse forall (a :: k). p a -> m (q a)
f h p
h

instance Traversable Generics.V1 where
   traverse :: forall (m :: * -> *) (p :: k -> *) (q :: k -> *).
Applicative m =>
(forall (a :: k). p a -> m (q a)) -> V1 p -> m (V1 q)
traverse forall (a :: k). p a -> m (q a)
_ = forall (f :: * -> *) a. Applicative f => a -> f a
Rank1.pure forall b c a. (b -> c) -> (a -> b) -> a -> c
. coerce :: forall a b. Coercible a b => a -> b
coerce
   
instance Traversable Generics.U1 where
   traverse :: forall (m :: * -> *) (p :: k -> *) (q :: k -> *).
Applicative m =>
(forall (a :: k). p a -> m (q a)) -> U1 p -> m (U1 q)
traverse forall (a :: k). p a -> m (q a)
_ = forall (f :: * -> *) a. Applicative f => a -> f a
Rank1.pure forall b c a. (b -> c) -> (a -> b) -> a -> c
. coerce :: forall a b. Coercible a b => a -> b
coerce

instance Traversable (Generics.K1 i c) where
   traverse :: forall (m :: * -> *) (p :: k -> *) (q :: k -> *).
Applicative m =>
(forall (a :: k). p a -> m (q a)) -> K1 i c p -> m (K1 i c q)
traverse forall (a :: k). p a -> m (q a)
_ = forall (f :: * -> *) a. Applicative f => a -> f a
Rank1.pure forall b c a. (b -> c) -> (a -> b) -> a -> c
. coerce :: forall a b. Coercible a b => a -> b
coerce

instance Traversable f => Traversable (Generics.M1 i c f) where
   traverse :: forall (m :: * -> *) (p :: k -> *) (q :: k -> *).
Applicative m =>
(forall (a :: k). p a -> m (q a)) -> M1 i c f p -> m (M1 i c f q)
traverse forall (a :: k). p a -> m (q a)
f (Generics.M1 f p
x) = forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Rank1.fmap forall k i (c :: Meta) (f :: k -> *) (p :: k). f p -> M1 i c f p
Generics.M1 (forall {k} (g :: (k -> *) -> *) (m :: * -> *) (p :: k -> *)
       (q :: k -> *).
(Traversable g, Applicative m) =>
(forall (a :: k). p a -> m (q a)) -> g p -> m (g q)
traverse forall (a :: k). p a -> m (q a)
f f p
x)

instance Traversable f => Traversable (Generics.Rec1 f) where
   traverse :: forall (m :: * -> *) (p :: k -> *) (q :: k -> *).
Applicative m =>
(forall (a :: k). p a -> m (q a)) -> Rec1 f p -> m (Rec1 f q)
traverse forall (a :: k). p a -> m (q a)
f (Generics.Rec1 f p
x) = forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Rank1.fmap forall k (f :: k -> *) (p :: k). f p -> Rec1 f p
Generics.Rec1 (forall {k} (g :: (k -> *) -> *) (m :: * -> *) (p :: k -> *)
       (q :: k -> *).
(Traversable g, Applicative m) =>
(forall (a :: k). p a -> m (q a)) -> g p -> m (g q)
traverse forall (a :: k). p a -> m (q a)
f f p
x)

instance (Traversable f, Traversable g) => Traversable ((Generics.:+:) f g) where
   traverse :: forall (m :: * -> *) (p :: k -> *) (q :: k -> *).
Applicative m =>
(forall (a :: k). p a -> m (q a)) -> (:+:) f g p -> m ((:+:) f g q)
traverse forall (a :: k). p a -> m (q a)
f (Generics.L1 f p
x) = forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Rank1.fmap forall k (f :: k -> *) (g :: k -> *) (p :: k). f p -> (:+:) f g p
Generics.L1 (forall {k} (g :: (k -> *) -> *) (m :: * -> *) (p :: k -> *)
       (q :: k -> *).
(Traversable g, Applicative m) =>
(forall (a :: k). p a -> m (q a)) -> g p -> m (g q)
traverse forall (a :: k). p a -> m (q a)
f f p
x)
   traverse forall (a :: k). p a -> m (q a)
f (Generics.R1 g p
x) = forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Rank1.fmap forall k (f :: k -> *) (g :: k -> *) (p :: k). g p -> (:+:) f g p
Generics.R1 (forall {k} (g :: (k -> *) -> *) (m :: * -> *) (p :: k -> *)
       (q :: k -> *).
(Traversable g, Applicative m) =>
(forall (a :: k). p a -> m (q a)) -> g p -> m (g q)
traverse forall (a :: k). p a -> m (q a)
f g p
x)

instance (Traversable f, Traversable g) => Traversable ((Generics.:*:) f g) where
   traverse :: forall (m :: * -> *) (p :: k -> *) (q :: k -> *).
Applicative m =>
(forall (a :: k). p a -> m (q a)) -> (:*:) f g p -> m ((:*:) f g q)
traverse forall (a :: k). p a -> m (q a)
f (f p
x Generics.:*: g p
y) = forall (f :: * -> *) a b c.
Applicative f =>
(a -> b -> c) -> f a -> f b -> f c
Rank1.liftA2 forall k (f :: k -> *) (g :: k -> *) (p :: k).
f p -> g p -> (:*:) f g p
(Generics.:*:) (forall {k} (g :: (k -> *) -> *) (m :: * -> *) (p :: k -> *)
       (q :: k -> *).
(Traversable g, Applicative m) =>
(forall (a :: k). p a -> m (q a)) -> g p -> m (g q)
traverse forall (a :: k). p a -> m (q a)
f f p
x) (forall {k} (g :: (k -> *) -> *) (m :: * -> *) (p :: k -> *)
       (q :: k -> *).
(Traversable g, Applicative m) =>
(forall (a :: k). p a -> m (q a)) -> g p -> m (g q)
traverse forall (a :: k). p a -> m (q a)
f g p
y)

instance Apply Empty where
   Empty (p ~> q)
_ <*> :: forall (p :: k -> *) (q :: k -> *).
Empty (p ~> q) -> Empty p -> Empty q
<*> Empty p
_ = forall {k} (f :: k). Empty f
Empty
   liftA2 :: forall (p :: k -> *) (q :: k -> *) (r :: k -> *).
(forall (a :: k). p a -> q a -> r a)
-> Empty p -> Empty q -> Empty r
liftA2 forall (a :: k). p a -> q a -> r a
_ Empty p
_ Empty q
_ = forall {k} (f :: k). Empty f
Empty

instance Apply Proxy where
   Proxy (p ~> q)
_ <*> :: forall (p :: k -> *) (q :: k -> *).
Proxy (p ~> q) -> Proxy p -> Proxy q
<*> Proxy p
_ = forall {k} (t :: k). Proxy t
Proxy
   liftA2 :: forall (p :: k -> *) (q :: k -> *) (r :: k -> *).
(forall (a :: k). p a -> q a -> r a)
-> Proxy p -> Proxy q -> Proxy r
liftA2 forall (a :: k). p a -> q a -> r a
_ Proxy p
_ Proxy q
_ = forall {k} (t :: k). Proxy t
Proxy

instance Semigroup x => Apply (Const x) where
   Const x
x <*> :: forall (p :: k -> *) (q :: k -> *).
Const x (p ~> q) -> Const x p -> Const x q
<*> Const x
y = forall {k} a (b :: k). a -> Const a b
Const (x
x forall a. Semigroup a => a -> a -> a
<> x
y)
   liftA2 :: forall (p :: k -> *) (q :: k -> *) (r :: k -> *).
(forall (a :: k). p a -> q a -> r a)
-> Const x p -> Const x q -> Const x r
liftA2 forall (a :: k). p a -> q a -> r a
_ (Const x
x) (Const x
y) = forall {k} a (b :: k). a -> Const a b
Const (x
x forall a. Semigroup a => a -> a -> a
<> x
y)

instance Apply (Only x) where
   Only (~>) p q x
f <*> :: forall (p :: k -> *) (q :: k -> *).
Only x (p ~> q) -> Only x p -> Only x q
<*> Only p x
x = forall {k} (a :: k) (f :: k -> *). f a -> Only a f
Only (forall {k} (p :: k -> *) (q :: k -> *) (a :: k).
Arrow p q a -> p a -> q a
apply (~>) p q x
f p x
x)
   liftA2 :: forall (p :: k -> *) (q :: k -> *) (r :: k -> *).
(forall (a :: k). p a -> q a -> r a)
-> Only x p -> Only x q -> Only x r
liftA2 forall (a :: k). p a -> q a -> r a
f (Only p x
x) (Only q x
y) = forall {k} (a :: k) (f :: k -> *). f a -> Only a f
Only (forall (a :: k). p a -> q a -> r a
f p x
x q x
y)

instance Apply g => Apply (Identity g) where
   Identity g (p ~> q)
g <*> :: forall (p :: k -> *) (q :: k -> *).
Identity g (p ~> q) -> Identity g p -> Identity g q
<*> Identity g p
h = forall {k} (g :: k -> *) (f :: k). g f -> Identity g f
Identity (g (p ~> q)
g forall {k} (g :: (k -> *) -> *) (p :: k -> *) (q :: k -> *).
Apply g =>
g (p ~> q) -> g p -> g q
<*> g p
h)
   liftA2 :: forall (p :: k -> *) (q :: k -> *) (r :: k -> *).
(forall (a :: k). p a -> q a -> r a)
-> Identity g p -> Identity g q -> Identity g r
liftA2 forall (a :: k). p a -> q a -> r a
f (Identity g p
g) (Identity g q
h) = forall {k} (g :: k -> *) (f :: k). g f -> Identity g f
Identity (forall {k} (g :: (k -> *) -> *) (p :: k -> *) (q :: k -> *)
       (r :: k -> *).
Apply g =>
(forall (a :: k). p a -> q a -> r a) -> g p -> g q -> g r
liftA2 forall (a :: k). p a -> q a -> r a
f g p
g g q
h)

instance (Apply g, Rank1.Applicative p) => Apply (Compose g p) where
   (<*>)  :: forall q r. Compose g p (q ~> r) -> Compose g p q -> Compose g p r
   liftA2 :: forall q r s. (forall a. q a -> r a -> s a) -> Compose g p q -> Compose g p r -> Compose g p s
   Compose g (Compose p (q ~> r))
g <*> :: forall (p :: k -> *) (q :: k -> *).
Compose g p (p ~> q) -> Compose g p p -> Compose g p q
<*> Compose g (Compose p q)
h = forall {k1} {k} (g :: (k1 -> *) -> *) (p :: k -> *) (q :: k1 -> k).
g (Compose p q) -> Compose g p q
Compose (forall {k} (g :: (k -> *) -> *) (p :: k -> *) (q :: k -> *)
       (r :: k -> *).
Apply g =>
(forall (a :: k). p a -> q a -> r a) -> g p -> g q -> g r
liftA2 forall (a :: k).
Compose p (q ~> r) a -> Compose p q a -> Compose p r a
f' g (Compose p (q ~> r))
g g (Compose p q)
h)
      where f' :: forall a. Rank1.Compose p (q ~> r) a -> Rank1.Compose p q a -> Rank1.Compose p r a
            f' :: forall (a :: k).
Compose p (q ~> r) a -> Compose p q a -> Compose p r a
f' (Rank1.Compose p ((~>) q r a)
f) (Rank1.Compose p (q a)
q) = forall {k} {k1} (f :: k -> *) (g :: k1 -> k) (a :: k1).
f (g a) -> Compose f g a
Rank1.Compose (forall (f :: * -> *) a b c.
Applicative f =>
(a -> b -> c) -> f a -> f b -> f c
Rank1.liftA2 forall {k} (p :: k -> *) (q :: k -> *) (a :: k).
Arrow p q a -> p a -> q a
apply p ((~>) q r a)
f p (q a)
q)
   liftA2 :: forall (p :: k -> *) (q :: k -> *) (r :: k -> *).
(forall (a :: k). p a -> q a -> r a)
-> Compose g p p -> Compose g p q -> Compose g p r
liftA2 forall (a :: k). q a -> r a -> s a
f (Compose g (Compose p q)
g) (Compose g (Compose p r)
h) = forall {k1} {k} (g :: (k1 -> *) -> *) (p :: k -> *) (q :: k1 -> k).
g (Compose p q) -> Compose g p q
Compose (forall {k} (g :: (k -> *) -> *) (p :: k -> *) (q :: k -> *)
       (r :: k -> *).
Apply g =>
(forall (a :: k). p a -> q a -> r a) -> g p -> g q -> g r
liftA2 forall (a :: k). Compose p q a -> Compose p r a -> Compose p s a
f' g (Compose p q)
g g (Compose p r)
h)
      where f' :: forall a. Rank1.Compose p q a -> Rank1.Compose p r a -> Rank1.Compose p s a
            f' :: forall (a :: k). Compose p q a -> Compose p r a -> Compose p s a
f' (Rank1.Compose p (q a)
q) (Rank1.Compose p (r a)
r) = forall {k} {k1} (f :: k -> *) (g :: k1 -> k) (a :: k1).
f (g a) -> Compose f g a
Rank1.Compose (forall (f :: * -> *) a b c.
Applicative f =>
(a -> b -> c) -> f a -> f b -> f c
Rank1.liftA2 forall (a :: k). q a -> r a -> s a
f p (q a)
q p (r a)
r)

instance (Apply g, Apply h) => Apply (Product g h) where
   Pair g (p ~> q)
gf h (p ~> q)
hf <*> :: forall (p :: k -> *) (q :: k -> *).
Product g h (p ~> q) -> Product g h p -> Product g h q
<*> ~(Pair g p
gx h p
hx) = forall {k} (f :: k -> *) (g :: k -> *) (a :: k).
f a -> g a -> Product f g a
Pair (g (p ~> q)
gf forall {k} (g :: (k -> *) -> *) (p :: k -> *) (q :: k -> *).
Apply g =>
g (p ~> q) -> g p -> g q
<*> g p
gx) (h (p ~> q)
hf forall {k} (g :: (k -> *) -> *) (p :: k -> *) (q :: k -> *).
Apply g =>
g (p ~> q) -> g p -> g q
<*> h p
hx)
   liftA2 :: forall (p :: k -> *) (q :: k -> *) (r :: k -> *).
(forall (a :: k). p a -> q a -> r a)
-> Product g h p -> Product g h q -> Product g h r
liftA2 forall (a :: k). p a -> q a -> r a
f (Pair g p
g1 h p
h1) ~(Pair g q
g2 h q
h2) = forall {k} (f :: k -> *) (g :: k -> *) (a :: k).
f a -> g a -> Product f g a
Pair (forall {k} (g :: (k -> *) -> *) (p :: k -> *) (q :: k -> *)
       (r :: k -> *).
Apply g =>
(forall (a :: k). p a -> q a -> r a) -> g p -> g q -> g r
liftA2 forall (a :: k). p a -> q a -> r a
f g p
g1 g q
g2) (forall {k} (g :: (k -> *) -> *) (p :: k -> *) (q :: k -> *)
       (r :: k -> *).
Apply g =>
(forall (a :: k). p a -> q a -> r a) -> g p -> g q -> g r
liftA2 forall (a :: k). p a -> q a -> r a
f h p
h1 h q
h2)
   liftA3 :: forall (p :: k -> *) (q :: k -> *) (r :: k -> *) (s :: k -> *).
(forall (a :: k). p a -> q a -> r a -> s a)
-> Product g h p -> Product g h q -> Product g h r -> Product g h s
liftA3 forall (a :: k). p a -> q a -> r a -> s a
f (Pair g p
g1 h p
h1) ~(Pair g q
g2 h q
h2) ~(Pair g r
g3 h r
h3) = forall {k} (f :: k -> *) (g :: k -> *) (a :: k).
f a -> g a -> Product f g a
Pair (forall {k} (g :: (k -> *) -> *) (p :: k -> *) (q :: k -> *)
       (r :: k -> *) (s :: k -> *).
Apply g =>
(forall (a :: k). p a -> q a -> r a -> s a)
-> g p -> g q -> g r -> g s
liftA3 forall (a :: k). p a -> q a -> r a -> s a
f g p
g1 g q
g2 g r
g3) (forall {k} (g :: (k -> *) -> *) (p :: k -> *) (q :: k -> *)
       (r :: k -> *) (s :: k -> *).
Apply g =>
(forall (a :: k). p a -> q a -> r a -> s a)
-> g p -> g q -> g r -> g s
liftA3 forall (a :: k). p a -> q a -> r a -> s a
f h p
h1 h q
h2 h r
h3)

instance Apply Generics.V1 where
   <*> :: forall (p :: k -> *) (q :: k -> *). V1 (p ~> q) -> V1 p -> V1 q
(<*>) V1 (p ~> q)
_ = coerce :: forall a b. Coercible a b => a -> b
coerce
   
instance Apply Generics.U1 where
   <*> :: forall (p :: k -> *) (q :: k -> *). U1 (p ~> q) -> U1 p -> U1 q
(<*>) U1 (p ~> q)
_ = coerce :: forall a b. Coercible a b => a -> b
coerce

instance Semigroup c => Apply (Generics.K1 i c) where
   Generics.K1 c
x <*> :: forall (p :: k -> *) (q :: k -> *).
K1 i c (p ~> q) -> K1 i c p -> K1 i c q
<*> Generics.K1 c
y = forall k i c (p :: k). c -> K1 i c p
Generics.K1 (c
x forall a. Semigroup a => a -> a -> a
<> c
y)

instance Apply f => Apply (Generics.M1 i c f) where
   Generics.M1 f (p ~> q)
f <*> :: forall (p :: k -> *) (q :: k -> *).
M1 i c f (p ~> q) -> M1 i c f p -> M1 i c f q
<*> Generics.M1 f p
x = forall k i (c :: Meta) (f :: k -> *) (p :: k). f p -> M1 i c f p
Generics.M1 (f (p ~> q)
f forall {k} (g :: (k -> *) -> *) (p :: k -> *) (q :: k -> *).
Apply g =>
g (p ~> q) -> g p -> g q
<*> f p
x)

instance Apply f => Apply (Generics.Rec1 f) where
   Generics.Rec1 f (p ~> q)
f <*> :: forall (p :: k -> *) (q :: k -> *).
Rec1 f (p ~> q) -> Rec1 f p -> Rec1 f q
<*> Generics.Rec1 f p
x = forall k (f :: k -> *) (p :: k). f p -> Rec1 f p
Generics.Rec1 (f (p ~> q)
f forall {k} (g :: (k -> *) -> *) (p :: k -> *) (q :: k -> *).
Apply g =>
g (p ~> q) -> g p -> g q
<*> f p
x)

instance (Apply f, Apply g) => Apply ((Generics.:*:) f g) where
   (f (p ~> q)
x1 Generics.:*: g (p ~> q)
y1) <*> :: forall (p :: k -> *) (q :: k -> *).
(:*:) f g (p ~> q) -> (:*:) f g p -> (:*:) f g q
<*> (f p
x2 Generics.:*: g p
y2) = (f (p ~> q)
x1 forall {k} (g :: (k -> *) -> *) (p :: k -> *) (q :: k -> *).
Apply g =>
g (p ~> q) -> g p -> g q
<*> f p
x2) forall k (f :: k -> *) (g :: k -> *) (p :: k).
f p -> g p -> (:*:) f g p
Generics.:*: (g (p ~> q)
y1 forall {k} (g :: (k -> *) -> *) (p :: k -> *) (q :: k -> *).
Apply g =>
g (p ~> q) -> g p -> g q
<*> g p
y2)

instance Applicative Empty where
   pure :: forall (f :: k -> *). (forall (a :: k). f a) -> Empty f
pure forall (a :: k). f a
_ = forall {k} (f :: k). Empty f
Empty

instance Applicative Proxy where
   pure :: forall (f :: k -> *). (forall (a :: k). f a) -> Proxy f
pure forall (a :: k). f a
_ = forall {k} (t :: k). Proxy t
Proxy

instance (Semigroup x, Monoid x) => Applicative (Const x) where
   pure :: forall (f :: k -> *). (forall (a :: k). f a) -> Const x f
pure forall (a :: k). f a
_ = forall {k} a (b :: k). a -> Const a b
Const forall a. Monoid a => a
mempty

instance Applicative (Only x) where
   pure :: forall (f :: k -> *). (forall (a :: k). f a) -> Only x f
pure forall (a :: k). f a
f = forall {k} (a :: k) (f :: k -> *). f a -> Only a f
Only forall (a :: k). f a
f

instance Applicative g => Applicative (Identity g) where
   pure :: forall (f :: k -> *). (forall (a :: k). f a) -> Identity g f
pure forall (a :: k). f a
f = forall {k} (g :: k -> *) (f :: k). g f -> Identity g f
Identity (forall {k} (g :: (k -> *) -> *) (f :: k -> *).
Applicative g =>
(forall (a :: k). f a) -> g f
pure forall (a :: k). f a
f)

instance (Applicative g, Rank1.Applicative p) => Applicative (Compose g p) where
   pure :: forall (f :: k -> *). (forall (a :: k). f a) -> Compose g p f
pure forall (a :: k). f a
f = forall {k1} {k} (g :: (k1 -> *) -> *) (p :: k -> *) (q :: k1 -> k).
g (Compose p q) -> Compose g p q
Compose (forall {k} (g :: (k -> *) -> *) (f :: k -> *).
Applicative g =>
(forall (a :: k). f a) -> g f
pure (forall {k} {k1} (f :: k -> *) (g :: k1 -> k) (a :: k1).
f (g a) -> Compose f g a
Rank1.Compose (forall (f :: * -> *) a. Applicative f => a -> f a
Rank1.pure forall (a :: k). f a
f)))

instance (Applicative g, Applicative h) => Applicative (Product g h) where
   pure :: forall (f :: k -> *). (forall (a :: k). f a) -> Product g h f
pure forall (a :: k). f a
f = forall {k} (f :: k -> *) (g :: k -> *) (a :: k).
f a -> g a -> Product f g a
Pair (forall {k} (g :: (k -> *) -> *) (f :: k -> *).
Applicative g =>
(forall (a :: k). f a) -> g f
pure forall (a :: k). f a
f) (forall {k} (g :: (k -> *) -> *) (f :: k -> *).
Applicative g =>
(forall (a :: k). f a) -> g f
pure forall (a :: k). f a
f)

instance (Semigroup c, Monoid c) => Applicative (Generics.K1 i c) where
   pure :: forall (f :: k -> *). (forall (a :: k). f a) -> K1 i c f
pure forall (a :: k). f a
_ = forall k i c (p :: k). c -> K1 i c p
Generics.K1 forall a. Monoid a => a
mempty

instance Applicative f => Applicative (Generics.M1 i c f) where
   pure :: forall (f :: k -> *). (forall (a :: k). f a) -> M1 i c f f
pure forall (a :: k). f a
f = forall k i (c :: Meta) (f :: k -> *) (p :: k). f p -> M1 i c f p
Generics.M1 (forall {k} (g :: (k -> *) -> *) (f :: k -> *).
Applicative g =>
(forall (a :: k). f a) -> g f
pure forall (a :: k). f a
f)

instance Applicative f => Applicative (Generics.Rec1 f) where
   pure :: forall (f :: k -> *). (forall (a :: k). f a) -> Rec1 f f
pure forall (a :: k). f a
f = forall k (f :: k -> *) (p :: k). f p -> Rec1 f p
Generics.Rec1 (forall {k} (g :: (k -> *) -> *) (f :: k -> *).
Applicative g =>
(forall (a :: k). f a) -> g f
pure forall (a :: k). f a
f)

instance (Applicative f, Applicative g) => Applicative ((Generics.:*:) f g) where
   pure :: forall (f :: k -> *). (forall (a :: k). f a) -> (:*:) f g f
pure forall (a :: k). f a
f = forall {k} (g :: (k -> *) -> *) (f :: k -> *).
Applicative g =>
(forall (a :: k). f a) -> g f
pure forall (a :: k). f a
f forall k (f :: k -> *) (g :: k -> *) (p :: k).
f p -> g p -> (:*:) f g p
Generics.:*: forall {k} (g :: (k -> *) -> *) (f :: k -> *).
Applicative g =>
(forall (a :: k). f a) -> g f
pure forall (a :: k). f a
f
   
instance DistributiveTraversable Empty
instance DistributiveTraversable Proxy
instance DistributiveTraversable (Only x)
instance DistributiveTraversable g => DistributiveTraversable (Identity g) where
   cotraverseTraversable :: forall (f1 :: * -> *) (f2 :: k -> *) (f :: k -> *).
Traversable f1 =>
(forall (x :: k). f1 (f2 x) -> f x)
-> f1 (Identity g f2) -> Identity g f
cotraverseTraversable forall (x :: k). f1 (f2 x) -> f x
w f1 (Identity g f2)
f = forall {k} (g :: k -> *) (f :: k). g f -> Identity g f
Identity (forall k (g :: (k -> *) -> *) (f1 :: * -> *) (f2 :: k -> *)
       (f :: k -> *).
(DistributiveTraversable g, Traversable f1) =>
(forall (x :: k). f1 (f2 x) -> f x) -> f1 (g f2) -> g f
cotraverseTraversable forall (x :: k). f1 (f2 x) -> f x
w (forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Rank1.fmap forall {k} (g :: k -> *) (f :: k). Identity g f -> g f
runIdentity f1 (Identity g f2)
f))
instance (DistributiveTraversable g, Rank1.Distributive p) => DistributiveTraversable (Compose g p) where
   cotraverseTraversable :: forall (f1 :: * -> *) (f2 :: k -> *) (f :: k -> *).
Traversable f1 =>
(forall (x :: k). f1 (f2 x) -> f x)
-> f1 (Compose g p f2) -> Compose g p f
cotraverseTraversable forall (x :: k). f1 (f2 x) -> f x
w f1 (Compose g p f2)
f = forall {k1} {k} (g :: (k1 -> *) -> *) (p :: k -> *) (q :: k1 -> k).
g (Compose p q) -> Compose g p q
Compose (forall k (g :: (k -> *) -> *) (f1 :: * -> *) (f2 :: k -> *)
       (f :: k -> *).
(DistributiveTraversable g, Traversable f1) =>
(forall (x :: k). f1 (f2 x) -> f x) -> f1 (g f2) -> g f
cotraverseTraversable
                                        (forall {k} {k1} (f :: k -> *) (g :: k1 -> k) (a :: k1).
f (g a) -> Compose f g a
Rank1.Compose forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Rank1.fmap forall (x :: k). f1 (f2 x) -> f x
w forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (g :: * -> *) (f :: * -> *) a.
(Distributive g, Functor f) =>
f (g a) -> g (f a)
Rank1.distribute forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Rank1.fmap forall {k1} {k2} (f :: k1 -> *) (g :: k2 -> k1) (a :: k2).
Compose f g a -> f (g a)
Rank1.getCompose)
                                        (forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Rank1.fmap forall {k1} {k} (g :: (k1 -> *) -> *) (p :: k -> *) (q :: k1 -> k).
Compose g p q -> g (Compose p q)
getCompose f1 (Compose g p f2)
f))
instance (DistributiveTraversable g, DistributiveTraversable h) => DistributiveTraversable (Product g h) where
   cotraverseTraversable :: forall (f1 :: * -> *) (f2 :: k -> *) (f :: k -> *).
Traversable f1 =>
(forall (x :: k). f1 (f2 x) -> f x)
-> f1 (Product g h f2) -> Product g h f
cotraverseTraversable forall (x :: k). f1 (f2 x) -> f x
w f1 (Product g h f2)
f = forall {k} (f :: k -> *) (g :: k -> *) (a :: k).
f a -> g a -> Product f g a
Pair (forall k (g :: (k -> *) -> *) (f1 :: * -> *) (f2 :: k -> *)
       (f :: k -> *).
(DistributiveTraversable g, Traversable f1) =>
(forall (x :: k). f1 (f2 x) -> f x) -> f1 (g f2) -> g f
cotraverseTraversable forall (x :: k). f1 (f2 x) -> f x
w (forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Rank1.fmap forall {k} (g :: k -> *) (h :: k -> *) (p :: k).
Product g h p -> g p
fst f1 (Product g h f2)
f))
                                    (forall k (g :: (k -> *) -> *) (f1 :: * -> *) (f2 :: k -> *)
       (f :: k -> *).
(DistributiveTraversable g, Traversable f1) =>
(forall (x :: k). f1 (f2 x) -> f x) -> f1 (g f2) -> g f
cotraverseTraversable forall (x :: k). f1 (f2 x) -> f x
w (forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Rank1.fmap forall {k} (g :: k -> *) (h :: k -> *) (p :: k).
Product g h p -> h p
snd f1 (Product g h f2)
f))

instance DistributiveTraversable f => DistributiveTraversable (Generics.M1 i c f) where
   cotraverseTraversable :: forall (f1 :: * -> *) (f2 :: k -> *) (f :: k -> *).
Traversable f1 =>
(forall (x :: k). f1 (f2 x) -> f x)
-> f1 (M1 i c f f2) -> M1 i c f f
cotraverseTraversable forall (x :: k). f1 (f2 x) -> f x
w f1 (M1 i c f f2)
f = forall k i (c :: Meta) (f :: k -> *) (p :: k). f p -> M1 i c f p
Generics.M1 (forall k (g :: (k -> *) -> *) (f1 :: * -> *) (f2 :: k -> *)
       (f :: k -> *).
(DistributiveTraversable g, Traversable f1) =>
(forall (x :: k). f1 (f2 x) -> f x) -> f1 (g f2) -> g f
cotraverseTraversable forall (x :: k). f1 (f2 x) -> f x
w (forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Rank1.fmap forall k i (c :: Meta) (f :: k -> *) (p :: k). M1 i c f p -> f p
Generics.unM1 f1 (M1 i c f f2)
f))
instance DistributiveTraversable f => DistributiveTraversable (Generics.Rec1 f) where
   cotraverseTraversable :: forall (f1 :: * -> *) (f2 :: k -> *) (f :: k -> *).
Traversable f1 =>
(forall (x :: k). f1 (f2 x) -> f x) -> f1 (Rec1 f f2) -> Rec1 f f
cotraverseTraversable forall (x :: k). f1 (f2 x) -> f x
w f1 (Rec1 f f2)
f = forall k (f :: k -> *) (p :: k). f p -> Rec1 f p
Generics.Rec1 (forall k (g :: (k -> *) -> *) (f1 :: * -> *) (f2 :: k -> *)
       (f :: k -> *).
(DistributiveTraversable g, Traversable f1) =>
(forall (x :: k). f1 (f2 x) -> f x) -> f1 (g f2) -> g f
cotraverseTraversable forall (x :: k). f1 (f2 x) -> f x
w (forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Rank1.fmap forall k (f :: k -> *) (p :: k). Rec1 f p -> f p
Generics.unRec1 f1 (Rec1 f f2)
f))
instance (DistributiveTraversable f, DistributiveTraversable g) => DistributiveTraversable ((Generics.:*:) f g) where
   cotraverseTraversable :: forall (f1 :: * -> *) (f2 :: k -> *) (f :: k -> *).
Traversable f1 =>
(forall (x :: k). f1 (f2 x) -> f x)
-> f1 ((:*:) f g f2) -> (:*:) f g f
cotraverseTraversable forall (x :: k). f1 (f2 x) -> f x
w f1 ((:*:) f g f2)
f = forall k (g :: (k -> *) -> *) (f1 :: * -> *) (f2 :: k -> *)
       (f :: k -> *).
(DistributiveTraversable g, Traversable f1) =>
(forall (x :: k). f1 (f2 x) -> f x) -> f1 (g f2) -> g f
cotraverseTraversable forall (x :: k). f1 (f2 x) -> f x
w (forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Rank1.fmap (\(f f2
a Generics.:*: g f2
_) -> f f2
a) f1 ((:*:) f g f2)
f) forall k (f :: k -> *) (g :: k -> *) (p :: k).
f p -> g p -> (:*:) f g p
Generics.:*: forall k (g :: (k -> *) -> *) (f1 :: * -> *) (f2 :: k -> *)
       (f :: k -> *).
(DistributiveTraversable g, Traversable f1) =>
(forall (x :: k). f1 (f2 x) -> f x) -> f1 (g f2) -> g f
cotraverseTraversable forall (x :: k). f1 (f2 x) -> f x
w (forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Rank1.fmap (\(f f2
_ Generics.:*: g f2
b) -> g f2
b) f1 ((:*:) f g f2)
f)

instance Distributive Empty where
   cotraverse :: forall (m :: * -> *) (p :: k1 -> *) (q :: k1 -> *).
Functor m =>
(forall (a :: k1). m (p a) -> q a) -> m (Empty p) -> Empty q
cotraverse forall (a :: k1). m (p a) -> q a
_ m (Empty p)
_ = forall {k} (f :: k). Empty f
Empty

instance Distributive Proxy where
   cotraverse :: forall (m :: * -> *) (p :: k1 -> *) (q :: k1 -> *).
Functor m =>
(forall (a :: k1). m (p a) -> q a) -> m (Proxy p) -> Proxy q
cotraverse forall (a :: k1). m (p a) -> q a
_ m (Proxy p)
_ = forall {k} (t :: k). Proxy t
Proxy

instance Monoid x => DistributiveTraversable (Const x) where
   cotraverseTraversable :: forall (f1 :: * -> *) (f2 :: k -> *) (f :: k -> *).
Traversable f1 =>
(forall (x :: k). f1 (f2 x) -> f x) -> f1 (Const x f2) -> Const x f
cotraverseTraversable forall (x :: k). f1 (f2 x) -> f x
_ f1 (Const x f2)
f = coerce :: forall a b. Coercible a b => a -> b
coerce (forall (t :: * -> *) m. (Foldable t, Monoid m) => t m -> m
Rank1.fold f1 (Const x f2)
f)

instance Distributive (Only x) where
   cotraverse :: forall (m :: * -> *) (p :: k1 -> *) (q :: k1 -> *).
Functor m =>
(forall (a :: k1). m (p a) -> q a) -> m (Only x p) -> Only x q
cotraverse forall (a :: k1). m (p a) -> q a
w m (Only x p)
f = forall {k} (a :: k) (f :: k -> *). f a -> Only a f
Only (forall (a :: k1). m (p a) -> q a
w (forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Rank1.fmap forall {k} (a :: k) (f :: k -> *). Only a f -> f a
fromOnly m (Only x p)
f))

instance Distributive g => Distributive (Identity g) where
   cotraverse :: forall (m :: * -> *) (p :: k1 -> *) (q :: k1 -> *).
Functor m =>
(forall (a :: k1). m (p a) -> q a)
-> m (Identity g p) -> Identity g q
cotraverse forall (a :: k1). m (p a) -> q a
w m (Identity g p)
f = forall {k} (g :: k -> *) (f :: k). g f -> Identity g f
Identity (forall {k1} (g :: (k1 -> *) -> *) (m :: * -> *) (p :: k1 -> *)
       (q :: k1 -> *).
(Distributive g, Functor m) =>
(forall (a :: k1). m (p a) -> q a) -> m (g p) -> g q
cotraverse forall (a :: k1). m (p a) -> q a
w (forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Rank1.fmap forall {k} (g :: k -> *) (f :: k). Identity g f -> g f
runIdentity m (Identity g p)
f))

instance (Distributive g, Rank1.Distributive p) => Distributive (Compose g p) where
   cotraverse :: forall (m :: * -> *) (p :: k1 -> *) (q :: k1 -> *).
Functor m =>
(forall (a :: k1). m (p a) -> q a)
-> m (Compose g p p) -> Compose g p q
cotraverse forall (a :: k1). m (p a) -> q a
w m (Compose g p p)
f = forall {k1} {k} (g :: (k1 -> *) -> *) (p :: k -> *) (q :: k1 -> k).
g (Compose p q) -> Compose g p q
Compose (forall {k1} (g :: (k1 -> *) -> *) (m :: * -> *) (p :: k1 -> *)
       (q :: k1 -> *).
(Distributive g, Functor m) =>
(forall (a :: k1). m (p a) -> q a) -> m (g p) -> g q
cotraverse (forall {k} {k1} (f :: k -> *) (g :: k1 -> k) (a :: k1).
f (g a) -> Compose f g a
Rank1.Compose forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Rank1.fmap forall (a :: k1). m (p a) -> q a
w forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (g :: * -> *) (f :: * -> *) a.
(Distributive g, Functor f) =>
f (g a) -> g (f a)
Rank1.distribute forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Rank1.fmap forall {k1} {k2} (f :: k1 -> *) (g :: k2 -> k1) (a :: k2).
Compose f g a -> f (g a)
Rank1.getCompose)
                                        (forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Rank1.fmap forall {k1} {k} (g :: (k1 -> *) -> *) (p :: k -> *) (q :: k1 -> k).
Compose g p q -> g (Compose p q)
getCompose m (Compose g p p)
f))

instance (Distributive g, Distributive h) => Distributive (Product g h) where
   cotraverse :: forall (m :: * -> *) (p :: k1 -> *) (q :: k1 -> *).
Functor m =>
(forall (a :: k1). m (p a) -> q a)
-> m (Product g h p) -> Product g h q
cotraverse forall (a :: k1). m (p a) -> q a
w m (Product g h p)
f = forall {k} (f :: k -> *) (g :: k -> *) (a :: k).
f a -> g a -> Product f g a
Pair (forall {k1} (g :: (k1 -> *) -> *) (m :: * -> *) (p :: k1 -> *)
       (q :: k1 -> *).
(Distributive g, Functor m) =>
(forall (a :: k1). m (p a) -> q a) -> m (g p) -> g q
cotraverse forall (a :: k1). m (p a) -> q a
w (forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Rank1.fmap forall {k} (g :: k -> *) (h :: k -> *) (p :: k).
Product g h p -> g p
fst m (Product g h p)
f)) (forall {k1} (g :: (k1 -> *) -> *) (m :: * -> *) (p :: k1 -> *)
       (q :: k1 -> *).
(Distributive g, Functor m) =>
(forall (a :: k1). m (p a) -> q a) -> m (g p) -> g q
cotraverse forall (a :: k1). m (p a) -> q a
w (forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Rank1.fmap forall {k} (g :: k -> *) (h :: k -> *) (p :: k).
Product g h p -> h p
snd m (Product g h p)
f))

instance Monoid c => DistributiveTraversable (Generics.K1 i c) where
   cotraverseTraversable :: forall (f1 :: * -> *) (f2 :: k -> *) (f :: k -> *).
Traversable f1 =>
(forall (x :: k). f1 (f2 x) -> f x) -> f1 (K1 i c f2) -> K1 i c f
cotraverseTraversable forall (x :: k). f1 (f2 x) -> f x
_ f1 (K1 i c f2)
f = coerce :: forall a b. Coercible a b => a -> b
coerce (forall (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
Rank1.foldMap forall k i c (p :: k). K1 i c p -> c
Generics.unK1 f1 (K1 i c f2)
f)

instance Distributive f => Distributive (Generics.M1 i c f) where
   cotraverse :: forall (m :: * -> *) (p :: k1 -> *) (q :: k1 -> *).
Functor m =>
(forall (a :: k1). m (p a) -> q a) -> m (M1 i c f p) -> M1 i c f q
cotraverse forall (a :: k1). m (p a) -> q a
w m (M1 i c f p)
f = forall k i (c :: Meta) (f :: k -> *) (p :: k). f p -> M1 i c f p
Generics.M1 (forall {k1} (g :: (k1 -> *) -> *) (m :: * -> *) (p :: k1 -> *)
       (q :: k1 -> *).
(Distributive g, Functor m) =>
(forall (a :: k1). m (p a) -> q a) -> m (g p) -> g q
cotraverse forall (a :: k1). m (p a) -> q a
w (forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Rank1.fmap forall k i (c :: Meta) (f :: k -> *) (p :: k). M1 i c f p -> f p
Generics.unM1 m (M1 i c f p)
f))
instance Distributive f => Distributive (Generics.Rec1 f) where
   cotraverse :: forall (m :: * -> *) (p :: k1 -> *) (q :: k1 -> *).
Functor m =>
(forall (a :: k1). m (p a) -> q a) -> m (Rec1 f p) -> Rec1 f q
cotraverse forall (a :: k1). m (p a) -> q a
w m (Rec1 f p)
f = forall k (f :: k -> *) (p :: k). f p -> Rec1 f p
Generics.Rec1 (forall {k1} (g :: (k1 -> *) -> *) (m :: * -> *) (p :: k1 -> *)
       (q :: k1 -> *).
(Distributive g, Functor m) =>
(forall (a :: k1). m (p a) -> q a) -> m (g p) -> g q
cotraverse forall (a :: k1). m (p a) -> q a
w (forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Rank1.fmap forall k (f :: k -> *) (p :: k). Rec1 f p -> f p
Generics.unRec1 m (Rec1 f p)
f))
instance (Distributive f, Distributive g) => Distributive ((Generics.:*:) f g) where
   cotraverse :: forall (m :: * -> *) (p :: k1 -> *) (q :: k1 -> *).
Functor m =>
(forall (a :: k1). m (p a) -> q a)
-> m ((:*:) f g p) -> (:*:) f g q
cotraverse forall (a :: k1). m (p a) -> q a
w m ((:*:) f g p)
f = forall {k1} (g :: (k1 -> *) -> *) (m :: * -> *) (p :: k1 -> *)
       (q :: k1 -> *).
(Distributive g, Functor m) =>
(forall (a :: k1). m (p a) -> q a) -> m (g p) -> g q
cotraverse forall (a :: k1). m (p a) -> q a
w (forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Rank1.fmap (\(f p
a Generics.:*: g p
_) -> f p
a) m ((:*:) f g p)
f) forall k (f :: k -> *) (g :: k -> *) (p :: k).
f p -> g p -> (:*:) f g p
Generics.:*: forall {k1} (g :: (k1 -> *) -> *) (m :: * -> *) (p :: k1 -> *)
       (q :: k1 -> *).
(Distributive g, Functor m) =>
(forall (a :: k1). m (p a) -> q a) -> m (g p) -> g q
cotraverse forall (a :: k1). m (p a) -> q a
w (forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Rank1.fmap (\(f p
_ Generics.:*: g p
b) -> g p
b) m ((:*:) f g p)
f)

instance Logistic Empty where
   deliver :: forall (p :: * -> *) (q :: k1 -> *).
Contravariant p =>
p (Empty q -> Empty q) -> Empty (Compose p (q ~> q))
deliver p (Empty q -> Empty q)
_ = forall {k} (f :: k). Empty f
Empty

instance Logistic Proxy where
   deliver :: forall (p :: * -> *) (q :: k1 -> *).
Contravariant p =>
p (Proxy q -> Proxy q) -> Proxy (Compose p (q ~> q))
deliver p (Proxy q -> Proxy q)
_ = forall {k} (t :: k). Proxy t
Proxy

instance Logistic (Only x) where
   deliver :: forall (p :: * -> *) (q :: k1 -> *).
Contravariant p =>
p (Only x q -> Only x q) -> Only x (Compose p (q ~> q))
deliver p (Only x q -> Only x q)
f = forall {k} (a :: k) (f :: k -> *). f a -> Only a f
Only (forall {k} {k1} (f :: k -> *) (g :: k1 -> k) (a :: k1).
f (g a) -> Compose f g a
Rank1.Compose (forall (f :: * -> *) a' a.
Contravariant f =>
(a' -> a) -> f a -> f a'
Rank1.contramap coerce :: forall a b. Coercible a b => a -> b
coerce p (Only x q -> Only x q)
f))

instance Logistic g => Logistic (Identity g) where
   deliver :: forall (p :: * -> *) (q :: k1 -> *).
Contravariant p =>
p (Identity g q -> Identity g q) -> Identity g (Compose p (q ~> q))
deliver p (Identity g q -> Identity g q)
f = forall {k} (g :: k -> *) (f :: k). g f -> Identity g f
Identity (forall {k1} (g :: (k1 -> *) -> *) (p :: * -> *) (q :: k1 -> *).
(Logistic g, Contravariant p) =>
p (g q -> g q) -> g (Compose p (q ~> q))
deliver (forall (f :: * -> *) a' a.
Contravariant f =>
(a' -> a) -> f a -> f a'
Rank1.contramap coerce :: forall a b. Coercible a b => a -> b
coerce p (Identity g q -> Identity g q)
f))

instance (Logistic g, Rank1.Logistic p) => Logistic (Compose g p) where
   deliver :: forall (p :: * -> *) (q :: k1 -> *).
Contravariant p =>
p (Compose g p q -> Compose g p q)
-> Compose g p (Compose p (q ~> q))
deliver = forall {k1} {k} (g :: (k1 -> *) -> *) (p :: k -> *) (q :: k1 -> k).
g (Compose p q) -> Compose g p q
Compose
             forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall {k} (g :: (k -> *) -> *) (p :: k -> *) (q :: k -> *).
Functor g =>
(forall (a :: k). p a -> q a) -> g p -> g q
fmap (forall {k} {k1} {k} {k1} (p :: k -> *) (q :: k1 -> k) (a :: k1)
       (p' :: k -> *) (q' :: k1 -> k) (a' :: k1).
(p (q a) -> p' (q' a')) -> Compose p q a -> Compose p' q' a'
inRank1Compose (forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Rank1.fmap (forall {k} {k1} (f :: k -> *) (g :: k1 -> k) (a :: k1).
f (g a) -> Compose f g a
Rank1.Compose forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (f :: * -> *) a' a.
Contravariant f =>
(a' -> a) -> f a -> f a'
Rank1.contramap forall {k} (p :: k -> *) (q :: k -> *) (a :: k).
Arrow p q a -> p a -> q a
apply)
                                     forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (t :: * -> *) (f :: * -> *) a.
(Logistic t, Contravariant f) =>
f (t a -> t a) -> t (f (a -> a))
Rank1.deliver
                                     forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (f :: * -> *) a' a.
Contravariant f =>
(a' -> a) -> f a -> f a'
Rank1.contramap (forall {k} (p :: k -> *) (q :: k -> *) (a :: k).
(p a -> q a) -> Arrow p q a
Arrow forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall {k} {k1} {k} {k1} (p :: k -> *) (q :: k1 -> k) (a :: k1)
       (p' :: k -> *) (q' :: k1 -> k) (a' :: k1).
(p (q a) -> p' (q' a')) -> Compose p q a -> Compose p' q' a'
inRank1Compose)))
             forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall {k1} (g :: (k1 -> *) -> *) (p :: * -> *) (q :: k1 -> *).
(Logistic g, Contravariant p) =>
p (g q -> g q) -> g (Compose p (q ~> q))
deliver
             forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (f :: * -> *) a' a.
Contravariant f =>
(a' -> a) -> f a -> f a'
Rank1.contramap forall {k1} {k} {k1} {k} (g :: (k1 -> *) -> *) (p :: k -> *)
       (q :: k1 -> k) (g' :: (k1 -> *) -> *) (p' :: k -> *)
       (q' :: k1 -> k).
(g (Compose p q) -> g' (Compose p' q'))
-> Compose g p q -> Compose g' p' q'
inCompose

inCompose :: (g (Rank1.Compose p q) -> g' (Rank1.Compose p' q')) -> Compose g p q -> Compose g' p' q'
inCompose :: forall {k1} {k} {k1} {k} (g :: (k1 -> *) -> *) (p :: k -> *)
       (q :: k1 -> k) (g' :: (k1 -> *) -> *) (p' :: k -> *)
       (q' :: k1 -> k).
(g (Compose p q) -> g' (Compose p' q'))
-> Compose g p q -> Compose g' p' q'
inCompose g (Compose p q) -> g' (Compose p' q')
f = forall {k1} {k} (g :: (k1 -> *) -> *) (p :: k -> *) (q :: k1 -> k).
g (Compose p q) -> Compose g p q
Compose forall b c a. (b -> c) -> (a -> b) -> a -> c
. g (Compose p q) -> g' (Compose p' q')
f forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall {k1} {k} (g :: (k1 -> *) -> *) (p :: k -> *) (q :: k1 -> k).
Compose g p q -> g (Compose p q)
getCompose

inRank1Compose :: (p (q a) -> p' (q' a')) -> Rank1.Compose p q a -> Rank1.Compose p' q' a'
inRank1Compose :: forall {k} {k1} {k} {k1} (p :: k -> *) (q :: k1 -> k) (a :: k1)
       (p' :: k -> *) (q' :: k1 -> k) (a' :: k1).
(p (q a) -> p' (q' a')) -> Compose p q a -> Compose p' q' a'
inRank1Compose p (q a) -> p' (q' a')
f = forall {k} {k1} (f :: k -> *) (g :: k1 -> k) (a :: k1).
f (g a) -> Compose f g a
Rank1.Compose forall b c a. (b -> c) -> (a -> b) -> a -> c
. p (q a) -> p' (q' a')
f forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall {k1} {k2} (f :: k1 -> *) (g :: k2 -> k1) (a :: k2).
Compose f g a -> f (g a)
Rank1.getCompose

instance (Logistic g, Logistic h) => Logistic (Product g h) where
   deliver :: forall (p :: * -> *) (q :: k1 -> *).
Contravariant p =>
p (Product g h q -> Product g h q)
-> Product g h (Compose p (q ~> q))
deliver p (Product g h q -> Product g h q)
f = forall {k} (f :: k -> *) (g :: k -> *) (a :: k).
f a -> g a -> Product f g a
Pair (forall {k1} (g :: (k1 -> *) -> *) (p :: * -> *) (q :: k1 -> *).
(Logistic g, Contravariant p) =>
p (g q -> g q) -> g (Compose p (q ~> q))
deliver (forall (f :: * -> *) a' a.
Contravariant f =>
(a' -> a) -> f a -> f a'
Rank1.contramap forall {k} (g :: k -> *) (p :: k) (g' :: k -> *) (h :: k -> *).
(g p -> g' p) -> Product g h p -> Product g' h p
first p (Product g h q -> Product g h q)
f)) (forall {k1} (g :: (k1 -> *) -> *) (p :: * -> *) (q :: k1 -> *).
(Logistic g, Contravariant p) =>
p (g q -> g q) -> g (Compose p (q ~> q))
deliver (forall (f :: * -> *) a' a.
Contravariant f =>
(a' -> a) -> f a -> f a'
Rank1.contramap forall {k} (h :: k -> *) (p :: k) (h' :: k -> *) (g :: k -> *).
(h p -> h' p) -> Product g h p -> Product g h' p
second p (Product g h q -> Product g h q)
f))

first :: (g p -> g' p) -> Product g h p -> Product g' h p
first :: forall {k} (g :: k -> *) (p :: k) (g' :: k -> *) (h :: k -> *).
(g p -> g' p) -> Product g h p -> Product g' h p
first g p -> g' p
f (Pair g p
g h p
h) = forall {k} (f :: k -> *) (g :: k -> *) (a :: k).
f a -> g a -> Product f g a
Pair (g p -> g' p
f g p
g) h p
h

second :: (h p -> h' p) -> Product g h p -> Product g h' p
second :: forall {k} (h :: k -> *) (p :: k) (h' :: k -> *) (g :: k -> *).
(h p -> h' p) -> Product g h p -> Product g h' p
second h p -> h' p
f (Pair g p
g h p
h) = forall {k} (f :: k -> *) (g :: k -> *) (a :: k).
f a -> g a -> Product f g a
Pair g p
g (h p -> h' p
f h p
h)

instance Logistic f => Logistic (Generics.M1 i c f) where
   deliver :: forall (p :: * -> *) (q :: k1 -> *).
Contravariant p =>
p (M1 i c f q -> M1 i c f q) -> M1 i c f (Compose p (q ~> q))
deliver p (M1 i c f q -> M1 i c f q)
f = forall k i (c :: Meta) (f :: k -> *) (p :: k). f p -> M1 i c f p
Generics.M1 (forall {k1} (g :: (k1 -> *) -> *) (p :: * -> *) (q :: k1 -> *).
(Logistic g, Contravariant p) =>
p (g q -> g q) -> g (Compose p (q ~> q))
deliver (forall (f :: * -> *) a' a.
Contravariant f =>
(a' -> a) -> f a -> f a'
Rank1.contramap (\f q -> f q
f'-> forall k i (c :: Meta) (f :: k -> *) (p :: k). f p -> M1 i c f p
Generics.M1 forall b c a. (b -> c) -> (a -> b) -> a -> c
. f q -> f q
f' forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall k i (c :: Meta) (f :: k -> *) (p :: k). M1 i c f p -> f p
Generics.unM1) p (M1 i c f q -> M1 i c f q)
f))

instance Logistic f => Logistic (Generics.Rec1 f) where
   deliver :: forall (p :: * -> *) (q :: k1 -> *).
Contravariant p =>
p (Rec1 f q -> Rec1 f q) -> Rec1 f (Compose p (q ~> q))
deliver p (Rec1 f q -> Rec1 f q)
f = forall k (f :: k -> *) (p :: k). f p -> Rec1 f p
Generics.Rec1 (forall {k1} (g :: (k1 -> *) -> *) (p :: * -> *) (q :: k1 -> *).
(Logistic g, Contravariant p) =>
p (g q -> g q) -> g (Compose p (q ~> q))
deliver (forall (f :: * -> *) a' a.
Contravariant f =>
(a' -> a) -> f a -> f a'
Rank1.contramap (\f q -> f q
f'-> forall k (f :: k -> *) (p :: k). f p -> Rec1 f p
Generics.Rec1 forall b c a. (b -> c) -> (a -> b) -> a -> c
. f q -> f q
f' forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall k (f :: k -> *) (p :: k). Rec1 f p -> f p
Generics.unRec1) p (Rec1 f q -> Rec1 f q)
f))

instance (Logistic f, Logistic g) => Logistic ((Generics.:*:) f g) where
   deliver :: forall (p :: * -> *) (q :: k1 -> *).
Contravariant p =>
p ((:*:) f g q -> (:*:) f g q) -> (:*:) f g (Compose p (q ~> q))
deliver p ((:*:) f g q -> (:*:) f g q)
f = forall {k1} (g :: (k1 -> *) -> *) (p :: * -> *) (q :: k1 -> *).
(Logistic g, Contravariant p) =>
p (g q -> g q) -> g (Compose p (q ~> q))
deliver (forall (f :: * -> *) a' a.
Contravariant f =>
(a' -> a) -> f a -> f a'
Rank1.contramap (\f q -> f q
f' (f q
a Generics.:*: g q
b) -> f q -> f q
f' f q
a forall k (f :: k -> *) (g :: k -> *) (p :: k).
f p -> g p -> (:*:) f g p
Generics.:*: g q
b) p ((:*:) f g q -> (:*:) f g q)
f)
               forall k (f :: k -> *) (g :: k -> *) (p :: k).
f p -> g p -> (:*:) f g p
Generics.:*:
               forall {k1} (g :: (k1 -> *) -> *) (p :: * -> *) (q :: k1 -> *).
(Logistic g, Contravariant p) =>
p (g q -> g q) -> g (Compose p (q ~> q))
deliver (forall (f :: * -> *) a' a.
Contravariant f =>
(a' -> a) -> f a -> f a'
Rank1.contramap (\g q -> g q
f' (f q
a Generics.:*: g q
b) -> f q
a forall k (f :: k -> *) (g :: k -> *) (p :: k).
f p -> g p -> (:*:) f g p
Generics.:*: g q -> g q
f' g q
b) p ((:*:) f g q -> (:*:) f g q)
f)