kind-generics-th 0.1.1.0 → 0.2.0.0
raw patch · 4 files changed
+13/−15 lines, 4 filesdep ~kind-genericsPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: kind-generics
API changes (from Hackage documentation)
Files
- README.md +8/−8
- kind-generics-th.cabal +3/−3
- src/Generics/Kind/TH.hs +1/−3
- tests/Main.hs +1/−1
README.md view
@@ -45,9 +45,9 @@ three `GenericK` instances: ```haskell-instance GenericK (Either a b) LoT0 where ...-instance GenericK (Either a) (b :&&: LoT0) where ...-instance GenericK Either (a :&&: b :&&: LoT0) where ...+instance GenericK (Either a b) where ...+instance GenericK (Either a) where ...+instance GenericK Either where ... ``` Not every data type can be partially applied all the way in this fashion,@@ -62,7 +62,7 @@ One cannot partially apply to `Bar a a` to simply `Bar a`, so `$(deriveGenericK 'MkBar)` will only generate a single instance for- `GenericK (Bar a a) LoT0`.+ `GenericK (Bar a a)`. 2. Dependent kinds. `kind-generics` is not currently capable of representing data types such as the following in their full generality: @@ -74,8 +74,8 @@ in a visible, dependent fashion). As a consequence, `$(deriveGenericK ''Baz)` will only generate the following instances: - * `instance GenericK (Baz k a) LoT0`- * `instance GenericK (Baz k) (a :&&: LoT0)`+ * `instance GenericK (Baz k a)`+ * `instance GenericK (Baz k) ` 3. Data types with type family applications. In the following example: ```haskell@@ -87,7 +87,7 @@ of `WrappedFam`, since the representation type would necessarily need to partially apply `Fam`, which GHC does not permit. Therefore, `$(deriveGenericK ''WrappedFam)` will only generate a single instance for- `GenericK (WrappedFam a) LoT0`.+ `GenericK (WrappedFam a)`. There are some uses of type families that are not supported altogether. For instance, if a type family is applied to an _existentially_ quantified@@ -144,7 +144,7 @@ Therefore, we ought to get a `GenericK` instance like this: ```haskell- instance GenericK (Quux :: k -> *) (a :&&: LoT0) where+ instance GenericK (Quux :: k -> *) where type RepK (Quux :: k -> *) = Exists * ((Kon (k ~ Type) :&: (Var0 :~~: Var1)) :=>: Field (Maybe :$: Var0))
kind-generics-th.cabal view
@@ -1,6 +1,6 @@ cabal-version: >=1.10 name: kind-generics-th-version: 0.1.1.0+version: 0.2.0.0 synopsis: Template Haskell support for generating `GenericK` instances description: This package provides Template Haskell functionality to automatically derive @GenericK@ instances (from the@@ -23,7 +23,7 @@ library exposed-modules: Generics.Kind.TH build-depends: base >=4.12 && <5- , kind-generics >=0.3+ , kind-generics >=0.4 , template-haskell >=2.14 && <2.15 , th-abstraction >=0.2.8 && <0.4 hs-source-dirs: src@@ -34,7 +34,7 @@ type: exitcode-stdio-1.0 main-is: Main.hs build-depends: base >=4.12 && <5- , kind-generics >=0.2.1+ , kind-generics >=0.4 , kind-generics-th hs-source-dirs: tests default-language: Haskell2010
src/Generics/Kind/TH.hs view
@@ -81,9 +81,7 @@ (ConT ''Kind.Type) (map typeKind argsToDrop) dataApp = pure $ SigT (foldr (flip AppT) (ConT dataName) argsToKeep) kind instanceD (pure [])- (conT ''GenericK `appT` dataApp `appT`- foldr (\x y -> infixT x '(:&&:) y)- (promotedT 'LoT0) (map varT argNamesToDrop))+ (conT ''GenericK `appT` dataApp) [ tySynInstD ''RepK $ tySynEqn [dataApp] $ deriveRepK dataName argNamesToDrop variant cons' , deriveFromK cons'
tests/Main.hs view
@@ -83,7 +83,7 @@ ] in insts `seq` pure () -isGenericK :: forall k (f :: k) (x :: LoT k). GenericK f x => ()+isGenericK :: forall k (f :: k) (x :: LoT k). GenericK f => () isGenericK = fromK @k @f @x `seq` () ----------------