Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Extensible ADT
Synopsis
- newtype EADT fs = EADT (VariantF fs (EADT fs))
- type family f :<: xs where ...
- type family xs :<<: ys :: Constraint where ...
- pattern VF :: forall e f cs. (e ~ EADT cs, f :<: cs) => f (EADT cs) -> EADT cs
- appendEADT :: forall ys xs zs. (zs ~ Concat xs ys, ApplyAll (EADT zs) zs ~ Concat (ApplyAll (EADT zs) xs) (ApplyAll (EADT zs) ys), Functor (VariantF xs)) => EADT xs -> EADT zs
- liftEADT :: forall e as bs. (e ~ EADT bs, LiftVariantF as bs e, Functor (VariantF as)) => EADT as -> EADT bs
- popEADT :: forall f xs e. (f :<: xs, e ~ EADT xs, f e :< ApplyAll e xs) => EADT xs -> Either (VariantF (Remove f xs) (EADT xs)) (f (EADT xs))
- contToEADT :: ContVariant (ApplyAll (EADT xs) xs) => ContFlow (ApplyAll (EADT xs) xs) (V (ApplyAll (EADT xs) xs)) -> EADT xs
- contToEADTM :: (ContVariant (ApplyAll (EADT xs) xs), Monad f) => ContFlow (ApplyAll (EADT xs) xs) (f (V (ApplyAll (EADT xs) xs))) -> f (EADT xs)
- class EADTShow f where
- eadtShow :: forall xs. BottomUpF EADTShow xs => EADT xs -> String
- module Haskus.Utils.Functor
- module Haskus.Utils.VariantF
Documentation
An extensible ADT
Instances
Show1 (VariantF fs) => Show (EADT fs) Source # | |
Eq1 (VariantF fs) => Eq (EADT fs) Source # | |
Ord1 (VariantF fs) => Ord (EADT fs) Source # | |
(Functor (VariantF xs), ContVariant (ApplyAll (EADT xs) xs)) => MultiCont (EADT xs) Source # | MultiCont instance
|
Functor (VariantF fs) => Corecursive (EADT fs) Source # | |
Defined in Haskus.Utils.EADT embed :: Base (EADT fs) (EADT fs) -> EADT fs # ana :: (a -> Base (EADT fs) a) -> a -> EADT fs # apo :: (a -> Base (EADT fs) (Either (EADT fs) a)) -> a -> EADT fs # postpro :: Recursive (EADT fs) => (forall b. Base (EADT fs) b -> Base (EADT fs) b) -> (a -> Base (EADT fs) a) -> a -> EADT fs # gpostpro :: (Recursive (EADT fs), Monad m) => (forall b. m (Base (EADT fs) b) -> Base (EADT fs) (m b)) -> (forall c. Base (EADT fs) c -> Base (EADT fs) c) -> (a -> Base (EADT fs) (m a)) -> a -> EADT fs # | |
Functor (VariantF fs) => Recursive (EADT fs) Source # | |
Defined in Haskus.Utils.EADT project :: EADT fs -> Base (EADT fs) (EADT fs) # cata :: (Base (EADT fs) a -> a) -> EADT fs -> a # para :: (Base (EADT fs) (EADT fs, a) -> a) -> EADT fs -> a # gpara :: (Corecursive (EADT fs), Comonad w) => (forall b. Base (EADT fs) (w b) -> w (Base (EADT fs) b)) -> (Base (EADT fs) (EnvT (EADT fs) w a) -> a) -> EADT fs -> a # prepro :: Corecursive (EADT fs) => (forall b. Base (EADT fs) b -> Base (EADT fs) b) -> (Base (EADT fs) a -> a) -> EADT fs -> a # gprepro :: (Corecursive (EADT fs), Comonad w) => (forall b. Base (EADT fs) (w b) -> w (Base (EADT fs) b)) -> (forall c. Base (EADT fs) c -> Base (EADT fs) c) -> (Base (EADT fs) (w a) -> a) -> EADT fs -> a # | |
type MultiContTypes (EADT xs) Source # | |
Defined in Haskus.Utils.EADT | |
type Base (EADT fs) Source # | |
Defined in Haskus.Utils.EADT |
type family xs :<<: ys :: Constraint where ... Source #
Forall x
in xs
, `x :<: ys`
pattern VF :: forall e f cs. (e ~ EADT cs, f :<: cs) => f (EADT cs) -> EADT cs Source #
Pattern-match in an extensible ADT
appendEADT :: forall ys xs zs. (zs ~ Concat xs ys, ApplyAll (EADT zs) zs ~ Concat (ApplyAll (EADT zs) xs) (ApplyAll (EADT zs) ys), Functor (VariantF xs)) => EADT xs -> EADT zs Source #
Append new "constructors" to the EADT
liftEADT :: forall e as bs. (e ~ EADT bs, LiftVariantF as bs e, Functor (VariantF as)) => EADT as -> EADT bs Source #
Lift an EADT into another
popEADT :: forall f xs e. (f :<: xs, e ~ EADT xs, f e :< ApplyAll e xs) => EADT xs -> Either (VariantF (Remove f xs) (EADT xs)) (f (EADT xs)) Source #
Pop an EADT value
contToEADT :: ContVariant (ApplyAll (EADT xs) xs) => ContFlow (ApplyAll (EADT xs) xs) (V (ApplyAll (EADT xs) xs)) -> EADT xs Source #
Convert a multi-continuation into an EADT
contToEADTM :: (ContVariant (ApplyAll (EADT xs) xs), Monad f) => ContFlow (ApplyAll (EADT xs) xs) (f (V (ApplyAll (EADT xs) xs))) -> f (EADT xs) Source #
Convert a multi-continuation into an EADT
Reexport
module Haskus.Utils.Functor
module Haskus.Utils.VariantF