{-# LANGUAGE DerivingVia           #-}
{-# OPTIONS_HADDOCK hide, not-home #-}
module Data.HFunctor.Internal (
    HFunctor(..)
  , HBifunctor(..)
  , WrappedHBifunctor(..)
  , sumSum, prodProd
  , generalize, absorb
  , NDL, ndlSingleton, fromNDL
  ) where
import           Control.Applicative.Backwards
import           Control.Applicative.Free
import           Control.Applicative.Lift
import           Control.Applicative.ListF
import           Control.Applicative.Step
import           Control.Comonad.Trans.Env
import           Control.Monad.Freer.Church
import           Control.Monad.Trans.Compose
import           Control.Monad.Trans.Identity
import           Control.Monad.Trans.Maybe
import           Control.Monad.Trans.Reader
import           Control.Natural
import           Control.Natural.IsoF
import           Data.Bifunctor
import           Data.Bifunctor.Joker
import           Data.Coerce
import           Data.Foldable
import           Data.Functor.Bind
import           Data.Functor.Contravariant.Night    (Night(..))
import           Data.Functor.Coyoneda
import           Data.Functor.Day                    (Day(..))
import           Data.Functor.Identity
import           Data.Functor.Product
import           Data.Functor.Reverse
import           Data.Functor.Sum
import           Data.Functor.These
import           Data.Functor.Yoneda
import           Data.Kind
import           Data.List.NonEmpty                  (NonEmpty(..))
import           Data.Proxy
import           Data.Tagged
import           Data.Vinyl.CoRec
import           Data.Vinyl.Core                     (Rec)
import           Data.Vinyl.Recursive
import           GHC.Generics
import qualified Control.Alternative.Free            as Alt
import qualified Control.Applicative.Free.Fast       as FAF
import qualified Control.Applicative.Free.Final      as FA
import qualified Control.Monad.Free.Church           as MC
import qualified Data.Functor.Contravariant.Coyoneda as CCY
import qualified Data.Functor.Contravariant.Day      as CD
import qualified Data.Functor.Contravariant.Night    as N
import qualified Data.Functor.Day                    as D
import qualified Data.Functor.Invariant.Day          as ID
import qualified Data.Functor.Invariant.Night        as IN
import qualified Data.SOP                            as SOP
import qualified Data.SOP.NP                         as SOP
import qualified Data.SOP.NS                         as SOP
class HFunctor t where
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    hmap :: f ~> g -> t f ~> t g
    {-# MINIMAL hmap #-}
class HBifunctor (t :: (k -> Type) -> (k -> Type) -> k -> Type) where
    
    hleft  :: f ~> j -> t f g ~> t j g
    hleft f ~> j
f t f g x
x = (f ~> j) -> (g ~> g) -> t f g ~> t j g
forall k (t :: (k -> *) -> (k -> *) -> k -> *) (f :: k -> *)
       (j :: k -> *) (g :: k -> *) (l :: k -> *).
HBifunctor t =>
(f ~> j) -> (g ~> l) -> t f g ~> t j l
forall (f :: k -> *) (j :: k -> *) (g :: k -> *) (l :: k -> *).
(f ~> j) -> (g ~> l) -> t f g ~> t j l
hbimap f x -> j x
f ~> j
f g x -> g x
g ~> g
forall a. a -> a
id t f g x
x
    
    hright :: g ~> l -> t f g ~> t f l
    hright g ~> l
f t f g x
x = (f ~> f) -> (g ~> l) -> t f g ~> t f l
forall k (t :: (k -> *) -> (k -> *) -> k -> *) (f :: k -> *)
       (j :: k -> *) (g :: k -> *) (l :: k -> *).
HBifunctor t =>
(f ~> j) -> (g ~> l) -> t f g ~> t j l
forall (f :: k -> *) (j :: k -> *) (g :: k -> *) (l :: k -> *).
(f ~> j) -> (g ~> l) -> t f g ~> t j l
hbimap f x -> f x
f ~> f
forall a. a -> a
id g x -> l x
g ~> l
f t f g x
x
    
    hbimap :: f ~> j -> g ~> l -> t f g ~> t j l
    hbimap f ~> j
f g ~> l
g = (f ~> j) -> t f l ~> t j l
forall k (t :: (k -> *) -> (k -> *) -> k -> *) (f :: k -> *)
       (j :: k -> *) (g :: k -> *).
HBifunctor t =>
(f ~> j) -> t f g ~> t j g
forall (f :: k -> *) (j :: k -> *) (g :: k -> *).
(f ~> j) -> t f g ~> t j g
hleft f x -> j x
f ~> j
f (t f l x -> t j l x) -> (t f g x -> t f l x) -> t f g x -> t j l x
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (g ~> l) -> t f g ~> t f l
forall k (t :: (k -> *) -> (k -> *) -> k -> *) (g :: k -> *)
       (l :: k -> *) (f :: k -> *).
HBifunctor t =>
(g ~> l) -> t f g ~> t f l
forall (g :: k -> *) (l :: k -> *) (f :: k -> *).
(g ~> l) -> t f g ~> t f l
hright g x -> l x
g ~> l
g
    {-# MINIMAL hleft, hright | hbimap #-}
newtype WrappedHBifunctor t (f :: k -> Type) (g :: k -> Type) (a :: k)
    = WrapHBifunctor { forall k (t :: (k -> *) -> (k -> *) -> k -> *) (f :: k -> *)
       (g :: k -> *) (a :: k).
WrappedHBifunctor t f g a -> t f g a
unwrapHBifunctor :: t f g a }
  deriving (forall a b.
 (a -> b) -> WrappedHBifunctor t f g a -> WrappedHBifunctor t f g b)
-> (forall a b.
    a -> WrappedHBifunctor t f g b -> WrappedHBifunctor t f g a)
-> Functor (WrappedHBifunctor t f g)
forall a b.
a -> WrappedHBifunctor t f g b -> WrappedHBifunctor t f g a
forall a b.
(a -> b) -> WrappedHBifunctor t f g a -> WrappedHBifunctor t f g b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
forall (t :: (* -> *) -> (* -> *) -> * -> *) (f :: * -> *)
       (g :: * -> *) a b.
Functor (t f g) =>
a -> WrappedHBifunctor t f g b -> WrappedHBifunctor t f g a
forall (t :: (* -> *) -> (* -> *) -> * -> *) (f :: * -> *)
       (g :: * -> *) a b.
Functor (t f g) =>
(a -> b) -> WrappedHBifunctor t f g a -> WrappedHBifunctor t f g b
$cfmap :: forall (t :: (* -> *) -> (* -> *) -> * -> *) (f :: * -> *)
       (g :: * -> *) a b.
Functor (t f g) =>
(a -> b) -> WrappedHBifunctor t f g a -> WrappedHBifunctor t f g b
fmap :: forall a b.
(a -> b) -> WrappedHBifunctor t f g a -> WrappedHBifunctor t f g b
$c<$ :: forall (t :: (* -> *) -> (* -> *) -> * -> *) (f :: * -> *)
       (g :: * -> *) a b.
Functor (t f g) =>
a -> WrappedHBifunctor t f g b -> WrappedHBifunctor t f g a
<$ :: forall a b.
a -> WrappedHBifunctor t f g b -> WrappedHBifunctor t f g a
Functor
sumSum :: (f :+: g) <~> Sum f g
sumSum :: forall {k} (f :: k -> *) (g :: k -> *) (p :: * -> * -> *) (a :: k).
Profunctor p =>
p (Sum f g a) (Sum f g a) -> p ((:+:) f g a) ((:+:) f g a)
sumSum = ((f :+: g) ~> Sum f g)
-> (Sum f g ~> (f :+: g)) -> (f :+: g) <~> Sum f g
forall {k} (f :: k -> *) (g :: k -> *).
(f ~> g) -> (g ~> f) -> f <~> g
isoF (:+:) f g x -> Sum f g x
(f :+: g) ~> Sum f g
forall {k} {f :: k -> *} {g :: k -> *} {a :: k}.
(:+:) f g a -> Sum f g a
to_ Sum f g x -> (:+:) f g x
Sum f g ~> (f :+: g)
forall {k} {f :: k -> *} {g :: k -> *} {p :: k}.
Sum f g p -> (:+:) f g p
from_
  where
    to_ :: (:+:) f g a -> Sum f g a
to_   (L1 f a
x)  = f a -> Sum f g a
forall {k} (f :: k -> *) (g :: k -> *) (a :: k). f a -> Sum f g a
InL f a
x
    to_   (R1 g a
y)  = g a -> Sum f g a
forall {k} (f :: k -> *) (g :: k -> *) (a :: k). g a -> Sum f g a
InR g a
y
    from_ :: Sum f g p -> (:+:) f g p
from_ (InL f p
x) = f p -> (:+:) f g p
forall k (f :: k -> *) (g :: k -> *) (p :: k). f p -> (:+:) f g p
L1 f p
x
    from_ (InR g p
y) = g p -> (:+:) f g p
forall k (f :: k -> *) (g :: k -> *) (p :: k). g p -> (:+:) f g p
R1 g p
y
prodProd :: (f :*: g) <~> Product f g
prodProd :: forall {k} (f :: k -> *) (g :: k -> *) (p :: * -> * -> *) (a :: k).
Profunctor p =>
p (Product f g a) (Product f g a) -> p ((:*:) f g a) ((:*:) f g a)
prodProd = ((f :*: g) ~> Product f g)
-> (Product f g ~> (f :*: g)) -> (f :*: g) <~> Product f g
forall {k} (f :: k -> *) (g :: k -> *).
(f ~> g) -> (g ~> f) -> f <~> g
isoF (:*:) f g x -> Product f g x
(f :*: g) ~> Product f g
forall {k} {f :: k -> *} {g :: k -> *} {a :: k}.
(:*:) f g a -> Product f g a
to_ Product f g x -> (:*:) f g x
Product f g ~> (f :*: g)
forall {k} {f :: k -> *} {g :: k -> *} {p :: k}.
Product f g p -> (:*:) f g p
from_
  where
    to_ :: (:*:) f g a -> Product f g a
to_   (f a
x :*: g a
y)  = f a -> g a -> Product f g a
forall {k} (f :: k -> *) (g :: k -> *) (a :: k).
f a -> g a -> Product f g a
Pair f a
x g a
y
    from_ :: Product f g p -> (:*:) f g p
from_ (Pair f p
x g p
y) = f p
x f p -> g p -> (:*:) f g p
forall k (f :: k -> *) (g :: k -> *) (p :: k).
f p -> g p -> (:*:) f g p
:*: g p
y
generalize :: Applicative f => Identity ~> f
generalize :: forall (f :: * -> *). Applicative f => Identity ~> f
generalize (Identity x
x) = x -> f x
forall a. a -> f a
forall (f :: * -> *) a. Applicative f => a -> f a
pure x
x
absorb :: f ~> Proxy
absorb :: forall {k} (f :: k -> *) (x :: k). f x -> Proxy x
absorb f x
_ = Proxy x
forall {k} (t :: k). Proxy t
Proxy
newtype NDL a = NDL ([a] -> NonEmpty a)
ndlSingleton :: a -> NDL a
ndlSingleton :: forall a. a -> NDL a
ndlSingleton a
x = ([a] -> NonEmpty a) -> NDL a
forall a. ([a] -> NonEmpty a) -> NDL a
NDL (a
xa -> [a] -> NonEmpty a
forall a. a -> [a] -> NonEmpty a
:|)
fromNDL :: NDL a -> NonEmpty a
fromNDL :: forall a. NDL a -> NonEmpty a
fromNDL (NDL [a] -> NonEmpty a
f) = [a] -> NonEmpty a
f []
instance Semigroup (NDL a) where
    NDL [a] -> NonEmpty a
x <> :: NDL a -> NDL a -> NDL a
<> NDL [a] -> NonEmpty a
y = ([a] -> NonEmpty a) -> NDL a
forall a. ([a] -> NonEmpty a) -> NDL a
NDL ([a] -> NonEmpty a
x ([a] -> NonEmpty a) -> ([a] -> [a]) -> [a] -> NonEmpty a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. NonEmpty a -> [a]
forall a. NonEmpty a -> [a]
forall (t :: * -> *) a. Foldable t => t a -> [a]
toList (NonEmpty a -> [a]) -> ([a] -> NonEmpty a) -> [a] -> [a]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [a] -> NonEmpty a
y)
instance HFunctor Coyoneda where
    hmap :: forall (f :: * -> *) (g :: * -> *).
(f ~> g) -> Coyoneda f ~> Coyoneda g
hmap f ~> g
f Coyoneda f x
x = (f ~> g) -> Coyoneda f x -> Coyoneda g x
forall (f :: * -> *) (g :: * -> *) b.
(forall a. f a -> g a) -> Coyoneda f b -> Coyoneda g b
hoistCoyoneda f a -> g a
f ~> g
f Coyoneda f x
x
instance HFunctor CCY.Coyoneda where
    hmap :: forall (f :: * -> *) (g :: * -> *).
(f ~> g) -> Coyoneda f ~> Coyoneda g
hmap f ~> g
f (CCY.Coyoneda x -> b
g f b
x) = (x -> b) -> g b -> Coyoneda g x
forall a b (f :: * -> *). (a -> b) -> f b -> Coyoneda f a
CCY.Coyoneda x -> b
g (f b -> g b
f ~> g
f f b
x)
instance HFunctor Ap where
    hmap :: forall (f :: * -> *) (g :: * -> *). (f ~> g) -> Ap f ~> Ap g
hmap f ~> g
f Ap f x
x = (f ~> g) -> Ap f x -> Ap g x
forall (f :: * -> *) (g :: * -> *) b.
(forall a. f a -> g a) -> Ap f b -> Ap g b
hoistAp f a -> g a
f ~> g
f Ap f x
x
instance HFunctor ListF where
    hmap :: forall (f :: k -> *) (g :: k -> *). (f ~> g) -> ListF f ~> ListF g
hmap f ~> g
f (ListF [f x]
xs) = [g x] -> ListF g x
forall {k} (f :: k -> *) (a :: k). [f a] -> ListF f a
ListF ((f x -> g x) -> [f x] -> [g x]
forall a b. (a -> b) -> [a] -> [b]
map f x -> g x
f ~> g
f [f x]
xs)
instance HFunctor NonEmptyF where
    hmap :: forall (f :: k -> *) (g :: k -> *).
(f ~> g) -> NonEmptyF f ~> NonEmptyF g
hmap f ~> g
f (NonEmptyF NonEmpty (f x)
xs) = NonEmpty (g x) -> NonEmptyF g x
forall {k} (f :: k -> *) (a :: k). NonEmpty (f a) -> NonEmptyF f a
NonEmptyF ((f x -> g x) -> NonEmpty (f x) -> NonEmpty (g x)
forall a b. (a -> b) -> NonEmpty a -> NonEmpty b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap f x -> g x
f ~> g
f NonEmpty (f x)
xs)
instance HFunctor MaybeF where
    hmap :: forall (f :: k -> *) (g :: k -> *).
(f ~> g) -> MaybeF f ~> MaybeF g
hmap f ~> g
f (MaybeF Maybe (f x)
xs) = Maybe (g x) -> MaybeF g x
forall {k} (f :: k -> *) (a :: k). Maybe (f a) -> MaybeF f a
MaybeF ((f x -> g x) -> Maybe (f x) -> Maybe (g x)
forall a b. (a -> b) -> Maybe a -> Maybe b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap f x -> g x
f ~> g
f Maybe (f x)
xs)
instance HFunctor (MapF k) where
    hmap :: forall (f :: k -> *) (g :: k -> *).
(f ~> g) -> MapF k f ~> MapF k g
hmap f ~> g
f (MapF Map k (f x)
xs) = Map k (g x) -> MapF k g x
forall {k} k1 (f :: k -> *) (a :: k). Map k1 (f a) -> MapF k1 f a
MapF ((f x -> g x) -> Map k (f x) -> Map k (g x)
forall a b. (a -> b) -> Map k a -> Map k b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap f x -> g x
f ~> g
f Map k (f x)
xs)
instance HFunctor (NEMapF k) where
    hmap :: forall (f :: k -> *) (g :: k -> *).
(f ~> g) -> NEMapF k f ~> NEMapF k g
hmap f ~> g
f (NEMapF NEMap k (f x)
xs) = NEMap k (g x) -> NEMapF k g x
forall {k} k1 (f :: k -> *) (a :: k).
NEMap k1 (f a) -> NEMapF k1 f a
NEMapF ((f x -> g x) -> NEMap k (f x) -> NEMap k (g x)
forall a b. (a -> b) -> NEMap k a -> NEMap k b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap f x -> g x
f ~> g
f NEMap k (f x)
xs)
instance HFunctor Alt.Alt where
    hmap :: forall (f :: * -> *) (g :: * -> *). (f ~> g) -> Alt f ~> Alt g
hmap f ~> g
f Alt f x
x = (f ~> g) -> Alt f x -> Alt g x
forall (f :: * -> *) (g :: * -> *) b.
(forall a. f a -> g a) -> Alt f b -> Alt g b
Alt.hoistAlt f a -> g a
f ~> g
f Alt f x
x
instance HFunctor Alt.AltF where
    hmap :: forall (f :: * -> *) (g :: * -> *). (f ~> g) -> AltF f ~> AltF g
hmap f ~> g
f = \case
      Alt.Ap f a1
x Alt f (a1 -> x)
xs -> g a1 -> Alt g (a1 -> x) -> AltF g x
forall (f :: * -> *) a1 a. f a1 -> Alt f (a1 -> a) -> AltF f a
Alt.Ap (f a1 -> g a1
f ~> g
f f a1
x) ((f ~> g) -> Alt f ~> Alt g
forall {k} {k} (t :: (k -> *) -> k -> *) (f :: k -> *)
       (g :: k -> *).
HFunctor t =>
(f ~> g) -> t f ~> t g
forall (f :: * -> *) (g :: * -> *). (f ~> g) -> Alt f ~> Alt g
hmap f x -> g x
f ~> g
f Alt f (a1 -> x)
xs)
      Alt.Pure x
x  -> x -> AltF g x
forall a (f :: * -> *). a -> AltF f a
Alt.Pure x
x
instance HFunctor Step where
    hmap :: forall (f :: k -> *) (g :: k -> *). (f ~> g) -> Step f ~> Step g
hmap f ~> g
f (Step Natural
n f x
x) = Natural -> g x -> Step g x
forall {k} (f :: k -> *) (a :: k). Natural -> f a -> Step f a
Step Natural
n (f x -> g x
f ~> g
f f x
x)
instance HFunctor Steps where
    hmap :: forall (f :: k -> *) (g :: k -> *). (f ~> g) -> Steps f ~> Steps g
hmap f ~> g
f (Steps NEMap Natural (f x)
xs) = NEMap Natural (g x) -> Steps g x
forall {k} (f :: k -> *) (a :: k). NEMap Natural (f a) -> Steps f a
Steps (f x -> g x
f ~> g
f (f x -> g x) -> NEMap Natural (f x) -> NEMap Natural (g x)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> NEMap Natural (f x)
xs)
instance HFunctor Flagged where
    hmap :: forall (f :: k -> *) (g :: k -> *).
(f ~> g) -> Flagged f ~> Flagged g
hmap f ~> g
f (Flagged Bool
b f x
x) = Bool -> g x -> Flagged g x
forall {k} (f :: k -> *) (a :: k). Bool -> f a -> Flagged f a
Flagged Bool
b (f x -> g x
f ~> g
f f x
x)
instance HFunctor Free where
    hmap :: forall (f :: * -> *) (g :: * -> *). (f ~> g) -> Free f ~> Free g
hmap f ~> g
f Free f x
x = (f ~> g) -> Free f ~> Free g
forall (f :: * -> *) (g :: * -> *). (f ~> g) -> Free f ~> Free g
hoistFree f x -> g x
f ~> g
f Free f x
x
instance HFunctor Free1 where
    hmap :: forall (f :: * -> *) (g :: * -> *). (f ~> g) -> Free1 f ~> Free1 g
hmap f ~> g
f Free1 f x
x = (f ~> g) -> Free1 f ~> Free1 g
forall (f :: * -> *) (g :: * -> *). (f ~> g) -> Free1 f ~> Free1 g
hoistFree1 f x -> g x
f ~> g
f Free1 f x
x
instance HFunctor MC.F where
    hmap :: forall (f :: * -> *) (g :: * -> *). (f ~> g) -> F f ~> F g
hmap f ~> g
f F f x
x = (f ~> g) -> F f x -> F g x
forall (f :: * -> *) (g :: * -> *) a.
(forall x. f x -> g x) -> F f a -> F g a
MC.hoistF f x -> g x
f ~> g
f F f x
x
instance HFunctor MaybeT where
    hmap :: forall (f :: * -> *) (g :: * -> *).
(f ~> g) -> MaybeT f ~> MaybeT g
hmap f ~> g
f MaybeT f x
x = (f (Maybe x) -> g (Maybe x)) -> MaybeT f x -> MaybeT g x
forall (m :: * -> *) a (n :: * -> *) b.
(m (Maybe a) -> n (Maybe b)) -> MaybeT m a -> MaybeT n b
mapMaybeT f (Maybe x) -> g (Maybe x)
f ~> g
f MaybeT f x
x
instance HFunctor Yoneda where
    hmap :: forall (f :: * -> *) (g :: * -> *).
(f ~> g) -> Yoneda f ~> Yoneda g
hmap f ~> g
f Yoneda f x
x = (forall b. (x -> b) -> g b) -> Yoneda g x
forall (f :: * -> *) a. (forall b. (a -> b) -> f b) -> Yoneda f a
Yoneda ((forall b. (x -> b) -> g b) -> Yoneda g x)
-> (forall b. (x -> b) -> g b) -> Yoneda g x
forall a b. (a -> b) -> a -> b
$ f b -> g b
f ~> g
f (f b -> g b) -> ((x -> b) -> f b) -> (x -> b) -> g b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Yoneda f x -> forall b. (x -> b) -> f b
forall (f :: * -> *) a. Yoneda f a -> forall b. (a -> b) -> f b
runYoneda Yoneda f x
x
instance HFunctor FA.Ap where
    hmap :: forall (f :: * -> *) (g :: * -> *). (f ~> g) -> Ap f ~> Ap g
hmap f ~> g
f Ap f x
x = (f ~> g) -> Ap f x -> Ap g x
forall (f :: * -> *) (g :: * -> *) b.
(forall a. f a -> g a) -> Ap f b -> Ap g b
FA.hoistAp f a -> g a
f ~> g
f Ap f x
x
instance HFunctor FAF.Ap where
    hmap :: forall (f :: * -> *) (g :: * -> *). (f ~> g) -> Ap f ~> Ap g
hmap f ~> g
f Ap f x
x = (f ~> g) -> Ap f x -> Ap g x
forall (f :: * -> *) (g :: * -> *) a.
(forall x. f x -> g x) -> Ap f a -> Ap g a
FAF.hoistAp f x -> g x
f ~> g
f Ap f x
x
instance HFunctor IdentityT where
    hmap :: forall (f :: k -> *) (g :: k -> *).
(f ~> g) -> IdentityT f ~> IdentityT g
hmap f ~> g
f IdentityT f x
x = (f x -> g x) -> IdentityT f x -> IdentityT g x
forall {k1} {k2} (m :: k1 -> *) (a :: k1) (n :: k2 -> *) (b :: k2).
(m a -> n b) -> IdentityT m a -> IdentityT n b
mapIdentityT f x -> g x
f ~> g
f IdentityT f x
x
instance HFunctor Lift where
    hmap :: forall (f :: * -> *) (g :: * -> *). (f ~> g) -> Lift f ~> Lift g
hmap f ~> g
f Lift f x
x = (f x -> g x) -> Lift f x -> Lift g x
forall (f :: * -> *) a (g :: * -> *).
(f a -> g a) -> Lift f a -> Lift g a
mapLift f x -> g x
f ~> g
f Lift f x
x
instance HFunctor MaybeApply where
    hmap :: forall (f :: * -> *) (g :: * -> *).
(f ~> g) -> MaybeApply f ~> MaybeApply g
hmap f ~> g
f (MaybeApply Either (f x) x
x) = Either (g x) x -> MaybeApply g x
forall (f :: * -> *) a. Either (f a) a -> MaybeApply f a
MaybeApply ((f x -> g x) -> Either (f x) x -> Either (g x) x
forall a b c. (a -> b) -> Either a c -> Either b c
forall (p :: * -> * -> *) a b c.
Bifunctor p =>
(a -> b) -> p a c -> p b c
first f x -> g x
f ~> g
f Either (f x) x
x)
instance HFunctor Backwards where
    hmap :: forall (f :: k -> *) (g :: k -> *).
(f ~> g) -> Backwards f ~> Backwards g
hmap f ~> g
f (Backwards f x
x) = g x -> Backwards g x
forall {k} (f :: k -> *) (a :: k). f a -> Backwards f a
Backwards (f x -> g x
f ~> g
f f x
x)
instance HFunctor WrappedApplicative where
    hmap :: forall (f :: * -> *) (g :: * -> *).
(f ~> g) -> WrappedApplicative f ~> WrappedApplicative g
hmap f ~> g
f (WrapApplicative f x
x) = g x -> WrappedApplicative g x
forall (f :: * -> *) a. f a -> WrappedApplicative f a
WrapApplicative (f x -> g x
f ~> g
f f x
x)
instance HFunctor (ReaderT r) where
    hmap :: forall (f :: * -> *) (g :: * -> *).
(f ~> g) -> ReaderT r f ~> ReaderT r g
hmap f ~> g
f ReaderT r f x
x = (f x -> g x) -> ReaderT r f x -> ReaderT r g x
forall (m :: * -> *) a (n :: * -> *) b r.
(m a -> n b) -> ReaderT r m a -> ReaderT r n b
mapReaderT f x -> g x
f ~> g
f ReaderT r f x
x
instance HFunctor Tagged where
    hmap :: forall (f :: k -> *) (g :: k -> *).
(f ~> g) -> Tagged f ~> Tagged g
hmap f ~> g
_ Tagged f x
x = Tagged f x -> Tagged g x
forall a b. Coercible a b => a -> b
coerce Tagged f x
x
instance HFunctor Reverse where
    hmap :: forall (f :: k -> *) (g :: k -> *).
(f ~> g) -> Reverse f ~> Reverse g
hmap f ~> g
f (Reverse f x
x) = g x -> Reverse g x
forall {k} (f :: k -> *) (a :: k). f a -> Reverse f a
Reverse (f x -> g x
f ~> g
f f x
x)
instance (HFunctor s, HFunctor t) => HFunctor (ComposeT s t) where
    hmap :: forall (f :: * -> *) (g :: * -> *).
(f ~> g) -> ComposeT s t f ~> ComposeT s t g
hmap f ~> g
f (ComposeT s (t f) x
x) = s (t g) x -> ComposeT s t g x
forall (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *)
       (m :: * -> *) a.
f (g m) a -> ComposeT f g m a
ComposeT (s (t g) x -> ComposeT s t g x) -> s (t g) x -> ComposeT s t g x
forall a b. (a -> b) -> a -> b
$ (t f ~> t g) -> s (t f) ~> s (t g)
forall {k} {k} (t :: (k -> *) -> k -> *) (f :: k -> *)
       (g :: k -> *).
HFunctor t =>
(f ~> g) -> t f ~> t g
forall (f :: * -> *) (g :: * -> *). (f ~> g) -> s f ~> s g
hmap ((f ~> g) -> t f ~> t g
forall {k} {k} (t :: (k -> *) -> k -> *) (f :: k -> *)
       (g :: k -> *).
HFunctor t =>
(f ~> g) -> t f ~> t g
forall (f :: * -> *) (g :: * -> *). (f ~> g) -> t f ~> t g
hmap f x -> g x
f ~> g
f) s (t f) x
x
instance Functor f => HFunctor ((:.:) f) where
    hmap :: forall (f :: k -> *) (g :: k -> *).
(f ~> g) -> (f :.: f) ~> (f :.: g)
hmap f ~> g
f (Comp1 f (f x)
x) = f (g x) -> (:.:) f g x
forall k2 k1 (f :: k2 -> *) (g :: k1 -> k2) (p :: k1).
f (g p) -> (:.:) f g p
Comp1 (f x -> g x
f ~> g
f (f x -> g x) -> f (f x) -> f (g x)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> f (f x)
x)
instance HFunctor (M1 i c) where
    hmap :: forall (f :: k -> *) (g :: k -> *).
(f ~> g) -> M1 i c f ~> M1 i c g
hmap f ~> g
f (M1 f x
x) = g x -> M1 i c g x
forall k i (c :: Meta) (f :: k -> *) (p :: k). f p -> M1 i c f p
M1 (f x -> g x
f ~> g
f f x
x)
instance HFunctor Void2 where
    hmap :: forall (f :: k -> *) (g :: k -> *). (f ~> g) -> Void2 f ~> Void2 g
hmap f ~> g
_ Void2 f x
x = Void2 f x -> Void2 g x
forall a b. Coercible a b => a -> b
coerce Void2 f x
x
instance HFunctor (EnvT e) where
    hmap :: forall (f :: * -> *) (g :: * -> *).
(f ~> g) -> EnvT e f ~> EnvT e g
hmap f ~> g
f (EnvT e
e f x
x) = e -> g x -> EnvT e g x
forall e (w :: * -> *) a. e -> w a -> EnvT e w a
EnvT e
e (f x -> g x
f ~> g
f f x
x)
instance HFunctor Rec where
    hmap :: forall (f :: k -> *) (g :: k -> *). (f ~> g) -> Rec f ~> Rec g
hmap f ~> g
f Rec f x
x = (f ~> g) -> Rec f x -> Rec g x
forall {u} (f :: u -> *) (g :: u -> *) (rs :: [u]).
(forall (x :: u). f x -> g x) -> Rec f rs -> Rec g rs
rmap f x -> g x
f ~> g
f Rec f x
x
instance HFunctor CoRec where
    hmap :: forall (f :: k -> *) (g :: k -> *). (f ~> g) -> CoRec f ~> CoRec g
hmap f ~> g
f (CoRec f a1
x) = g a1 -> CoRec g x
forall {k} (a1 :: k) (b :: [k]) (a :: k -> *).
RElem a1 b (RIndex a1 b) =>
a a1 -> CoRec a b
CoRec (f a1 -> g a1
f ~> g
f f a1
x)
instance HFunctor SOP.NP where
    hmap :: forall (f :: k -> *) (g :: k -> *). (f ~> g) -> NP f ~> NP g
hmap f ~> g
f = NP g '[]
-> (forall (y :: k) (ys :: [k]). f y -> NP g ys -> NP g (y : ys))
-> NP f x
-> NP g x
forall {k} (r :: [k] -> *) (f :: k -> *) (xs :: [k]).
r '[]
-> (forall (y :: k) (ys :: [k]). f y -> r ys -> r (y : ys))
-> NP f xs
-> r xs
SOP.cata_NP NP g '[]
forall {k} (a :: k -> *). NP a '[]
SOP.Nil (g y -> NP g ys -> NP g (y : ys)
forall {k} (a :: k -> *) (x :: k) (xs :: [k]).
a x -> NP a xs -> NP a (x : xs)
(SOP.:*) (g y -> NP g ys -> NP g (y : ys))
-> (f y -> g y) -> f y -> NP g ys -> NP g (y : ys)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. f y -> g y
f ~> g
f)
instance HFunctor SOP.NS where
    hmap :: forall (f :: k -> *) (g :: k -> *). (f ~> g) -> NS f ~> NS g
hmap f ~> g
f = (forall (y :: k) (ys :: [k]). f y -> NS g (y : ys))
-> (forall (y :: k) (ys :: [k]). NS g ys -> NS g (y : ys))
-> NS f x
-> NS g x
forall {k} (r :: [k] -> *) (f :: k -> *) (xs :: [k]).
(forall (y :: k) (ys :: [k]). f y -> r (y : ys))
-> (forall (y :: k) (ys :: [k]). r ys -> r (y : ys))
-> NS f xs
-> r xs
SOP.cata_NS (g y -> NS g (y : ys)
forall {k} (a :: k -> *) (x :: k) (xs :: [k]). a x -> NS a (x : xs)
SOP.Z (g y -> NS g (y : ys)) -> (f y -> g y) -> f y -> NS g (y : ys)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. f y -> g y
f ~> g
f) NS g ys -> NS g (y : ys)
forall (y :: k) (ys :: [k]). NS g ys -> NS g (y : ys)
forall {k} (a :: k -> *) (xs :: [k]) (x :: k).
NS a xs -> NS a (x : xs)
SOP.S
instance HFunctor (Joker f) where
    hmap :: forall (f :: k -> *) (g :: k -> *).
(f ~> g) -> Joker f f ~> Joker f g
hmap f ~> g
_ Joker f f x
x = Joker f f x -> Joker f g x
forall a b. Coercible a b => a -> b
coerce Joker f f x
x
instance HFunctor (Void3 f) where
    hmap :: forall (f :: k -> *) (g :: k -> *).
(f ~> g) -> Void3 f f ~> Void3 f g
hmap f ~> g
_ = \case {}
instance HFunctor (Comp f) where
    hmap :: forall (f :: k -> *) (g :: k -> *).
(f ~> g) -> Comp f f ~> Comp f g
hmap f ~> g
f (f x
x :>>= x -> f x
h) = f x
x f x -> (x -> g x) -> Comp f g x
forall {k} (f :: * -> *) (g :: k -> *) (a :: k) x.
f x -> (x -> g a) -> Comp f g a
:>>= (f x -> g x
f ~> g
f (f x -> g x) -> (x -> f x) -> x -> g x
forall b c a. (b -> c) -> (a -> b) -> a -> c
. x -> f x
h)
instance HBifunctor (:*:) where
    hleft :: forall (f :: k -> *) (j :: k -> *) (g :: k -> *).
(f ~> j) -> (f :*: g) ~> (j :*: g)
hleft  f ~> j
f (f x
x :*: g x
y) = f x -> j x
f ~> j
f f x
x j x -> g x -> (:*:) j g x
forall k (f :: k -> *) (g :: k -> *) (p :: k).
f p -> g p -> (:*:) f g p
:*:   g x
y
    hright :: forall (g :: k -> *) (l :: k -> *) (f :: k -> *).
(g ~> l) -> (f :*: g) ~> (f :*: l)
hright g ~> l
g (f x
x :*: g x
y) =   f x
x f x -> l x -> (:*:) f l x
forall k (f :: k -> *) (g :: k -> *) (p :: k).
f p -> g p -> (:*:) f g p
:*: g x -> l x
g ~> l
g g x
y
    hbimap :: forall (f :: k -> *) (j :: k -> *) (g :: k -> *) (l :: k -> *).
(f ~> j) -> (g ~> l) -> (f :*: g) ~> (j :*: l)
hbimap f ~> j
f g ~> l
g (f x
x :*: g x
y) = f x -> j x
f ~> j
f f x
x j x -> l x -> (:*:) j l x
forall k (f :: k -> *) (g :: k -> *) (p :: k).
f p -> g p -> (:*:) f g p
:*: g x -> l x
g ~> l
g g x
y
instance HBifunctor Product where
    hleft :: forall (f :: k -> *) (j :: k -> *) (g :: k -> *).
(f ~> j) -> Product f g ~> Product j g
hleft  f ~> j
f (Pair f x
x g x
y)   = j x -> g x -> Product j g x
forall {k} (f :: k -> *) (g :: k -> *) (a :: k).
f a -> g a -> Product f g a
Pair (f x -> j x
f ~> j
f f x
x)    g x
y
    hright :: forall (g :: k -> *) (l :: k -> *) (f :: k -> *).
(g ~> l) -> Product f g ~> Product f l
hright g ~> l
g (Pair f x
x g x
y)   = f x -> l x -> Product f l x
forall {k} (f :: k -> *) (g :: k -> *) (a :: k).
f a -> g a -> Product f g a
Pair    f x
x  (g x -> l x
g ~> l
g g x
y)
    hbimap :: forall (f :: k -> *) (j :: k -> *) (g :: k -> *) (l :: k -> *).
(f ~> j) -> (g ~> l) -> Product f g ~> Product j l
hbimap f ~> j
f g ~> l
g (Pair f x
x g x
y) = j x -> l x -> Product j l x
forall {k} (f :: k -> *) (g :: k -> *) (a :: k).
f a -> g a -> Product f g a
Pair (f x -> j x
f ~> j
f f x
x) (g x -> l x
g ~> l
g g x
y)
instance HBifunctor Day where
    hleft :: forall (f :: * -> *) (j :: * -> *) (g :: * -> *).
(f ~> j) -> Day f g ~> Day j g
hleft f ~> j
f Day f g x
x = (f ~> j) -> Day f g x -> Day j g x
forall (f :: * -> *) (g :: * -> *) (h :: * -> *) a.
(forall x. f x -> g x) -> Day f h a -> Day g h a
D.trans1 f x -> j x
f ~> j
f Day f g x
x
    hright :: forall (g :: * -> *) (l :: * -> *) (f :: * -> *).
(g ~> l) -> Day f g ~> Day f l
hright g ~> l
f Day f g x
x = (g ~> l) -> Day f g x -> Day f l x
forall (g :: * -> *) (h :: * -> *) (f :: * -> *) a.
(forall x. g x -> h x) -> Day f g a -> Day f h a
D.trans2 g x -> l x
g ~> l
f Day f g x
x
    hbimap :: forall (f :: * -> *) (j :: * -> *) (g :: * -> *) (l :: * -> *).
(f ~> j) -> (g ~> l) -> Day f g ~> Day j l
hbimap f ~> j
f g ~> l
g (Day f b
x g c
y b -> c -> x
z) = j b -> l c -> (b -> c -> x) -> Day j l x
forall (f :: * -> *) (g :: * -> *) a b c.
f b -> g c -> (b -> c -> a) -> Day f g a
Day (f b -> j b
f ~> j
f f b
x) (g c -> l c
g ~> l
g g c
y) b -> c -> x
z
instance HBifunctor CD.Day where
    hleft :: forall (f :: * -> *) (j :: * -> *) (g :: * -> *).
(f ~> j) -> Day f g ~> Day j g
hleft f ~> j
f Day f g x
x = (f ~> j) -> Day f g x -> Day j g x
forall (f :: * -> *) (g :: * -> *) (h :: * -> *) a.
(forall x. f x -> g x) -> Day f h a -> Day g h a
CD.trans1 f x -> j x
f ~> j
f Day f g x
x
    hright :: forall (g :: * -> *) (l :: * -> *) (f :: * -> *).
(g ~> l) -> Day f g ~> Day f l
hright g ~> l
f Day f g x
x = (g ~> l) -> Day f g x -> Day f l x
forall (g :: * -> *) (h :: * -> *) (f :: * -> *) a.
(forall x. g x -> h x) -> Day f g a -> Day f h a
CD.trans2 g x -> l x
g ~> l
f Day f g x
x
    hbimap :: forall (f :: * -> *) (j :: * -> *) (g :: * -> *) (l :: * -> *).
(f ~> j) -> (g ~> l) -> Day f g ~> Day j l
hbimap f ~> j
f g ~> l
g (CD.Day f b
x g c
y x -> (b, c)
z) = j b -> l c -> (x -> (b, c)) -> Day j l x
forall (f :: * -> *) (g :: * -> *) a b c.
f b -> g c -> (a -> (b, c)) -> Day f g a
CD.Day (f b -> j b
f ~> j
f f b
x) (g c -> l c
g ~> l
g g c
y) x -> (b, c)
z
instance HBifunctor ID.Day where
    hbimap :: forall (f :: * -> *) (j :: * -> *) (g :: * -> *) (l :: * -> *).
(f ~> j) -> (g ~> l) -> Day f g ~> Day j l
hbimap f ~> j
f g ~> l
g (ID.Day f b
x g c
y b -> c -> x
h x -> (b, c)
j) = j b -> l c -> (b -> c -> x) -> (x -> (b, c)) -> Day j l x
forall (f :: * -> *) (g :: * -> *) a b c.
f b -> g c -> (b -> c -> a) -> (a -> (b, c)) -> Day f g a
ID.Day (f b -> j b
f ~> j
f f b
x) (g c -> l c
g ~> l
g g c
y) b -> c -> x
h x -> (b, c)
j
instance HBifunctor IN.Night where
    hbimap :: forall (f :: * -> *) (j :: * -> *) (g :: * -> *) (l :: * -> *).
(f ~> j) -> (g ~> l) -> Night f g ~> Night j l
hbimap f ~> j
f g ~> l
g (IN.Night f b1
x g c1
y b1 -> x
h c1 -> x
j x -> Either b1 c1
k) = j b1
-> l c1
-> (b1 -> x)
-> (c1 -> x)
-> (x -> Either b1 c1)
-> Night j l x
forall (a :: * -> *) b1 (b :: * -> *) c1 c.
a b1
-> b c1
-> (b1 -> c)
-> (c1 -> c)
-> (c -> Either b1 c1)
-> Night a b c
IN.Night (f b1 -> j b1
f ~> j
f f b1
x) (g c1 -> l c1
g ~> l
g g c1
y) b1 -> x
h c1 -> x
j x -> Either b1 c1
k
instance HBifunctor Night where
    hleft :: forall (f :: * -> *) (j :: * -> *) (g :: * -> *).
(f ~> j) -> Night f g ~> Night j g
hleft f ~> j
f Night f g x
x = (f ~> j) -> Night f g ~> Night j g
forall (f :: * -> *) (j :: * -> *) (g :: * -> *).
(f ~> j) -> Night f g ~> Night j g
N.trans1 f x -> j x
f ~> j
f Night f g x
x
    hright :: forall (g :: * -> *) (l :: * -> *) (f :: * -> *).
(g ~> l) -> Night f g ~> Night f l
hright g ~> l
f Night f g x
x = (g ~> l) -> Night f g ~> Night f l
forall (g :: * -> *) (l :: * -> *) (f :: * -> *).
(g ~> l) -> Night f g ~> Night f l
N.trans2 g x -> l x
g ~> l
f Night f g x
x
    hbimap :: forall (f :: * -> *) (j :: * -> *) (g :: * -> *) (l :: * -> *).
(f ~> j) -> (g ~> l) -> Night f g ~> Night j l
hbimap f ~> j
f g ~> l
g (Night f b1
x g c1
y x -> Either b1 c1
z) = j b1 -> l c1 -> (x -> Either b1 c1) -> Night j l x
forall (a :: * -> *) b1 (b :: * -> *) c1 c.
a b1 -> b c1 -> (c -> Either b1 c1) -> Night a b c
Night (f b1 -> j b1
f ~> j
f f b1
x) (g c1 -> l c1
g ~> l
g g c1
y) x -> Either b1 c1
z
instance HBifunctor (:+:) where
    hleft :: forall (f :: k -> *) (j :: k -> *) (g :: k -> *).
(f ~> j) -> (f :+: g) ~> (j :+: g)
hleft f ~> j
f = \case
      L1 f x
x -> j x -> (:+:) j g x
forall k (f :: k -> *) (g :: k -> *) (p :: k). f p -> (:+:) f g p
L1 (f x -> j x
f ~> j
f f x
x)
      R1 g x
y -> g x -> (:+:) j g x
forall k (f :: k -> *) (g :: k -> *) (p :: k). g p -> (:+:) f g p
R1 g x
y
    hright :: forall (g :: k -> *) (l :: k -> *) (f :: k -> *).
(g ~> l) -> (f :+: g) ~> (f :+: l)
hright g ~> l
g = \case
      L1 f x
x -> f x -> (:+:) f l x
forall k (f :: k -> *) (g :: k -> *) (p :: k). f p -> (:+:) f g p
L1 f x
x
      R1 g x
y -> l x -> (:+:) f l x
forall k (f :: k -> *) (g :: k -> *) (p :: k). g p -> (:+:) f g p
R1 (g x -> l x
g ~> l
g g x
y)
    hbimap :: forall (f :: k -> *) (j :: k -> *) (g :: k -> *) (l :: k -> *).
(f ~> j) -> (g ~> l) -> (f :+: g) ~> (j :+: l)
hbimap f ~> j
f g ~> l
g = \case
      L1 f x
x -> j x -> (:+:) j l x
forall k (f :: k -> *) (g :: k -> *) (p :: k). f p -> (:+:) f g p
L1 (f x -> j x
f ~> j
f f x
x)
      R1 g x
y -> l x -> (:+:) j l x
forall k (f :: k -> *) (g :: k -> *) (p :: k). g p -> (:+:) f g p
R1 (g x -> l x
g ~> l
g g x
y)
instance HBifunctor Sum where
    hleft :: forall (f :: k -> *) (j :: k -> *) (g :: k -> *).
(f ~> j) -> Sum f g ~> Sum j g
hleft f ~> j
f = \case
      InL f x
x -> j x -> Sum j g x
forall {k} (f :: k -> *) (g :: k -> *) (a :: k). f a -> Sum f g a
InL (f x -> j x
f ~> j
f f x
x)
      InR g x
y -> g x -> Sum j g x
forall {k} (f :: k -> *) (g :: k -> *) (a :: k). g a -> Sum f g a
InR g x
y
    hright :: forall (g :: k -> *) (l :: k -> *) (f :: k -> *).
(g ~> l) -> Sum f g ~> Sum f l
hright g ~> l
g = \case
      InL f x
x -> f x -> Sum f l x
forall {k} (f :: k -> *) (g :: k -> *) (a :: k). f a -> Sum f g a
InL f x
x
      InR g x
y -> l x -> Sum f l x
forall {k} (f :: k -> *) (g :: k -> *) (a :: k). g a -> Sum f g a
InR (g x -> l x
g ~> l
g g x
y)
    hbimap :: forall (f :: k -> *) (j :: k -> *) (g :: k -> *) (l :: k -> *).
(f ~> j) -> (g ~> l) -> Sum f g ~> Sum j l
hbimap f ~> j
f g ~> l
g = \case
      InL f x
x -> j x -> Sum j l x
forall {k} (f :: k -> *) (g :: k -> *) (a :: k). f a -> Sum f g a
InL (f x -> j x
f ~> j
f f x
x)
      InR g x
y -> l x -> Sum j l x
forall {k} (f :: k -> *) (g :: k -> *) (a :: k). g a -> Sum f g a
InR (g x -> l x
g ~> l
g g x
y)
instance HBifunctor These1 where
    hbimap :: forall (f :: * -> *) (j :: * -> *) (g :: * -> *) (l :: * -> *).
(f ~> j) -> (g ~> l) -> These1 f g ~> These1 j l
hbimap f ~> j
f g ~> l
g = \case
      This1  f x
x   -> j x -> These1 j l x
forall (f :: * -> *) (g :: * -> *) a. f a -> These1 f g a
This1  (f x -> j x
f ~> j
f f x
x)
      That1    g x
y -> l x -> These1 j l x
forall (f :: * -> *) (g :: * -> *) a. g a -> These1 f g a
That1        (g x -> l x
g ~> l
g g x
y)
      These1 f x
x g x
y -> j x -> l x -> These1 j l x
forall (f :: * -> *) (g :: * -> *) a. f a -> g a -> These1 f g a
These1 (f x -> j x
f ~> j
f f x
x) (g x -> l x
g ~> l
g g x
y)
instance HBifunctor Joker where
    hleft :: forall (f :: k -> *) (j :: k -> *) (g :: k -> *).
(f ~> j) -> Joker f g ~> Joker j g
hleft  f ~> j
f   (Joker f x
x) = j x -> Joker j g x
forall {k} {k1} (g :: k -> *) (a :: k1) (b :: k).
g b -> Joker g a b
Joker (f x -> j x
f ~> j
f f x
x)
    hright :: forall (g :: k -> *) (l :: k -> *) (f :: k -> *).
(g ~> l) -> Joker f g ~> Joker f l
hright   g ~> l
_           = Joker f g x -> Joker f l x
forall a b. Coercible a b => a -> b
coerce
    hbimap :: forall (f :: k -> *) (j :: k -> *) (g :: k -> *) (l :: k -> *).
(f ~> j) -> (g ~> l) -> Joker f g ~> Joker j l
hbimap f ~> j
f g ~> l
_ (Joker f x
x) = j x -> Joker j l x
forall {k} {k1} (g :: k -> *) (a :: k1) (b :: k).
g b -> Joker g a b
Joker (f x -> j x
f ~> j
f f x
x)
instance HBifunctor Void3 where
    hleft :: forall (f :: k -> *) (j :: k -> *) (g :: k -> *).
(f ~> j) -> Void3 f g ~> Void3 j g
hleft  f ~> j
_   = Void3 f g x -> Void3 j g x
forall a b. Coercible a b => a -> b
coerce
    hright :: forall (g :: k -> *) (l :: k -> *) (f :: k -> *).
(g ~> l) -> Void3 f g ~> Void3 f l
hright   g ~> l
_ = Void3 f g x -> Void3 f l x
forall a b. Coercible a b => a -> b
coerce
    hbimap :: forall (f :: k -> *) (j :: k -> *) (g :: k -> *) (l :: k -> *).
(f ~> j) -> (g ~> l) -> Void3 f g ~> Void3 j l
hbimap f ~> j
_ g ~> l
_ = Void3 f g x -> Void3 j l x
forall a b. Coercible a b => a -> b
coerce
instance HBifunctor Comp where
    hleft :: forall (f :: * -> *) (j :: * -> *) (g :: * -> *).
(f ~> j) -> Comp f g ~> Comp j g
hleft  f ~> j
f   (f x
x :>>= x -> g x
h) = f x -> j x
f ~> j
f f x
x j x -> (x -> g x) -> Comp j g x
forall {k} (f :: * -> *) (g :: k -> *) (a :: k) x.
f x -> (x -> g a) -> Comp f g a
:>>= x -> g x
h
    hright :: forall (g :: * -> *) (l :: * -> *) (f :: * -> *).
(g ~> l) -> Comp f g ~> Comp f l
hright   g ~> l
g (f x
x :>>= x -> g x
h) =   f x
x f x -> (x -> l x) -> Comp f l x
forall {k} (f :: * -> *) (g :: k -> *) (a :: k) x.
f x -> (x -> g a) -> Comp f g a
:>>= (g x -> l x
g ~> l
g (g x -> l x) -> (x -> g x) -> x -> l x
forall b c a. (b -> c) -> (a -> b) -> a -> c
. x -> g x
h)
    hbimap :: forall (f :: * -> *) (j :: * -> *) (g :: * -> *) (l :: * -> *).
(f ~> j) -> (g ~> l) -> Comp f g ~> Comp j l
hbimap f ~> j
f g ~> l
g (f x
x :>>= x -> g x
h) = f x -> j x
f ~> j
f f x
x j x -> (x -> l x) -> Comp j l x
forall {k} (f :: * -> *) (g :: k -> *) (a :: k) x.
f x -> (x -> g a) -> Comp f g a
:>>= (g x -> l x
g ~> l
g (g x -> l x) -> (x -> g x) -> x -> l x
forall b c a. (b -> c) -> (a -> b) -> a -> c
. x -> g x
h)
instance HBifunctor t => HFunctor (WrappedHBifunctor t f) where
    hmap :: forall (f :: k -> *) (g :: k -> *).
(f ~> g) -> WrappedHBifunctor t f f ~> WrappedHBifunctor t f g
hmap f ~> g
f = t f g x -> WrappedHBifunctor t f g x
forall k (t :: (k -> *) -> (k -> *) -> k -> *) (f :: k -> *)
       (g :: k -> *) (a :: k).
t f g a -> WrappedHBifunctor t f g a
WrapHBifunctor (t f g x -> WrappedHBifunctor t f g x)
-> (WrappedHBifunctor t f f x -> t f g x)
-> WrappedHBifunctor t f f x
-> WrappedHBifunctor t f g x
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (f ~> g) -> t f f ~> t f g
forall k (t :: (k -> *) -> (k -> *) -> k -> *) (g :: k -> *)
       (l :: k -> *) (f :: k -> *).
HBifunctor t =>
(g ~> l) -> t f g ~> t f l
forall (g :: k -> *) (l :: k -> *) (f :: k -> *).
(g ~> l) -> t f g ~> t f l
hright f x -> g x
f ~> g
f (t f f x -> t f g x)
-> (WrappedHBifunctor t f f x -> t f f x)
-> WrappedHBifunctor t f f x
-> t f g x
forall b c a. (b -> c) -> (a -> b) -> a -> c
. WrappedHBifunctor t f f x -> t f f x
forall k (t :: (k -> *) -> (k -> *) -> k -> *) (f :: k -> *)
       (g :: k -> *) (a :: k).
WrappedHBifunctor t f g a -> t f g a
unwrapHBifunctor
deriving via (WrappedHBifunctor Day f)      instance HFunctor (Day f)
deriving via (WrappedHBifunctor ID.Day f)   instance HFunctor (ID.Day f)
deriving via (WrappedHBifunctor IN.Night f) instance HFunctor (IN.Night f)
deriving via (WrappedHBifunctor (:*:) f)    instance HFunctor ((:*:) f)
deriving via (WrappedHBifunctor (:+:) f)    instance HFunctor ((:+:) f)
deriving via (WrappedHBifunctor Product f)  instance HFunctor (Product f)
deriving via (WrappedHBifunctor Sum f)      instance HFunctor (Sum f)
deriving via (WrappedHBifunctor These1 f)   instance HFunctor (These1 f)