{-# LANGUAGE TemplateHaskell, UndecidableInstances, FlexibleInstances #-}
module Hyper.Combinator.Ann
( Ann(..), hAnn, hVal
, Annotated, annotation, annValue
) where
import Control.Lens (Lens, Lens', _Wrapped, from)
import Hyper.Class.Foldable (HFoldable(..))
import Hyper.Class.Functor (HFunctor(..))
import Hyper.Class.Nodes
import Hyper.Class.Traversable
import Hyper.Combinator.Flip
import Hyper.Recurse
import Hyper.TH.Traversable (makeHTraversableApplyAndBases)
import Hyper.Type (type (#), type (:#))
import Hyper.Internal.Prelude
data Ann a h = Ann
{ Ann a h -> a h
_hAnn :: a h
, Ann a h -> h :# Ann a
_hVal :: h :# Ann a
} deriving (forall x. Ann a h -> Rep (Ann a h) x)
-> (forall x. Rep (Ann a h) x -> Ann a h) -> Generic (Ann a h)
forall x. Rep (Ann a h) x -> Ann a h
forall x. Ann a h -> Rep (Ann a h) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall (a :: AHyperType -> *) (h :: AHyperType) x.
Rep (Ann a h) x -> Ann a h
forall (a :: AHyperType -> *) (h :: AHyperType) x.
Ann a h -> Rep (Ann a h) x
$cto :: forall (a :: AHyperType -> *) (h :: AHyperType) x.
Rep (Ann a h) x -> Ann a h
$cfrom :: forall (a :: AHyperType -> *) (h :: AHyperType) x.
Ann a h -> Rep (Ann a h) x
Generic
makeLenses ''Ann
makeHTraversableApplyAndBases ''Ann
makeCommonInstances [''Ann]
instance RNodes h => HNodes (HFlip Ann h) where
type HNodesConstraint (HFlip Ann h) c = (Recursive c, c h)
type HWitnessType (HFlip Ann h) = HRecWitness h
hLiftConstraint :: HWitness (HFlip Ann h) n -> Proxy c -> (c n => r) -> r
hLiftConstraint (HWitness HWitnessType (HFlip Ann h) n
HRecSelf) = \Proxy c
_ c n => r
x -> r
c n => r
x
hLiftConstraint (HWitness (HRecSub w0 w1)) = HWitness h c -> HRecWitness c n -> Proxy c -> (c n => r) -> r
forall (a :: AHyperType -> *)
(c :: (AHyperType -> *) -> Constraint) (b :: AHyperType -> *)
(n :: AHyperType -> *) r.
(RNodes a, HNodesConstraint (HFlip Ann a) c) =>
HWitness a b -> HRecWitness b n -> Proxy c -> (c n => r) -> r
hLiftConstraintH HWitness h c
w0 HRecWitness c n
w1
hLiftConstraintH ::
forall a c b n r.
(RNodes a, HNodesConstraint (HFlip Ann a) c) =>
HWitness a b -> HRecWitness b n -> Proxy c -> (c n => r) -> r
hLiftConstraintH :: HWitness a b -> HRecWitness b n -> Proxy c -> (c n => r) -> r
hLiftConstraintH HWitness a b
c HRecWitness b n
n Proxy c
p c n => r
f =
Dict (HNodesConstraint a RNodes)
-> (HNodesConstraint a RNodes => r) -> r
forall (c :: Constraint) e r. HasDict c e => e -> (c => r) -> r
withDict (Proxy (RNodes a) -> Dict (HNodesConstraint a RNodes)
forall (c :: (AHyperType -> *) -> Constraint)
(h :: AHyperType -> *) (proxy :: Constraint -> *).
(Recursive c, HNodes h, c h) =>
proxy (c h) -> Dict (HNodesConstraint h c)
recurse (Proxy (RNodes a)
forall k (t :: k). Proxy t
Proxy @(RNodes a))) ((HNodesConstraint a RNodes => r) -> r)
-> (HNodesConstraint a RNodes => r) -> r
forall a b. (a -> b) -> a -> b
$
Dict (HNodesConstraint a c) -> (HNodesConstraint a c => r) -> r
forall (c :: Constraint) e r. HasDict c e => e -> (c => r) -> r
withDict (Proxy (c a) -> Dict (HNodesConstraint a c)
forall (c :: (AHyperType -> *) -> Constraint)
(h :: AHyperType -> *) (proxy :: Constraint -> *).
(Recursive c, HNodes h, c h) =>
proxy (c h) -> Dict (HNodesConstraint h c)
recurse (Proxy (c a)
forall k (t :: k). Proxy t
Proxy @(c a))) ((HNodesConstraint a c => r) -> r)
-> (HNodesConstraint a c => r) -> r
forall a b. (a -> b) -> a -> b
$
HWitness a b -> Proxy RNodes -> (RNodes b => 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 b
c (Proxy RNodes
forall k (t :: k). Proxy t
Proxy @RNodes)
( HWitness a b -> Proxy c -> (c b => 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 b
c Proxy c
p
(HWitness (HFlip Ann b) n -> Proxy c -> (c n => 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 (HWitnessType (HFlip Ann b) n -> HWitness (HFlip Ann b) n
forall (h2 :: AHyperType -> *) (n2 :: AHyperType -> *).
HWitnessType h2 n2 -> HWitness h2 n2
HWitness @(HFlip Ann _) HWitnessType (HFlip Ann b) n
HRecWitness b n
n) Proxy c
p c n => r
f)
)
instance RNodes a => RNodes (Ann a) where
{-# INLINE recursiveHNodes #-}
recursiveHNodes :: proxy (Ann a) -> Dict (HNodesConstraint (Ann a) RNodes)
recursiveHNodes proxy (Ann a)
_ = Dict (HNodesConstraint a RNodes)
-> (HNodesConstraint a RNodes =>
Dict (HNodesConstraint a RNodes, RNodes (Ann a)))
-> Dict (HNodesConstraint a RNodes, RNodes (Ann a))
forall (c :: Constraint) e r. HasDict c e => e -> (c => r) -> r
withDict (Proxy a -> Dict (HNodesConstraint a RNodes)
forall (h :: AHyperType -> *) (proxy :: (AHyperType -> *) -> *).
RNodes h =>
proxy h -> Dict (HNodesConstraint h RNodes)
recursiveHNodes (Proxy a
forall k (t :: k). Proxy t
Proxy @a)) HNodesConstraint a RNodes =>
Dict (HNodesConstraint a RNodes, RNodes (Ann a))
forall (a :: Constraint). a => Dict a
Dict
instance (c (Ann a), Recursively c a) => Recursively c (Ann a) where
{-# INLINE recursively #-}
recursively :: proxy (c (Ann a))
-> Dict (c (Ann a), HNodesConstraint (Ann a) (Recursively c))
recursively proxy (c (Ann a))
_ = Dict (c a, HNodesConstraint a (Recursively c))
-> ((c a, HNodesConstraint a (Recursively c)) =>
Dict
(c (Ann a),
(HNodesConstraint a (Recursively c), Recursively c (Ann a))))
-> Dict
(c (Ann a),
(HNodesConstraint a (Recursively c), Recursively c (Ann a)))
forall (c :: Constraint) e r. HasDict c e => e -> (c => r) -> r
withDict (Proxy (c a) -> Dict (c a, HNodesConstraint a (Recursively c))
forall (c :: (AHyperType -> *) -> Constraint)
(h :: AHyperType -> *) (proxy :: Constraint -> *).
Recursively c h =>
proxy (c h) -> Dict (c h, HNodesConstraint h (Recursively c))
recursively (Proxy (c a)
forall k (t :: k). Proxy t
Proxy @(c a))) (c a, HNodesConstraint a (Recursively c)) =>
Dict
(c (Ann a),
(HNodesConstraint a (Recursively c), Recursively c (Ann a)))
forall (a :: Constraint). a => Dict a
Dict
instance RTraversable a => RTraversable (Ann a) where
{-# INLINE recursiveHTraversable #-}
recursiveHTraversable :: proxy (Ann a) -> Dict (HNodesConstraint (Ann a) RTraversable)
recursiveHTraversable proxy (Ann a)
_ = Dict (HNodesConstraint a RTraversable)
-> (HNodesConstraint a RTraversable =>
Dict (HNodesConstraint a RTraversable, RTraversable (Ann a)))
-> Dict (HNodesConstraint a RTraversable, RTraversable (Ann a))
forall (c :: Constraint) e r. HasDict c e => e -> (c => r) -> r
withDict (Proxy a -> Dict (HNodesConstraint a RTraversable)
forall (h :: AHyperType -> *) (proxy :: (AHyperType -> *) -> *).
RTraversable h =>
proxy h -> Dict (HNodesConstraint h RTraversable)
recursiveHTraversable (Proxy a
forall k (t :: k). Proxy t
Proxy @a)) HNodesConstraint a RTraversable =>
Dict (HNodesConstraint a RTraversable, RTraversable (Ann a))
forall (a :: Constraint). a => Dict a
Dict
instance Recursively HFunctor h => HFunctor (HFlip Ann h) where
{-# INLINE hmap #-}
hmap :: (forall (n :: AHyperType -> *).
HWitness (HFlip Ann h) n -> (p # n) -> q # n)
-> (HFlip Ann h # p) -> HFlip Ann h # q
hmap forall (n :: AHyperType -> *).
HWitness (HFlip Ann h) n -> (p # n) -> q # n
f =
Dict (HFunctor h, HNodesConstraint h (Recursively HFunctor))
-> ((HFunctor h, HNodesConstraint h (Recursively HFunctor)) =>
(HFlip Ann h # p) -> HFlip Ann h # q)
-> (HFlip Ann h # p)
-> HFlip Ann h # q
forall (c :: Constraint) e r. HasDict c e => e -> (c => r) -> r
withDict (Proxy (HFunctor h)
-> Dict (HFunctor h, HNodesConstraint h (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 h)
forall k (t :: k). Proxy t
Proxy @(HFunctor h))) (((HFunctor h, HNodesConstraint h (Recursively HFunctor)) =>
(HFlip Ann h # p) -> HFlip Ann h # q)
-> (HFlip Ann h # p) -> HFlip Ann h # q)
-> ((HFunctor h, HNodesConstraint h (Recursively HFunctor)) =>
(HFlip Ann h # p) -> HFlip Ann h # q)
-> (HFlip Ann h # p)
-> HFlip Ann h # q
forall a b. (a -> b) -> a -> b
$
((Ann p # h) -> Identity (Ann q # h))
-> (HFlip Ann h # p) -> Identity (HFlip Ann h # q)
forall (f0 :: (AHyperType -> *) -> AHyperType -> *)
(x0 :: AHyperType -> *) (k0 :: AHyperType -> *)
(f1 :: (AHyperType -> *) -> AHyperType -> *)
(x1 :: AHyperType -> *) (k1 :: AHyperType -> *).
Iso (HFlip f0 x0 # k0) (HFlip f1 x1 # k1) (f0 k0 # x0) (f1 k1 # x1)
_HFlip (((Ann p # h) -> Identity (Ann q # h))
-> (HFlip Ann h # p) -> Identity (HFlip Ann h # q))
-> ((Ann p # h) -> Ann q # h)
-> (HFlip Ann h # p)
-> HFlip Ann h # q
forall s t a b. ASetter s t a b -> (a -> b) -> s -> t
%~
\(Ann p ('AHyperType h)
a 'AHyperType h :# Ann p
b) ->
q ('AHyperType h) -> ('AHyperType h :# Ann q) -> Ann q # h
forall (a :: AHyperType -> *) (h :: AHyperType).
a h -> (h :# Ann a) -> Ann a h
Ann
(HWitness (HFlip Ann h) h -> p ('AHyperType h) -> q ('AHyperType h)
forall (n :: AHyperType -> *).
HWitness (HFlip Ann h) n -> (p # n) -> q # n
f (HWitnessType (HFlip Ann h) h -> HWitness (HFlip Ann h) h
forall (h2 :: AHyperType -> *) (n2 :: AHyperType -> *).
HWitnessType h2 n2 -> HWitness h2 n2
HWitness HWitnessType (HFlip Ann h) h
forall (h :: AHyperType -> *). HRecWitness h h
HRecSelf) p ('AHyperType h)
a)
((forall (n :: AHyperType -> *).
HWitness h n -> (Ann p # n) -> Ann q # n)
-> (h # Ann p) -> h # Ann 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
( Proxy (Recursively HFunctor)
forall k (t :: k). Proxy t
Proxy @(Recursively HFunctor) Proxy (Recursively HFunctor)
-> (Recursively HFunctor n =>
HWitness h n -> (Ann p # n) -> Ann q # n)
-> HWitness h n
-> (Ann p # n)
-> Ann q # n
forall (h :: AHyperType -> *)
(c :: (AHyperType -> *) -> Constraint) (n :: AHyperType -> *) r.
(HNodes h, HNodesConstraint h c) =>
Proxy c -> (c n => HWitness h n -> r) -> HWitness h n -> r
#*#
\HWitness h n
w -> AnIso (HFlip Ann n # q) (HFlip Ann n # p) (Ann q # n) (Ann p # n)
-> Iso (Ann p # n) (Ann q # n) (HFlip Ann n # p) (HFlip Ann n # q)
forall s t a b. AnIso s t a b -> Iso b a t s
from AnIso (HFlip Ann n # q) (HFlip Ann n # p) (Ann q # n) (Ann p # n)
forall (f0 :: (AHyperType -> *) -> AHyperType -> *)
(x0 :: AHyperType -> *) (k0 :: AHyperType -> *)
(f1 :: (AHyperType -> *) -> AHyperType -> *)
(x1 :: AHyperType -> *) (k1 :: AHyperType -> *).
Iso (HFlip f0 x0 # k0) (HFlip f1 x1 # k1) (f0 k0 # x0) (f1 k1 # x1)
_HFlip (((HFlip Ann n # p) -> Identity (HFlip Ann n # q))
-> (Ann p # n) -> Identity (Ann q # n))
-> ((HFlip Ann n # p) -> HFlip Ann n # q)
-> (Ann p # n)
-> Ann q # n
forall s t a b. ASetter s t a b -> (a -> b) -> s -> t
%~ (forall (n :: AHyperType -> *).
HWitness (HFlip Ann n) n -> (p # n) -> q # n)
-> (HFlip Ann n # p) -> HFlip Ann n # 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 (HFlip Ann h) n -> (p # n) -> q # n
forall (n :: AHyperType -> *).
HWitness (HFlip Ann h) n -> (p # n) -> q # n
f (HWitness (HFlip Ann h) n -> (p # n) -> q # n)
-> (HWitness (HFlip Ann n) n -> HWitness (HFlip Ann h) n)
-> HWitness (HFlip Ann n) n
-> (p # n)
-> q # n
forall b c a. (b -> c) -> (a -> b) -> a -> c
. HRecWitness h n -> HWitness (HFlip Ann h) n
forall (h2 :: AHyperType -> *) (n2 :: AHyperType -> *).
HWitnessType h2 n2 -> HWitness h2 n2
HWitness (HRecWitness h n -> HWitness (HFlip Ann h) n)
-> (HWitness (HFlip Ann n) n -> HRecWitness h n)
-> HWitness (HFlip Ann n) n
-> HWitness (HFlip Ann h) n
forall b c a. (b -> c) -> (a -> b) -> a -> c
. HWitness h n -> HRecWitness n n -> HRecWitness h n
forall (h :: AHyperType -> *) (c :: AHyperType -> *)
(n :: AHyperType -> *).
HWitness h c -> HRecWitness c n -> HRecWitness h n
HRecSub HWitness h n
w (HRecWitness n n -> HRecWitness h n)
-> (HWitness (HFlip Ann n) n -> HRecWitness n n)
-> HWitness (HFlip Ann n) n
-> HRecWitness h n
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (HWitness (HFlip Ann n) n
-> Getting
(HRecWitness n n) (HWitness (HFlip Ann n) n) (HRecWitness n n)
-> HRecWitness n n
forall s a. s -> Getting a s a -> a
^. Getting
(HRecWitness n n) (HWitness (HFlip Ann n) n) (HRecWitness n n)
forall (h1 :: AHyperType -> *) (n1 :: AHyperType -> *)
(h2 :: AHyperType -> *) (n2 :: AHyperType -> *).
Iso
(HWitness h1 n1)
(HWitness h2 n2)
(HWitnessType h1 n1)
(HWitnessType h2 n2)
_HWitness))
) h # Ann p
'AHyperType h :# Ann p
b
)
instance Recursively HFoldable h => HFoldable (HFlip Ann h) where
{-# INLINE hfoldMap #-}
hfoldMap :: (forall (n :: AHyperType -> *).
HWitness (HFlip Ann h) n -> (p # n) -> a)
-> (HFlip Ann h # p) -> a
hfoldMap forall (n :: AHyperType -> *).
HWitness (HFlip Ann h) n -> (p # n) -> a
f (MkHFlip (Ann GetHyperType ('AHyperType p) ('AHyperType h)
a 'AHyperType h :# Ann (GetHyperType ('AHyperType p))
b)) =
Dict (HFoldable h, HNodesConstraint h (Recursively HFoldable))
-> ((HFoldable h, HNodesConstraint h (Recursively HFoldable)) => a)
-> a
forall (c :: Constraint) e r. HasDict c e => e -> (c => r) -> r
withDict (Proxy (HFoldable h)
-> Dict (HFoldable h, HNodesConstraint h (Recursively HFoldable))
forall (c :: (AHyperType -> *) -> Constraint)
(h :: AHyperType -> *) (proxy :: Constraint -> *).
Recursively c h =>
proxy (c h) -> Dict (c h, HNodesConstraint h (Recursively c))
recursively (Proxy (HFoldable h)
forall k (t :: k). Proxy t
Proxy @(HFoldable h))) (((HFoldable h, HNodesConstraint h (Recursively HFoldable)) => a)
-> a)
-> ((HFoldable h, HNodesConstraint h (Recursively HFoldable)) => a)
-> a
forall a b. (a -> b) -> a -> b
$
HWitness (HFlip Ann h) h -> (p # h) -> a
forall (n :: AHyperType -> *).
HWitness (HFlip Ann h) n -> (p # n) -> a
f (HWitnessType (HFlip Ann h) h -> HWitness (HFlip Ann h) h
forall (h2 :: AHyperType -> *) (n2 :: AHyperType -> *).
HWitnessType h2 n2 -> HWitness h2 n2
HWitness HWitnessType (HFlip Ann h) h
forall (h :: AHyperType -> *). HRecWitness h h
HRecSelf) p # h
GetHyperType ('AHyperType p) ('AHyperType h)
a a -> a -> a
forall a. Semigroup a => a -> a -> a
<>
(forall (n :: AHyperType -> *). HWitness h n -> (Ann p # n) -> a)
-> (h # Ann 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
( Proxy (Recursively HFoldable)
forall k (t :: k). Proxy t
Proxy @(Recursively HFoldable) Proxy (Recursively HFoldable)
-> (Recursively HFoldable n => HWitness h n -> (Ann p # n) -> a)
-> HWitness h n
-> (Ann p # n)
-> a
forall (h :: AHyperType -> *)
(c :: (AHyperType -> *) -> Constraint) (n :: AHyperType -> *) r.
(HNodes h, HNodesConstraint h c) =>
Proxy c -> (c n => HWitness h n -> r) -> HWitness h n -> r
#*#
\HWitness h n
w -> (forall (n :: AHyperType -> *).
HWitness (HFlip Ann n) n -> (p # n) -> a)
-> (HFlip Ann n # 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 (HFlip Ann h) n -> (p # n) -> a
forall (n :: AHyperType -> *).
HWitness (HFlip Ann h) n -> (p # n) -> a
f (HWitness (HFlip Ann h) n -> (p # n) -> a)
-> (HWitness (HFlip Ann n) n -> HWitness (HFlip Ann h) n)
-> HWitness (HFlip Ann n) n
-> (p # n)
-> a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. HRecWitness h n -> HWitness (HFlip Ann h) n
forall (h2 :: AHyperType -> *) (n2 :: AHyperType -> *).
HWitnessType h2 n2 -> HWitness h2 n2
HWitness (HRecWitness h n -> HWitness (HFlip Ann h) n)
-> (HWitness (HFlip Ann n) n -> HRecWitness h n)
-> HWitness (HFlip Ann n) n
-> HWitness (HFlip Ann h) n
forall b c a. (b -> c) -> (a -> b) -> a -> c
. HWitness h n -> HRecWitness n n -> HRecWitness h n
forall (h :: AHyperType -> *) (c :: AHyperType -> *)
(n :: AHyperType -> *).
HWitness h c -> HRecWitness c n -> HRecWitness h n
HRecSub HWitness h n
w (HRecWitness n n -> HRecWitness h n)
-> (HWitness (HFlip Ann n) n -> HRecWitness n n)
-> HWitness (HFlip Ann n) n
-> HRecWitness h n
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (HWitness (HFlip Ann n) n
-> Getting
(HRecWitness n n) (HWitness (HFlip Ann n) n) (HRecWitness n n)
-> HRecWitness n n
forall s a. s -> Getting a s a -> a
^. Getting
(HRecWitness n n) (HWitness (HFlip Ann n) n) (HRecWitness n n)
forall (h1 :: AHyperType -> *) (n1 :: AHyperType -> *)
(h2 :: AHyperType -> *) (n2 :: AHyperType -> *).
Iso
(HWitness h1 n1)
(HWitness h2 n2)
(HWitnessType h1 n1)
(HWitnessType h2 n2)
_HWitness)) ((HFlip Ann n # p) -> a)
-> ((Ann p # n) -> HFlip Ann n # p) -> (Ann p # n) -> a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Ann p # n) -> HFlip Ann n # p
forall (f :: (AHyperType -> *) -> AHyperType -> *)
(x :: AHyperType -> *) (h :: AHyperType).
(f (GetHyperType h) # x) -> HFlip f x h
MkHFlip
) h # Ann p
'AHyperType h :# Ann (GetHyperType ('AHyperType p))
b
instance RTraversable h => HTraversable (HFlip Ann h) where
{-# INLINE hsequence #-}
hsequence :: (HFlip Ann h # ContainedH f p) -> f (HFlip Ann h # p)
hsequence =
Dict (HNodesConstraint h RTraversable)
-> (HNodesConstraint h RTraversable =>
(HFlip Ann h # ContainedH f p) -> f (HFlip Ann h # p))
-> (HFlip Ann h # ContainedH f p)
-> f (HFlip Ann h # p)
forall (c :: Constraint) e r. HasDict c e => e -> (c => r) -> r
withDict (Proxy (RTraversable h) -> Dict (HNodesConstraint h RTraversable)
forall (c :: (AHyperType -> *) -> Constraint)
(h :: AHyperType -> *) (proxy :: Constraint -> *).
(Recursive c, HNodes h, c h) =>
proxy (c h) -> Dict (HNodesConstraint h c)
recurse (Proxy (RTraversable h)
forall k (t :: k). Proxy t
Proxy @(RTraversable h))) ((HNodesConstraint h RTraversable =>
(HFlip Ann h # ContainedH f p) -> f (HFlip Ann h # p))
-> (HFlip Ann h # ContainedH f p) -> f (HFlip Ann h # p))
-> (HNodesConstraint h RTraversable =>
(HFlip Ann h # ContainedH f p) -> f (HFlip Ann h # p))
-> (HFlip Ann h # ContainedH f p)
-> f (HFlip Ann h # p)
forall a b. (a -> b) -> a -> b
$
((Ann (ContainedH f p) # h) -> f (Ann p # h))
-> (HFlip Ann h # ContainedH f p) -> f (HFlip Ann h # p)
forall (f0 :: (AHyperType -> *) -> AHyperType -> *)
(x0 :: AHyperType -> *) (k0 :: AHyperType -> *)
(f1 :: (AHyperType -> *) -> AHyperType -> *)
(x1 :: AHyperType -> *) (k1 :: AHyperType -> *).
Iso (HFlip f0 x0 # k0) (HFlip f1 x1 # k1) (f0 k0 # x0) (f1 k1 # x1)
_HFlip
( \(Ann ContainedH f p ('AHyperType h)
a 'AHyperType h :# Ann (ContainedH f p)
b) ->
p ('AHyperType h) -> h ('AHyperType (Ann p)) -> Ann p # h
forall (a :: AHyperType -> *) (h :: AHyperType).
a h -> (h :# Ann a) -> Ann a h
Ann
(p ('AHyperType h) -> h ('AHyperType (Ann p)) -> Ann p # h)
-> f (p ('AHyperType h))
-> f (h ('AHyperType (Ann p)) -> Ann p # h)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ContainedH f p ('AHyperType h) -> f (p ('AHyperType h))
forall (f :: * -> *) (p :: AHyperType -> *) (h :: AHyperType).
ContainedH f p h -> f (p h)
runContainedH ContainedH f p ('AHyperType h)
a
f (h ('AHyperType (Ann p)) -> Ann p # h)
-> f (h ('AHyperType (Ann p))) -> f (Ann p # h)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (forall (n :: AHyperType -> *).
HWitness h n -> (Ann (ContainedH f p) # n) -> f (Ann p # n))
-> (h # Ann (ContainedH f p)) -> f (h ('AHyperType (Ann p)))
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 (Proxy RTraversable
forall k (t :: k). Proxy t
Proxy @RTraversable Proxy RTraversable
-> (RTraversable n => (Ann (ContainedH f p) # n) -> f (Ann p # n))
-> HWitness h n
-> (Ann (ContainedH f p) # n)
-> f (Ann p # n)
forall (h :: AHyperType -> *)
(c :: (AHyperType -> *) -> Constraint) (n :: AHyperType -> *) r.
(HNodes h, HNodesConstraint h c) =>
Proxy c -> (c n => r) -> HWitness h n -> r
#> AnIso
(HFlip Ann n # p)
(HFlip Ann n # ContainedH f p)
(Ann p # n)
(Ann (ContainedH f p) # n)
-> ((HFlip Ann n # ContainedH f p) -> f (HFlip Ann n # p))
-> (Ann (ContainedH f p) # n)
-> f (Ann p # n)
forall s t a b. AnIso s t a b -> Iso b a t s
from AnIso
(HFlip Ann n # p)
(HFlip Ann n # ContainedH f p)
(Ann p # n)
(Ann (ContainedH f p) # n)
forall (f0 :: (AHyperType -> *) -> AHyperType -> *)
(x0 :: AHyperType -> *) (k0 :: AHyperType -> *)
(f1 :: (AHyperType -> *) -> AHyperType -> *)
(x1 :: AHyperType -> *) (k1 :: AHyperType -> *).
Iso (HFlip f0 x0 # k0) (HFlip f1 x1 # k1) (f0 k0 # x0) (f1 k1 # x1)
_HFlip (HFlip Ann n # ContainedH f p) -> f (HFlip Ann n # p)
forall (h :: AHyperType -> *) (f :: * -> *) (p :: AHyperType -> *).
(HTraversable h, Applicative f) =>
(h # ContainedH f p) -> f (h # p)
hsequence) h # Ann (ContainedH f p)
'AHyperType h :# Ann (ContainedH f p)
b
)
type Annotated a = Ann (Const a)
annotation :: Lens' (Annotated a # h) a
annotation :: (a -> f a) -> (Annotated a # h) -> f (Annotated a # h)
annotation = (Const a ('AHyperType h) -> f (Const a ('AHyperType h)))
-> (Annotated a # h) -> f (Annotated a # h)
forall (a :: AHyperType -> *) (h :: AHyperType).
Lens' (Ann a h) (a h)
hAnn ((Const a ('AHyperType h) -> f (Const a ('AHyperType h)))
-> (Annotated a # h) -> f (Annotated a # h))
-> ((a -> f a)
-> Const a ('AHyperType h) -> f (Const a ('AHyperType h)))
-> (a -> f a)
-> (Annotated a # h)
-> f (Annotated a # h)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (a -> f a)
-> Const a ('AHyperType h) -> f (Const a ('AHyperType h))
forall s t. Rewrapping s t => Iso s t (Unwrapped s) (Unwrapped t)
_Wrapped
annValue :: Lens (Annotated a # h0) (Annotated a # h1) (h0 # Annotated a) (h1 # Annotated a)
annValue :: ((h0 # Annotated a) -> f (h1 # Annotated a))
-> (Annotated a # h0) -> f (Annotated a # h1)
annValue (h0 # Annotated a) -> f (h1 # Annotated a)
f (Ann (Const a
a) 'AHyperType h0 :# Annotated a
b) = (h0 # Annotated a) -> f (h1 # Annotated a)
f h0 # Annotated a
'AHyperType h0 :# Annotated a
b f (h1 # Annotated a)
-> ((h1 # Annotated a) -> Annotated a # h1) -> f (Annotated a # h1)
forall (f :: * -> *) a b. Functor f => f a -> (a -> b) -> f b
<&> Const a ('AHyperType h1)
-> ('AHyperType h1 :# Annotated a) -> Annotated a # h1
forall (a :: AHyperType -> *) (h :: AHyperType).
a h -> (h :# Ann a) -> Ann a h
Ann (a -> Const a ('AHyperType h1)
forall k a (b :: k). a -> Const a b
Const a
a)