kind-generics-th 0.2.1.0 → 0.2.2.0
raw patch · 2 files changed
+64/−60 lines, 2 filesdep ~template-haskellPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: template-haskell
API changes (from Hackage documentation)
Files
- kind-generics-th.cabal +3/−3
- tests/Main.hs +61/−57
kind-generics-th.cabal view
@@ -1,6 +1,6 @@ cabal-version: >=1.10 name: kind-generics-th-version: 0.2.1.0+version: 0.2.2.0 synopsis: Template Haskell support for generating `GenericK` instances description: This package provides Template Haskell functionality to automatically derive @GenericK@ instances (from the@@ -25,7 +25,7 @@ build-depends: base >=4.12 && <5 , ghc-prim >= 0.5.3 , kind-generics >=0.4- , template-haskell >=2.14 && <2.16+ , template-haskell >=2.14 && <2.17 , th-abstraction >=0.3.1 && <0.4 hs-source-dirs: src default-language: Haskell2010@@ -37,7 +37,7 @@ build-depends: base >=4.12 && <5 , kind-generics >=0.4 , kind-generics-th- , template-haskell >=2.14 && <2.16+ , template-haskell >=2.14 && <2.17 hs-source-dirs: tests default-language: Haskell2010 ghc-options: -Wall
tests/Main.hs view
@@ -20,6 +20,67 @@ import Generics.Kind import Generics.Kind.TH +----------------+-- Data families+----------------++data family DF a b c+data instance DF Char Int c = DF1 c+data instance DF a a c = DF2 a c+data instance DF Bool () (Maybe c) = DF3 c++---------------+-- Tricky cases+---------------++-- An existential context with multiple constraints+data TC1 :: Type -> Type where+ MkTC1 :: forall a. (Eq a, Read a, Show a) => TC1 a++-- A kind variable being used as a type variable+data TC2 :: forall k. k -> Type where+ MkTC2 :: forall k (a :: k). k -> Proxy a -> TC2 a++-- Visible dependent quantification+data TC3 k :: k -> Type where+ MkTC3 :: forall k (a :: k). k -> Proxy a -> TC3 k a++-- This sort of type family is OK to partially apply+type family UnsaturateMe :: Type -> Type+newtype TC4 :: Type -> Type where+ MkTC4 :: forall a. UnsaturateMe a -> TC4 a++-- Tricky kind inference involving Proxy+data TC5 :: Type -> Type where+ MkTC5 :: forall k (a :: k). k -> Proxy a -> TC5 k++#if MIN_VERSION_template_haskell(2,15,0)+-- Implicit parameters+data TC6 :: Type where+ MkTC6 :: (?n :: Bool) => TC6+#endif++$(concat <$> traverse deriveGenericK+ [ -- Representation types+ ''V1, ''(:+:), ''(:*:), ''U1, ''M1, ''Field, ''(:=>:), ''Exists++ -- Other data types+ , ''LoT, ''TyEnv++ -- Data families+ , 'DF1, 'DF2, 'DF3++ -- Tricky cases+ , ''TC1, ''TC2, ''TC3, ''TC4, ''TC5+#if MIN_VERSION_template_haskell(2,15,0)+ , ''TC6+#endif+ ])++-------+-- main+-------+ main :: IO () main = let insts = [ -- Representation types@@ -91,60 +152,3 @@ isGenericK :: forall k (f :: k) (x :: LoT k). GenericK f => () isGenericK = fromK @k @f @x `seq` ()--------------------- Data families-------------------data family DF a b c-data instance DF Char Int c = DF1 c-data instance DF a a c = DF2 a c-data instance DF Bool () (Maybe c) = DF3 c-------------------- Tricky cases-------------------- An existential context with multiple constraints-data TC1 :: Type -> Type where- MkTC1 :: forall a. (Eq a, Read a, Show a) => TC1 a---- A kind variable being used as a type variable-data TC2 :: forall k. k -> Type where- MkTC2 :: forall k (a :: k). k -> Proxy a -> TC2 a---- Visible dependent quantification-data TC3 k :: k -> Type where- MkTC3 :: forall k (a :: k). k -> Proxy a -> TC3 k a---- This sort of type family is OK to partially apply-type family UnsaturateMe :: Type -> Type-newtype TC4 :: Type -> Type where- MkTC4 :: forall a. UnsaturateMe a -> TC4 a---- Tricky kind inference involving Proxy-data TC5 :: Type -> Type where- MkTC5 :: forall k (a :: k). k -> Proxy a -> TC5 k--#if MIN_VERSION_template_haskell(2,15,0)--- Implicit parameters-data TC6 :: Type where- MkTC6 :: (?n :: Bool) => TC6-#endif--$(concat <$> traverse deriveGenericK- [ -- Representation types- ''V1, ''(:+:), ''(:*:), ''U1, ''M1, ''Field, ''(:=>:), ''Exists-- -- Other data types- , ''LoT, ''TyEnv-- -- Data families- , 'DF1, 'DF2, 'DF3-- -- Tricky cases- , ''TC1, ''TC2, ''TC3, ''TC4, ''TC5-#if MIN_VERSION_template_haskell(2,15,0)- , ''TC6-#endif- ])