packages feed

kind-apply 0.4.0.0 → 0.4.0.1

raw patch · 4 files changed

+60/−20 lines, 4 filesnew-uploaderPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

API changes (from Hackage documentation)

- Data.PolyKinded.Atom: type a :~~: b = 'Kon (~~) ':@: a ':@: b
- Data.PolyKinded.Atom: type f :$: x = 'Kon f ':@: x
+ Data.PolyKinded.Atom: type (a :: Atom d k1) :~~: (b :: Atom d k2) = 'Kon (~~) :: k1 -> k2 -> Constraint :: Atom d k1 -> k2 -> Constraint ':@: a ':@: b
- Data.PolyKinded: [:&&:] :: k -> LoT ks -> LoT (k -> ks)
+ Data.PolyKinded: [:&&:] :: forall k1 ks. k1 -> LoT ks -> LoT (k1 -> ks)
- Data.PolyKinded: [SLoTA] :: Proxy t -> SLoT ts -> SLoT (t ':&&: ts)
+ Data.PolyKinded: [SLoTA] :: forall {k1} {k2} (t :: k1) (ts :: LoT k2). Proxy t -> SLoT ts -> SLoT (t ':&&: ts)
- Data.PolyKinded: data () => Proxy (t :: k)
+ Data.PolyKinded: data Proxy (t :: k)
- Data.PolyKinded: type LoT1 a = a ':&&: 'LoT0
+ Data.PolyKinded: type LoT1 (a :: k) = a ':&&: 'LoT0
- Data.PolyKinded: type LoT2 a b = a ':&&: b ':&&: 'LoT0
+ Data.PolyKinded: type LoT2 (a :: k) (b :: k1) = a ':&&: b ':&&: 'LoT0
- Data.PolyKinded.Atom: [:&:] :: Atom d Constraint -> Atom d Constraint -> Atom d Constraint
+ Data.PolyKinded.Atom: [:&:] :: forall d. Atom d Constraint -> Atom d Constraint -> Atom d Constraint
- Data.PolyKinded.Atom: [:=>>:] :: Atom d Constraint -> Atom d Type -> Atom d Type
+ Data.PolyKinded.Atom: [:=>>:] :: forall d. Atom d Constraint -> Atom d Type -> Atom d Type
- Data.PolyKinded.Atom: [:@:] :: Atom d (k1 -> k2) -> Atom d k1 -> Atom d k2
+ Data.PolyKinded.Atom: [:@:] :: forall d k1 k2. Atom d (k1 -> k2) -> Atom d k1 -> Atom d k2
- Data.PolyKinded.Atom: [Eval] :: Atom d (Exp k) -> Atom d k
+ Data.PolyKinded.Atom: [Eval] :: forall d k1. Atom d (Exp k1) -> Atom d k1
- Data.PolyKinded.Atom: [ForAllI] :: (forall t. Interpret f (t ':&&: tys)) -> ForAllI f tys
+ Data.PolyKinded.Atom: [ForAllI] :: forall {d1} {d} (f :: Atom (d1 -> d) Type) (tys :: LoT d). (forall (t :: d1). () => Interpret f (t ':&&: tys)) -> ForAllI f tys
- Data.PolyKinded.Atom: [ForAll] :: Atom (d1 -> d) Type -> Atom d Type
+ Data.PolyKinded.Atom: [ForAll] :: forall d1 d. Atom (d1 -> d) Type -> Atom d Type
- Data.PolyKinded.Atom: [Kon] :: k -> Atom d k
+ Data.PolyKinded.Atom: [Kon] :: forall k1 d. k1 -> Atom d k1
- Data.PolyKinded.Atom: [SuchThatI] :: (Interpret c tys => Interpret f tys) -> SuchThatI c f tys
+ Data.PolyKinded.Atom: [SuchThatI] :: forall {d} (c :: Atom d Constraint) (tys :: LoT d) (f :: Atom d Type). (Interpret c tys => Interpret f tys) -> SuchThatI c f tys
- Data.PolyKinded.Atom: [VS] :: TyVar xs k -> TyVar (x -> xs) k
+ Data.PolyKinded.Atom: [VS] :: forall xs k1 x. TyVar xs k1 -> TyVar (x -> xs) k1
- Data.PolyKinded.Atom: [VZ] :: TyVar (x -> xs) x
+ Data.PolyKinded.Atom: [VZ] :: forall x xs. TyVar (x -> xs) x
- Data.PolyKinded.Atom: [Var] :: TyVar d k -> Atom d k
+ Data.PolyKinded.Atom: [Var] :: forall d k1. TyVar d k1 -> Atom d k1
- Data.PolyKinded.Atom: data Atom (d :: Type) (k :: TYPE r)
+ Data.PolyKinded.Atom: data Atom d (k :: TYPE r)
- Data.PolyKinded.Atom: data TyVar (d :: Type) (k :: TYPE r)
+ Data.PolyKinded.Atom: data TyVar d (k :: TYPE r)
- Data.PolyKinded.Atom: fromWrappedI :: forall f tys. (forall t. WrappedI f (t ':&&: tys)) -> ForAllI f tys
+ Data.PolyKinded.Atom: fromWrappedI :: forall {d1} {d} (f :: Atom (d1 -> d) Type) (tys :: LoT d). (forall (t :: d1). () => WrappedI f (t ':&&: tys)) -> ForAllI f tys
- Data.PolyKinded.Atom: newtype ForAllI (f :: Atom (d1 -> d) Type) (tys :: LoT d)
+ Data.PolyKinded.Atom: newtype ForAllI (f :: Atom d1 -> d Type) (tys :: LoT d)
- Data.PolyKinded.Atom: toWrappedI :: forall f tys t. ForAllI f tys -> WrappedI f (t ':&&: tys)
+ Data.PolyKinded.Atom: toWrappedI :: forall {d1} {ks} (f :: Atom (d1 -> ks) Type) (tys :: LoT ks) (t :: d1). ForAllI f tys -> WrappedI f (t ':&&: tys)
- Data.PolyKinded.Atom: type Var0 = 'Var 'VZ
+ Data.PolyKinded.Atom: type Var0 = 'Var 'VZ :: TyVar k -> xs k
- Data.PolyKinded.Atom: type Var1 = 'Var ('VS 'VZ)
+ Data.PolyKinded.Atom: type Var1 = 'Var 'VS 'VZ :: TyVar k -> xs k :: TyVar x -> k -> xs k
- Data.PolyKinded.Atom: type Var2 = 'Var ('VS ('VS 'VZ))
+ Data.PolyKinded.Atom: type Var2 = 'Var 'VS 'VS 'VZ :: TyVar k -> xs k :: TyVar x1 -> k -> xs k :: TyVar x -> x1 -> k -> xs k
- Data.PolyKinded.Atom: type Var3 = 'Var ('VS ('VS ('VS 'VZ)))
+ Data.PolyKinded.Atom: 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
- Data.PolyKinded.Atom: type Var4 = 'Var ('VS ('VS ('VS ('VS 'VZ))))
+ Data.PolyKinded.Atom: 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
- Data.PolyKinded.Atom: type Var5 = 'Var ('VS ('VS ('VS ('VS ('VS 'VZ)))))
+ Data.PolyKinded.Atom: 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
- Data.PolyKinded.Atom: type Var6 = 'Var ('VS ('VS ('VS ('VS ('VS ('VS 'VZ))))))
+ Data.PolyKinded.Atom: 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
- Data.PolyKinded.Atom: type Var7 = 'Var ('VS ('VS ('VS ('VS ('VS ('VS ('VS 'VZ)))))))
+ Data.PolyKinded.Atom: 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
- Data.PolyKinded.Atom: type Var8 = 'Var ('VS ('VS ('VS ('VS ('VS ('VS ('VS ('VS 'VZ))))))))
+ Data.PolyKinded.Atom: 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
- Data.PolyKinded.Atom: type Var9 = 'Var ('VS ('VS ('VS ('VS ('VS ('VS ('VS ('VS ('VS 'VZ)))))))))
+ Data.PolyKinded.Atom: 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.PolyKinded.Functor: [:^:] :: Mapping v a b -> Mappings vs as bs -> Mappings (v ': vs) (a ':&&: as) (b ':&&: bs)
+ Data.PolyKinded.Functor: [:^:] :: forall {k1} (v1 :: Variance) a b (vs :: [Variance]) (as :: LoT k1) (bs :: LoT k1). Mapping v1 a b -> Mappings vs as bs -> Mappings (v1 ': vs) (a ':&&: as) (b ':&&: bs)
- Data.PolyKinded.Functor: [M0] :: Mappings '[] 'LoT0 'LoT0
+ Data.PolyKinded.Functor: [M0] :: Mappings ('[] :: [Variance]) 'LoT0 'LoT0
- Data.PolyKinded.Functor: kmapo :: forall f v as bs. KFunctor f v as bs => Mappings v as bs -> (f :@@: as) -> f :@@: bs
+ Data.PolyKinded.Functor: kmapo :: forall {k} (f :: k) (v :: Variances) (as :: LoT k) (bs :: LoT k). KFunctor f v as bs => Mappings v as bs -> (f :@@: as) -> f :@@: bs
- GHC.Generics.Extra: [SuchThat] :: c => f a -> (c :=>: f) a
+ GHC.Generics.Extra: [SuchThat] :: forall {k} c (f :: k -> Type) (a :: k). c => f a -> (c :=>: f) a
- GHC.Generics.Extra: data (:=>:) (c :: Constraint) (f :: k -> Type) (a :: k)
+ GHC.Generics.Extra: data ( c :=>: (f :: k -> Type) ) (a :: k)

Files

+ CHANGELOG.md view
@@ -0,0 +1,22 @@+# Revision history for `kind-apply`
+
+## 0.4.0.1 - 2025-07-29
+
+Tidying:
+
+* Replace deprecated `TypeInType` with `PolyKinds` and `DataKinds`
+* Fix doctests
+
+## 0.4.0.0
+
+## 0.3.2.1
+
+## 0.3.2.0
+
+## 0.3.1.0
+
+## 0.3.0.0
+
+## 0.2.0.0
+
+## 0.1.0.0
kind-apply.cabal view
@@ -1,16 +1,17 @@ cabal-version:       >=1.10 name:                kind-apply-version:             0.4.0.0+version:             0.4.0.1 synopsis:            Utilities to work with lists of types description:         This packages reifies the concept of list of types, and application of those to list constructors.--- bug-reports:+bug-reports:         https://gitlab.com/trupill/kind-generics/issues license:             BSD3 license-file:        LICENSE author:              Alejandro Serrano-maintainer:          trupill@gmail.com+maintainer:          lysxia@gmail.com -- copyright: category:            Data build-type:          Simple+extra-source-files:  CHANGELOG.md  source-repository head   type:     git
src/Data/PolyKinded.hs view
@@ -1,11 +1,12 @@ {-# language ConstraintKinds        #-} {-# language FlexibleContexts       #-} {-# language FlexibleInstances      #-}+{-# language DataKinds              #-} {-# language GADTs                  #-} {-# language MultiParamTypeClasses  #-}+{-# language PolyKinds              #-} {-# language ScopedTypeVariables    #-} {-# language TypeFamilyDependencies #-}-{-# language TypeInType             #-} {-# language TypeOperators          #-} {-# language UndecidableInstances   #-} -- | Representation of types as constructor + list of types.@@ -22,6 +23,9 @@ import           Data.Kind import           Data.Proxy +-- $setup+-- >>> :set -XTypeOperators -XDataKinds -XNoStarIsType+ infixr 5 :&&: -- | @LoT k@ represents a list of types which can be applied -- to a data type of kind @k@.@@ -39,7 +43,8 @@ -- | Apply a list of types to a type constructor. -- -- >>> :kind! Either :@@: (Int :&&: Bool :&&: LoT0)--- Either Int Bool :: Type+-- Either :@@: (Int :&&: Bool :&&: LoT0) :: Type+-- = Either Int Bool type family (f :: k) :@@: (tys :: LoT k) :: Type where   f :@@: _  = f   f :@@: as = f (HeadLoT as) :@@: TailLoT as@@ -47,14 +52,16 @@ -- | Head of a non-empty list of types. -- -- >>> :kind! HeadLoT (Int :&&: LoT0)--- Int :: Type+-- HeadLoT (Int :&&: LoT0) :: Type+-- = Int type family HeadLoT (tys :: LoT (k -> k')) :: k where   HeadLoT (a ':&&: _) = a  -- | Tail of a non-empty list of types. -- -- >>> :kind! TailLoT (Int :&&: Bool :&&: LoT0)--- Bool :&&: LoT0 :: LoT (Type -> Type)+-- TailLoT (Int :&&: Bool :&&: LoT0) :: LoT (Type -> Type)+-- = Bool :&&: LoT0 type family TailLoT (tys :: LoT (k -> k')) :: LoT k' where   TailLoT (_ ':&&: as) = as @@ -83,9 +90,11 @@ -- | Split a type @t@ until the constructor @f@ is found. -- -- >>> :kind! SplitF (Either Int Bool) Either--- Int :&&: Bool :&&: LoT0 :: LoT (Type -> Type -> Type)+-- SplitF (Either Int Bool) Either :: LoT (Type -> Type -> Type)+-- = Int :&&: (Bool :&&: LoT0) -- >>> :kind! SplitF (Either Int Bool) (Either Int)--- Bool :&&: LoT0 :: LoT (Type -> Type)+-- SplitF (Either Int Bool) (Either Int) :: LoT (Type -> Type)+-- = Bool :&&: LoT0 type SplitF (t :: d) (f :: k) = SplitF' t f 'LoT0 type family SplitF' (t :: d) (f :: k) (p :: LoT l) :: LoT k where   SplitF' f     f acc = acc@@ -100,12 +109,14 @@  -- | Split a type @t@ until its list of types has length @n@. ----- >>> :kind! SplitN (Either Int Bool) (S (S Z))--- TyEnv Either (Int :&&: Bool :&&: LoT0) :: TyEnv--- >>> :kind! SplitF (Either Int Bool) (S Z)--- TyEnv (Either Int) (Bool :&&: LoT0) :: TyEnv+-- >>> :kind! SplitN (S (S Z)) (Either Int Bool)+-- SplitN (S (S Z)) (Either Int Bool) :: TyEnv+-- = 'TyEnv Either (Int :&&: (Bool :&&: LoT0))+-- >>> :kind! SplitN (S Z) (Either Int Bool)+-- SplitN (S Z) (Either Int Bool) :: TyEnv+-- = 'TyEnv (Either Int) (Bool :&&: LoT0) type family SplitN (n :: Nat) t :: TyEnv where   SplitN n t = SplitN' n t 'LoT0 type family SplitN' (n :: Nat) (t :: d) (p :: LoT d) :: TyEnv where-  SplitN' 'Z     t            acc = 'TyEnv t acc-  SplitN' ('S n) (t (a :: l)) acc = SplitN' n t (a ':&&: acc)+  SplitN' 'Z     t     acc = 'TyEnv t acc+  SplitN' ('S n) (t a) acc = SplitN' n t (a ':&&: acc)
src/Data/PolyKinded/Atom.hs view
@@ -31,6 +31,10 @@ import           GHC.Exts import           Fcf.Core (Exp, Eval) +-- $setup+-- >>> :set -XTypeOperators -XDataKinds -XNoStarIsType+-- >>> import Data.PolyKinded+ -- | Well-scoped de Bruijn representation of type variables. -- @TyVar d@ represents all the possible type variables which -- can refer to the holes in kind @d@.@@ -58,8 +62,9 @@ infixr 5 :=>>: -- | Shape of a type, possibly with type variables. ----- >>> :kind Kon [] :@: Var0 -- the type [a] for unknown a--- Kon [] :@: Var0 :: Atom (* -> xs) *+-- >>> -- the type [a] for unknown a+-- >>> :kind Kon [] :@: Var0+-- Kon [] :@: Var0 :: Atom (Type -> xs) Type -- -- === __Representation of type families__ --@@ -127,10 +132,10 @@ -- by the type variable @t@. -- -- >>> :kind! Interpret Var0 (LoT2 Int Bool)--- Interpret Var0 (LoT2 Int Bool) :: *+-- Interpret Var0 (LoT2 Int Bool) :: Type -- = Int -- >>> :kind! Interpret Var1 (LoT2 Int Bool)--- Interpret Var1 (LoT2 Int Bool) :: *+-- Interpret Var1 (LoT2 Int Bool) :: Type -- = Bool type family InterpretVar (t :: TyVar d k) (tys :: LoT d) :: k where   InterpretVar 'VZ     tys = HeadLoT tys@@ -141,7 +146,7 @@ -- must match statically those required by the 'Atom'. -- -- >>> :kind! Interpret ([] :$: Var0) (LoT1 Int)--- Interpret ([] :$: Var0) (LoT1 Int) :: *+-- Interpret ([] :$: Var0) (LoT1 Int) :: Type -- = [Int] type family Interpret (t :: Atom d k) (tys :: LoT d) :: k where   Interpret ('Var v)     tys = InterpretVar v tys@@ -162,6 +167,7 @@ -- -- >>> :t WrapI [1] :: WrappedI ([] :$: Var0) (LoT1 Int) -- WrapI [1] :: WrappedI ([] :$: Var0) (LoT1 Int)+--   :: WrappedI ([] :$: Var0) (LoT1 Int) newtype WrappedI (f :: Atom d Type) (tys :: LoT d) =   WrapI { unwrapI :: Interpret f tys }