-- | 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 two less standard classes 'Apply' and 'Distributive'.
{-# LANGUAGE DefaultSignatures, InstanceSigs, KindSignatures, PolyKinds, Rank2Types #-}
{-# LANGUAGE ScopedTypeVariables, StandaloneDeriving, TypeOperators, UndecidableInstances #-}
{-# LANGUAGE EmptyCase #-}
module Rank2 (
-- * Rank 2 classes
   Functor(..), Apply(..), Applicative(..),
   Foldable(..), Traversable(..), Distributive(..), DistributiveTraversable(..), 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)
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.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.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 :: 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 :: Product g h p -> h p
snd (Pair g p
_ h p
y) = h p
y

-- | Equivalent of '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 (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 (a :: k). p a -> q a) -> g p -> g q
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 'Foldable' for rank 2 data types
class Foldable g where
   foldMap :: Monoid m => (forall a. p a -> m) -> g p -> m

-- | Equivalent of '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 = g (Compose m q) -> m (g q)
forall k (g :: (k -> *) -> *) (m :: * -> *) (p :: k -> *).
(Traversable g, Applicative m) =>
g (Compose m p) -> m (g p)
sequence (g (Compose m q) -> m (g q))
-> (g p -> g (Compose m q)) -> g p -> m (g q)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (forall (a :: k). p a -> Compose m q a) -> g p -> g (Compose m q)
forall k (g :: (k -> *) -> *) (p :: k -> *) (q :: k -> *).
Functor g =>
(forall (a :: k). p a -> q a) -> g p -> g q
fmap (m (q a) -> Compose m q a
forall k k1 (f :: k -> *) (g :: k1 -> k) (a :: k1).
f (g a) -> Compose f g a
Rank1.Compose (m (q a) -> Compose m q a)
-> (p a -> m (q a)) -> p a -> Compose m q a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. p a -> m (q a)
forall (a :: k). p a -> m (q a)
f)
   sequence = (forall (a :: k). Compose m p a -> m (p a))
-> g (Compose m p) -> m (g p)
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 m p a -> m (p a)
forall k1 (f :: k1 -> *) k2 (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{Arrow p q a -> p a -> q a
apply :: p a -> q a}

type (~>) = Arrow
($) :: Arrow p q a -> p a -> q a
$ :: Arrow p q a -> p a -> q a
($) = 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 (a :: k). (~>) p q a -> p a -> q a)
-> g (p ~> q) -> g p -> g q
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 q a -> p a -> q a
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 = ((q a -> r a) -> Arrow q r a
forall k (p :: k -> *) (q :: k -> *) (a :: k).
(p a -> q a) -> Arrow p q a
Arrow ((q a -> r a) -> Arrow q r a)
-> (p a -> q a -> r a) -> p a -> Arrow q r a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. p a -> q a -> r a
forall (a :: k). p a -> q a -> r a
f) (forall (a :: k). p a -> Arrow q r a) -> g p -> g (q ~> r)
forall k (g :: (k -> *) -> *) (p :: k -> *) (q :: k -> *).
Functor g =>
(forall (a :: k). p a -> q a) -> g p -> g q
<$> g p
g g (q ~> r) -> g q -> g r
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 (a :: k). p a -> q a -> (~>) r s a)
-> g p -> g q -> g (r ~> 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 (\p a
p q a
q-> (r a -> s a) -> (~>) r s a
forall k (p :: k -> *) (q :: k -> *) (a :: k).
(p a -> q a) -> Arrow p q a
Arrow (p a -> q a -> r a -> s a
forall (a :: k). p a -> q a -> r a -> s a
f p a
p q a
q)) g p
g g q
h g (r ~> s) -> g r -> g s
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 (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 (a :: k). p a -> q a -> r a -> (~>) s t a)
-> g p -> g q -> g r -> g (s ~> t)
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-> (s a -> t a) -> (~>) s t a
forall k (p :: k -> *) (q :: k -> *) (a :: k).
(p a -> q a) -> Arrow p q a
Arrow (p a -> q a -> r a -> s a -> t a
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 g (s ~> t) -> g s -> g t
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 (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 (a :: k). p a -> q a -> r a -> s a -> (~>) t u a)
-> g p -> g q -> g r -> g s -> g (t ~> u)
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-> (t a -> u a) -> (~>) t u a
forall k (p :: k -> *) (q :: k -> *) (a :: k).
(p a -> q a) -> Arrow p q a
Arrow (p a -> q a -> r a -> s a -> t a -> u a
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 g (t ~> u) -> g t -> g u
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 :: g (p ~> q) -> g p -> g q
ap = g (p ~> q) -> g p -> g q
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 f1 => (a -> g f2) -> f1 a -> g (Rank1.Compose f1 f2)
   distribute :: Rank1.Functor f1 => f1 (g f2) -> g (Rank1.Compose f1 f2)
   -- | 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 f2
f = f1 (g f2) -> g (Compose f1 f2)
forall k (g :: (k -> *) -> *) (f1 :: * -> *) (f2 :: k -> *).
(Distributive g, Functor f1) =>
f1 (g f2) -> g (Compose f1 f2)
distribute (f1 (g f2) -> g (Compose f1 f2))
-> (f1 a -> f1 (g f2)) -> f1 a -> g (Compose f1 f2)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (a -> g f2) -> f1 a -> f1 (g f2)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Rank1.fmap a -> g f2
f
   distribute = (forall (a :: k). f1 (f2 a) -> Compose f1 f2 a)
-> f1 (g f2) -> g (Compose f1 f2)
forall k (g :: (k -> *) -> *) (m :: * -> *) (p :: k -> *)
       (q :: k -> *).
(Distributive g, Functor m) =>
(forall (a :: k). m (p a) -> q a) -> m (g p) -> g q
cotraverse forall (a :: k). f1 (f2 a) -> Compose f1 f2 a
forall k k1 (f :: k -> *) (g :: k1 -> k) (a :: k1).
f (g a) -> Compose f g a
Rank1.Compose
   cotraverse forall (a :: k). m (p a) -> q a
f = ((forall (a :: k). Compose m p a -> q a) -> g (Compose m p) -> g q
forall k (g :: (k -> *) -> *) (p :: k -> *) (q :: k -> *).
Functor g =>
(forall (a :: k). p a -> q a) -> g p -> g q
fmap (m (p a) -> q a
forall (a :: k). m (p a) -> q a
f (m (p a) -> q a)
-> (Compose m p a -> m (p a)) -> Compose m p a -> q a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Compose m p a -> m (p a)
forall k1 (f :: k1 -> *) k2 (g :: k2 -> k1) (a :: k2).
Compose f g a -> f (g a)
Rank1.getCompose)) (g (Compose m p) -> g q)
-> (m (g p) -> g (Compose m p)) -> m (g p) -> g q
forall b c a. (b -> c) -> (a -> b) -> a -> c
. m (g p) -> g (Compose m p)
forall k (g :: (k -> *) -> *) (f1 :: * -> *) (f2 :: k -> *).
(Distributive g, Functor f1) =>
f1 (g f2) -> g (Compose f1 f2)
distribute

-- | A weaker 'Distributive' that requires 'Rank1.Traversable' to use, not just a 'Rank1.Functor'.
class Functor g => DistributiveTraversable (g :: (k -> *) -> *) 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 = f1 (g f2) -> g (Compose f1 f2)
forall k (g :: (k -> *) -> *) (f1 :: * -> *) (f2 :: k -> *).
(DistributiveTraversable g, Traversable f1) =>
f1 (g f2) -> g (Compose f1 f2)
distributeTraversable (f1 (g f2) -> g (Compose f1 f2))
-> (f1 a -> f1 (g f2)) -> f1 a -> g (Compose f1 f2)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (a -> g f2) -> f1 a -> f1 (g f2)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Rank1.fmap a -> g f2
f
   distributeTraversable = (forall (x :: k). f1 (f2 x) -> Compose f1 f2 x)
-> f1 (g f2) -> g (Compose f1 f2)
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) -> Compose f1 f2 x
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 (a :: k). m (p a) -> q a) -> m (g p) -> g q
forall k (g :: (k -> *) -> *) (m :: * -> *) (p :: k -> *)
       (q :: k -> *).
(Distributive g, Functor m) =>
(forall (a :: k). m (p a) -> q a) -> m (g p) -> g q
cotraverse

-- | A variant of 'distribute' convenient with 'Rank1.Monad' instances
distributeJoin :: (Distributive g, Rank1.Monad f) => f (g f) -> g f
distributeJoin :: f (g f) -> g f
distributeJoin = (forall a. f (f a) -> f a) -> f (g f) -> g f
forall k (g :: (k -> *) -> *) (m :: * -> *) (p :: k -> *)
       (q :: k -> *).
(Distributive g, Functor m) =>
(forall (a :: k). m (p a) -> q a) -> m (g p) -> g q
cotraverse forall a. f (f a) -> f a
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 (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 (a :: k). Compose f t a -> u a) -> g (Compose f t) -> g u
forall k (g :: (k -> *) -> *) (p :: k -> *) (q :: k -> *).
Functor g =>
(forall (a :: k). p a -> q a) -> g p -> g q
fmap (f (t a) -> u a
forall (a :: k). f (t a) -> u a
f (f (t a) -> u a)
-> (Compose f t a -> f (t a)) -> Compose f t a -> u a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Compose f t a -> f (t a)
forall k1 (f :: k1 -> *) k2 (g :: k2 -> k1) (a :: k2).
Compose f g a -> f (g a)
Rank1.getCompose) (f (g t) -> g (Compose f t)
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 (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 (a :: k). Compose f t a -> u a -> v a)
-> g (Compose f t) -> g u -> g v
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 (f (t a) -> u a -> v a
forall (a :: k). f (t a) -> u a -> v a
f (f (t a) -> u a -> v a)
-> (Compose f t a -> f (t a)) -> Compose f t a -> u a -> v a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Compose f t a -> f (t a)
forall k1 (f :: k1 -> *) k2 (g :: k2 -> k1) (a :: k2).
Compose f g a -> f (g a)
Rank1.getCompose) (f (g t) -> g (Compose f t)
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 (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 (a :: k). t a -> Compose f u a -> v a)
-> g t -> g (Compose f u) -> g v
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' -> t a -> f (u a) -> v a
forall (a :: k). t a -> f (u a) -> v a
f t a
x' (Compose f u a -> f (u a)
forall k1 (f :: k1 -> *) k2 (g :: k2 -> k1) (a :: k2).
Compose f g a -> f (g a)
Rank1.getCompose Compose f u a
y')) g t
x (f (g u) -> g (Compose f u)
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 :: (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 (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 (a :: k). Compose f1 t a -> Compose f2 u a -> v a)
-> g (Compose f1 t) -> g (Compose f2 u) -> g v
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 (f1 (g t) -> g (Compose f1 t)
forall k (g :: (k -> *) -> *) (f1 :: * -> *) (f2 :: k -> *).
(DistributiveTraversable g, Traversable f1) =>
f1 (g f2) -> g (Compose f1 f2)
distributeTraversable f1 (g t)
x) (f2 (g u) -> g (Compose f2 u)
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 :: Compose f1 t a -> Compose f2 u a -> v a
applyCompose Compose f1 t a
x' Compose f2 u a
y' = f1 (t a) -> f2 (u a) -> v a
forall (a :: k). f1 (t a) -> f2 (u a) -> v a
f (Compose f1 t a -> f1 (t a)
forall k1 (f :: k1 -> *) k2 (g :: k2 -> k1) (a :: k2).
Compose f g a -> f (g a)
Rank1.getCompose Compose f1 t a
x') (Compose f2 u a -> f2 (u a)
forall k1 (f :: k1 -> *) k2 (g :: k2 -> k1) (a :: k2).
Compose f g a -> f (g a)
Rank1.getCompose Compose f2 u a
y')

{-# 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 (i :: k). f (a i) -> b i) -> f (g a) -> g b
distributeWith = (forall (i :: k). f (a i) -> b i) -> f (g a) -> g b
forall k (g :: (k -> *) -> *) (m :: * -> *) (p :: k -> *)
       (q :: k -> *).
(Distributive g, Functor m) =>
(forall (a :: k). 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 (a :: k). m (p a) -> q a) -> m (g p) -> g q
distributeWithTraversable = (forall (a :: k). m (p a) -> q a) -> m (g p) -> g q
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
(Empty f -> Empty f -> Bool)
-> (Empty f -> Empty f -> Bool) -> Eq (Empty f)
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, Eq (Empty f)
Eq (Empty f)
-> (Empty f -> Empty f -> Ordering)
-> (Empty f -> Empty f -> Bool)
-> (Empty f -> Empty f -> Bool)
-> (Empty f -> Empty f -> Bool)
-> (Empty f -> Empty f -> Bool)
-> (Empty f -> Empty f -> Empty f)
-> (Empty f -> Empty f -> Empty f)
-> Ord (Empty f)
Empty f -> Empty f -> Bool
Empty f -> Empty f -> Ordering
Empty f -> Empty f -> Empty 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 (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
$cp1Ord :: forall k (f :: k). Eq (Empty f)
Ord, Int -> Empty f -> ShowS
[Empty f] -> ShowS
Empty f -> String
(Int -> Empty f -> ShowS)
-> (Empty f -> String) -> ([Empty f] -> ShowS) -> Show (Empty f)
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 {Only a f -> f a
fromOnly :: f a} deriving (Only a f -> Only a f -> Bool
(Only a f -> Only a f -> Bool)
-> (Only a f -> Only a f -> Bool) -> Eq (Only a f)
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, Eq (Only a f)
Eq (Only a f)
-> (Only a f -> Only a f -> Ordering)
-> (Only a f -> Only a f -> Bool)
-> (Only a f -> Only a f -> Bool)
-> (Only a f -> Only a f -> Bool)
-> (Only a f -> Only a f -> Bool)
-> (Only a f -> Only a f -> Only a f)
-> (Only a f -> Only a f -> Only a f)
-> Ord (Only a f)
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
$cp1Ord :: forall k (a :: k) (f :: k -> *). Ord (f a) => Eq (Only a f)
Ord, Int -> Only a f -> ShowS
[Only a f] -> ShowS
Only a f -> String
(Int -> Only a f -> ShowS)
-> (Only a f -> String) -> ([Only a f] -> ShowS) -> Show (Only a f)
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 {Identity g f -> g f
runIdentity :: g f} deriving (Identity g f -> Identity g f -> Bool
(Identity g f -> Identity g f -> Bool)
-> (Identity g f -> Identity g f -> Bool) -> Eq (Identity g f)
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, Eq (Identity g f)
Eq (Identity g f)
-> (Identity g f -> Identity g f -> Ordering)
-> (Identity g f -> Identity g f -> Bool)
-> (Identity g f -> Identity g f -> Bool)
-> (Identity g f -> Identity g f -> Bool)
-> (Identity g f -> Identity g f -> Bool)
-> (Identity g f -> Identity g f -> Identity g f)
-> (Identity g f -> Identity g f -> Identity g f)
-> Ord (Identity g f)
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
$cp1Ord :: forall k (g :: k -> *) (f :: k). Ord (g f) => Eq (Identity g f)
Ord, Int -> Identity g f -> ShowS
[Identity g f] -> ShowS
Identity g f -> String
(Int -> Identity g f -> ShowS)
-> (Identity g f -> String)
-> ([Identity g f] -> ShowS)
-> Show (Identity g f)
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 {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 {Flip g a f -> g (f a)
unFlip :: g (f a)} deriving (Flip g a f -> Flip g a f -> Bool
(Flip g a f -> Flip g a f -> Bool)
-> (Flip g a f -> Flip g a f -> Bool) -> Eq (Flip g a f)
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, Eq (Flip g a f)
Eq (Flip g a f)
-> (Flip g a f -> Flip g a f -> Ordering)
-> (Flip g a f -> Flip g a f -> Bool)
-> (Flip g a f -> Flip g a f -> Bool)
-> (Flip g a f -> Flip g a f -> Bool)
-> (Flip g a f -> Flip g a f -> Bool)
-> (Flip g a f -> Flip g a f -> Flip g a f)
-> (Flip g a f -> Flip g a f -> Flip g a f)
-> Ord (Flip g a f)
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
$cp1Ord :: forall k (g :: k -> *) k (a :: k) (f :: k -> k).
Ord (g (f a)) =>
Eq (Flip g a f)
Ord, Int -> Flip g a f -> ShowS
[Flip g a f] -> ShowS
Flip g a f -> String
(Int -> Flip g a f -> ShowS)
-> (Flip g a f -> String)
-> ([Flip g a f] -> ShowS)
-> Show (Flip g a f)
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 = g (f a) -> Flip g a f
forall k k (g :: k -> *) (a :: k) (f :: k -> k).
g (f a) -> Flip g a f
Flip (g (f a)
x g (f a) -> g (f a) -> g (f a)
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 = g (f a) -> Flip g a f
forall k k (g :: k -> *) (a :: k) (f :: k -> k).
g (f a) -> Flip g a f
Flip g (f a)
forall a. Monoid a => a
mempty
   Flip g (f a)
x mappend :: Flip g a f -> Flip g a f -> Flip g a f
`mappend` Flip g (f a)
y = g (f a) -> Flip g a f
forall k k (g :: k -> *) (a :: k) (f :: k -> k).
g (f a) -> Flip g a f
Flip (g (f a)
x g (f a) -> g (f a) -> g (f a)
forall a. Monoid a => a -> a -> a
`mappend` g (f a)
y)

instance Rank1.Functor g => Rank2.Functor (Flip g a) where
   forall (a :: k). p a -> q a
f <$> :: (forall (a :: k). p a -> q a) -> Flip g a p -> Flip g a q
<$> Flip g (p a)
g = g (q a) -> Flip g a q
forall k k (g :: k -> *) (a :: k) (f :: k -> k).
g (f a) -> Flip g a f
Flip (p a -> q a
forall (a :: k). p a -> q a
f (p a -> q a) -> g (p a) -> g (q a)
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 <*> :: Flip g a (p ~> q) -> Flip g a p -> Flip g a q
<*> Flip g (p a)
h = g (q a) -> Flip g a q
forall k k (g :: k -> *) (a :: k) (f :: k -> k).
g (f a) -> Flip g a f
Flip ((~>) p q a -> p a -> q a
forall k (p :: k -> *) (q :: k -> *) (a :: k).
Arrow p q a -> p a -> q a
apply ((~>) p q a -> p a -> q a) -> g ((~>) p q a) -> g (p a -> q a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Rank1.<$> g ((~>) p q a)
g g (p a -> q a) -> g (p a) -> g (q a)
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 (a :: k). f a) -> Flip g a f
pure forall (a :: k). f a
f = g (f a) -> Flip g a f
forall k k (g :: k -> *) (a :: k) (f :: k -> k).
g (f a) -> Flip g a f
Flip (f a -> g (f a)
forall (f :: * -> *) a. Applicative f => a -> f a
Rank1.pure f a
forall (a :: k). f a
f)

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

instance Rank1.Traversable g => Rank2.Traversable (Flip g a) where
   traverse :: (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) = g (q a) -> Flip g a q
forall k k (g :: k -> *) (a :: k) (f :: k -> k).
g (f a) -> Flip g a f
Flip (g (q a) -> Flip g a q) -> m (g (q a)) -> m (Flip g a q)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Rank1.<$> (p a -> m (q a)) -> g (p a) -> m (g (q a))
forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
Rank1.traverse p a -> m (q a)
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 (a :: k). p a -> q a) -> Empty p -> Empty q
<$> Empty p
_ = Empty q
forall k (f :: k). Empty f
Empty

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

instance Functor (Const a) where
   forall (a :: k). p a -> q a
_ <$> :: (forall (a :: k). p a -> q a) -> Const a p -> Const a q
<$> Const a
a = a -> Const a q
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 (a :: k). p a -> q a) -> Only a p -> Only a q
<$> Only p a
a = q a -> Only a q
forall k (a :: k) (f :: k -> *). f a -> Only a f
Only (p a -> q a
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 (a :: k). p a -> q a) -> Identity g p -> Identity g q
<$> Identity g p
g = g q -> Identity g q
forall k (g :: k -> *) (f :: k). g f -> Identity g f
Identity (forall (a :: k). p a -> q a
f (forall (a :: k). p a -> q a) -> g p -> g q
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 (a :: k). q a -> r a) -> Compose g p q -> Compose g p r
<$> Compose g (Compose p q)
g = g (Compose p r) -> Compose g p r
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 (a :: k). Compose p q a -> Compose p r a)
-> g (Compose p q) -> g (Compose p r)
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' :: Compose p q a -> Compose p r a
f' (Rank1.Compose p (q a)
q) = p (r a) -> Compose p r a
forall k k1 (f :: k -> *) (g :: k1 -> k) (a :: k1).
f (g a) -> Compose f g a
Rank1.Compose (q a -> r a
forall (a :: k). q a -> r a
f (q a -> r a) -> p (q a) -> p (r a)
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 (a :: k). p a -> q a) -> Product g h p -> Product g h q
<$> Pair g p
a h p
b = g q -> h q -> Product g h q
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 (a :: k). p a -> q a) -> g p -> g q
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 (a :: k). p a -> q a) -> h p -> h q
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 (a :: k). p a -> q a) -> Sum g h p -> Sum g h q
<$> InL g p
g = g q -> Sum g h q
forall k (f :: k -> *) (g :: k -> *) (a :: k). f a -> Sum f g a
InL (forall (a :: k). p a -> q a
f (forall (a :: k). p a -> q a) -> g p -> g q
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 = h q -> Sum g h q
forall k (f :: k -> *) (g :: k -> *) (a :: k). g a -> Sum f g a
InR (forall (a :: k). p a -> q a
f (forall (a :: k). p a -> q a) -> h p -> h q
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 (a :: k). p a -> q a) -> V1 p -> V1 q
(<$>) forall (a :: k). p a -> q a
_ = V1 p -> V1 q
coerce
   
instance Functor Generics.U1 where
   <$> :: (forall (a :: k). p a -> q a) -> U1 p -> U1 q
(<$>) forall (a :: k). p a -> q a
_ = U1 p -> U1 q
coerce

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

instance Functor f => Functor (Generics.M1 i c f) where
   forall (a :: k). p a -> q a
f <$> :: (forall (a :: k). p a -> q a) -> M1 i c f p -> M1 i c f q
<$> Generics.M1 f p
x = f q -> M1 i c f q
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 (a :: k). p a -> q a) -> f p -> f q
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 (a :: k). p a -> q a) -> Rec1 f p -> Rec1 f q
<$> Generics.Rec1 f p
x = f q -> Rec1 f q
forall k (f :: k -> *) (p :: k). f p -> Rec1 f p
Generics.Rec1 (forall (a :: k). p a -> q a
f (forall (a :: k). p a -> q a) -> f p -> f q
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 (a :: k). p a -> q a) -> (:+:) f g p -> (:+:) f g q
<$> Generics.L1 f p
x = f q -> (:+:) f g q
forall k (f :: k -> *) (g :: k -> *) (p :: k). f p -> (:+:) f g p
Generics.L1 (forall (a :: k). p a -> q a
f (forall (a :: k). p a -> q a) -> f p -> f q
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 = g q -> (:+:) f g q
forall k (f :: k -> *) (g :: k -> *) (p :: k). g p -> (:+:) f g p
Generics.R1 (forall (a :: k). p a -> q a
f (forall (a :: k). p a -> q a) -> g p -> g q
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 (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 (a :: k). p a -> q a) -> f p -> f q
forall k (g :: (k -> *) -> *) (p :: k -> *) (q :: k -> *).
Functor g =>
(forall (a :: k). p a -> q a) -> g p -> g q
<$> f p
x) f q -> g q -> (:*:) f g q
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 (a :: k). p a -> q a) -> g p -> g q
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 (a :: k). p a -> m) -> Empty p -> m
foldMap forall (a :: k). p a -> m
_ Empty p
_ = m
forall a. Monoid a => a
mempty

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

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

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

instance Foldable g => Foldable (Identity g) where
   foldMap :: (forall (a :: k). p a -> m) -> Identity g p -> m
foldMap forall (a :: k). p a -> m
f (Identity g p
g) = (forall (a :: k). p a -> m) -> g p -> m
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 (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 (a :: k). Compose p p a -> m) -> g (Compose p p) -> m
forall k (g :: (k -> *) -> *) m (p :: k -> *).
(Foldable g, Monoid m) =>
(forall (a :: k). p a -> m) -> g p -> m
foldMap ((p a -> m) -> p (p a) -> m
forall (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
Rank1.foldMap p a -> m
forall (a :: k). p a -> m
f (p (p a) -> m) -> (Compose p p a -> p (p a)) -> Compose p p a -> m
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Compose p p a -> p (p a)
forall k1 (f :: k1 -> *) k2 (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 (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 (a :: k). p a -> m) -> g p -> m
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 m -> m -> m
forall a. Monoid a => a -> a -> a
`mappend` (forall (a :: k). p a -> m) -> h p -> m
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 (a :: k). p a -> m) -> Sum g h p -> m
foldMap forall (a :: k). p a -> m
f (InL g p
g) = (forall (a :: k). p a -> m) -> g p -> m
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 (a :: k). p a -> m) -> h p -> m
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 (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 (a :: k). p a -> m) -> U1 p -> m
foldMap forall (a :: k). p a -> m
_ U1 p
_ = m
forall a. Monoid a => a
mempty

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

instance Foldable f => Foldable (Generics.M1 i c f) where
   foldMap :: (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 (a :: k). p a -> m) -> f p -> m
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 (a :: k). p a -> m) -> Rec1 f p -> m
foldMap forall (a :: k). p a -> m
f (Generics.Rec1 f p
x) = (forall (a :: k). p a -> m) -> f p -> m
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 (a :: k). p a -> m) -> (:+:) f g p -> m
foldMap forall (a :: k). p a -> m
f (Generics.L1 f p
x) = (forall (a :: k). p a -> m) -> f p -> m
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 (a :: k). p a -> m) -> g p -> m
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 (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 (a :: k). p a -> m) -> f p -> m
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 m -> m -> m
forall a. Monoid a => a -> a -> a
`mappend` (forall (a :: k). p a -> m) -> g p -> m
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 (a :: k). p a -> m (q a)) -> Empty p -> m (Empty q)
traverse forall (a :: k). p a -> m (q a)
_ Empty p
_ = Empty q -> m (Empty q)
forall (f :: * -> *) a. Applicative f => a -> f a
Rank1.pure Empty q
forall k (f :: k). Empty f
Empty

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

instance Traversable (Const x) where
   traverse :: (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) = Const x q -> m (Const x q)
forall (f :: * -> *) a. Applicative f => a -> f a
Rank1.pure (x -> Const x q
forall k a (b :: k). a -> Const a b
Const x
x)

instance Traversable (Only x) where
   traverse :: (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) = q x -> Only x q
forall k (a :: k) (f :: k -> *). f a -> Only a f
Only (q x -> Only x q) -> m (q x) -> m (Only x q)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Rank1.<$> p x -> m (q x)
forall (a :: k). p a -> m (q a)
f p x
x

instance Traversable g => Traversable (Identity g) where
   traverse :: (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) = g q -> Identity g q
forall k (g :: k -> *) (f :: k). g f -> Identity g f
Identity (g q -> Identity g q) -> m (g q) -> m (Identity g q)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Rank1.<$> (forall (a :: k). p a -> m (q a)) -> g p -> m (g q)
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 (a :: k). q a -> m (r a))
-> Compose g p q -> m (Compose g p r)
traverse forall (a :: k). q a -> m (r a)
f (Compose g (Compose p q)
g) = g (Compose p r) -> Compose g p r
forall k1 k (g :: (k1 -> *) -> *) (p :: k -> *) (q :: k1 -> k).
g (Compose p q) -> Compose g p q
Compose (g (Compose p r) -> Compose g p r)
-> m (g (Compose p r)) -> m (Compose g p r)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Rank1.<$> (forall (a :: k). Compose p q a -> m (Compose p r a))
-> g (Compose p q) -> m (g (Compose p r))
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' :: Compose p q a -> m (Compose p r a)
f' (Rank1.Compose p (q a)
q) = p (r a) -> Compose p r a
forall k k1 (f :: k -> *) (g :: k1 -> k) (a :: k1).
f (g a) -> Compose f g a
Rank1.Compose (p (r a) -> Compose p r a) -> m (p (r a)) -> m (Compose p r a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Rank1.<$> (q a -> m (r a)) -> p (q a) -> m (p (r a))
forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
Rank1.traverse q a -> m (r a)
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 (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) = (g q -> h q -> Product g h q)
-> m (g q) -> m (h q) -> m (Product g h q)
forall (f :: * -> *) a b c.
Applicative f =>
(a -> b -> c) -> f a -> f b -> f c
Rank1.liftA2 g q -> h q -> Product g h q
forall k (f :: k -> *) (g :: k -> *) (a :: k).
f a -> g a -> Product f g a
Pair ((forall (a :: k). p a -> m (q a)) -> g p -> m (g q)
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 (a :: k). p a -> m (q a)) -> h p -> m (h q)
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 (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) = g q -> Sum g h q
forall k (f :: k -> *) (g :: k -> *) (a :: k). f a -> Sum f g a
InL (g q -> Sum g h q) -> m (g q) -> m (Sum g h q)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Rank1.<$> (forall (a :: k). p a -> m (q a)) -> g p -> m (g q)
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) = h q -> Sum g h q
forall k (f :: k -> *) (g :: k -> *) (a :: k). g a -> Sum f g a
InR (h q -> Sum g h q) -> m (h q) -> m (Sum g h q)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Rank1.<$> (forall (a :: k). p a -> m (q a)) -> h p -> m (h q)
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 (a :: k). p a -> m (q a)) -> V1 p -> m (V1 q)
traverse forall (a :: k). p a -> m (q a)
_ = V1 q -> m (V1 q)
forall (f :: * -> *) a. Applicative f => a -> f a
Rank1.pure (V1 q -> m (V1 q)) -> (V1 p -> V1 q) -> V1 p -> m (V1 q)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. V1 p -> V1 q
coerce
   
instance Traversable Generics.U1 where
   traverse :: (forall (a :: k). p a -> m (q a)) -> U1 p -> m (U1 q)
traverse forall (a :: k). p a -> m (q a)
_ = U1 q -> m (U1 q)
forall (f :: * -> *) a. Applicative f => a -> f a
Rank1.pure (U1 q -> m (U1 q)) -> (U1 p -> U1 q) -> U1 p -> m (U1 q)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. U1 p -> U1 q
coerce

instance Traversable (Generics.K1 i c) where
   traverse :: (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)
_ = K1 i c q -> m (K1 i c q)
forall (f :: * -> *) a. Applicative f => a -> f a
Rank1.pure (K1 i c q -> m (K1 i c q))
-> (K1 i c p -> K1 i c q) -> K1 i c p -> m (K1 i c q)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. K1 i c p -> K1 i c q
coerce

instance Traversable f => Traversable (Generics.M1 i c f) where
   traverse :: (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) = (f q -> M1 i c f q) -> m (f q) -> m (M1 i c f q)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Rank1.fmap f q -> M1 i c f q
forall k i (c :: Meta) (f :: k -> *) (p :: k). f p -> M1 i c f p
Generics.M1 ((forall (a :: k). p a -> m (q a)) -> f p -> m (f q)
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 (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) = (f q -> Rec1 f q) -> m (f q) -> m (Rec1 f q)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Rank1.fmap f q -> Rec1 f q
forall k (f :: k -> *) (p :: k). f p -> Rec1 f p
Generics.Rec1 ((forall (a :: k). p a -> m (q a)) -> f p -> m (f q)
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 (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) = (f q -> (:+:) f g q) -> m (f q) -> m ((:+:) f g q)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Rank1.fmap f q -> (:+:) f g q
forall k (f :: k -> *) (g :: k -> *) (p :: k). f p -> (:+:) f g p
Generics.L1 ((forall (a :: k). p a -> m (q a)) -> f p -> m (f q)
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) = (g q -> (:+:) f g q) -> m (g q) -> m ((:+:) f g q)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Rank1.fmap g q -> (:+:) f g q
forall k (f :: k -> *) (g :: k -> *) (p :: k). g p -> (:+:) f g p
Generics.R1 ((forall (a :: k). p a -> m (q a)) -> g p -> m (g q)
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 (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) = (f q -> g q -> (:*:) f g q)
-> m (f q) -> m (g q) -> m ((:*:) f g q)
forall (f :: * -> *) a b c.
Applicative f =>
(a -> b -> c) -> f a -> f b -> f c
Rank1.liftA2 f q -> g q -> (:*:) f g q
forall k (f :: k -> *) (g :: k -> *) (p :: k).
f p -> g p -> (:*:) f g p
(Generics.:*:) ((forall (a :: k). p a -> m (q a)) -> f p -> m (f q)
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 (a :: k). p a -> m (q a)) -> g p -> m (g q)
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)
_ <*> :: Empty (p ~> q) -> Empty p -> Empty q
<*> Empty p
_ = Empty q
forall k (f :: k). Empty f
Empty
   liftA2 :: (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
_ = Empty r
forall k (f :: k). Empty f
Empty

instance Apply Proxy where
   Proxy (p ~> q)
_ <*> :: Proxy (p ~> q) -> Proxy p -> Proxy q
<*> Proxy p
_ = Proxy q
forall k (t :: k). Proxy t
Proxy
   liftA2 :: (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
_ = Proxy r
forall k (t :: k). Proxy t
Proxy

instance Semigroup x => Apply (Const x) where
   Const x
x <*> :: Const x (p ~> q) -> Const x p -> Const x q
<*> Const x
y = x -> Const x q
forall k a (b :: k). a -> Const a b
Const (x
x x -> x -> x
forall a. Semigroup a => a -> a -> a
<> x
y)
   liftA2 :: (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) = x -> Const x r
forall k a (b :: k). a -> Const a b
Const (x
x x -> x -> x
forall a. Semigroup a => a -> a -> a
<> x
y)

instance Apply (Only x) where
   Only (~>) p q x
f <*> :: Only x (p ~> q) -> Only x p -> Only x q
<*> Only p x
x = q x -> Only x q
forall k (a :: k) (f :: k -> *). f a -> Only a f
Only ((~>) p q x -> p x -> q x
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 (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) = r x -> Only x r
forall k (a :: k) (f :: k -> *). f a -> Only a f
Only (p x -> q x -> r x
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 <*> :: Identity g (p ~> q) -> Identity g p -> Identity g q
<*> Identity g p
h = g q -> Identity g q
forall k (g :: k -> *) (f :: k). g f -> Identity g f
Identity (g (p ~> q)
g g (p ~> q) -> g p -> g q
forall k (g :: (k -> *) -> *) (p :: k -> *) (q :: k -> *).
Apply g =>
g (p ~> q) -> g p -> g q
<*> g p
h)
   liftA2 :: (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) = g r -> Identity g r
forall k (g :: k -> *) (f :: k). g f -> Identity g f
Identity ((forall (a :: k). p a -> q a -> r a) -> g p -> g q -> g r
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 <*> :: Compose g p (q ~> r) -> Compose g p q -> Compose g p r
<*> Compose g (Compose p q)
h = g (Compose p r) -> Compose g p r
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 ~> r) a -> Compose p q a -> Compose p r a)
-> g (Compose p (q ~> r)) -> g (Compose p q) -> g (Compose p r)
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' :: 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) = p (r a) -> Compose p r a
forall k k1 (f :: k -> *) (g :: k1 -> k) (a :: k1).
f (g a) -> Compose f g a
Rank1.Compose (((~>) q r a -> q a -> r a) -> p ((~>) q r a) -> p (q a) -> p (r a)
forall (f :: * -> *) a b c.
Applicative f =>
(a -> b -> c) -> f a -> f b -> f c
Rank1.liftA2 (~>) q r a -> q a -> r a
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 (a :: k). q a -> r a -> s a)
-> Compose g p q -> Compose g p r -> Compose g p s
liftA2 forall (a :: k). q a -> r a -> s a
f (Compose g (Compose p q)
g) (Compose g (Compose p r)
h) = g (Compose p s) -> Compose g p s
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 -> Compose p s a)
-> g (Compose p q) -> g (Compose p r) -> g (Compose p 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 (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' :: 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) = p (s a) -> Compose p s a
forall k k1 (f :: k -> *) (g :: k1 -> k) (a :: k1).
f (g a) -> Compose f g a
Rank1.Compose ((q a -> r a -> s a) -> p (q a) -> p (r a) -> p (s a)
forall (f :: * -> *) a b c.
Applicative f =>
(a -> b -> c) -> f a -> f b -> f c
Rank1.liftA2 q a -> r a -> s a
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 <*> :: Product g h (p ~> q) -> Product g h p -> Product g h q
<*> ~(Pair g p
gx h p
hx) = g q -> h q -> Product g h q
forall k (f :: k -> *) (g :: k -> *) (a :: k).
f a -> g a -> Product f g a
Pair (g (p ~> q)
gf g (p ~> q) -> g p -> g q
forall k (g :: (k -> *) -> *) (p :: k -> *) (q :: k -> *).
Apply g =>
g (p ~> q) -> g p -> g q
<*> g p
gx) (h (p ~> q)
hf h (p ~> q) -> h p -> h q
forall k (g :: (k -> *) -> *) (p :: k -> *) (q :: k -> *).
Apply g =>
g (p ~> q) -> g p -> g q
<*> h p
hx)
   liftA2 :: (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) = g r -> h r -> Product g h r
forall k (f :: k -> *) (g :: k -> *) (a :: k).
f a -> g a -> Product f g a
Pair ((forall (a :: k). p a -> q a -> r a) -> g p -> g q -> g r
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 (a :: k). p a -> q a -> r a) -> h p -> h q -> h r
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 (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) = g s -> h s -> Product g h s
forall k (f :: k -> *) (g :: k -> *) (a :: k).
f a -> g a -> Product f g a
Pair ((forall (a :: k). 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 -> *) (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 (a :: k). p a -> q a -> r a -> s a)
-> h p -> h q -> h r -> h s
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
   <*> :: V1 (p ~> q) -> V1 p -> V1 q
(<*>) V1 (p ~> q)
_ = V1 p -> V1 q
coerce
   
instance Apply Generics.U1 where
   <*> :: U1 (p ~> q) -> U1 p -> U1 q
(<*>) U1 (p ~> q)
_ = U1 p -> U1 q
coerce

instance Semigroup c => Apply (Generics.K1 i c) where
   Generics.K1 c
x <*> :: K1 i c (p ~> q) -> K1 i c p -> K1 i c q
<*> Generics.K1 c
y = c -> K1 i c q
forall k i c (p :: k). c -> K1 i c p
Generics.K1 (c
x c -> c -> c
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 <*> :: M1 i c f (p ~> q) -> M1 i c f p -> M1 i c f q
<*> Generics.M1 f p
x = f q -> M1 i c f q
forall k i (c :: Meta) (f :: k -> *) (p :: k). f p -> M1 i c f p
Generics.M1 (f (p ~> q)
f f (p ~> q) -> f p -> f q
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 <*> :: Rec1 f (p ~> q) -> Rec1 f p -> Rec1 f q
<*> Generics.Rec1 f p
x = f q -> Rec1 f q
forall k (f :: k -> *) (p :: k). f p -> Rec1 f p
Generics.Rec1 (f (p ~> q)
f f (p ~> q) -> f p -> f q
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) <*> :: (:*:) f g (p ~> q) -> (:*:) f g p -> (:*:) f g q
<*> (f p
x2 Generics.:*: g p
y2) = (f (p ~> q)
x1 f (p ~> q) -> f p -> f q
forall k (g :: (k -> *) -> *) (p :: k -> *) (q :: k -> *).
Apply g =>
g (p ~> q) -> g p -> g q
<*> f p
x2) f q -> g q -> (:*:) f g q
forall k (f :: k -> *) (g :: k -> *) (p :: k).
f p -> g p -> (:*:) f g p
Generics.:*: (g (p ~> q)
y1 g (p ~> q) -> g p -> g q
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 (a :: k). f a) -> Empty f
pure = Empty f -> f Any -> Empty f
forall a b. a -> b -> a
const Empty f
forall k (f :: k). Empty f
Empty

instance Applicative Proxy where
   pure :: (forall (a :: k). f a) -> Proxy f
pure = Proxy f -> f Any -> Proxy f
forall a b. a -> b -> a
const Proxy f
forall k (t :: k). Proxy t
Proxy

instance (Semigroup x, Monoid x) => Applicative (Const x) where
   pure :: (forall (a :: k). f a) -> Const x f
pure = Const x f -> f Any -> Const x f
forall a b. a -> b -> a
const (x -> Const x f
forall k a (b :: k). a -> Const a b
Const x
forall a. Monoid a => a
mempty)

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

instance Applicative g => Applicative (Identity g) where
   pure :: (forall (a :: k). f a) -> Identity g f
pure forall (a :: k). f a
f = g f -> Identity g f
forall k (g :: k -> *) (f :: k). g f -> Identity g f
Identity ((forall (a :: k). f a) -> g f
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 (a :: k). f a) -> Compose g p f
pure forall (a :: k). f a
f = g (Compose p f) -> Compose g p f
forall k1 k (g :: (k1 -> *) -> *) (p :: k -> *) (q :: k1 -> k).
g (Compose p q) -> Compose g p q
Compose ((forall (a :: k). Compose p f a) -> g (Compose p f)
forall k (g :: (k -> *) -> *) (f :: k -> *).
Applicative g =>
(forall (a :: k). f a) -> g f
pure (p (f a) -> Compose p f a
forall k k1 (f :: k -> *) (g :: k1 -> k) (a :: k1).
f (g a) -> Compose f g a
Rank1.Compose (f a -> p (f a)
forall (f :: * -> *) a. Applicative f => a -> f a
Rank1.pure f a
forall (a :: k). f a
f)))

instance (Applicative g, Applicative h) => Applicative (Product g h) where
   pure :: (forall (a :: k). f a) -> Product g h f
pure forall (a :: k). f a
f = g f -> h f -> Product g h f
forall k (f :: k -> *) (g :: k -> *) (a :: k).
f a -> g a -> Product f g a
Pair ((forall (a :: k). f a) -> g f
forall k (g :: (k -> *) -> *) (f :: k -> *).
Applicative g =>
(forall (a :: k). f a) -> g f
pure forall (a :: k). f a
f) ((forall (a :: k). f a) -> h 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 (a :: k). f a) -> K1 i c f
pure forall (a :: k). f a
_ = c -> K1 i c f
forall k i c (p :: k). c -> K1 i c p
Generics.K1 c
forall a. Monoid a => a
mempty

instance Applicative f => Applicative (Generics.M1 i c f) where
   pure :: (forall (a :: k). f a) -> M1 i c f f
pure forall (a :: k). f a
f = f f -> M1 i c f f
forall k i (c :: Meta) (f :: k -> *) (p :: k). f p -> M1 i c f p
Generics.M1 ((forall (a :: k). f a) -> f f
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 (a :: k). f a) -> Rec1 f f
pure forall (a :: k). f a
f = f f -> Rec1 f f
forall k (f :: k -> *) (p :: k). f p -> Rec1 f p
Generics.Rec1 ((forall (a :: k). f a) -> f f
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 (a :: k). f a) -> (:*:) f g f
pure forall (a :: k). f a
f = (forall (a :: k). f a) -> f f
forall k (g :: (k -> *) -> *) (f :: k -> *).
Applicative g =>
(forall (a :: k). f a) -> g f
pure forall (a :: k). f a
f f f -> g f -> (:*:) f g f
forall k (f :: k -> *) (g :: k -> *) (p :: k).
f p -> g p -> (:*:) f g p
Generics.:*: (forall (a :: k). f a) -> g f
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 (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 = g f -> Identity g f
forall k (g :: k -> *) (f :: k). g f -> Identity g f
Identity ((forall (x :: k). f1 (f2 x) -> f x) -> f1 (g f2) -> g 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 ((Identity g f2 -> g f2) -> f1 (Identity g f2) -> f1 (g f2)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Rank1.fmap Identity g f2 -> g f2
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 (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 = g (Compose p f) -> Compose g p f
forall k1 k (g :: (k1 -> *) -> *) (p :: k -> *) (q :: k1 -> k).
g (Compose p q) -> Compose g p q
Compose ((forall (x :: k). f1 (Compose p f2 x) -> Compose p f x)
-> f1 (g (Compose p f2)) -> g (Compose p 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
                                        (p (f x) -> Compose p f x
forall k k1 (f :: k -> *) (g :: k1 -> k) (a :: k1).
f (g a) -> Compose f g a
Rank1.Compose (p (f x) -> Compose p f x)
-> (f1 (Compose p f2 x) -> p (f x))
-> f1 (Compose p f2 x)
-> Compose p f x
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (f1 (f2 x) -> f x) -> p (f1 (f2 x)) -> p (f x)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Rank1.fmap f1 (f2 x) -> f x
forall (x :: k). f1 (f2 x) -> f x
w (p (f1 (f2 x)) -> p (f x))
-> (f1 (Compose p f2 x) -> p (f1 (f2 x)))
-> f1 (Compose p f2 x)
-> p (f x)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. f1 (p (f2 x)) -> p (f1 (f2 x))
forall (g :: * -> *) (f :: * -> *) a.
(Distributive g, Functor f) =>
f (g a) -> g (f a)
Rank1.distribute (f1 (p (f2 x)) -> p (f1 (f2 x)))
-> (f1 (Compose p f2 x) -> f1 (p (f2 x)))
-> f1 (Compose p f2 x)
-> p (f1 (f2 x))
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Compose p f2 x -> p (f2 x))
-> f1 (Compose p f2 x) -> f1 (p (f2 x))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Rank1.fmap Compose p f2 x -> p (f2 x)
forall k1 (f :: k1 -> *) k2 (g :: k2 -> k1) (a :: k2).
Compose f g a -> f (g a)
Rank1.getCompose)
                                        ((Compose g p f2 -> g (Compose p f2))
-> f1 (Compose g p f2) -> f1 (g (Compose p f2))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Rank1.fmap Compose g p f2 -> g (Compose p f2)
forall k1 (g :: (k1 -> *) -> *) k (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 (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 = g f -> h f -> Product g h f
forall k (f :: k -> *) (g :: k -> *) (a :: k).
f a -> g a -> Product f g a
Pair ((forall (x :: k). f1 (f2 x) -> f x) -> f1 (g f2) -> g 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 ((Product g h f2 -> g f2) -> f1 (Product g h f2) -> f1 (g f2)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Rank1.fmap Product g h f2 -> g f2
forall k (g :: k -> *) (h :: k -> *) (p :: k). Product g h p -> g p
fst f1 (Product g h f2)
f))
                                    ((forall (x :: k). f1 (f2 x) -> f x) -> f1 (h f2) -> h 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 ((Product g h f2 -> h f2) -> f1 (Product g h f2) -> f1 (h f2)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Rank1.fmap Product g h f2 -> h f2
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 (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 = f f -> M1 i c f f
forall k i (c :: Meta) (f :: k -> *) (p :: k). f p -> M1 i c f p
Generics.M1 ((forall (x :: k). f1 (f2 x) -> f x) -> f1 (f f2) -> f 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 ((M1 i c f f2 -> f f2) -> f1 (M1 i c f f2) -> f1 (f f2)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Rank1.fmap M1 i c f f2 -> f f2
forall i (c :: Meta) k (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 (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 = f f -> Rec1 f f
forall k (f :: k -> *) (p :: k). f p -> Rec1 f p
Generics.Rec1 ((forall (x :: k). f1 (f2 x) -> f x) -> f1 (f f2) -> f 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 ((Rec1 f f2 -> f f2) -> f1 (Rec1 f f2) -> f1 (f f2)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Rank1.fmap Rec1 f f2 -> f f2
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 (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 (x :: k). f1 (f2 x) -> f x) -> f1 (f f2) -> f 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 (((:*:) f g f2 -> f f2) -> f1 ((:*:) f g f2) -> f1 (f f2)
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) f f -> g f -> (:*:) f g f
forall k (f :: k -> *) (g :: k -> *) (p :: k).
f p -> g p -> (:*:) f g p
Generics.:*: (forall (x :: k). f1 (f2 x) -> f x) -> f1 (g f2) -> g 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 (((:*:) f g f2 -> g f2) -> f1 ((:*:) f g f2) -> f1 (g f2)
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 (a :: k). m (p a) -> q a) -> m (Empty p) -> Empty q
cotraverse forall (a :: k). m (p a) -> q a
_ m (Empty p)
_ = Empty q
forall k (f :: k). Empty f
Empty

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

instance Monoid x => DistributiveTraversable (Const x) where
   cotraverseTraversable :: (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 = Const x f2 -> Const x f
coerce (f1 (Const x f2) -> Const x f2
forall (t :: * -> *) m. (Foldable t, Monoid m) => t m -> m
Rank1.fold f1 (Const x f2)
f)

instance Distributive (Only x) where
   cotraverse :: (forall (a :: k). m (p a) -> q a) -> m (Only x p) -> Only x q
cotraverse forall (a :: k). m (p a) -> q a
w m (Only x p)
f = q x -> Only x q
forall k (a :: k) (f :: k -> *). f a -> Only a f
Only (m (p x) -> q x
forall (a :: k). m (p a) -> q a
w ((Only x p -> p x) -> m (Only x p) -> m (p x)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Rank1.fmap Only x p -> p x
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 (a :: k). m (p a) -> q a)
-> m (Identity g p) -> Identity g q
cotraverse forall (a :: k). m (p a) -> q a
w m (Identity g p)
f = g q -> Identity g q
forall k (g :: k -> *) (f :: k). g f -> Identity g f
Identity ((forall (a :: k). m (p a) -> q a) -> m (g p) -> g q
forall k (g :: (k -> *) -> *) (m :: * -> *) (p :: k -> *)
       (q :: k -> *).
(Distributive g, Functor m) =>
(forall (a :: k). m (p a) -> q a) -> m (g p) -> g q
cotraverse forall (a :: k). m (p a) -> q a
w ((Identity g p -> g p) -> m (Identity g p) -> m (g p)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Rank1.fmap Identity g p -> g p
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 (a :: k). m (p a) -> q a)
-> m (Compose g p p) -> Compose g p q
cotraverse forall (a :: k). m (p a) -> q a
w m (Compose g p p)
f = g (Compose p q) -> Compose g p q
forall k1 k (g :: (k1 -> *) -> *) (p :: k -> *) (q :: k1 -> k).
g (Compose p q) -> Compose g p q
Compose ((forall (a :: k). m (Compose p p a) -> Compose p q a)
-> m (g (Compose p p)) -> g (Compose p q)
forall k (g :: (k -> *) -> *) (m :: * -> *) (p :: k -> *)
       (q :: k -> *).
(Distributive g, Functor m) =>
(forall (a :: k). m (p a) -> q a) -> m (g p) -> g q
cotraverse (p (q a) -> Compose p q a
forall k k1 (f :: k -> *) (g :: k1 -> k) (a :: k1).
f (g a) -> Compose f g a
Rank1.Compose (p (q a) -> Compose p q a)
-> (m (Compose p p a) -> p (q a))
-> m (Compose p p a)
-> Compose p q a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (m (p a) -> q a) -> p (m (p a)) -> p (q a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Rank1.fmap m (p a) -> q a
forall (a :: k). m (p a) -> q a
w (p (m (p a)) -> p (q a))
-> (m (Compose p p a) -> p (m (p a)))
-> m (Compose p p a)
-> p (q a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. m (p (p a)) -> p (m (p a))
forall (g :: * -> *) (f :: * -> *) a.
(Distributive g, Functor f) =>
f (g a) -> g (f a)
Rank1.distribute (m (p (p a)) -> p (m (p a)))
-> (m (Compose p p a) -> m (p (p a)))
-> m (Compose p p a)
-> p (m (p a))
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Compose p p a -> p (p a)) -> m (Compose p p a) -> m (p (p a))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Rank1.fmap Compose p p a -> p (p a)
forall k1 (f :: k1 -> *) k2 (g :: k2 -> k1) (a :: k2).
Compose f g a -> f (g a)
Rank1.getCompose)
                                        ((Compose g p p -> g (Compose p p))
-> m (Compose g p p) -> m (g (Compose p p))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Rank1.fmap Compose g p p -> g (Compose p p)
forall k1 (g :: (k1 -> *) -> *) k (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 (a :: k). m (p a) -> q a)
-> m (Product g h p) -> Product g h q
cotraverse forall (a :: k). m (p a) -> q a
w m (Product g h p)
f = g q -> h q -> Product g h q
forall k (f :: k -> *) (g :: k -> *) (a :: k).
f a -> g a -> Product f g a
Pair ((forall (a :: k). m (p a) -> q a) -> m (g p) -> g q
forall k (g :: (k -> *) -> *) (m :: * -> *) (p :: k -> *)
       (q :: k -> *).
(Distributive g, Functor m) =>
(forall (a :: k). m (p a) -> q a) -> m (g p) -> g q
cotraverse forall (a :: k). m (p a) -> q a
w ((Product g h p -> g p) -> m (Product g h p) -> m (g p)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Rank1.fmap Product g h p -> g p
forall k (g :: k -> *) (h :: k -> *) (p :: k). Product g h p -> g p
fst m (Product g h p)
f)) ((forall (a :: k). m (p a) -> q a) -> m (h p) -> h q
forall k (g :: (k -> *) -> *) (m :: * -> *) (p :: k -> *)
       (q :: k -> *).
(Distributive g, Functor m) =>
(forall (a :: k). m (p a) -> q a) -> m (g p) -> g q
cotraverse forall (a :: k). m (p a) -> q a
w ((Product g h p -> h p) -> m (Product g h p) -> m (h p)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Rank1.fmap Product g h p -> h p
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 (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 = c -> K1 i c f
coerce ((K1 i c f2 -> c) -> f1 (K1 i c f2) -> c
forall (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
Rank1.foldMap K1 i c f2 -> c
forall i c k (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 (a :: k). m (p a) -> q a) -> m (M1 i c f p) -> M1 i c f q
cotraverse forall (a :: k). m (p a) -> q a
w m (M1 i c f p)
f = f q -> M1 i c f q
forall k i (c :: Meta) (f :: k -> *) (p :: k). f p -> M1 i c f p
Generics.M1 ((forall (a :: k). m (p a) -> q a) -> m (f p) -> f q
forall k (g :: (k -> *) -> *) (m :: * -> *) (p :: k -> *)
       (q :: k -> *).
(Distributive g, Functor m) =>
(forall (a :: k). m (p a) -> q a) -> m (g p) -> g q
cotraverse forall (a :: k). m (p a) -> q a
w ((M1 i c f p -> f p) -> m (M1 i c f p) -> m (f p)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Rank1.fmap M1 i c f p -> f p
forall i (c :: Meta) k (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 (a :: k). m (p a) -> q a) -> m (Rec1 f p) -> Rec1 f q
cotraverse forall (a :: k). m (p a) -> q a
w m (Rec1 f p)
f = f q -> Rec1 f q
forall k (f :: k -> *) (p :: k). f p -> Rec1 f p
Generics.Rec1 ((forall (a :: k). m (p a) -> q a) -> m (f p) -> f q
forall k (g :: (k -> *) -> *) (m :: * -> *) (p :: k -> *)
       (q :: k -> *).
(Distributive g, Functor m) =>
(forall (a :: k). m (p a) -> q a) -> m (g p) -> g q
cotraverse forall (a :: k). m (p a) -> q a
w ((Rec1 f p -> f p) -> m (Rec1 f p) -> m (f p)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Rank1.fmap Rec1 f p -> f p
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 (a :: k). m (p a) -> q a) -> m ((:*:) f g p) -> (:*:) f g q
cotraverse forall (a :: k). m (p a) -> q a
w m ((:*:) f g p)
f = (forall (a :: k). m (p a) -> q a) -> m (f p) -> f q
forall k (g :: (k -> *) -> *) (m :: * -> *) (p :: k -> *)
       (q :: k -> *).
(Distributive g, Functor m) =>
(forall (a :: k). m (p a) -> q a) -> m (g p) -> g q
cotraverse forall (a :: k). m (p a) -> q a
w (((:*:) f g p -> f p) -> m ((:*:) f g p) -> m (f p)
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) f q -> g q -> (:*:) f g q
forall k (f :: k -> *) (g :: k -> *) (p :: k).
f p -> g p -> (:*:) f g p
Generics.:*: (forall (a :: k). m (p a) -> q a) -> m (g p) -> g q
forall k (g :: (k -> *) -> *) (m :: * -> *) (p :: k -> *)
       (q :: k -> *).
(Distributive g, Functor m) =>
(forall (a :: k). m (p a) -> q a) -> m (g p) -> g q
cotraverse forall (a :: k). m (p a) -> q a
w (((:*:) f g p -> g p) -> m ((:*:) f g p) -> m (g p)
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)