Copyright | (c) 2023 Yamada Ryo (c) 2023 Casper Bach Poulsen and Cas van der Rest |
---|---|
License | MPL-2.0 (see the file LICENSE) |
Maintainer | ymdfield@outlook.jp |
Stability | experimental |
Portability | portable |
Safe Haskell | Safe-Inferred |
Language | GHC2021 |
An implementation of an open union for higher-order effects using recursively nested binary sums.
Synopsis
- absurdLH :: (NopS :+: h) f ~> h f
- absurdRH :: (h :+: NopS) f ~> h f
- swapSumH :: (h1 :+: h2) f a -> (h2 :+: h1) f a
- type family SumH hs where ...
- newtype SumUnionH hs f a = SumUnionH {
- unSumUnionH :: SumH hs f a
- class isHead ~ (h1 `IsHeadSigOf` h2) => SumMemberH isHead (h1 :: Signature) h2 where
- type family IsHeadSigOf (h1 :: Signature) h2 where ...
- type (<<) h1 h2 = SumMemberH (IsHeadSigOf h1 h2) h1 h2
- injH :: forall h1 h2 f. h1 << h2 => h1 f ~> h2 f
- projH :: forall h1 h2 f a. h1 << h2 => h2 f a -> Maybe (h1 f a)
Documentation
newtype SumUnionH hs f a Source #
An implementation of an open union for higher-order effects using recursively nested binary sums.
SumUnionH | |
|
Instances
UnionH SumUnionH Source # | |
Defined in Data.Hefty.Sum type HasMembershipH SumUnionH h hs Source # injectH :: forall (h :: Signature) (hs :: [Signature]) (f :: Type -> Type). HasMembershipH SumUnionH h hs => h f ~> SumUnionH hs f Source # projectH :: forall h (hs :: [Signature]) (f :: Type -> Type) a. HasMembershipH SumUnionH h hs => SumUnionH hs f a -> Maybe (h f a) Source # absurdUnionH :: forall (f :: Type -> Type) a x. SumUnionH '[] f a -> x Source # compH :: forall h (f :: Type -> Type) a (hs :: [Signature]). Either (h f a) (SumUnionH hs f a) -> SumUnionH (h ': hs) f a Source # decompH :: forall h (hs :: [Signature]) (f :: Type -> Type) a. SumUnionH (h ': hs) f a -> Either (h f a) (SumUnionH hs f a) Source # (|+:) :: forall h (f :: Type -> Type) a r (hs :: [Signature]). (h f a -> r) -> (SumUnionH hs f a -> r) -> SumUnionH (h ': hs) f a -> r Source # inject0H :: forall (h :: (Type -> Type) -> Type -> Type) (f :: Type -> Type) (hs :: [(Type -> Type) -> Type -> Type]). h f ~> SumUnionH (h ': hs) f Source # injectUnderH :: forall (h2 :: (Type -> Type) -> Type -> Type) (f :: Type -> Type) (h1 :: (Type -> Type) -> Type -> Type) (hs :: [(Type -> Type) -> Type -> Type]). h2 f ~> SumUnionH (h1 ': (h2 ': hs)) f Source # injectUnder2H :: forall (h3 :: (Type -> Type) -> Type -> Type) (f :: Type -> Type) (h1 :: (Type -> Type) -> Type -> Type) (h2 :: (Type -> Type) -> Type -> Type) (hs :: [(Type -> Type) -> Type -> Type]). h3 f ~> SumUnionH (h1 ': (h2 ': (h3 ': hs))) f Source # injectUnder3H :: forall (h4 :: (Type -> Type) -> Type -> Type) (f :: Type -> Type) (h1 :: (Type -> Type) -> Type -> Type) (h2 :: (Type -> Type) -> Type -> Type) (h3 :: (Type -> Type) -> Type -> Type) (hs :: [(Type -> Type) -> Type -> Type]). h4 f ~> SumUnionH (h1 ': (h2 ': (h3 ': (h4 ': hs)))) f Source # weakenH :: forall (hs :: [Signature]) (f :: Type -> Type) (h :: Signature). SumUnionH hs f ~> SumUnionH (h ': hs) f Source # weaken2H :: forall (hs :: [Signature]) (f :: Type -> Type) (h1 :: Signature) (h2 :: Signature). SumUnionH hs f ~> SumUnionH (h1 ': (h2 ': hs)) f Source # weaken3H :: forall (hs :: [Signature]) (f :: Type -> Type) (h1 :: Signature) (h2 :: Signature) (h3 :: Signature). SumUnionH hs f ~> SumUnionH (h1 ': (h2 ': (h3 ': hs))) f Source # weaken4H :: forall (hs :: [Signature]) (f :: Type -> Type) (h1 :: Signature) (h2 :: Signature) (h3 :: Signature) (h4 :: Signature). SumUnionH hs f ~> SumUnionH (h1 ': (h2 ': (h3 ': (h4 ': hs)))) f Source # weakenUnderH :: forall (h1 :: Signature) (hs :: [Signature]) (f :: Type -> Type) (h2 :: Signature). SumUnionH (h1 ': hs) f ~> SumUnionH (h1 ': (h2 ': hs)) f Source # weakenUnder2H :: forall (h1 :: Signature) (h2 :: Signature) (hs :: [Signature]) (f :: Type -> Type) (h3 :: Signature). SumUnionH (h1 ': (h2 ': hs)) f ~> SumUnionH (h1 ': (h2 ': (h3 ': hs))) f Source # weakenUnder3H :: forall (h1 :: Signature) (h2 :: Signature) (h3 :: Signature) (hs :: [Signature]) (f :: Type -> Type) (h4 :: Signature). SumUnionH (h1 ': (h2 ': (h3 ': hs))) f ~> SumUnionH (h1 ': (h2 ': (h3 ': (h4 ': hs)))) f Source # weaken2UnderH :: forall (h1 :: Signature) (hs :: [Signature]) (f :: Type -> Type) (h2 :: Signature) (h3 :: Signature). SumUnionH (h1 ': hs) f ~> SumUnionH (h1 ': (h2 ': (h3 ': hs))) f Source # weaken2Under2H :: forall (h1 :: Signature) (h2 :: Signature) (hs :: [Signature]) (f :: Type -> Type) (h3 :: Signature) (h4 :: Signature). SumUnionH (h1 ': (h2 ': hs)) f ~> SumUnionH (h1 ': (h2 ': (h3 ': (h4 ': hs)))) f Source # weaken3UnderH :: forall (h1 :: Signature) (hs :: [Signature]) (f :: Type -> Type) (h2 :: Signature) (h3 :: Signature) (h4 :: Signature). SumUnionH (h1 ': hs) f ~> SumUnionH (h1 ': (h2 ': (h3 ': (h4 ': hs)))) f Source # flipUnionH :: forall (h1 :: Signature) (h2 :: Signature) (hs :: [Signature]) (f :: Type -> Type). SumUnionH (h1 ': (h2 ': hs)) f ~> SumUnionH (h2 ': (h1 ': hs)) f Source # flipUnion3H :: forall (h1 :: Signature) (h2 :: Signature) (h3 :: Signature) (hs :: [Signature]) (f :: Type -> Type). SumUnionH (h1 ': (h2 ': (h3 ': hs))) f ~> SumUnionH (h3 ': (h2 ': (h1 ': hs))) f Source # flipUnionUnderH :: forall (h1 :: Signature) (h2 :: Signature) (h3 :: Signature) (hs :: [Signature]) (f :: Type -> Type). SumUnionH (h1 ': (h2 ': (h3 ': hs))) f ~> SumUnionH (h1 ': (h3 ': (h2 ': hs))) f Source # rot3H :: forall (h1 :: Signature) (h2 :: Signature) (h3 :: Signature) (hs :: [Signature]) (f :: Type -> Type). SumUnionH (h1 ': (h2 ': (h3 ': hs))) f ~> SumUnionH (h2 ': (h3 ': (h1 ': hs))) f Source # rot3H' :: forall (h1 :: Signature) (h2 :: Signature) (h3 :: Signature) (hs :: [Signature]) (f :: Type -> Type). SumUnionH (h1 ': (h2 ': (h3 ': hs))) f ~> SumUnionH (h3 ': (h1 ': (h2 ': hs))) f Source # bundleUnion2H :: forall (u' :: [Signature] -> Signature) (h1 :: Signature) (h2 :: Signature) (hs :: [Signature]) (f :: Type -> Type). UnionH u' => SumUnionH (h1 ': (h2 ': hs)) f ~> SumUnionH (u' '[h1, h2] ': hs) f Source # bundleUnion3H :: forall (u' :: [Signature] -> Signature) (h1 :: Signature) (h2 :: Signature) (h3 :: Signature) (hs :: [Signature]) (f :: Type -> Type). UnionH u' => SumUnionH (h1 ': (h2 ': (h3 ': hs))) f ~> SumUnionH (u' '[h1, h2, h3] ': hs) f Source # bundleUnion4H :: forall (u' :: [Signature] -> Signature) (h1 :: Signature) (h2 :: Signature) (h3 :: Signature) (h4 :: Signature) (hs :: [Signature]) (f :: Type -> Type). UnionH u' => SumUnionH (h1 ': (h2 ': (h3 ': (h4 ': hs)))) f ~> SumUnionH (u' '[h1, h2, h3, h4] ': hs) f Source # unbundleUnion2H :: forall (u' :: [Signature] -> Signature) (h1 :: Signature) (h2 :: Signature) (hs :: [Signature]) (f :: Type -> Type). UnionH u' => SumUnionH (u' '[h1, h2] ': hs) f ~> SumUnionH (h1 ': (h2 ': hs)) f Source # unbundleUnion3H :: forall (u' :: [Signature] -> Signature) (h1 :: Signature) (h2 :: Signature) (h3 :: Signature) (hs :: [Signature]) (f :: Type -> Type). UnionH u' => SumUnionH (u' '[h1, h2, h3] ': hs) f ~> SumUnionH (h1 ': (h2 ': (h3 ': hs))) f Source # unbundleUnion4H :: forall (u' :: [Signature] -> Signature) (h1 :: Signature) (h2 :: Signature) (h3 :: Signature) (h4 :: Signature) (hs :: [Signature]) (f :: Type -> Type). UnionH u' => SumUnionH (u' '[h1, h2, h3, h4] ': hs) f ~> SumUnionH (h1 ': (h2 ': (h3 ': (h4 ': hs)))) f Source # | |
HFunctor (SumH hs) => HFunctor (SumUnionH hs) Source # | |
Foldable (SumUnionH ('[] :: [(Type -> Type) -> Type -> Type]) f) Source # | |
Defined in Data.Hefty.Sum fold :: Monoid m => SumUnionH '[] f m -> m # foldMap :: Monoid m => (a -> m) -> SumUnionH '[] f a -> m # foldMap' :: Monoid m => (a -> m) -> SumUnionH '[] f a -> m # foldr :: (a -> b -> b) -> b -> SumUnionH '[] f a -> b # foldr' :: (a -> b -> b) -> b -> SumUnionH '[] f a -> b # foldl :: (b -> a -> b) -> b -> SumUnionH '[] f a -> b # foldl' :: (b -> a -> b) -> b -> SumUnionH '[] f a -> b # foldr1 :: (a -> a -> a) -> SumUnionH '[] f a -> a # foldl1 :: (a -> a -> a) -> SumUnionH '[] f a -> a # toList :: SumUnionH '[] f a -> [a] # null :: SumUnionH '[] f a -> Bool # length :: SumUnionH '[] f a -> Int # elem :: Eq a => a -> SumUnionH '[] f a -> Bool # maximum :: Ord a => SumUnionH '[] f a -> a # minimum :: Ord a => SumUnionH '[] f a -> a # | |
Traversable (SumUnionH ('[] :: [(Type -> Type) -> Type -> Type]) f) Source # | |
Defined in Data.Hefty.Sum traverse :: Applicative f0 => (a -> f0 b) -> SumUnionH '[] f a -> f0 (SumUnionH '[] f b) # sequenceA :: Applicative f0 => SumUnionH '[] f (f0 a) -> f0 (SumUnionH '[] f a) # mapM :: Monad m => (a -> m b) -> SumUnionH '[] f a -> m (SumUnionH '[] f b) # sequence :: Monad m => SumUnionH '[] f (m a) -> m (SumUnionH '[] f a) # | |
Functor (SumUnionH ('[] :: [(Type -> Type) -> Type -> Type]) f) Source # | |
type HasMembershipH SumUnionH h hs Source # | |
Defined in Data.Hefty.Sum |
class isHead ~ (h1 `IsHeadSigOf` h2) => SumMemberH isHead (h1 :: Signature) h2 where Source #
Instances
(IsHeadSigOf f (g :+: h) ~ 'False, f << h) => SumMemberH 'False f (g :+: h) Source # | |
SumMemberH 'True f (f :+: g) Source # | |
type family IsHeadSigOf (h1 :: Signature) h2 where ... Source #
IsHeadSigOf f (f :+: g) = 'True | |
IsHeadSigOf _ _ = 'False |
type (<<) h1 h2 = SumMemberH (IsHeadSigOf h1 h2) h1 h2 Source #