Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Main module of kind-generics
. Please refer to the README
file for documentation on how to use this package.
Synopsis
- data ((f :: k -> Type) :+: (g :: k -> Type)) (p :: k)
- data ((f :: k -> Type) :*: (g :: k -> Type)) (p :: k) = (f p) :*: (g p)
- data V1 (p :: k)
- data U1 (p :: k) = U1
- newtype M1 i (c :: Meta) (f :: k -> Type) (p :: k) = M1 {
- unM1 :: f p
- newtype Field (t :: Atom d Type) (x :: LoT d) where
- data ((c :: Atom d Constraint) :=>: (f :: LoT d -> Type)) (x :: LoT d) where
- data Exists k (f :: LoT (k -> d) -> Type) (x :: LoT d) where
- data Atom d (k :: TYPE r) where
- Var :: forall d k1. TyVar d k1 -> Atom d k1
- Kon :: forall k1 d. k1 -> Atom d k1
- (:@:) :: forall d k1 k2. Atom d (k1 -> k2) -> Atom d k1 -> Atom d k2
- (:&:) :: forall d. Atom d Constraint -> Atom d Constraint -> Atom d Constraint
- ForAll :: forall d1 d. Atom (d1 -> d) Type -> Atom d Type
- (:=>>:) :: forall d. Atom d Constraint -> Atom d Type -> Atom d Type
- Eval :: forall d k1. Atom d (Exp k1) -> Atom d k1
- data TyVar d (k :: TYPE r) where
- type (:$:) (f :: k1 -> k2) (x :: Atom d k1) = ('Kon f :: Atom d (k1 -> k2)) ':@: x
- type (:~:) (a :: Atom d k1) (b :: Atom d k1) = (('Kon ((~) :: k1 -> k1 -> Constraint) :: Atom d (k1 -> k1 -> Constraint)) ':@: a) ':@: b
- type (:~~:) (a :: Atom d k1) (b :: Atom d k2) = (('Kon ((~~) :: k1 -> k2 -> Constraint) :: Atom d (k1 -> k2 -> Constraint)) ':@: a) ':@: b
- type Var0 = 'Var ('VZ :: TyVar (k -> xs) k)
- type Var1 = 'Var ('VS ('VZ :: TyVar (k -> xs) k) :: TyVar (x -> k -> xs) k)
- type Var2 = 'Var ('VS ('VS ('VZ :: TyVar (k -> xs) k) :: TyVar (x1 -> k -> xs) k) :: TyVar (x -> x1 -> k -> xs) k)
- type Var3 = 'Var ('VS ('VS ('VS ('VZ :: TyVar (k -> xs) k) :: TyVar (x2 -> k -> xs) k) :: TyVar (x1 -> x2 -> k -> xs) k) :: TyVar (x -> x1 -> x2 -> k -> xs) k)
- type Var4 = 'Var ('VS ('VS ('VS ('VS ('VZ :: TyVar (k -> xs) k) :: TyVar (x3 -> k -> xs) k) :: TyVar (x2 -> x3 -> k -> xs) k) :: TyVar (x1 -> x2 -> x3 -> k -> xs) k) :: TyVar (x -> x1 -> x2 -> x3 -> k -> xs) k)
- type Var5 = 'Var ('VS ('VS ('VS ('VS ('VS ('VZ :: TyVar (k -> xs) k) :: TyVar (x4 -> k -> xs) k) :: TyVar (x3 -> x4 -> k -> xs) k) :: TyVar (x2 -> x3 -> x4 -> k -> xs) k) :: TyVar (x1 -> x2 -> x3 -> x4 -> k -> xs) k) :: TyVar (x -> x1 -> x2 -> x3 -> x4 -> k -> xs) k)
- type Var6 = 'Var ('VS ('VS ('VS ('VS ('VS ('VS ('VZ :: TyVar (k -> xs) k) :: TyVar (x5 -> k -> xs) k) :: TyVar (x4 -> x5 -> k -> xs) k) :: TyVar (x3 -> x4 -> x5 -> k -> xs) k) :: TyVar (x2 -> x3 -> x4 -> x5 -> k -> xs) k) :: TyVar (x1 -> x2 -> x3 -> x4 -> x5 -> k -> xs) k) :: TyVar (x -> x1 -> x2 -> x3 -> x4 -> x5 -> k -> xs) k)
- type Var7 = 'Var ('VS ('VS ('VS ('VS ('VS ('VS ('VS ('VZ :: TyVar (k -> xs) k) :: TyVar (x6 -> k -> xs) k) :: TyVar (x5 -> x6 -> k -> xs) k) :: TyVar (x4 -> x5 -> x6 -> k -> xs) k) :: TyVar (x3 -> x4 -> x5 -> x6 -> k -> xs) k) :: TyVar (x2 -> x3 -> x4 -> x5 -> x6 -> k -> xs) k) :: TyVar (x1 -> x2 -> x3 -> x4 -> x5 -> x6 -> k -> xs) k) :: TyVar (x -> x1 -> x2 -> x3 -> x4 -> x5 -> x6 -> k -> xs) k)
- type Var8 = 'Var ('VS ('VS ('VS ('VS ('VS ('VS ('VS ('VS ('VZ :: TyVar (k -> xs) k) :: TyVar (x7 -> k -> xs) k) :: TyVar (x6 -> x7 -> k -> xs) k) :: TyVar (x5 -> x6 -> x7 -> k -> xs) k) :: TyVar (x4 -> x5 -> x6 -> x7 -> k -> xs) k) :: TyVar (x3 -> x4 -> x5 -> x6 -> x7 -> k -> xs) k) :: TyVar (x2 -> x3 -> x4 -> x5 -> x6 -> x7 -> k -> xs) k) :: TyVar (x1 -> x2 -> x3 -> x4 -> x5 -> x6 -> x7 -> k -> xs) k) :: TyVar (x -> x1 -> x2 -> x3 -> x4 -> x5 -> x6 -> x7 -> k -> xs) k)
- type Var9 = 'Var ('VS ('VS ('VS ('VS ('VS ('VS ('VS ('VS ('VS ('VZ :: TyVar (k -> xs) k) :: TyVar (x8 -> k -> xs) k) :: TyVar (x7 -> x8 -> k -> xs) k) :: TyVar (x6 -> x7 -> x8 -> k -> xs) k) :: TyVar (x5 -> x6 -> x7 -> x8 -> k -> xs) k) :: TyVar (x4 -> x5 -> x6 -> x7 -> x8 -> k -> xs) k) :: TyVar (x3 -> x4 -> x5 -> x6 -> x7 -> x8 -> k -> xs) k) :: TyVar (x2 -> x3 -> x4 -> x5 -> x6 -> x7 -> x8 -> k -> xs) k) :: TyVar (x1 -> x2 -> x3 -> x4 -> x5 -> x6 -> x7 -> x8 -> k -> xs) k) :: TyVar (x -> x1 -> x2 -> x3 -> x4 -> x5 -> x6 -> x7 -> x8 -> k -> xs) k)
- data LoT k where
- type family (f :: k) :@@: (tys :: LoT k) where ...
- type LoT1 (a :: k) = a ':&&: 'LoT0
- type LoT2 (a :: k) (b :: k1) = a ':&&: (b ':&&: 'LoT0)
- data TyEnv where
- class GenericK (f :: k) where
- type GenericF t f x = (GenericK f, x ~ SplitF t f, t ~ (f :@@: x))
- fromF :: forall f t x. GenericF t f x => t -> RepK f x
- toF :: forall f t x. GenericF t f x => RepK f x -> t
- type GenericN n t f x = (GenericK f, 'TyEnv f x ~ SplitN n t, t ~ (f :@@: x))
- fromN :: forall n t f x. GenericN n t f x => t -> RepK f x
- toN :: forall n t f x. GenericN n t f x => RepK f x -> t
- fromRepK :: forall f x xs. (GenericK f, SubstRep' (RepK f) x xs) => (f x :@@: xs) -> SubstRep (RepK f) x xs
- toRepK :: forall f x xs. (GenericK f, SubstRep' (RepK f) x xs) => SubstRep (RepK f) x xs -> f x :@@: xs
- type family SubstRep f x :: LoT k -> Type
- class SubstRep' (f :: LoT (t -> k) -> Type) (x :: t) (xs :: LoT k)
- type family SubstAtom (f :: Atom (t -> k) d) (x :: t) :: Atom k d where ...
- class Conv (gg :: Type -> Type) (kg :: LoT d -> Type) (tys :: LoT d) where
- toGhcGenerics :: kg tys -> gg a
- toKindGenerics :: gg a -> kg tys
- type family Interpret (t :: Atom d k) (tys :: LoT d) :: k where ...
- type family InterpretVar (t :: TyVar d k) (tys :: LoT d) :: k where ...
- type family Satisfies (cs :: [Atom d Constraint]) (tys :: LoT d) where ...
- type family ContainsTyVar (v :: TyVar d k) (t :: Atom d p) :: Bool where ...
- newtype ForAllI (f :: Atom (d1 -> d) Type) (tys :: LoT d) where
- newtype SuchThatI (c :: Atom d Constraint) (f :: Atom d Type) (tys :: LoT d) where
- newtype WrappedI (f :: Atom d Type) (tys :: LoT d) = WrapI {}
- toWrappedI :: forall {d1} {ks} (f :: Atom (d1 -> ks) Type) (tys :: LoT ks) (t :: d1). ForAllI f tys -> WrappedI f (t ':&&: tys)
- fromWrappedI :: forall {d1} {d} (f :: Atom (d1 -> d) Type) (tys :: LoT d). (forall (t :: d1). WrappedI f (t ':&&: tys)) -> ForAllI f tys
Generic representation types
data ((f :: k -> Type) :+: (g :: k -> Type)) (p :: k) infixr 5 #
Sums: encode choice between constructors
Instances
(SubstRep' f x xs, SubstRep' g x xs) => SubstRep' (f :+: g :: LoT (t -> k) -> Type) (x :: t) (xs :: LoT k) Source # | |
Generic1 (f :+: g :: k -> Type) | |
(Conv f f' tys, Conv g g' tys) => Conv (f :+: g) (f' :+: g' :: LoT d -> Type) (tys :: LoT d) Source # | |
Defined in Generics.Kind toGhcGenerics :: (f' :+: g') tys -> (f :+: g) a Source # toKindGenerics :: (f :+: g) a -> (f' :+: g') tys Source # | |
(Foldable f, Foldable g) => Foldable (f :+: g) | Since: base-4.9.0.0 |
Defined in Data.Foldable fold :: Monoid m => (f :+: g) m -> m # foldMap :: Monoid m => (a -> m) -> (f :+: g) a -> m # foldMap' :: Monoid m => (a -> m) -> (f :+: g) a -> m # foldr :: (a -> b -> b) -> b -> (f :+: g) a -> b # foldr' :: (a -> b -> b) -> b -> (f :+: g) a -> b # foldl :: (b -> a -> b) -> b -> (f :+: g) a -> b # foldl' :: (b -> a -> b) -> b -> (f :+: g) a -> b # foldr1 :: (a -> a -> a) -> (f :+: g) a -> a # foldl1 :: (a -> a -> a) -> (f :+: g) a -> a # toList :: (f :+: g) a -> [a] # length :: (f :+: g) a -> Int # elem :: Eq a => a -> (f :+: g) a -> Bool # maximum :: Ord a => (f :+: g) a -> a # minimum :: Ord a => (f :+: g) a -> a # | |
(Traversable f, Traversable g) => Traversable (f :+: g) | Since: base-4.9.0.0 |
(Functor f, Functor g) => Functor (f :+: g) | Since: base-4.9.0.0 |
Generic ((f :+: g) p) | |
(Read (f p), Read (g p)) => Read ((f :+: g) p) | Since: base-4.7.0.0 |
(Show (f p), Show (g p)) => Show ((f :+: g) p) | Since: base-4.7.0.0 |
(Eq (f p), Eq (g p)) => Eq ((f :+: g) p) | Since: base-4.7.0.0 |
(Ord (f p), Ord (g p)) => Ord ((f :+: g) p) | Since: base-4.7.0.0 |
type SubstRep (f :+: g :: LoT (t -> k) -> Type) (x :: t) Source # | |
type Rep1 (f :+: g :: k -> Type) | Since: base-4.9.0.0 |
Defined in GHC.Generics type Rep1 (f :+: g :: k -> Type) = D1 ('MetaData ":+:" "GHC.Generics" "base" 'False) (C1 ('MetaCons "L1" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec1 f)) :+: C1 ('MetaCons "R1" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec1 g))) | |
type Rep ((f :+: g) p) | Since: base-4.7.0.0 |
Defined in GHC.Generics type Rep ((f :+: g) p) = D1 ('MetaData ":+:" "GHC.Generics" "base" 'False) (C1 ('MetaCons "L1" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (f p))) :+: C1 ('MetaCons "R1" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (g p)))) |
data ((f :: k -> Type) :*: (g :: k -> Type)) (p :: k) infixr 6 #
Products: encode multiple arguments to constructors
(f p) :*: (g p) infixr 6 |
Instances
(SubstRep' f x xs, SubstRep' g x xs) => SubstRep' (f :*: g :: LoT (t -> k) -> Type) (x :: t) (xs :: LoT k) Source # | |
Generic1 (f :*: g :: k -> Type) | |
(Conv f f' tys, Conv g g' tys) => Conv (f :*: g) (f' :*: g' :: LoT d -> Type) (tys :: LoT d) Source # | |
Defined in Generics.Kind toGhcGenerics :: (f' :*: g') tys -> (f :*: g) a Source # toKindGenerics :: (f :*: g) a -> (f' :*: g') tys Source # | |
(Foldable f, Foldable g) => Foldable (f :*: g) | Since: base-4.9.0.0 |
Defined in Data.Foldable fold :: Monoid m => (f :*: g) m -> m # foldMap :: Monoid m => (a -> m) -> (f :*: g) a -> m # foldMap' :: Monoid m => (a -> m) -> (f :*: g) a -> m # foldr :: (a -> b -> b) -> b -> (f :*: g) a -> b # foldr' :: (a -> b -> b) -> b -> (f :*: g) a -> b # foldl :: (b -> a -> b) -> b -> (f :*: g) a -> b # foldl' :: (b -> a -> b) -> b -> (f :*: g) a -> b # foldr1 :: (a -> a -> a) -> (f :*: g) a -> a # foldl1 :: (a -> a -> a) -> (f :*: g) a -> a # toList :: (f :*: g) a -> [a] # length :: (f :*: g) a -> Int # elem :: Eq a => a -> (f :*: g) a -> Bool # maximum :: Ord a => (f :*: g) a -> a # minimum :: Ord a => (f :*: g) a -> a # | |
(Traversable f, Traversable g) => Traversable (f :*: g) | Since: base-4.9.0.0 |
(Alternative f, Alternative g) => Alternative (f :*: g) | Since: base-4.9.0.0 |
(Applicative f, Applicative g) => Applicative (f :*: g) | Since: base-4.9.0.0 |
(Functor f, Functor g) => Functor (f :*: g) | Since: base-4.9.0.0 |
(Monad f, Monad g) => Monad (f :*: g) | Since: base-4.9.0.0 |
(MonadPlus f, MonadPlus g) => MonadPlus (f :*: g) | Since: base-4.9.0.0 |
(Monoid (f p), Monoid (g p)) => Monoid ((f :*: g) p) | Since: base-4.12.0.0 |
(Semigroup (f p), Semigroup (g p)) => Semigroup ((f :*: g) p) | Since: base-4.12.0.0 |
Generic ((f :*: g) p) | |
(Read (f p), Read (g p)) => Read ((f :*: g) p) | Since: base-4.7.0.0 |
(Show (f p), Show (g p)) => Show ((f :*: g) p) | Since: base-4.7.0.0 |
(Eq (f p), Eq (g p)) => Eq ((f :*: g) p) | Since: base-4.7.0.0 |
(Ord (f p), Ord (g p)) => Ord ((f :*: g) p) | Since: base-4.7.0.0 |
type SubstRep (f :*: g :: LoT (t -> k) -> Type) (x :: t) Source # | |
type Rep1 (f :*: g :: k -> Type) | Since: base-4.9.0.0 |
Defined in GHC.Generics type Rep1 (f :*: g :: k -> Type) = D1 ('MetaData ":*:" "GHC.Generics" "base" 'False) (C1 ('MetaCons ":*:" ('InfixI 'RightAssociative 6) 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec1 f) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec1 g))) | |
type Rep ((f :*: g) p) | Since: base-4.7.0.0 |
Defined in GHC.Generics type Rep ((f :*: g) p) = D1 ('MetaData ":*:" "GHC.Generics" "base" 'False) (C1 ('MetaCons ":*:" ('InfixI 'RightAssociative 6) 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (f p)) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (g p)))) |
Void: used for datatypes without constructors
Instances
Generic1 (V1 :: k -> Type) | |
Foldable (V1 :: Type -> Type) | Since: base-4.9.0.0 |
Defined in Data.Foldable fold :: Monoid m => V1 m -> m # foldMap :: Monoid m => (a -> m) -> V1 a -> m # foldMap' :: Monoid m => (a -> m) -> V1 a -> m # foldr :: (a -> b -> b) -> b -> V1 a -> b # foldr' :: (a -> b -> b) -> b -> V1 a -> b # foldl :: (b -> a -> b) -> b -> V1 a -> b # foldl' :: (b -> a -> b) -> b -> V1 a -> b # foldr1 :: (a -> a -> a) -> V1 a -> a # foldl1 :: (a -> a -> a) -> V1 a -> a # elem :: Eq a => a -> V1 a -> Bool # maximum :: Ord a => V1 a -> a # | |
Traversable (V1 :: Type -> Type) | Since: base-4.9.0.0 |
Functor (V1 :: Type -> Type) | Since: base-4.9.0.0 |
Semigroup (V1 p) | Since: base-4.12.0.0 |
Generic (V1 p) | |
Read (V1 p) | Since: base-4.9.0.0 |
Show (V1 p) | Since: base-4.9.0.0 |
Eq (V1 p) | Since: base-4.9.0.0 |
Ord (V1 p) | Since: base-4.9.0.0 |
type Rep1 (V1 :: k -> Type) | Since: base-4.9.0.0 |
type Rep (V1 p) | Since: base-4.9.0.0 |
Unit: used for constructors without arguments
Instances
SubstRep' (U1 :: LoT (t -> k) -> Type) (x :: t) (xs :: LoT k) Source # | |
Generic1 (U1 :: k -> Type) | |
Conv (U1 :: Type -> Type) (U1 :: LoT d -> Type) (tys :: LoT d) Source # | |
Defined in Generics.Kind toGhcGenerics :: U1 tys -> U1 a Source # toKindGenerics :: U1 a -> U1 tys Source # | |
Foldable (U1 :: Type -> Type) | Since: base-4.9.0.0 |
Defined in Data.Foldable fold :: Monoid m => U1 m -> m # foldMap :: Monoid m => (a -> m) -> U1 a -> m # foldMap' :: Monoid m => (a -> m) -> U1 a -> m # foldr :: (a -> b -> b) -> b -> U1 a -> b # foldr' :: (a -> b -> b) -> b -> U1 a -> b # foldl :: (b -> a -> b) -> b -> U1 a -> b # foldl' :: (b -> a -> b) -> b -> U1 a -> b # foldr1 :: (a -> a -> a) -> U1 a -> a # foldl1 :: (a -> a -> a) -> U1 a -> a # elem :: Eq a => a -> U1 a -> Bool # maximum :: Ord a => U1 a -> a # | |
Traversable (U1 :: Type -> Type) | Since: base-4.9.0.0 |
Alternative (U1 :: Type -> Type) | Since: base-4.9.0.0 |
Applicative (U1 :: Type -> Type) | Since: base-4.9.0.0 |
Functor (U1 :: Type -> Type) | Since: base-4.9.0.0 |
Monad (U1 :: Type -> Type) | Since: base-4.9.0.0 |
MonadPlus (U1 :: Type -> Type) | Since: base-4.9.0.0 |
Monoid (U1 p) | Since: base-4.12.0.0 |
Semigroup (U1 p) | Since: base-4.12.0.0 |
Generic (U1 p) | |
Read (U1 p) | Since: base-4.9.0.0 |
Show (U1 p) | Since: base-4.9.0.0 |
Eq (U1 p) | Since: base-4.9.0.0 |
Ord (U1 p) | Since: base-4.7.0.0 |
type SubstRep (U1 :: LoT (t -> k) -> Type) (x :: t) Source # | |
type Rep1 (U1 :: k -> Type) | Since: base-4.9.0.0 |
type Rep (U1 p) | Since: base-4.7.0.0 |
newtype M1 i (c :: Meta) (f :: k -> Type) (p :: k) #
Meta-information (constructor names, etc.)
Instances
SubstRep' f x xs => SubstRep' (M1 i c f :: LoT (t -> k) -> Type) (x :: t) (xs :: LoT k) Source # | |
Generic1 (M1 i c f :: k -> Type) | |
Conv f f' tys => Conv (M1 i c f) (f' :: LoT d -> Type) (tys :: LoT d) Source # | |
Defined in Generics.Kind toGhcGenerics :: f' tys -> M1 i c f a Source # toKindGenerics :: M1 i c f a -> f' tys Source # | |
Conv f f' tys => Conv (M1 i c f) (M1 i c f' :: LoT d -> Type) (tys :: LoT d) Source # | |
Defined in Generics.Kind toGhcGenerics :: M1 i c f' tys -> M1 i c f a Source # toKindGenerics :: M1 i c f a -> M1 i c f' tys Source # | |
Foldable f => Foldable (M1 i c f) | Since: base-4.9.0.0 |
Defined in Data.Foldable fold :: Monoid m => M1 i c f m -> m # foldMap :: Monoid m => (a -> m) -> M1 i c f a -> m # foldMap' :: Monoid m => (a -> m) -> M1 i c f a -> m # foldr :: (a -> b -> b) -> b -> M1 i c f a -> b # foldr' :: (a -> b -> b) -> b -> M1 i c f a -> b # foldl :: (b -> a -> b) -> b -> M1 i c f a -> b # foldl' :: (b -> a -> b) -> b -> M1 i c f a -> b # foldr1 :: (a -> a -> a) -> M1 i c f a -> a # foldl1 :: (a -> a -> a) -> M1 i c f a -> a # elem :: Eq a => a -> M1 i c f a -> Bool # maximum :: Ord a => M1 i c f a -> a # minimum :: Ord a => M1 i c f a -> a # | |
Traversable f => Traversable (M1 i c f) | Since: base-4.9.0.0 |
Alternative f => Alternative (M1 i c f) | Since: base-4.9.0.0 |
Applicative f => Applicative (M1 i c f) | Since: base-4.9.0.0 |
Functor f => Functor (M1 i c f) | Since: base-4.9.0.0 |
Monad f => Monad (M1 i c f) | Since: base-4.9.0.0 |
MonadPlus f => MonadPlus (M1 i c f) | Since: base-4.9.0.0 |
Monoid (f p) => Monoid (M1 i c f p) | Since: base-4.12.0.0 |
Semigroup (f p) => Semigroup (M1 i c f p) | Since: base-4.12.0.0 |
Generic (M1 i c f p) | |
Read (f p) => Read (M1 i c f p) | Since: base-4.7.0.0 |
Show (f p) => Show (M1 i c f p) | Since: base-4.7.0.0 |
Eq (f p) => Eq (M1 i c f p) | Since: base-4.7.0.0 |
Ord (f p) => Ord (M1 i c f p) | Since: base-4.7.0.0 |
type SubstRep (M1 i c f :: LoT (t -> k) -> Type) (x :: t) Source # | |
type Rep1 (M1 i c f :: k -> Type) | Since: base-4.9.0.0 |
Defined in GHC.Generics | |
type Rep (M1 i c f p) | Since: base-4.7.0.0 |
Defined in GHC.Generics |
newtype Field (t :: Atom d Type) (x :: LoT d) where Source #
Fields: used to represent each of the (visible) arguments to a constructor.
Replaces the K1
type from Generics
. The type of the field is
represented by an Atom
from Atom
.
instance GenericK [] (a :&&: LoT0) where type RepK [] = Field Var0 :*: Field ([] :$: Var0)
Instances
Interpret (SubstAtom t2 x) xs ~ Interpret t2 (x ':&&: xs) => SubstRep' (Field t2 :: LoT (t1 -> k) -> Type) (x :: t1) (xs :: LoT k) Source # | |
k ~ Interpret t tys => Conv (K1 p k :: Type -> Type) (Field t :: LoT d -> Type) (tys :: LoT d) Source # | |
Defined in Generics.Kind toGhcGenerics :: Field t tys -> K1 p k a Source # toKindGenerics :: K1 p k a -> Field t tys Source # | |
Monoid (Interpret t x) => Monoid (Field t x) Source # | |
Semigroup (Interpret t x) => Semigroup (Field t x) Source # | |
Show (Interpret t x) => Show (Field t x) Source # | |
Eq (Interpret t x) => Eq (Field t x) Source # | |
Ord (Interpret t x) => Ord (Field t x) Source # | |
Defined in Generics.Kind | |
type SubstRep (Field t2 :: LoT (t1 -> k) -> Type) (x :: t1) Source # | |
data ((c :: Atom d Constraint) :=>: (f :: LoT d -> Type)) (x :: LoT d) where Source #
Constraints: used to represent constraints in a constructor.
Replaces the (:=>:)
type from GHC.Generics.Extra.
data Showable a = Show a => a -> X a instance GenericK Showable (a :&&: LoT0) where type RepK Showable = (Show :$: a) :=>: (Field Var0)
Instances
(Interpret (SubstAtom c x) xs => InterpretCons c x xs, Interpret c (x ':&&: xs) => InterpretSubst c x xs, SubstRep' f x xs) => SubstRep' (c :=>: f :: LoT (t -> k) -> Type) (x :: t) (xs :: LoT k) Source # | |
(k ~ Interpret t tys, Conv f f' tys) => Conv (k :=>: f) (t :=>: f' :: LoT d -> Type) (tys :: LoT d) Source # | |
Defined in Generics.Kind toGhcGenerics :: (t :=>: f') tys -> (k :=>: f) a Source # toKindGenerics :: (k :=>: f) a -> (t :=>: f') tys Source # | |
(Interpret c x => Show (f x)) => Show ((c :=>: f) x) Source # | |
(Interpret c x => Eq (f x)) => Eq ((c :=>: f) x) Source # | |
(Interpret c x => Ord (f x)) => Ord ((c :=>: f) x) Source # | |
Defined in Generics.Kind | |
type SubstRep (c :=>: f :: LoT (t -> k) -> Type) (x :: t) Source # | |
data Exists k (f :: LoT (k -> d) -> Type) (x :: LoT d) where Source #
Existentials: a representation of the form E f
describes
a constructor whose inner type is represented by f
, and where
the type variable at index 0, Var0
, is existentially quantified.
data E where E :: t -> Exists instance GenericK E LoT0 where type RepK E = Exists Type (Field Var0)
Atoms for Field
data Atom d (k :: TYPE r) where #
Var :: forall d k1. TyVar d k1 -> Atom d k1 | |
Kon :: forall k1 d. k1 -> Atom d k1 | |
(:@:) :: forall d k1 k2. Atom d (k1 -> k2) -> Atom d k1 -> Atom d k2 | |
(:&:) :: forall d. Atom d Constraint -> Atom d Constraint -> Atom d Constraint | |
ForAll :: forall d1 d. Atom (d1 -> d) Type -> Atom d Type | |
(:=>>:) :: forall d. Atom d Constraint -> Atom d Type -> Atom d Type | |
Eval :: forall d k1. Atom d (Exp k1) -> Atom d k1 |
type (:~:) (a :: Atom d k1) (b :: Atom d k1) = (('Kon ((~) :: k1 -> k1 -> Constraint) :: Atom d (k1 -> k1 -> Constraint)) ':@: a) ':@: b #
type (:~~:) (a :: Atom d k1) (b :: Atom d k2) = (('Kon ((~~) :: k1 -> k2 -> Constraint) :: Atom d (k1 -> k2 -> Constraint)) ':@: a) ':@: b #
type Var2 = 'Var ('VS ('VS ('VZ :: TyVar (k -> xs) k) :: TyVar (x1 -> k -> xs) k) :: TyVar (x -> x1 -> k -> xs) k) #
type Var3 = 'Var ('VS ('VS ('VS ('VZ :: TyVar (k -> xs) k) :: TyVar (x2 -> k -> xs) k) :: TyVar (x1 -> x2 -> k -> xs) k) :: TyVar (x -> x1 -> x2 -> k -> xs) k) #
type Var4 = 'Var ('VS ('VS ('VS ('VS ('VZ :: TyVar (k -> xs) k) :: TyVar (x3 -> k -> xs) k) :: TyVar (x2 -> x3 -> k -> xs) k) :: TyVar (x1 -> x2 -> x3 -> k -> xs) k) :: TyVar (x -> x1 -> x2 -> x3 -> k -> xs) k) #
type Var5 = 'Var ('VS ('VS ('VS ('VS ('VS ('VZ :: TyVar (k -> xs) k) :: TyVar (x4 -> k -> xs) k) :: TyVar (x3 -> x4 -> k -> xs) k) :: TyVar (x2 -> x3 -> x4 -> k -> xs) k) :: TyVar (x1 -> x2 -> x3 -> x4 -> k -> xs) k) :: TyVar (x -> x1 -> x2 -> x3 -> x4 -> k -> xs) k) #
type Var6 = 'Var ('VS ('VS ('VS ('VS ('VS ('VS ('VZ :: TyVar (k -> xs) k) :: TyVar (x5 -> k -> xs) k) :: TyVar (x4 -> x5 -> k -> xs) k) :: TyVar (x3 -> x4 -> x5 -> k -> xs) k) :: TyVar (x2 -> x3 -> x4 -> x5 -> k -> xs) k) :: TyVar (x1 -> x2 -> x3 -> x4 -> x5 -> k -> xs) k) :: TyVar (x -> x1 -> x2 -> x3 -> x4 -> x5 -> k -> xs) k) #
type Var7 = 'Var ('VS ('VS ('VS ('VS ('VS ('VS ('VS ('VZ :: TyVar (k -> xs) k) :: TyVar (x6 -> k -> xs) k) :: TyVar (x5 -> x6 -> k -> xs) k) :: TyVar (x4 -> x5 -> x6 -> k -> xs) k) :: TyVar (x3 -> x4 -> x5 -> x6 -> k -> xs) k) :: TyVar (x2 -> x3 -> x4 -> x5 -> x6 -> k -> xs) k) :: TyVar (x1 -> x2 -> x3 -> x4 -> x5 -> x6 -> k -> xs) k) :: TyVar (x -> x1 -> x2 -> x3 -> x4 -> x5 -> x6 -> k -> xs) k) #
type Var8 = 'Var ('VS ('VS ('VS ('VS ('VS ('VS ('VS ('VS ('VZ :: TyVar (k -> xs) k) :: TyVar (x7 -> k -> xs) k) :: TyVar (x6 -> x7 -> k -> xs) k) :: TyVar (x5 -> x6 -> x7 -> k -> xs) k) :: TyVar (x4 -> x5 -> x6 -> x7 -> k -> xs) k) :: TyVar (x3 -> x4 -> x5 -> x6 -> x7 -> k -> xs) k) :: TyVar (x2 -> x3 -> x4 -> x5 -> x6 -> x7 -> k -> xs) k) :: TyVar (x1 -> x2 -> x3 -> x4 -> x5 -> x6 -> x7 -> k -> xs) k) :: TyVar (x -> x1 -> x2 -> x3 -> x4 -> x5 -> x6 -> x7 -> k -> xs) k) #
type Var9 = 'Var ('VS ('VS ('VS ('VS ('VS ('VS ('VS ('VS ('VS ('VZ :: TyVar (k -> xs) k) :: TyVar (x8 -> k -> xs) k) :: TyVar (x7 -> x8 -> k -> xs) k) :: TyVar (x6 -> x7 -> x8 -> k -> xs) k) :: TyVar (x5 -> x6 -> x7 -> x8 -> k -> xs) k) :: TyVar (x4 -> x5 -> x6 -> x7 -> x8 -> k -> xs) k) :: TyVar (x3 -> x4 -> x5 -> x6 -> x7 -> x8 -> k -> xs) k) :: TyVar (x2 -> x3 -> x4 -> x5 -> x6 -> x7 -> x8 -> k -> xs) k) :: TyVar (x1 -> x2 -> x3 -> x4 -> x5 -> x6 -> x7 -> x8 -> k -> xs) k) :: TyVar (x -> x1 -> x2 -> x3 -> x4 -> x5 -> x6 -> x7 -> x8 -> k -> xs) k) #
Lists of types
Instances
SubstRep' (U1 :: LoT (t -> k) -> Type) (x :: t) (xs :: LoT k) Source # | |
(SubstRep' f x xs, SubstRep' g x xs) => SubstRep' (f :*: g :: LoT (t -> k) -> Type) (x :: t) (xs :: LoT k) Source # | |
(SubstRep' f x xs, SubstRep' g x xs) => SubstRep' (f :+: g :: LoT (t -> k) -> Type) (x :: t) (xs :: LoT k) Source # | |
SubstRep' f x xs => SubstRep' (M1 i c f :: LoT (t -> k) -> Type) (x :: t) (xs :: LoT k) Source # | |
Conv (U1 :: Type -> Type) (U1 :: LoT d -> Type) (tys :: LoT d) Source # | |
Defined in Generics.Kind toGhcGenerics :: U1 tys -> U1 a Source # toKindGenerics :: U1 a -> U1 tys Source # | |
(Conv f f' tys, Conv g g' tys) => Conv (f :*: g) (f' :*: g' :: LoT d -> Type) (tys :: LoT d) Source # | |
Defined in Generics.Kind toGhcGenerics :: (f' :*: g') tys -> (f :*: g) a Source # toKindGenerics :: (f :*: g) a -> (f' :*: g') tys Source # | |
(Conv f f' tys, Conv g g' tys) => Conv (f :+: g) (f' :+: g' :: LoT d -> Type) (tys :: LoT d) Source # | |
Defined in Generics.Kind toGhcGenerics :: (f' :+: g') tys -> (f :+: g) a Source # toKindGenerics :: (f :+: g) a -> (f' :+: g') tys Source # | |
Conv f f' tys => Conv (M1 i c f) (M1 i c f' :: LoT d -> Type) (tys :: LoT d) Source # | |
Defined in Generics.Kind toGhcGenerics :: M1 i c f' tys -> M1 i c f a Source # toKindGenerics :: M1 i c f a -> M1 i c f' tys Source # | |
type SubstRep (U1 :: LoT (t -> k) -> Type) (x :: t) Source # | |
type SubstRep (f :*: g :: LoT (t -> k) -> Type) (x :: t) Source # | |
type SubstRep (f :+: g :: LoT (t -> k) -> Type) (x :: t) Source # | |
type SubstRep (M1 i c f :: LoT (t -> k) -> Type) (x :: t) Source # | |
Generic type classes
class GenericK (f :: k) where Source #
Representable types of any kind. Examples:
instance GenericK Int instance GenericK [] instance GenericK Either instance GenericK (Either a) instance GenericK (Either a b)
Nothing
fromK :: (f :@@: x) -> RepK f x Source #
Convert the data type to its representation.
default fromK :: (Generic (f :@@: x), Conv (Rep (f :@@: x)) (RepK f) x) => (f :@@: x) -> RepK f x Source #
toK :: RepK f x -> f :@@: x Source #
Convert from a representation to its corresponding data type.
Instances
Getting more instances almost for free
fromRepK :: forall f x xs. (GenericK f, SubstRep' (RepK f) x xs) => (f x :@@: xs) -> SubstRep (RepK f) x xs Source #
toRepK :: forall f x xs. (GenericK f, SubstRep' (RepK f) x xs) => SubstRep (RepK f) x xs -> f x :@@: xs Source #
type family SubstRep f x :: LoT k -> Type Source #
Instances
type SubstRep (U1 :: LoT (t -> k) -> Type) (x :: t) Source # | |
type SubstRep (Field t2 :: LoT (t1 -> k) -> Type) (x :: t1) Source # | |
type SubstRep (f :*: g :: LoT (t -> k) -> Type) (x :: t) Source # | |
type SubstRep (f :+: g :: LoT (t -> k) -> Type) (x :: t) Source # | |
type SubstRep (c :=>: f :: LoT (t -> k) -> Type) (x :: t) Source # | |
type SubstRep (M1 i c f :: LoT (t -> k) -> Type) (x :: t) Source # | |
class SubstRep' (f :: LoT (t -> k) -> Type) (x :: t) (xs :: LoT k) Source #
substRep, unsubstRep
Instances
SubstRep' (U1 :: LoT (t -> k) -> Type) (x :: t) (xs :: LoT k) Source # | |
Interpret (SubstAtom t2 x) xs ~ Interpret t2 (x ':&&: xs) => SubstRep' (Field t2 :: LoT (t1 -> k) -> Type) (x :: t1) (xs :: LoT k) Source # | |
(SubstRep' f x xs, SubstRep' g x xs) => SubstRep' (f :*: g :: LoT (t -> k) -> Type) (x :: t) (xs :: LoT k) Source # | |
(SubstRep' f x xs, SubstRep' g x xs) => SubstRep' (f :+: g :: LoT (t -> k) -> Type) (x :: t) (xs :: LoT k) Source # | |
(Interpret (SubstAtom c x) xs => InterpretCons c x xs, Interpret c (x ':&&: xs) => InterpretSubst c x xs, SubstRep' f x xs) => SubstRep' (c :=>: f :: LoT (t -> k) -> Type) (x :: t) (xs :: LoT k) Source # | |
SubstRep' f x xs => SubstRep' (M1 i c f :: LoT (t -> k) -> Type) (x :: t) (xs :: LoT k) Source # | |
Bridging with GHC.Generics
class Conv (gg :: Type -> Type) (kg :: LoT d -> Type) (tys :: LoT d) where Source #
Bridges a representation of a data type using the combinators
in GHC.Generics with a representation using this module.
You are never expected to manipulate this type class directly,
it is part of the deriving mechanism for GenericK
.
toGhcGenerics :: kg tys -> gg a Source #
toKindGenerics :: gg a -> kg tys Source #
Instances
Conv (U1 :: Type -> Type) (U1 :: LoT d -> Type) (tys :: LoT d) Source # | |
Defined in Generics.Kind toGhcGenerics :: U1 tys -> U1 a Source # toKindGenerics :: U1 a -> U1 tys Source # | |
k ~ Interpret t tys => Conv (K1 p k :: Type -> Type) (Field t :: LoT d -> Type) (tys :: LoT d) Source # | |
Defined in Generics.Kind toGhcGenerics :: Field t tys -> K1 p k a Source # toKindGenerics :: K1 p k a -> Field t tys Source # | |
(Conv f f' tys, Conv g g' tys) => Conv (f :*: g) (f' :*: g' :: LoT d -> Type) (tys :: LoT d) Source # | |
Defined in Generics.Kind toGhcGenerics :: (f' :*: g') tys -> (f :*: g) a Source # toKindGenerics :: (f :*: g) a -> (f' :*: g') tys Source # | |
(Conv f f' tys, Conv g g' tys) => Conv (f :+: g) (f' :+: g' :: LoT d -> Type) (tys :: LoT d) Source # | |
Defined in Generics.Kind toGhcGenerics :: (f' :+: g') tys -> (f :+: g) a Source # toKindGenerics :: (f :+: g) a -> (f' :+: g') tys Source # | |
(k ~ Interpret t tys, Conv f f' tys) => Conv (k :=>: f) (t :=>: f' :: LoT d -> Type) (tys :: LoT d) Source # | |
Defined in Generics.Kind toGhcGenerics :: (t :=>: f') tys -> (k :=>: f) a Source # toKindGenerics :: (k :=>: f) a -> (t :=>: f') tys Source # | |
Conv f f' tys => Conv (M1 i c f) (f' :: LoT d -> Type) (tys :: LoT d) Source # | |
Defined in Generics.Kind toGhcGenerics :: f' tys -> M1 i c f a Source # toKindGenerics :: M1 i c f a -> f' tys Source # | |
Conv f f' tys => Conv (M1 i c f) (M1 i c f' :: LoT d -> Type) (tys :: LoT d) Source # | |
Defined in Generics.Kind toGhcGenerics :: M1 i c f' tys -> M1 i c f a Source # toKindGenerics :: M1 i c f a -> M1 i c f' tys Source # |
Re-exported from Atom
Interpretation of atoms
type family Interpret (t :: Atom d k) (tys :: LoT d) :: k where ... #
Interpret ('Var v :: Atom d k) (tys :: LoT d) = InterpretVar v tys | |
Interpret ('Kon t :: Atom d k) (tys :: LoT d) = t | |
Interpret (f ':@: x :: Atom d k2) (tys :: LoT d) = Interpret f tys (Interpret x tys) | |
Interpret (c ':&: d2 :: Atom d1 Constraint) (tys :: LoT d1) = (Interpret c tys, Interpret d2 tys) | |
Interpret ('ForAll f :: Atom d Type) (tys :: LoT d) = ForAllI f tys | |
Interpret (c ':=>>: f :: Atom d Type) (tys :: LoT d) = SuchThatI c f tys | |
Interpret ('Eval f :: Atom d a) (tys :: LoT d) = Eval (Interpret f tys) |
type family InterpretVar (t :: TyVar d k) (tys :: LoT d) :: k where ... #
InterpretVar ('VZ :: TyVar (k -> k') k) (tys :: LoT (k -> k')) = HeadLoT tys | |
InterpretVar ('VS v :: TyVar (k2 -> k') k1) (tys :: LoT (k2 -> k')) = InterpretVar v (TailLoT tys) |
type family Satisfies (cs :: [Atom d Constraint]) (tys :: LoT d) where ... #
Satisfies ('[] :: [Atom d Constraint]) (tys :: LoT d) = () | |
Satisfies (c ': cs :: [Atom d Constraint]) (tys :: LoT d) = (Interpret c tys, Satisfies cs tys) |
type family ContainsTyVar (v :: TyVar d k) (t :: Atom d p) :: Bool where ... #
ContainsTyVar (v :: TyVar d p) ('Var v :: Atom d p) = 'True | |
ContainsTyVar (v :: TyVar d k) ('Var w :: Atom d p) = 'False | |
ContainsTyVar (v :: TyVar d k) ('Kon t :: Atom d p) = 'False | |
ContainsTyVar (v :: TyVar d k) (f ':@: x :: Atom d p2) = Or (ContainsTyVar v f) (ContainsTyVar v x) | |
ContainsTyVar (v :: TyVar d k) (x ':&: y :: Atom d Constraint) = Or (ContainsTyVar v x) (ContainsTyVar v y) | |
ContainsTyVar (v :: TyVar d k) (c ':=>>: f :: Atom d Type) = Or (ContainsTyVar v c) (ContainsTyVar v f) | |
ContainsTyVar (v :: TyVar xs k) ('ForAll f :: Atom xs Type) = ContainsTyVar ('VS v :: TyVar (x -> xs) k) f |
Auxiliary data types for interpretation
newtype SuchThatI (c :: Atom d Constraint) (f :: Atom d Type) (tys :: LoT d) where #
SuchThatI | |
|