| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Data.Variant.VariantF
Description
VariantF functor
Synopsis
- newtype VariantF (xs :: [t -> Type]) (e :: t) = VariantF (V (ApplyAll e xs))
- type family ApplyAll (e :: t) (xs :: [t -> k]) :: [k] where ...
- pattern FV :: forall {t} c cs e. c :< ApplyAll e cs => c -> VariantF cs e
- appendVariantF :: forall (ys :: [Type -> Type]) (xs :: [Type -> Type]) e. ApplyAll e (Concat xs ys) ~ Concat (ApplyAll e xs) (ApplyAll e ys) => VariantF xs e -> VariantF (Concat xs ys) e
- prependVariantF :: forall (xs :: [Type -> Type]) (ys :: [Type -> Type]) e. (ApplyAll e (Concat xs ys) ~ Concat (ApplyAll e xs) (ApplyAll e ys), KnownNat (Length (ApplyAll e xs))) => VariantF ys e -> VariantF (Concat xs ys) e
- toVariantFHead :: forall {t} x (xs :: [t -> Type]) (e :: t). x e -> VariantF (x ': xs) e
- toVariantFTail :: forall {t} (x :: t -> Type) (xs :: [t -> Type]) (e :: t). VariantF xs e -> VariantF (x ': xs) e
- popVariantFHead :: forall {t} x (xs :: [t -> Type]) (e :: t). VariantF (x ': xs) e -> Either (VariantF xs e) (x e)
- variantFToValue :: forall {t} f (e :: t). VariantF '[f] e -> f e
- type MapVariantF (a :: t -> Type) (b :: t -> Type) (cs :: [t -> Type]) (ds :: [t -> Type]) (e :: t) = (MapVariant (a e) (b e) (ApplyAll e cs), ds ~ ReplaceNS (IndexesOf a cs) b cs, ApplyAll e ds ~ ReplaceNS (IndexesOf (a e) (ApplyAll e cs)) (b e) (ApplyAll e cs))
- mapVariantF :: forall {t} a b (cs :: [t -> Type]) (ds :: [t -> Type]) (e :: t). MapVariantF a b cs ds e => (a e -> b e) -> VariantF cs e -> VariantF ds e
- type PopVariantF (x :: t -> Type) (xs :: [t -> Type]) (e :: t) = (x e :< ApplyAll e xs, Remove (x e) (ApplyAll e xs) ~ ApplyAll e (Remove x xs))
- popVariantF :: forall {t} x (xs :: [t -> Type]) (e :: t). PopVariantF x xs e => VariantF xs e -> Either (VariantF (Remove x xs) e) (x e)
- type LiftVariantF (xs :: [t -> Type]) (ys :: [t -> Type]) (e :: t) = LiftVariant (ApplyAll e xs) (ApplyAll e ys)
- liftVariantF :: forall {t} (as :: [t -> Type]) (bs :: [t -> Type]) (e :: t). LiftVariantF as bs e => VariantF as e -> VariantF bs e
- type SplitVariantF (as :: [t -> Type]) (xs :: [t -> Type]) (e :: t) = (Complement (ApplyAll e xs) (ApplyAll e as) ~ ApplyAll e (Complement xs as), SplitVariant (ApplyAll e as) (ApplyAll e (Complement xs as)) (ApplyAll e xs))
- splitVariantF :: forall {t} (as :: [t -> Type]) (xs :: [t -> Type]) (e :: t). SplitVariantF as xs e => VariantF xs e -> Either (VariantF (Complement xs as) e) (VariantF as e)
- variantFToCont :: forall {t} (e :: t) (xs :: [t -> Type]) r. ContVariant (ApplyAll e xs) => VariantF xs e -> ContFlow (ApplyAll e xs) r
- variantFToContM :: forall {t} (e :: t) (xs :: [t -> Type]) m r. (ContVariant (ApplyAll e xs), Monad m) => m (VariantF xs e) -> ContFlow (ApplyAll e xs) (m r)
- contToVariantF :: forall {t} (xs :: [t -> Type]) (e :: t). ContVariant (ApplyAll e xs) => ContFlow (ApplyAll e xs) (V (ApplyAll e xs)) -> VariantF xs e
- contToVariantFM :: forall {t} (xs :: [t -> Type]) (e :: t) m. (ContVariant (ApplyAll e xs), Monad m) => ContFlow (ApplyAll e xs) (m (V (ApplyAll e xs))) -> m (VariantF xs e)
- type family BottomUpF (c :: (Type -> Type) -> Constraint) (fs :: [Type -> Type]) where ...
- class BottomUp (c :: (t -> Type) -> Constraint) (fs :: [t -> Type]) where
- toBottomUp :: forall (a :: t) b. (forall (f :: t -> Type). c f => f a -> b) -> VariantF fs a -> b
- class BottomUpOrig (c :: (Type -> Type) -> Constraint) (fs :: [Type -> Type]) where
- toBottomUpOrig :: (forall (f :: Type -> Type). c f => f (t, a) -> b) -> VariantF fs (t, a) -> b
- type family BottomUpOrigF (c :: (Type -> Type) -> Constraint) (fs :: [Type -> Type]) where ...
- class TopDownStop (c :: (Type -> Type) -> Constraint) (fs :: [Type -> Type]) where
- toTopDownStop :: (forall (f :: Type -> Type). c f => TopDownStopT a f) -> TopDownStopT a (VariantF fs)
- type family TopDownStopF (c :: (Type -> Type) -> Constraint) (fs :: [Type -> Type]) where ...
- class NoConstraint a
- module Data.Functor
Documentation
newtype VariantF (xs :: [t -> Type]) (e :: t) Source #
Recursive Functor-like Variant
Instances
| (Eq1 f, Eq1 (VariantF fs), ConstraintAll1 Eq1 fs) => Eq1 (VariantF (f ': fs)) Source # | |||||
| Eq1 (VariantF ('[] :: [Type -> Type])) Source # | |||||
| (Ord1 f, Ord1 (VariantF fs), ConstraintAll1 Eq1 fs, ConstraintAll1 Ord1 fs) => Ord1 (VariantF (f ': fs)) Source # | |||||
Defined in Data.Variant.VariantF | |||||
| Ord1 (VariantF ('[] :: [Type -> Type])) Source # | |||||
| (Show1 f, Show1 (VariantF fs), ConstraintAll1 Show1 fs) => Show1 (VariantF (f ': fs)) Source # | |||||
| Show1 (VariantF ('[] :: [Type -> Type])) Source # | |||||
| (Functor (VariantF fs), Functor f) => Functor (VariantF (f ': fs)) Source # | |||||
| Functor (VariantF ('[] :: [Type -> Type])) Source # | |||||
| (Show1 (VariantF xs), ConstraintAll1 Show1 xs, Show e) => Show (VariantF xs e) Source # | Show instance for VariantF
| ||||
| NFData (V (ApplyAll e xs)) => NFData (VariantF xs e) Source # | |||||
Defined in Data.Variant.VariantF | |||||
| (Eq1 (VariantF xs), ConstraintAll1 Eq1 xs, Eq e) => Eq (VariantF xs e) Source # | Eq instance for VariantF
| ||||
| (Ord1 (VariantF xs), ConstraintAll1 Ord1 xs, ConstraintAll1 Eq1 xs, Ord e) => Ord (VariantF xs e) Source # | Ord instance for VariantF
| ||||
Defined in Data.Variant.VariantF Methods compare :: VariantF xs e -> VariantF xs e -> Ordering # (<) :: VariantF xs e -> VariantF xs e -> Bool # (<=) :: VariantF xs e -> VariantF xs e -> Bool # (>) :: VariantF xs e -> VariantF xs e -> Bool # (>=) :: VariantF xs e -> VariantF xs e -> Bool # | |||||
| ContVariant (ApplyAll e xs) => MultiCont (VariantF xs e) Source # | |||||
Defined in Data.Variant.VariantF Associated Types
| |||||
| type Base (VariantF xs a) Source # | |||||
Defined in Data.Variant.VariantF | |||||
| type MultiContTypes (VariantF xs e) Source # | |||||
Defined in Data.Variant.VariantF | |||||
type family ApplyAll (e :: t) (xs :: [t -> k]) :: [k] where ... Source #
Apply its first argument to every element of the 2nd arg list
ApplyAll e [f,g,h] ==> [f e, g e, h e]
pattern FV :: forall {t} c cs e. c :< ApplyAll e cs => c -> VariantF cs e Source #
Pattern-match in a VariantF
>>>FV (NilF :: NilF String) :: VariantF [ConsF Char,NilF] StringNilF
appendVariantF :: forall (ys :: [Type -> Type]) (xs :: [Type -> Type]) e. ApplyAll e (Concat xs ys) ~ Concat (ApplyAll e xs) (ApplyAll e ys) => VariantF xs e -> VariantF (Concat xs ys) e Source #
prependVariantF :: forall (xs :: [Type -> Type]) (ys :: [Type -> Type]) e. (ApplyAll e (Concat xs ys) ~ Concat (ApplyAll e xs) (ApplyAll e ys), KnownNat (Length (ApplyAll e xs))) => VariantF ys e -> VariantF (Concat xs ys) e Source #
toVariantFHead :: forall {t} x (xs :: [t -> Type]) (e :: t). x e -> VariantF (x ': xs) e Source #
Set the first value
toVariantFTail :: forall {t} (x :: t -> Type) (xs :: [t -> Type]) (e :: t). VariantF xs e -> VariantF (x ': xs) e Source #
Set the tail
popVariantFHead :: forall {t} x (xs :: [t -> Type]) (e :: t). VariantF (x ': xs) e -> Either (VariantF xs e) (x e) Source #
Pop VariantF head
variantFToValue :: forall {t} f (e :: t). VariantF '[f] e -> f e Source #
Retrieve a single value
type MapVariantF (a :: t -> Type) (b :: t -> Type) (cs :: [t -> Type]) (ds :: [t -> Type]) (e :: t) = (MapVariant (a e) (b e) (ApplyAll e cs), ds ~ ReplaceNS (IndexesOf a cs) b cs, ApplyAll e ds ~ ReplaceNS (IndexesOf (a e) (ApplyAll e cs)) (b e) (ApplyAll e cs)) Source #
mapVariantF :: forall {t} a b (cs :: [t -> Type]) (ds :: [t -> Type]) (e :: t). MapVariantF a b cs ds e => (a e -> b e) -> VariantF cs e -> VariantF ds e Source #
Map the matching types of a variant
type PopVariantF (x :: t -> Type) (xs :: [t -> Type]) (e :: t) = (x e :< ApplyAll e xs, Remove (x e) (ApplyAll e xs) ~ ApplyAll e (Remove x xs)) Source #
popVariantF :: forall {t} x (xs :: [t -> Type]) (e :: t). PopVariantF x xs e => VariantF xs e -> Either (VariantF (Remove x xs) e) (x e) Source #
Pop VariantF
type LiftVariantF (xs :: [t -> Type]) (ys :: [t -> Type]) (e :: t) = LiftVariant (ApplyAll e xs) (ApplyAll e ys) Source #
xs is liftable in ys
liftVariantF :: forall {t} (as :: [t -> Type]) (bs :: [t -> Type]) (e :: t). LiftVariantF as bs e => VariantF as e -> VariantF bs e Source #
Lift a VariantF into another
type SplitVariantF (as :: [t -> Type]) (xs :: [t -> Type]) (e :: t) = (Complement (ApplyAll e xs) (ApplyAll e as) ~ ApplyAll e (Complement xs as), SplitVariant (ApplyAll e as) (ApplyAll e (Complement xs as)) (ApplyAll e xs)) Source #
splitVariantF :: forall {t} (as :: [t -> Type]) (xs :: [t -> Type]) (e :: t). SplitVariantF as xs e => VariantF xs e -> Either (VariantF (Complement xs as) e) (VariantF as e) Source #
Split a VariantF in two
variantFToCont :: forall {t} (e :: t) (xs :: [t -> Type]) r. ContVariant (ApplyAll e xs) => VariantF xs e -> ContFlow (ApplyAll e xs) r Source #
Convert a VariantF into a multi-continuation
variantFToContM :: forall {t} (e :: t) (xs :: [t -> Type]) m r. (ContVariant (ApplyAll e xs), Monad m) => m (VariantF xs e) -> ContFlow (ApplyAll e xs) (m r) Source #
Convert a VariantF into a multi-continuation
contToVariantF :: forall {t} (xs :: [t -> Type]) (e :: t). ContVariant (ApplyAll e xs) => ContFlow (ApplyAll e xs) (V (ApplyAll e xs)) -> VariantF xs e Source #
Convert a multi-continuation into a VariantF
contToVariantFM :: forall {t} (xs :: [t -> Type]) (e :: t) m. (ContVariant (ApplyAll e xs), Monad m) => ContFlow (ApplyAll e xs) (m (V (ApplyAll e xs))) -> m (VariantF xs e) Source #
Convert a multi-continuation into a VariantF
Algebras
class BottomUp (c :: (t -> Type) -> Constraint) (fs :: [t -> Type]) where Source #
Methods
toBottomUp :: forall (a :: t) b. (forall (f :: t -> Type). c f => f a -> b) -> VariantF fs a -> b Source #
Instances
| BottomUp (c :: (t -> Type) -> Constraint) ('[] :: [t -> Type]) Source # | |
Defined in Data.Variant.VariantF | |
| (BottomUp c fs, c f) => BottomUp (c :: (t -> Type) -> Constraint) (f ': fs :: [t -> Type]) Source # | |
Defined in Data.Variant.VariantF Methods toBottomUp :: forall (a :: t) b. (forall (f0 :: t -> Type). c f0 => f0 a -> b) -> VariantF (f ': fs) a -> b Source # | |
class BottomUpOrig (c :: (Type -> Type) -> Constraint) (fs :: [Type -> Type]) where Source #
Methods
toBottomUpOrig :: (forall (f :: Type -> Type). c f => f (t, a) -> b) -> VariantF fs (t, a) -> b Source #
Instances
| BottomUpOrig c ('[] :: [Type -> Type]) Source # | |
Defined in Data.Variant.VariantF | |
| (BottomUpOrig c fs, c f) => BottomUpOrig c (f ': fs) Source # | |
Defined in Data.Variant.VariantF | |
type family BottomUpOrigF (c :: (Type -> Type) -> Constraint) (fs :: [Type -> Type]) where ... Source #
Equations
| BottomUpOrigF c fs = (Functor (VariantF fs), BottomUpOrig c fs) |
class TopDownStop (c :: (Type -> Type) -> Constraint) (fs :: [Type -> Type]) where Source #
Methods
toTopDownStop :: (forall (f :: Type -> Type). c f => TopDownStopT a f) -> TopDownStopT a (VariantF fs) Source #
Instances
| TopDownStop c ('[] :: [Type -> Type]) Source # | |
Defined in Data.Variant.VariantF Methods toTopDownStop :: (forall (f :: Type -> Type). c f => TopDownStopT a f) -> TopDownStopT a (VariantF ('[] :: [Type -> Type])) Source # | |
| (TopDownStop c fs, Functor f, c f) => TopDownStop c (f ': fs) Source # | |
Defined in Data.Variant.VariantF Methods toTopDownStop :: (forall (f0 :: Type -> Type). c f0 => TopDownStopT a f0) -> TopDownStopT a (VariantF (f ': fs)) Source # | |
type family TopDownStopF (c :: (Type -> Type) -> Constraint) (fs :: [Type -> Type]) where ... Source #
Equations
| TopDownStopF c fs = (Functor (VariantF fs), TopDownStop c fs) |
Reexport
class NoConstraint a Source #
Useful to specify a "Type -> Constraint" function returning an empty constraint
Instances
| NoConstraint a Source # | |
Defined in Data.Variant | |
module Data.Functor