-- | Compose two 'HyperType's.
--
-- Inspired by [hyperfunctions' @Category@ instance](http://hackage.haskell.org/package/hyperfunctions-0/docs/Control-Monad-Hyper.html).

{-# LANGUAGE UndecidableInstances, FlexibleInstances, FlexibleContexts, TemplateHaskell #-}

module Hyper.Combinator.Compose
    ( HCompose(..), _HCompose, W_HCompose(..)
    , HComposeConstraint1
    , decompose, decompose', hcomposed
    ) where

import Control.Lens (Profunctor, Optic, Iso', iso)
import Hyper.Class.Apply (HApply(..))
import Hyper.Class.Foldable (HFoldable(..))
import Hyper.Class.Functor (HFunctor(..), hiso)
import Hyper.Class.Nodes (HNodes(..), HWitness(..), (#>))
import Hyper.Class.Pointed (HPointed(..))
import Hyper.Class.Traversable (HTraversable(..), ContainedH(..), htraverse)
import Hyper.Class.Recursive (RNodes(..), Recursively(..), RTraversable)
import Hyper.Class.ZipMatch (ZipMatch(..))
import Hyper.Type (HyperType, GetHyperType, type (#))
import Hyper.Type.Pure (Pure, _Pure)

import Hyper.Internal.Prelude

-- | Compose two 'HyperType's as an external and internal layer
newtype HCompose a b h = HCompose { HCompose a b h -> a # HCompose b (GetHyperType h)
getHCompose :: a # HCompose b (GetHyperType h) }
    deriving stock (forall x. HCompose a b h -> Rep (HCompose a b h) x)
-> (forall x. Rep (HCompose a b h) x -> HCompose a b h)
-> Generic (HCompose a b h)
forall x. Rep (HCompose a b h) x -> HCompose a b h
forall x. HCompose a b h -> Rep (HCompose a b h) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall (a :: AHyperType -> *) (b :: AHyperType -> *)
       (h :: AHyperType) x.
Rep (HCompose a b h) x -> HCompose a b h
forall (a :: AHyperType -> *) (b :: AHyperType -> *)
       (h :: AHyperType) x.
HCompose a b h -> Rep (HCompose a b h) x
$cto :: forall (a :: AHyperType -> *) (b :: AHyperType -> *)
       (h :: AHyperType) x.
Rep (HCompose a b h) x -> HCompose a b h
$cfrom :: forall (a :: AHyperType -> *) (b :: AHyperType -> *)
       (h :: AHyperType) x.
HCompose a b h -> Rep (HCompose a b h) x
Generic

makeCommonInstances [''HCompose]

-- | An 'Control.Lens.Iso' for the 'HCompose' @newtype@
{-# INLINE _HCompose #-}
_HCompose ::
    Iso
    (HCompose a0 b0 # h0) (HCompose a1 b1 # h1)
    (a0 # HCompose b0 h0) (a1 # HCompose b1 h1)
_HCompose :: p (a0 # HCompose b0 h0) (f (a1 # HCompose b1 h1))
-> p (HCompose a0 b0 # h0) (f (HCompose a1 b1 # h1))
_HCompose = ((HCompose a0 b0 # h0) -> a0 # HCompose b0 h0)
-> ((a1 # HCompose b1 h1) -> HCompose a1 b1 # h1)
-> Iso
     (HCompose a0 b0 # h0)
     (HCompose a1 b1 # h1)
     (a0 # HCompose b0 h0)
     (a1 # HCompose b1 h1)
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso (HCompose a0 b0 # h0) -> a0 # HCompose b0 h0
forall (a :: AHyperType -> *) (b :: AHyperType -> *)
       (h :: AHyperType).
HCompose a b h -> a # HCompose b (GetHyperType h)
getHCompose (a1 # HCompose b1 h1) -> HCompose a1 b1 # h1
forall (a :: AHyperType -> *) (b :: AHyperType -> *)
       (h :: AHyperType).
(a # HCompose b (GetHyperType h)) -> HCompose a b h
HCompose

{-# ANN module "HLint: ignore Use camelCase" #-}
data W_HCompose a b n where
    W_HCompose :: HWitness a a0 -> HWitness b b0 -> W_HCompose a b (HCompose a0 b0)

instance (HNodes a, HNodes b) => HNodes (HCompose a b) where
    type HNodesConstraint (HCompose a b) c = HNodesConstraint a (HComposeConstraint0 c b)
    type HWitnessType (HCompose a b) = W_HCompose a b
    {-# INLINE hLiftConstraint #-}
    hLiftConstraint :: HWitness (HCompose a b) n -> Proxy c -> (c n => r) -> r
hLiftConstraint (HWitness (W_HCompose w0 w1)) Proxy c
p c n => r
r =
        HWitness a a0
-> Proxy (HComposeConstraint0 c b)
-> (HComposeConstraint0 c b a0 => r)
-> r
forall (h :: AHyperType -> *)
       (c :: (AHyperType -> *) -> Constraint) (n :: AHyperType -> *) r.
(HNodes h, HNodesConstraint h c) =>
HWitness h n -> Proxy c -> (c n => r) -> r
hLiftConstraint HWitness a a0
w0 (Proxy c -> Proxy (HComposeConstraint0 c b)
forall (c :: (AHyperType -> *) -> Constraint).
Proxy c -> Proxy (HComposeConstraint0 c b)
p0 Proxy c
p) ((HComposeConstraint0 c b a0 => r) -> r)
-> (HComposeConstraint0 c b a0 => r) -> r
forall a b. (a -> b) -> a -> b
$
        Dict (HNodesConstraint b (HComposeConstraint1 c a0))
-> (HNodesConstraint b (HComposeConstraint1 c a0) => r) -> r
forall (c :: Constraint) e r. HasDict c e => e -> (c => r) -> r
withDict (Proxy c
-> Proxy b
-> HWitness a a0
-> Dict (HNodesConstraint b (HComposeConstraint1 c a0))
forall (c :: (AHyperType -> *) -> Constraint)
       (b :: AHyperType -> *) (h0 :: AHyperType -> *)
       (proxy0 :: ((AHyperType -> *) -> Constraint) -> *)
       (proxy1 :: (AHyperType -> *) -> *)
       (proxy2 :: (AHyperType -> *) -> *).
HComposeConstraint0 c b h0 =>
proxy0 c
-> proxy1 b
-> proxy2 h0
-> Dict (HNodesConstraint b (HComposeConstraint1 c h0))
hComposeConstraint0 Proxy c
p (Proxy b
forall k (t :: k). Proxy t
Proxy @b) HWitness a a0
w0) ((HNodesConstraint b (HComposeConstraint1 c a0) => r) -> r)
-> (HNodesConstraint b (HComposeConstraint1 c a0) => r) -> r
forall a b. (a -> b) -> a -> b
$
        HWitness b b0
-> Proxy (HComposeConstraint1 c a0)
-> (HComposeConstraint1 c a0 b0 => r)
-> r
forall (h :: AHyperType -> *)
       (c :: (AHyperType -> *) -> Constraint) (n :: AHyperType -> *) r.
(HNodes h, HNodesConstraint h c) =>
HWitness h n -> Proxy c -> (c n => r) -> r
hLiftConstraint HWitness b b0
w1 (Proxy c -> HWitness a a0 -> Proxy (HComposeConstraint1 c a0)
forall (proxy0 :: ((AHyperType -> *) -> Constraint) -> *)
       (c :: (AHyperType -> *) -> Constraint)
       (proxy1 :: (AHyperType -> *) -> *) (a0 :: AHyperType -> *).
proxy0 c -> proxy1 a0 -> Proxy (HComposeConstraint1 c a0)
p1 Proxy c
p HWitness a a0
w0) ((HComposeConstraint1 c a0 b0 => r) -> r)
-> (HComposeConstraint1 c a0 b0 => r) -> r
forall a b. (a -> b) -> a -> b
$
        Dict (c (HCompose a0 b0)) -> (c (HCompose a0 b0) => r) -> r
forall (c :: Constraint) e r. HasDict c e => e -> (c => r) -> r
withDict (Proxy c
-> HWitness a a0 -> HWitness b b0 -> Dict (c (HCompose a0 b0))
forall (c :: (AHyperType -> *) -> Constraint)
       (a0 :: AHyperType -> *) (b0 :: AHyperType -> *).
HComposeConstraint1 c a0 b0 =>
Proxy c
-> HWitness a a0 -> HWitness b b0 -> Dict (c (HCompose a0 b0))
d0 Proxy c
p HWitness a a0
w0 HWitness b b0
w1) c n => r
c (HCompose a0 b0) => r
r
        where
            p0 :: Proxy c -> Proxy (HComposeConstraint0 c b)
            p0 :: Proxy c -> Proxy (HComposeConstraint0 c b)
p0 Proxy c
_ = Proxy (HComposeConstraint0 c b)
forall k (t :: k). Proxy t
Proxy
            p1 :: proxy0 c -> proxy1 a0 -> Proxy (HComposeConstraint1 c a0)
            p1 :: proxy0 c -> proxy1 a0 -> Proxy (HComposeConstraint1 c a0)
p1 proxy0 c
_ proxy1 a0
_ = Proxy (HComposeConstraint1 c a0)
forall k (t :: k). Proxy t
Proxy
            d0 ::
                HComposeConstraint1 c a0 b0 =>
                Proxy c -> HWitness a a0 -> HWitness b b0 -> Dict (c (HCompose a0 b0))
            d0 :: Proxy c
-> HWitness a a0 -> HWitness b b0 -> Dict (c (HCompose a0 b0))
d0 Proxy c
_ HWitness a a0
_ HWitness b b0
_ = Dict (c (HCompose a0 b0))
forall (c :: (AHyperType -> *) -> Constraint)
       (h0 :: AHyperType -> *) (h1 :: AHyperType -> *).
HComposeConstraint1 c h0 h1 =>
Dict (c (HCompose h0 h1))
hComposeConstraint1

class HComposeConstraint0 (c :: HyperType -> Constraint) (b :: HyperType) (h0 :: HyperType) where
    hComposeConstraint0 ::
        proxy0 c -> proxy1 b -> proxy2 h0 ->
        Dict (HNodesConstraint b (HComposeConstraint1 c h0))

instance HNodesConstraint b (HComposeConstraint1 c h0) => HComposeConstraint0 c b h0 where
    {-# INLINE hComposeConstraint0 #-}
    hComposeConstraint0 :: proxy0 c
-> proxy1 b
-> proxy2 h0
-> Dict (HNodesConstraint b (HComposeConstraint1 c h0))
hComposeConstraint0 proxy0 c
_ proxy1 b
_ proxy2 h0
_ = Dict (HNodesConstraint b (HComposeConstraint1 c h0))
forall (a :: Constraint). a => Dict a
Dict

class HComposeConstraint1 (c :: HyperType -> Constraint) (h0 :: HyperType) (h1 :: HyperType) where
    hComposeConstraint1 :: Dict (c (HCompose h0 h1))

instance c (HCompose h0 h1) => HComposeConstraint1 c h0 h1 where
    {-# INLINE hComposeConstraint1 #-}
    hComposeConstraint1 :: Dict (c (HCompose h0 h1))
hComposeConstraint1 = Dict (c (HCompose h0 h1))
forall (a :: Constraint). a => Dict a
Dict

instance
    (HNodes a, HPointed a, HPointed b) =>
    HPointed (HCompose a b) where
    {-# INLINE hpure #-}
    hpure :: (forall (n :: AHyperType -> *). HWitness (HCompose a b) n -> p # n)
-> HCompose a b # p
hpure forall (n :: AHyperType -> *). HWitness (HCompose a b) n -> p # n
x =
        Tagged (a # HCompose b p) (Identity (a # HCompose b p))
-> Tagged (HCompose a b # p) (Identity (HCompose a b # p))
forall (a0 :: AHyperType -> *) (b0 :: AHyperType -> *)
       (h0 :: AHyperType -> *) (a1 :: AHyperType -> *)
       (b1 :: AHyperType -> *) (h1 :: AHyperType -> *).
Iso
  (HCompose a0 b0 # h0)
  (HCompose a1 b1 # h1)
  (a0 # HCompose b0 h0)
  (a1 # HCompose b1 h1)
_HCompose (Tagged (a # HCompose b p) (Identity (a # HCompose b p))
 -> Tagged (HCompose a b # p) (Identity (HCompose a b # p)))
-> (a # HCompose b p) -> HCompose a b # p
forall t b. AReview t b -> b -> t
#
        (forall (n :: AHyperType -> *). HWitness a n -> HCompose b p # n)
-> a # HCompose b p
forall (h :: AHyperType -> *) (p :: AHyperType -> *).
HPointed h =>
(forall (n :: AHyperType -> *). HWitness h n -> p # n) -> h # p
hpure
        ( \HWitness a n
wa ->
            Tagged (b # HCompose p n) (Identity (b # HCompose p n))
-> Tagged (HCompose b p # n) (Identity (HCompose b p # n))
forall (a0 :: AHyperType -> *) (b0 :: AHyperType -> *)
       (h0 :: AHyperType -> *) (a1 :: AHyperType -> *)
       (b1 :: AHyperType -> *) (h1 :: AHyperType -> *).
Iso
  (HCompose a0 b0 # h0)
  (HCompose a1 b1 # h1)
  (a0 # HCompose b0 h0)
  (a1 # HCompose b1 h1)
_HCompose (Tagged (b # HCompose p n) (Identity (b # HCompose p n))
 -> Tagged (HCompose b p # n) (Identity (HCompose b p # n)))
-> (b # HCompose p n) -> HCompose b p # n
forall t b. AReview t b -> b -> t
# (forall (n :: AHyperType -> *). HWitness b n -> HCompose p n # n)
-> b # HCompose p n
forall (h :: AHyperType -> *) (p :: AHyperType -> *).
HPointed h =>
(forall (n :: AHyperType -> *). HWitness h n -> p # n) -> h # p
hpure (\HWitness b n
wb -> Tagged (p # HCompose n n) (Identity (p # HCompose n n))
-> Tagged (HCompose p n # n) (Identity (HCompose p n # n))
forall (a0 :: AHyperType -> *) (b0 :: AHyperType -> *)
       (h0 :: AHyperType -> *) (a1 :: AHyperType -> *)
       (b1 :: AHyperType -> *) (h1 :: AHyperType -> *).
Iso
  (HCompose a0 b0 # h0)
  (HCompose a1 b1 # h1)
  (a0 # HCompose b0 h0)
  (a1 # HCompose b1 h1)
_HCompose (Tagged (p # HCompose n n) (Identity (p # HCompose n n))
 -> Tagged (HCompose p n # n) (Identity (HCompose p n # n)))
-> (p # HCompose n n) -> HCompose p n # n
forall t b. AReview t b -> b -> t
# HWitness (HCompose a b) (HCompose n n) -> p # HCompose n n
forall (n :: AHyperType -> *). HWitness (HCompose a b) n -> p # n
x (HWitnessType (HCompose a b) (HCompose n n)
-> HWitness (HCompose a b) (HCompose n n)
forall (h :: AHyperType -> *) (n :: AHyperType -> *).
HWitnessType h n -> HWitness h n
HWitness (HWitness a n -> HWitness b n -> W_HCompose a b (HCompose n n)
forall (a :: AHyperType -> *) (a0 :: AHyperType -> *)
       (b :: AHyperType -> *) (b0 :: AHyperType -> *).
HWitness a a0 -> HWitness b b0 -> W_HCompose a b (HCompose a0 b0)
W_HCompose HWitness a n
wa HWitness b n
wb)))
        )

instance (HFunctor a, HFunctor b) => HFunctor (HCompose a b) where
    {-# INLINE hmap #-}
    hmap :: (forall (n :: AHyperType -> *).
 HWitness (HCompose a b) n -> (p # n) -> q # n)
-> (HCompose a b # p) -> HCompose a b # q
hmap forall (n :: AHyperType -> *).
HWitness (HCompose a b) n -> (p # n) -> q # n
f =
        ((a # HCompose b p) -> Identity (a # HCompose b q))
-> (HCompose a b # p) -> Identity (HCompose a b # q)
forall (a0 :: AHyperType -> *) (b0 :: AHyperType -> *)
       (h0 :: AHyperType -> *) (a1 :: AHyperType -> *)
       (b1 :: AHyperType -> *) (h1 :: AHyperType -> *).
Iso
  (HCompose a0 b0 # h0)
  (HCompose a1 b1 # h1)
  (a0 # HCompose b0 h0)
  (a1 # HCompose b1 h1)
_HCompose (((a # HCompose b p) -> Identity (a # HCompose b q))
 -> (HCompose a b # p) -> Identity (HCompose a b # q))
-> ((a # HCompose b p) -> a # HCompose b q)
-> (HCompose a b # p)
-> HCompose a b # q
forall s t a b. ASetter s t a b -> (a -> b) -> s -> t
%~
        (forall (n :: AHyperType -> *).
 HWitness a n -> (HCompose b p # n) -> HCompose b q # n)
-> (a # HCompose b p) -> a # HCompose b q
forall (h :: AHyperType -> *) (p :: AHyperType -> *)
       (q :: AHyperType -> *).
HFunctor h =>
(forall (n :: AHyperType -> *). HWitness h n -> (p # n) -> q # n)
-> (h # p) -> h # q
hmap
        ( \HWitness a n
w0 ->
            ((b # HCompose p n) -> Identity (b # HCompose q n))
-> (HCompose b p # n) -> Identity (HCompose b q # n)
forall (a0 :: AHyperType -> *) (b0 :: AHyperType -> *)
       (h0 :: AHyperType -> *) (a1 :: AHyperType -> *)
       (b1 :: AHyperType -> *) (h1 :: AHyperType -> *).
Iso
  (HCompose a0 b0 # h0)
  (HCompose a1 b1 # h1)
  (a0 # HCompose b0 h0)
  (a1 # HCompose b1 h1)
_HCompose (((b # HCompose p n) -> Identity (b # HCompose q n))
 -> (HCompose b p # n) -> Identity (HCompose b q # n))
-> ((b # HCompose p n) -> b # HCompose q n)
-> (HCompose b p # n)
-> HCompose b q # n
forall s t a b. ASetter s t a b -> (a -> b) -> s -> t
%~ (forall (n :: AHyperType -> *).
 HWitness b n -> (HCompose p n # n) -> HCompose q n # n)
-> (b # HCompose p n) -> b # HCompose q n
forall (h :: AHyperType -> *) (p :: AHyperType -> *)
       (q :: AHyperType -> *).
HFunctor h =>
(forall (n :: AHyperType -> *). HWitness h n -> (p # n) -> q # n)
-> (h # p) -> h # q
hmap (\HWitness b n
w1 -> ((p # HCompose n n) -> Identity (q # HCompose n n))
-> (HCompose p n # n) -> Identity (HCompose q n # n)
forall (a0 :: AHyperType -> *) (b0 :: AHyperType -> *)
       (h0 :: AHyperType -> *) (a1 :: AHyperType -> *)
       (b1 :: AHyperType -> *) (h1 :: AHyperType -> *).
Iso
  (HCompose a0 b0 # h0)
  (HCompose a1 b1 # h1)
  (a0 # HCompose b0 h0)
  (a1 # HCompose b1 h1)
_HCompose (((p # HCompose n n) -> Identity (q # HCompose n n))
 -> (HCompose p n # n) -> Identity (HCompose q n # n))
-> ((p # HCompose n n) -> q # HCompose n n)
-> (HCompose p n # n)
-> HCompose q n # n
forall s t a b. ASetter s t a b -> (a -> b) -> s -> t
%~ HWitness (HCompose a b) (HCompose n n)
-> (p # HCompose n n) -> q # HCompose n n
forall (n :: AHyperType -> *).
HWitness (HCompose a b) n -> (p # n) -> q # n
f (HWitnessType (HCompose a b) (HCompose n n)
-> HWitness (HCompose a b) (HCompose n n)
forall (h :: AHyperType -> *) (n :: AHyperType -> *).
HWitnessType h n -> HWitness h n
HWitness (HWitness a n -> HWitness b n -> W_HCompose a b (HCompose n n)
forall (a :: AHyperType -> *) (a0 :: AHyperType -> *)
       (b :: AHyperType -> *) (b0 :: AHyperType -> *).
HWitness a a0 -> HWitness b b0 -> W_HCompose a b (HCompose a0 b0)
W_HCompose HWitness a n
w0 HWitness b n
w1)))
        )

instance (HApply a, HApply b) => HApply (HCompose a b) where
    {-# INLINE hzip #-}
    hzip :: (HCompose a b # p)
-> (HCompose a b # q) -> HCompose a b # (p :*: q)
hzip (HCompose a # HCompose b (GetHyperType ('AHyperType p))
a0) =
        ((a # HCompose b q) -> Identity (a # HCompose b (p :*: q)))
-> (HCompose a b # q) -> Identity (HCompose a b # (p :*: q))
forall (a0 :: AHyperType -> *) (b0 :: AHyperType -> *)
       (h0 :: AHyperType -> *) (a1 :: AHyperType -> *)
       (b1 :: AHyperType -> *) (h1 :: AHyperType -> *).
Iso
  (HCompose a0 b0 # h0)
  (HCompose a1 b1 # h1)
  (a0 # HCompose b0 h0)
  (a1 # HCompose b1 h1)
_HCompose (((a # HCompose b q) -> Identity (a # HCompose b (p :*: q)))
 -> (HCompose a b # q) -> Identity (HCompose a b # (p :*: q)))
-> ((a # HCompose b q) -> a # HCompose b (p :*: q))
-> (HCompose a b # q)
-> HCompose a b # (p :*: q)
forall s t a b. ASetter s t a b -> (a -> b) -> s -> t
%~
        (forall (n :: AHyperType -> *).
 HWitness a n
 -> ((HCompose b p :*: HCompose b q) # n)
 -> HCompose b (p :*: q) # n)
-> (a # (HCompose b p :*: HCompose b q))
-> a # HCompose b (p :*: q)
forall (h :: AHyperType -> *) (p :: AHyperType -> *)
       (q :: AHyperType -> *).
HFunctor h =>
(forall (n :: AHyperType -> *). HWitness h n -> (p # n) -> q # n)
-> (h # p) -> h # q
hmap
        ( \HWitness a n
_ (HCompose b0 :*: HCompose b1) ->
            Tagged
  (b # HCompose (p :*: q) n) (Identity (b # HCompose (p :*: q) n))
-> Tagged
     (HCompose b (p :*: q) # n) (Identity (HCompose b (p :*: q) # n))
forall (a0 :: AHyperType -> *) (b0 :: AHyperType -> *)
       (h0 :: AHyperType -> *) (a1 :: AHyperType -> *)
       (b1 :: AHyperType -> *) (h1 :: AHyperType -> *).
Iso
  (HCompose a0 b0 # h0)
  (HCompose a1 b1 # h1)
  (a0 # HCompose b0 h0)
  (a1 # HCompose b1 h1)
_HCompose (Tagged
   (b # HCompose (p :*: q) n) (Identity (b # HCompose (p :*: q) n))
 -> Tagged
      (HCompose b (p :*: q) # n) (Identity (HCompose b (p :*: q) # n)))
-> (b # HCompose (p :*: q) n) -> HCompose b (p :*: q) # n
forall t b. AReview t b -> b -> t
#
            (forall (n :: AHyperType -> *).
 HWitness b n
 -> ((HCompose p n :*: HCompose q n) # n)
 -> HCompose (p :*: q) n # n)
-> (b # (HCompose p n :*: HCompose q n))
-> b # HCompose (p :*: q) n
forall (h :: AHyperType -> *) (p :: AHyperType -> *)
       (q :: AHyperType -> *).
HFunctor h =>
(forall (n :: AHyperType -> *). HWitness h n -> (p # n) -> q # n)
-> (h # p) -> h # q
hmap
            ( \HWitness b n
_ (HCompose i0 :*: HCompose i1) ->
                Tagged
  ((p :*: q) # HCompose n n) (Identity ((p :*: q) # HCompose n n))
-> Tagged
     (HCompose (p :*: q) n # n) (Identity (HCompose (p :*: q) n # n))
forall (a0 :: AHyperType -> *) (b0 :: AHyperType -> *)
       (h0 :: AHyperType -> *) (a1 :: AHyperType -> *)
       (b1 :: AHyperType -> *) (h1 :: AHyperType -> *).
Iso
  (HCompose a0 b0 # h0)
  (HCompose a1 b1 # h1)
  (a0 # HCompose b0 h0)
  (a1 # HCompose b1 h1)
_HCompose (Tagged
   ((p :*: q) # HCompose n n) (Identity ((p :*: q) # HCompose n n))
 -> Tagged
      (HCompose (p :*: q) n # n) (Identity (HCompose (p :*: q) n # n)))
-> ((p :*: q) # HCompose n n) -> HCompose (p :*: q) n # n
forall t b. AReview t b -> b -> t
# (p ('AHyperType (HCompose n n))
p # HCompose n (GetHyperType ('AHyperType n))
i0 p ('AHyperType (HCompose n n))
-> q ('AHyperType (HCompose n n)) -> (p :*: q) # HCompose n n
forall k (f :: k -> *) (g :: k -> *) (p :: k).
f p -> g p -> (:*:) f g p
:*: q ('AHyperType (HCompose n n))
q # HCompose n (GetHyperType ('AHyperType n))
i1)
            ) ((b # HCompose p n)
-> (b # HCompose q n) -> b # (HCompose p n :*: HCompose q n)
forall (h :: AHyperType -> *) (p :: AHyperType -> *)
       (q :: AHyperType -> *).
HApply h =>
(h # p) -> (h # q) -> h # (p :*: q)
hzip b # HCompose p n
b # HCompose p (GetHyperType ('AHyperType n))
b0 b # HCompose q n
b # HCompose q (GetHyperType ('AHyperType n))
b1)
        )
        ((a # (HCompose b p :*: HCompose b q)) -> a # HCompose b (p :*: q))
-> ((a # HCompose b q) -> a # (HCompose b p :*: HCompose b q))
-> (a # HCompose b q)
-> a # HCompose b (p :*: q)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (a # HCompose b p)
-> (a # HCompose b q) -> a # (HCompose b p :*: HCompose b q)
forall (h :: AHyperType -> *) (p :: AHyperType -> *)
       (q :: AHyperType -> *).
HApply h =>
(h # p) -> (h # q) -> h # (p :*: q)
hzip a # HCompose b p
a # HCompose b (GetHyperType ('AHyperType p))
a0

instance (HFoldable a, HFoldable b) => HFoldable (HCompose a b) where
    {-# INLINE hfoldMap #-}
    hfoldMap :: (forall (n :: AHyperType -> *).
 HWitness (HCompose a b) n -> (p # n) -> a)
-> (HCompose a b # p) -> a
hfoldMap forall (n :: AHyperType -> *).
HWitness (HCompose a b) n -> (p # n) -> a
f =
        (forall (n :: AHyperType -> *).
 HWitness a n -> (HCompose b p # n) -> a)
-> (a # HCompose b p) -> a
forall (h :: AHyperType -> *) a (p :: AHyperType -> *).
(HFoldable h, Monoid a) =>
(forall (n :: AHyperType -> *). HWitness h n -> (p # n) -> a)
-> (h # p) -> a
hfoldMap
        ( \HWitness a n
w0 ->
            (forall (n :: AHyperType -> *).
 HWitness b n -> (HCompose p n # n) -> a)
-> (b # HCompose p n) -> a
forall (h :: AHyperType -> *) a (p :: AHyperType -> *).
(HFoldable h, Monoid a) =>
(forall (n :: AHyperType -> *). HWitness h n -> (p # n) -> a)
-> (h # p) -> a
hfoldMap (\HWitness b n
w1 -> HWitness (HCompose a b) (HCompose n n) -> (p # HCompose n n) -> a
forall (n :: AHyperType -> *).
HWitness (HCompose a b) n -> (p # n) -> a
f (HWitnessType (HCompose a b) (HCompose n n)
-> HWitness (HCompose a b) (HCompose n n)
forall (h :: AHyperType -> *) (n :: AHyperType -> *).
HWitnessType h n -> HWitness h n
HWitness (HWitness a n -> HWitness b n -> W_HCompose a b (HCompose n n)
forall (a :: AHyperType -> *) (a0 :: AHyperType -> *)
       (b :: AHyperType -> *) (b0 :: AHyperType -> *).
HWitness a a0 -> HWitness b b0 -> W_HCompose a b (HCompose a0 b0)
W_HCompose HWitness a n
w0 HWitness b n
w1)) ((p # HCompose n n) -> a)
-> ((HCompose p n # n) -> p # HCompose n n)
-> (HCompose p n # n)
-> a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ((HCompose p n # n)
-> Getting (p # HCompose n n) (HCompose p n # n) (p # HCompose n n)
-> p # HCompose n n
forall s a. s -> Getting a s a -> a
^. Getting (p # HCompose n n) (HCompose p n # n) (p # HCompose n n)
forall (a0 :: AHyperType -> *) (b0 :: AHyperType -> *)
       (h0 :: AHyperType -> *) (a1 :: AHyperType -> *)
       (b1 :: AHyperType -> *) (h1 :: AHyperType -> *).
Iso
  (HCompose a0 b0 # h0)
  (HCompose a1 b1 # h1)
  (a0 # HCompose b0 h0)
  (a1 # HCompose b1 h1)
_HCompose)) ((b # HCompose p n) -> a)
-> ((HCompose b p # n) -> b # HCompose p n)
-> (HCompose b p # n)
-> a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ((HCompose b p # n)
-> Getting (b # HCompose p n) (HCompose b p # n) (b # HCompose p n)
-> b # HCompose p n
forall s a. s -> Getting a s a -> a
^. Getting (b # HCompose p n) (HCompose b p # n) (b # HCompose p n)
forall (a0 :: AHyperType -> *) (b0 :: AHyperType -> *)
       (h0 :: AHyperType -> *) (a1 :: AHyperType -> *)
       (b1 :: AHyperType -> *) (h1 :: AHyperType -> *).
Iso
  (HCompose a0 b0 # h0)
  (HCompose a1 b1 # h1)
  (a0 # HCompose b0 h0)
  (a1 # HCompose b1 h1)
_HCompose)
        ) ((a # HCompose b p) -> a)
-> ((HCompose a b # p) -> a # HCompose b p)
-> (HCompose a b # p)
-> a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ((HCompose a b # p)
-> Getting (a # HCompose b p) (HCompose a b # p) (a # HCompose b p)
-> a # HCompose b p
forall s a. s -> Getting a s a -> a
^. Getting (a # HCompose b p) (HCompose a b # p) (a # HCompose b p)
forall (a0 :: AHyperType -> *) (b0 :: AHyperType -> *)
       (h0 :: AHyperType -> *) (a1 :: AHyperType -> *)
       (b1 :: AHyperType -> *) (h1 :: AHyperType -> *).
Iso
  (HCompose a0 b0 # h0)
  (HCompose a1 b1 # h1)
  (a0 # HCompose b0 h0)
  (a1 # HCompose b1 h1)
_HCompose)

instance (HTraversable a, HTraversable b) => HTraversable (HCompose a b) where
    {-# INLINE hsequence #-}
    hsequence :: (HCompose a b # ContainedH f p) -> f (HCompose a b # p)
hsequence =
        ((a # HCompose b (ContainedH f p)) -> f (a # HCompose b p))
-> (HCompose a b # ContainedH f p) -> f (HCompose a b # p)
forall (a0 :: AHyperType -> *) (b0 :: AHyperType -> *)
       (h0 :: AHyperType -> *) (a1 :: AHyperType -> *)
       (b1 :: AHyperType -> *) (h1 :: AHyperType -> *).
Iso
  (HCompose a0 b0 # h0)
  (HCompose a1 b1 # h1)
  (a0 # HCompose b0 h0)
  (a1 # HCompose b1 h1)
_HCompose
        ( (a # ContainedH f (HCompose b p)) -> f (a # HCompose b p)
forall (h :: AHyperType -> *) (f :: * -> *) (p :: AHyperType -> *).
(HTraversable h, Applicative f) =>
(h # ContainedH f p) -> f (h # p)
hsequence ((a # ContainedH f (HCompose b p)) -> f (a # HCompose b p))
-> ((a # HCompose b (ContainedH f p))
    -> a # ContainedH f (HCompose b p))
-> (a # HCompose b (ContainedH f p))
-> f (a # HCompose b p)
forall b c a. (b -> c) -> (a -> b) -> a -> c
.
            (forall (n :: AHyperType -> *).
 HWitness a n
 -> (HCompose b (ContainedH f p) # n)
 -> ContainedH f (HCompose b p) # n)
-> (a # HCompose b (ContainedH f p))
-> a # ContainedH f (HCompose b p)
forall (h :: AHyperType -> *) (p :: AHyperType -> *)
       (q :: AHyperType -> *).
HFunctor h =>
(forall (n :: AHyperType -> *). HWitness h n -> (p # n) -> q # n)
-> (h # p) -> h # q
hmap (((HCompose b (ContainedH f p) # n)
 -> ContainedH f (HCompose b p) ('AHyperType n))
-> HWitness a n
-> (HCompose b (ContainedH f p) # n)
-> ContainedH f (HCompose b p) ('AHyperType n)
forall a b. a -> b -> a
const (f (HCompose b p ('AHyperType n))
-> ContainedH f (HCompose b p) ('AHyperType n)
forall (f :: * -> *) (p :: AHyperType -> *) (h :: AHyperType).
f (p h) -> ContainedH f p h
MkContainedH (f (HCompose b p ('AHyperType n))
 -> ContainedH f (HCompose b p) ('AHyperType n))
-> ((HCompose b (ContainedH f p) # n)
    -> f (HCompose b p ('AHyperType n)))
-> (HCompose b (ContainedH f p) # n)
-> ContainedH f (HCompose b p) ('AHyperType n)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ((b # HCompose (ContainedH f p) n) -> f (b # HCompose p n))
-> (HCompose b (ContainedH f p) # n)
-> f (HCompose b p ('AHyperType n))
forall (a0 :: AHyperType -> *) (b0 :: AHyperType -> *)
       (h0 :: AHyperType -> *) (a1 :: AHyperType -> *)
       (b1 :: AHyperType -> *) (h1 :: AHyperType -> *).
Iso
  (HCompose a0 b0 # h0)
  (HCompose a1 b1 # h1)
  (a0 # HCompose b0 h0)
  (a1 # HCompose b1 h1)
_HCompose ((forall (n :: AHyperType -> *).
 HWitness b n
 -> (HCompose (ContainedH f p) n # n) -> f (HCompose p n # n))
-> (b # HCompose (ContainedH f p) n) -> f (b # HCompose p n)
forall (f :: * -> *) (h :: AHyperType -> *) (p :: AHyperType -> *)
       (q :: AHyperType -> *).
(Applicative f, HTraversable h) =>
(forall (n :: AHyperType -> *).
 HWitness h n -> (p # n) -> f (q # n))
-> (h # p) -> f (h # q)
htraverse (((HCompose (ContainedH f p) n # n) -> f (HCompose p n # n))
-> HWitness b n
-> (HCompose (ContainedH f p) n # n)
-> f (HCompose p n # n)
forall a b. a -> b -> a
const (((ContainedH f p # HCompose n n) -> f (p # HCompose n n))
-> (HCompose (ContainedH f p) n # n) -> f (HCompose p n # n)
forall (a0 :: AHyperType -> *) (b0 :: AHyperType -> *)
       (h0 :: AHyperType -> *) (a1 :: AHyperType -> *)
       (b1 :: AHyperType -> *) (h1 :: AHyperType -> *).
Iso
  (HCompose a0 b0 # h0)
  (HCompose a1 b1 # h1)
  (a0 # HCompose b0 h0)
  (a1 # HCompose b1 h1)
_HCompose (ContainedH f p # HCompose n n) -> f (p # HCompose n n)
forall (f :: * -> *) (p :: AHyperType -> *) (h :: AHyperType).
ContainedH f p h -> f (p h)
runContainedH)))))
        )

instance
    (ZipMatch h0, ZipMatch h1, HTraversable h0, HFunctor h1) =>
    ZipMatch (HCompose h0 h1) where
    {-# INLINE zipMatch #-}
    zipMatch :: (HCompose h0 h1 # p)
-> (HCompose h0 h1 # q) -> Maybe (HCompose h0 h1 # (p :*: q))
zipMatch (HCompose h0 # HCompose h1 (GetHyperType ('AHyperType p))
x) (HCompose h0 # HCompose h1 (GetHyperType ('AHyperType q))
y) =
        (h0 # HCompose h1 p)
-> (h0 # HCompose h1 q)
-> Maybe (h0 # (HCompose h1 p :*: HCompose h1 q))
forall (h :: AHyperType -> *) (p :: AHyperType -> *)
       (q :: AHyperType -> *).
ZipMatch h =>
(h # p) -> (h # q) -> Maybe (h # (p :*: q))
zipMatch h0 # HCompose h1 p
h0 # HCompose h1 (GetHyperType ('AHyperType p))
x h0 # HCompose h1 q
h0 # HCompose h1 (GetHyperType ('AHyperType q))
y
        Maybe (h0 # (HCompose h1 p :*: HCompose h1 q))
-> ((h0 # (HCompose h1 p :*: HCompose h1 q))
    -> Maybe (h0 # HCompose h1 (p :*: q)))
-> Maybe (h0 # HCompose h1 (p :*: q))
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= (forall (n :: AHyperType -> *).
 HWitness h0 n
 -> ((HCompose h1 p :*: HCompose h1 q) # n)
 -> Maybe (HCompose h1 (p :*: q) # n))
-> (h0 # (HCompose h1 p :*: HCompose h1 q))
-> Maybe (h0 # HCompose h1 (p :*: q))
forall (f :: * -> *) (h :: AHyperType -> *) (p :: AHyperType -> *)
       (q :: AHyperType -> *).
(Applicative f, HTraversable h) =>
(forall (n :: AHyperType -> *).
 HWitness h n -> (p # n) -> f (q # n))
-> (h # p) -> f (h # q)
htraverse
            (\HWitness h0 n
_ (HCompose cx :*: HCompose cy) ->
                (h1 # HCompose p n)
-> (h1 # HCompose q n)
-> Maybe (h1 # (HCompose p n :*: HCompose q n))
forall (h :: AHyperType -> *) (p :: AHyperType -> *)
       (q :: AHyperType -> *).
ZipMatch h =>
(h # p) -> (h # q) -> Maybe (h # (p :*: q))
zipMatch h1 # HCompose p n
h1 # HCompose p (GetHyperType ('AHyperType n))
cx h1 # HCompose q n
h1 # HCompose q (GetHyperType ('AHyperType n))
cy
                Maybe (h1 # (HCompose p n :*: HCompose q n))
-> ((h1 # (HCompose p n :*: HCompose q n))
    -> h1 # HCompose (p :*: q) n)
-> Maybe (h1 # HCompose (p :*: q) n)
forall (f :: * -> *) a b. Functor f => f a -> (a -> b) -> f b
<&> (forall (n :: AHyperType -> *).
 HWitness h1 n
 -> ((HCompose p n :*: HCompose q n) # n)
 -> HCompose (p :*: q) n # n)
-> (h1 # (HCompose p n :*: HCompose q n))
-> h1 # HCompose (p :*: q) n
forall (h :: AHyperType -> *) (p :: AHyperType -> *)
       (q :: AHyperType -> *).
HFunctor h =>
(forall (n :: AHyperType -> *). HWitness h n -> (p # n) -> q # n)
-> (h # p) -> h # q
hmap
                    (\HWitness h1 n
_ (HCompose bx :*: HCompose by) -> p ('AHyperType (HCompose n n))
p # HCompose n (GetHyperType ('AHyperType n))
bx p ('AHyperType (HCompose n n))
-> q ('AHyperType (HCompose n n))
-> (:*:) p q ('AHyperType (HCompose n n))
forall k (f :: k -> *) (g :: k -> *) (p :: k).
f p -> g p -> (:*:) f g p
:*: q ('AHyperType (HCompose n n))
q # HCompose n (GetHyperType ('AHyperType n))
by (:*:) p q ('AHyperType (HCompose n n))
-> ((:*:) p q ('AHyperType (HCompose n n))
    -> HCompose (p :*: q) n # n)
-> HCompose (p :*: q) n # n
forall a b. a -> (a -> b) -> b
& (:*:) p q ('AHyperType (HCompose n n)) -> HCompose (p :*: q) n # n
forall (a :: AHyperType -> *) (b :: AHyperType -> *)
       (h :: AHyperType).
(a # HCompose b (GetHyperType h)) -> HCompose a b h
HCompose)
                Maybe (h1 # HCompose (p :*: q) n)
-> ((h1 # HCompose (p :*: q) n) -> HCompose h1 (p :*: q) # n)
-> Maybe (HCompose h1 (p :*: q) # n)
forall (f :: * -> *) a b. Functor f => f a -> (a -> b) -> f b
<&> (Tagged
  (h1 # HCompose (p :*: q) n) (Identity (h1 # HCompose (p :*: q) n))
-> Tagged
     (HCompose h1 (p :*: q) # n) (Identity (HCompose h1 (p :*: q) # n))
forall (a0 :: AHyperType -> *) (b0 :: AHyperType -> *)
       (h0 :: AHyperType -> *) (a1 :: AHyperType -> *)
       (b1 :: AHyperType -> *) (h1 :: AHyperType -> *).
Iso
  (HCompose a0 b0 # h0)
  (HCompose a1 b1 # h1)
  (a0 # HCompose b0 h0)
  (a1 # HCompose b1 h1)
_HCompose (Tagged
   (h1 # HCompose (p :*: q) n) (Identity (h1 # HCompose (p :*: q) n))
 -> Tagged
      (HCompose h1 (p :*: q) # n) (Identity (HCompose h1 (p :*: q) # n)))
-> (h1 # HCompose (p :*: q) n) -> HCompose h1 (p :*: q) # n
forall t b. AReview t b -> b -> t
#)
            )
        Maybe (h0 # HCompose h1 (p :*: q))
-> ((h0 # HCompose h1 (p :*: q)) -> HCompose h0 h1 # (p :*: q))
-> Maybe (HCompose h0 h1 # (p :*: q))
forall (f :: * -> *) a b. Functor f => f a -> (a -> b) -> f b
<&> (Tagged
  (h0 # HCompose h1 (p :*: q))
  (Identity (h0 # HCompose h1 (p :*: q)))
-> Tagged
     (HCompose h0 h1 # (p :*: q))
     (Identity (HCompose h0 h1 # (p :*: q)))
forall (a0 :: AHyperType -> *) (b0 :: AHyperType -> *)
       (h0 :: AHyperType -> *) (a1 :: AHyperType -> *)
       (b1 :: AHyperType -> *) (h1 :: AHyperType -> *).
Iso
  (HCompose a0 b0 # h0)
  (HCompose a1 b1 # h1)
  (a0 # HCompose b0 h0)
  (a1 # HCompose b1 h1)
_HCompose (Tagged
   (h0 # HCompose h1 (p :*: q))
   (Identity (h0 # HCompose h1 (p :*: q)))
 -> Tagged
      (HCompose h0 h1 # (p :*: q))
      (Identity (HCompose h0 h1 # (p :*: q))))
-> (h0 # HCompose h1 (p :*: q)) -> HCompose h0 h1 # (p :*: q)
forall t b. AReview t b -> b -> t
#)

instance
    ( HNodes a, HNodes b
    , HNodesConstraint a (HComposeConstraint0 RNodes b)
    ) => RNodes (HCompose a b)

instance
    ( HNodes h0, HNodes h1
    , c (HCompose h0 h1)
    , HNodesConstraint h0 (HComposeConstraint0 RNodes h1)
    , HNodesConstraint h0 (HComposeConstraint0 (Recursively c) h1)
    ) => Recursively c (HCompose h0 h1)

instance
    ( HTraversable a, HTraversable b
    , HNodesConstraint a (HComposeConstraint0 RNodes b)
    , HNodesConstraint a (HComposeConstraint0 (Recursively HFunctor) b)
    , HNodesConstraint a (HComposeConstraint0 (Recursively HFoldable) b)
    , HNodesConstraint a (HComposeConstraint0 RTraversable b)
    ) => RTraversable (HCompose a b)

hcomposed ::
    (Profunctor p, Functor f) =>
    Optic p f
        (a0 # HCompose b0 c0)
        (a1 # HCompose b1 c1)
        (HCompose a2 b2 # c2)
        (HCompose a3 b3 # c3) ->
    Optic p f
        (HCompose a0 b0 # c0)
        (HCompose a1 b1 # c1)
        (a2 # HCompose b2 c2)
        (a3 # HCompose b3 c3)
hcomposed :: Optic
  p
  f
  (a0 # HCompose b0 c0)
  (a1 # HCompose b1 c1)
  (HCompose a2 b2 # c2)
  (HCompose a3 b3 # c3)
-> Optic
     p
     f
     (HCompose a0 b0 # c0)
     (HCompose a1 b1 # c1)
     (a2 # HCompose b2 c2)
     (a3 # HCompose b3 c3)
hcomposed Optic
  p
  f
  (a0 # HCompose b0 c0)
  (a1 # HCompose b1 c1)
  (HCompose a2 b2 # c2)
  (HCompose a3 b3 # c3)
f = p (a0 # HCompose b0 c0) (f (a1 # HCompose b1 c1))
-> p (HCompose a0 b0 # c0) (f (HCompose a1 b1 # c1))
forall (a0 :: AHyperType -> *) (b0 :: AHyperType -> *)
       (h0 :: AHyperType -> *) (a1 :: AHyperType -> *)
       (b1 :: AHyperType -> *) (h1 :: AHyperType -> *).
Iso
  (HCompose a0 b0 # h0)
  (HCompose a1 b1 # h1)
  (a0 # HCompose b0 h0)
  (a1 # HCompose b1 h1)
_HCompose (p (a0 # HCompose b0 c0) (f (a1 # HCompose b1 c1))
 -> p (HCompose a0 b0 # c0) (f (HCompose a1 b1 # c1)))
-> (p (a2 # HCompose b2 c2) (f (a3 # HCompose b3 c3))
    -> p (a0 # HCompose b0 c0) (f (a1 # HCompose b1 c1)))
-> Optic
     p
     f
     (HCompose a0 b0 # c0)
     (HCompose a1 b1 # c1)
     (a2 # HCompose b2 c2)
     (a3 # HCompose b3 c3)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Optic
  p
  f
  (a0 # HCompose b0 c0)
  (a1 # HCompose b1 c1)
  (HCompose a2 b2 # c2)
  (HCompose a3 b3 # c3)
f Optic
  p
  f
  (a0 # HCompose b0 c0)
  (a1 # HCompose b1 c1)
  (HCompose a2 b2 # c2)
  (HCompose a3 b3 # c3)
-> (p (a2 # HCompose b2 c2) (f (a3 # HCompose b3 c3))
    -> p (HCompose a2 b2 # c2) (f (HCompose a3 b3 # c3)))
-> p (a2 # HCompose b2 c2) (f (a3 # HCompose b3 c3))
-> p (a0 # HCompose b0 c0) (f (a1 # HCompose b1 c1))
forall b c a. (b -> c) -> (a -> b) -> a -> c
. p (a2 # HCompose b2 c2) (f (a3 # HCompose b3 c3))
-> p (HCompose a2 b2 # c2) (f (HCompose a3 b3 # c3))
forall (a0 :: AHyperType -> *) (b0 :: AHyperType -> *)
       (h0 :: AHyperType -> *) (a1 :: AHyperType -> *)
       (b1 :: AHyperType -> *) (h1 :: AHyperType -> *).
Iso
  (HCompose a0 b0 # h0)
  (HCompose a1 b1 # h1)
  (a0 # HCompose b0 h0)
  (a1 # HCompose b1 h1)
_HCompose

-- | Inject Pure between two hypertypes.
decompose ::
    forall a0 b0 a1 b1.
    (Recursively HFunctor a0, Recursively HFunctor b0, Recursively HFunctor a1, Recursively HFunctor b1) =>
    Iso (Pure # HCompose a0 b0) (Pure # HCompose a1 b1) (a0 # b0) (a1 # b1)
decompose :: Iso
  (Pure # HCompose a0 b0) (Pure # HCompose a1 b1) (a0 # b0) (a1 # b1)
decompose = ((Pure # HCompose a0 b0) -> a0 # b0)
-> ((a1 # b1) -> Pure # HCompose a1 b1)
-> Iso
     (Pure # HCompose a0 b0) (Pure # HCompose a1 b1) (a0 # b0) (a1 # b1)
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso ((Pure # HCompose a0 b0)
-> Getting (a0 # b0) (Pure # HCompose a0 b0) (a0 # b0) -> a0 # b0
forall s a. s -> Getting a s a -> a
^. Getting (a0 # b0) (Pure # HCompose a0 b0) (a0 # b0)
forall (a :: AHyperType -> *) (b :: AHyperType -> *).
(Recursively HFunctor a, Recursively HFunctor b) =>
Iso' (Pure # HCompose a b) (a # b)
decompose') (Tagged (a1 # b1) (Identity (a1 # b1))
-> Tagged
     (Pure # HCompose a1 b1) (Identity (Pure # HCompose a1 b1))
forall (a :: AHyperType -> *) (b :: AHyperType -> *).
(Recursively HFunctor a, Recursively HFunctor b) =>
Iso' (Pure # HCompose a b) (a # b)
decompose' (Tagged (a1 # b1) (Identity (a1 # b1))
 -> Tagged
      (Pure # HCompose a1 b1) (Identity (Pure # HCompose a1 b1)))
-> (a1 # b1) -> Pure # HCompose a1 b1
forall t b. AReview t b -> b -> t
#)

decompose' ::
    forall a b.
    (Recursively HFunctor a, Recursively HFunctor b) =>
    Iso' (Pure # HCompose a b) (a # b)
decompose' :: Iso' (Pure # HCompose a b) (a # b)
decompose' =
    Dict (HFunctor a, HNodesConstraint a (Recursively HFunctor))
-> ((HFunctor a, HNodesConstraint a (Recursively HFunctor)) =>
    p (a # b) (f (a # b))
    -> p (Pure # HCompose a b) (f (Pure # HCompose a b)))
-> p (a # b) (f (a # b))
-> p (Pure # HCompose a b) (f (Pure # HCompose a b))
forall (c :: Constraint) e r. HasDict c e => e -> (c => r) -> r
withDict (Proxy (HFunctor a)
-> Dict (HFunctor a, HNodesConstraint a (Recursively HFunctor))
forall (c :: (AHyperType -> *) -> Constraint)
       (h :: AHyperType -> *) (proxy :: Constraint -> *).
Recursively c h =>
proxy (c h) -> Dict (c h, HNodesConstraint h (Recursively c))
recursively (Proxy (HFunctor a)
forall k (t :: k). Proxy t
Proxy @(HFunctor a))) (((HFunctor a, HNodesConstraint a (Recursively HFunctor)) =>
  p (a # b) (f (a # b))
  -> p (Pure # HCompose a b) (f (Pure # HCompose a b)))
 -> p (a # b) (f (a # b))
 -> p (Pure # HCompose a b) (f (Pure # HCompose a b)))
-> ((HFunctor a, HNodesConstraint a (Recursively HFunctor)) =>
    p (a # b) (f (a # b))
    -> p (Pure # HCompose a b) (f (Pure # HCompose a b)))
-> p (a # b) (f (a # b))
-> p (Pure # HCompose a b) (f (Pure # HCompose a b))
forall a b. (a -> b) -> a -> b
$
    Dict (HFunctor b, HNodesConstraint b (Recursively HFunctor))
-> ((HFunctor b, HNodesConstraint b (Recursively HFunctor)) =>
    p (a # b) (f (a # b))
    -> p (Pure # HCompose a b) (f (Pure # HCompose a b)))
-> p (a # b) (f (a # b))
-> p (Pure # HCompose a b) (f (Pure # HCompose a b))
forall (c :: Constraint) e r. HasDict c e => e -> (c => r) -> r
withDict (Proxy (HFunctor b)
-> Dict (HFunctor b, HNodesConstraint b (Recursively HFunctor))
forall (c :: (AHyperType -> *) -> Constraint)
       (h :: AHyperType -> *) (proxy :: Constraint -> *).
Recursively c h =>
proxy (c h) -> Dict (c h, HNodesConstraint h (Recursively c))
recursively (Proxy (HFunctor b)
forall k (t :: k). Proxy t
Proxy @(HFunctor b))) (((HFunctor b, HNodesConstraint b (Recursively HFunctor)) =>
  p (a # b) (f (a # b))
  -> p (Pure # HCompose a b) (f (Pure # HCompose a b)))
 -> p (a # b) (f (a # b))
 -> p (Pure # HCompose a b) (f (Pure # HCompose a b)))
-> ((HFunctor b, HNodesConstraint b (Recursively HFunctor)) =>
    p (a # b) (f (a # b))
    -> p (Pure # HCompose a b) (f (Pure # HCompose a b)))
-> p (a # b) (f (a # b))
-> p (Pure # HCompose a b) (f (Pure # HCompose a b))
forall a b. (a -> b) -> a -> b
$
    p (HCompose a b # Pure) (f (HCompose a b # Pure))
-> p (Pure # HCompose a b) (f (Pure # HCompose a b))
forall (h :: AHyperType -> *) (j :: AHyperType -> *).
Iso (Pure # h) (Pure # j) (h # Pure) (j # Pure)
_Pure (p (HCompose a b # Pure) (f (HCompose a b # Pure))
 -> p (Pure # HCompose a b) (f (Pure # HCompose a b)))
-> (p (a # b) (f (a # b))
    -> p (HCompose a b # Pure) (f (HCompose a b # Pure)))
-> p (a # b) (f (a # b))
-> p (Pure # HCompose a b) (f (Pure # HCompose a b))
forall b c a. (b -> c) -> (a -> b) -> a -> c
. p (a # HCompose b Pure) (f (a # HCompose b Pure))
-> p (HCompose a b # Pure) (f (HCompose a b # Pure))
forall (a0 :: AHyperType -> *) (b0 :: AHyperType -> *)
       (h0 :: AHyperType -> *) (a1 :: AHyperType -> *)
       (b1 :: AHyperType -> *) (h1 :: AHyperType -> *).
Iso
  (HCompose a0 b0 # h0)
  (HCompose a1 b1 # h1)
  (a0 # HCompose b0 h0)
  (a1 # HCompose b1 h1)
_HCompose (p (a # HCompose b Pure) (f (a # HCompose b Pure))
 -> p (HCompose a b # Pure) (f (HCompose a b # Pure)))
-> (p (a # b) (f (a # b))
    -> p (a # HCompose b Pure) (f (a # HCompose b Pure)))
-> p (a # b) (f (a # b))
-> p (HCompose a b # Pure) (f (HCompose a b # Pure))
forall b c a. (b -> c) -> (a -> b) -> a -> c
.
    (forall (n :: AHyperType -> *).
 HWitness a n -> AnIso' (HCompose b Pure # n) (b # n))
-> Iso' (a # HCompose b Pure) (a # b)
forall (h :: AHyperType -> *) (p :: AHyperType -> *)
       (q :: AHyperType -> *).
HFunctor h =>
(forall (n :: AHyperType -> *).
 HWitness h n -> AnIso' (p # n) (q # n))
-> Iso' (h # p) (h # q)
hiso
    ( Proxy (Recursively HFunctor)
forall k (t :: k). Proxy t
Proxy @(Recursively HFunctor) Proxy (Recursively HFunctor)
-> (Recursively HFunctor n => AnIso' (HCompose b Pure # n) (b # n))
-> HWitness a n
-> AnIso' (HCompose b Pure # n) (b # n)
forall (h :: AHyperType -> *)
       (c :: (AHyperType -> *) -> Constraint) (n :: AHyperType -> *) r.
(HNodes h, HNodesConstraint h c) =>
Proxy c -> (c n => r) -> HWitness h n -> r
#>
        Exchange
  (b # n)
  (b # n)
  (b # HCompose Pure n)
  (Identity (b # HCompose Pure n))
-> Exchange
     (b # n)
     (b # n)
     (HCompose b Pure # n)
     (Identity (HCompose b Pure # n))
forall (a0 :: AHyperType -> *) (b0 :: AHyperType -> *)
       (h0 :: AHyperType -> *) (a1 :: AHyperType -> *)
       (b1 :: AHyperType -> *) (h1 :: AHyperType -> *).
Iso
  (HCompose a0 b0 # h0)
  (HCompose a1 b1 # h1)
  (a0 # HCompose b0 h0)
  (a1 # HCompose b1 h1)
_HCompose (Exchange
   (b # n)
   (b # n)
   (b # HCompose Pure n)
   (Identity (b # HCompose Pure n))
 -> Exchange
      (b # n)
      (b # n)
      (HCompose b Pure # n)
      (Identity (HCompose b Pure # n)))
-> (Exchange (b # n) (b # n) (b # n) (Identity (b # n))
    -> Exchange
         (b # n)
         (b # n)
         (b # HCompose Pure n)
         (Identity (b # HCompose Pure n)))
-> AnIso' (HCompose b Pure # n) (b # n)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (forall (n :: AHyperType -> *).
 HWitness b n -> AnIso' (HCompose Pure n # n) (n # n))
-> Iso' (b # HCompose Pure n) (b # n)
forall (h :: AHyperType -> *) (p :: AHyperType -> *)
       (q :: AHyperType -> *).
HFunctor h =>
(forall (n :: AHyperType -> *).
 HWitness h n -> AnIso' (p # n) (q # n))
-> Iso' (h # p) (h # q)
hiso (Proxy (Recursively HFunctor)
forall k (t :: k). Proxy t
Proxy @(Recursively HFunctor) Proxy (Recursively HFunctor)
-> (Recursively HFunctor n => AnIso' (HCompose Pure n # n) (n # n))
-> HWitness b n
-> AnIso' (HCompose Pure n # n) (n # n)
forall (h :: AHyperType -> *)
       (c :: (AHyperType -> *) -> Constraint) (n :: AHyperType -> *) r.
(HNodes h, HNodesConstraint h c) =>
Proxy c -> (c n => r) -> HWitness h n -> r
#> Exchange
  (n # n)
  (n # n)
  (Pure # HCompose n n)
  (Identity (Pure # HCompose n n))
-> Exchange
     (n # n)
     (n # n)
     (HCompose Pure n # n)
     (Identity (HCompose Pure n # n))
forall (a0 :: AHyperType -> *) (b0 :: AHyperType -> *)
       (h0 :: AHyperType -> *) (a1 :: AHyperType -> *)
       (b1 :: AHyperType -> *) (h1 :: AHyperType -> *).
Iso
  (HCompose a0 b0 # h0)
  (HCompose a1 b1 # h1)
  (a0 # HCompose b0 h0)
  (a1 # HCompose b1 h1)
_HCompose (Exchange
   (n # n)
   (n # n)
   (Pure # HCompose n n)
   (Identity (Pure # HCompose n n))
 -> Exchange
      (n # n)
      (n # n)
      (HCompose Pure n # n)
      (Identity (HCompose Pure n # n)))
-> (Exchange (n # n) (n # n) (n # n) (Identity (n # n))
    -> Exchange
         (n # n)
         (n # n)
         (Pure # HCompose n n)
         (Identity (Pure # HCompose n n)))
-> AnIso' (HCompose Pure n # n) (n # n)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Exchange (n # n) (n # n) (n # n) (Identity (n # n))
-> Exchange
     (n # n)
     (n # n)
     (Pure # HCompose n n)
     (Identity (Pure # HCompose n n))
forall (a :: AHyperType -> *) (b :: AHyperType -> *).
(Recursively HFunctor a, Recursively HFunctor b) =>
Iso' (Pure # HCompose a b) (a # b)
decompose')
    )