diff options
author | RyanGlScott <ryan.gl.scott@gmail.com> | 2016-05-11 15:57:48 +0200 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2016-05-12 15:39:30 +0200 |
commit | b8e2565123de45f215277e3a92fbc7ace2b8fd71 (patch) | |
tree | f3373dc4a2c01a392271615084563545d1d01158 /testsuite/tests/generics | |
parent | e53f2180e89652c72e51ffa614c56294ba67cf37 (diff) | |
download | haskell-b8e2565123de45f215277e3a92fbc7ace2b8fd71.tar.gz |
Make Generic1 poly-kinded
This generalizes the `Generic1` typeclass to be of kind `k -> *`, and
this also makes the relevant datatypes and typeclasses in `GHC.Generics`
poly-kinded. If `PolyKinds` is enabled, `DeriveGeneric` derives
`Generic1` instances such that they use the most general kind possible.
Otherwise, deriving `Generic1` defaults to make an instance where the
argument is of kind `* -> *` (the current behavior).
Fixes #10604. Depends on D2117.
Test Plan: ./validate
Reviewers: kosmikus, dreixel, goldfire, austin, hvr, simonpj, bgamari
Reviewed By: simonpj, bgamari
Subscribers: thomie, ekmett
Differential Revision: https://phabricator.haskell.org/D2168
GHC Trac Issues: #10604
Diffstat (limited to 'testsuite/tests/generics')
9 files changed, 615 insertions, 0 deletions
diff --git a/testsuite/tests/generics/T10604/Makefile b/testsuite/tests/generics/T10604/Makefile new file mode 100644 index 0000000000..9101fbd40a --- /dev/null +++ b/testsuite/tests/generics/T10604/Makefile @@ -0,0 +1,3 @@ +TOP=../../.. +include $(TOP)/mk/boilerplate.mk +include $(TOP)/mk/test.mk diff --git a/testsuite/tests/generics/T10604/T10604_Authenticated.hs b/testsuite/tests/generics/T10604/T10604_Authenticated.hs new file mode 100644 index 0000000000..b43c11b581 --- /dev/null +++ b/testsuite/tests/generics/T10604/T10604_Authenticated.hs @@ -0,0 +1,41 @@ +{-# LANGUAGE DataKinds #-} +{-# LANGUAGE DefaultSignatures #-} +{-# LANGUAGE FlexibleContexts #-} +{-# LANGUAGE PolyKinds #-} +{-# LANGUAGE TypeOperators #-} +module T10604_Authenticated where + +import GHC.Generics + +data AuthParam = Prover | Verifier + +class MapAuth f where + mapAuth :: f 'Prover -> f 'Verifier + default mapAuth :: (GMapAuth (Rep1 f), Generic1 f) + => f 'Prover -> f 'Verifier + mapAuth = to1 . gmapAuth . from1 + +class GMapAuth f where + gmapAuth :: f 'Prover -> f 'Verifier + +instance GMapAuth V1 where + gmapAuth = undefined + +instance GMapAuth U1 where + gmapAuth U1 = U1 + +instance (GMapAuth l, GMapAuth r) => GMapAuth (l :+: r) where + gmapAuth (L1 x) = L1 (gmapAuth x) + gmapAuth (R1 x) = R1 (gmapAuth x) + +instance (GMapAuth l, GMapAuth r) => GMapAuth (l :*: r) where + gmapAuth (x :*: y) = gmapAuth x :*: gmapAuth y + +instance GMapAuth (K1 i c) where + gmapAuth (K1 c) = K1 c + +instance (GMapAuth f) => GMapAuth (M1 i t f) where + gmapAuth (M1 x) = M1 (gmapAuth x) + +instance (MapAuth f) => GMapAuth (Rec1 f) where + gmapAuth (Rec1 x) = Rec1 (mapAuth x) diff --git a/testsuite/tests/generics/T10604/T10604_bad_variable_occurrence.hs b/testsuite/tests/generics/T10604/T10604_bad_variable_occurrence.hs new file mode 100644 index 0000000000..53ad879702 --- /dev/null +++ b/testsuite/tests/generics/T10604/T10604_bad_variable_occurrence.hs @@ -0,0 +1,8 @@ +{-# LANGUAGE DeriveGeneric #-} +{-# LANGUAGE PolyKinds #-} +module T10604_bad_variable_occurrence where + +import GHC.Generics + +newtype Fix f = In { out :: f (Fix f) } + deriving Generic1 diff --git a/testsuite/tests/generics/T10604/T10604_bad_variable_occurrence.stderr b/testsuite/tests/generics/T10604/T10604_bad_variable_occurrence.stderr new file mode 100644 index 0000000000..26c6a5562a --- /dev/null +++ b/testsuite/tests/generics/T10604/T10604_bad_variable_occurrence.stderr @@ -0,0 +1,6 @@ + +T10604_bad_variable_occurrence.hs:8:12: error: + • Can't make a derived instance of ‘Generic1 Fix’: + Constructor ‘In’ applies a type to an argument involving the last parameter + but the applied type is not of kind * -> * + • In the newtype declaration for ‘Fix’ diff --git a/testsuite/tests/generics/T10604/T10604_deriving.hs b/testsuite/tests/generics/T10604/T10604_deriving.hs new file mode 100644 index 0000000000..5bdf586e75 --- /dev/null +++ b/testsuite/tests/generics/T10604/T10604_deriving.hs @@ -0,0 +1,22 @@ +{-# LANGUAGE DataKinds #-} +{-# LANGUAGE DeriveFunctor #-} +{-# LANGUAGE DeriveGeneric #-} +{-# LANGUAGE PolyKinds #-} +{-# OPTIONS_GHC -ddump-deriv -fprint-explicit-kinds #-} +module T10604_deriving where + +import GHC.Generics + +data Empty (a :: Bool) + deriving (Generic, Generic1) +data Proxy (a :: k) = Proxy + deriving (Functor, Generic, Generic1) +data Wrap (a :: * -> *) = Wrap (Proxy a) + deriving (Generic, Generic1) +data Wrap2 (a :: k -> *) = Wrap2 (Proxy (Proxy a)) + deriving (Generic, Generic1) +data SumOfProducts a = Prod1 (Proxy a) (Proxy a) | Prod2 (Proxy a) (Proxy a) + deriving (Generic, Generic1) + +data Starify a = Starify1 a | Starify2 Int + deriving (Generic, Generic1) diff --git a/testsuite/tests/generics/T10604/T10604_deriving.stderr b/testsuite/tests/generics/T10604/T10604_deriving.stderr new file mode 100644 index 0000000000..b4168d1bdd --- /dev/null +++ b/testsuite/tests/generics/T10604/T10604_deriving.stderr @@ -0,0 +1,518 @@ + +==================== Derived instances ==================== +Derived instances: + instance GHC.Generics.Generic (T10604_deriving.Empty a) where + GHC.Generics.from _ + = GHC.Generics.M1 + (GHC.Err.error + "No generic representation for empty datatype Empty") + GHC.Generics.to (GHC.Generics.M1 _) + = GHC.Err.error "No values for empty datatype Empty" + + instance GHC.Generics.Generic1 + GHC.Types.Bool T10604_deriving.Empty where + GHC.Generics.from1 _ + = GHC.Generics.M1 + (GHC.Err.error + "No generic representation for empty datatype Empty") + GHC.Generics.to1 (GHC.Generics.M1 _) + = GHC.Err.error "No values for empty datatype Empty" + + instance GHC.Base.Functor (T10604_deriving.Proxy *) where + GHC.Base.fmap f T10604_deriving.Proxy = T10604_deriving.Proxy + + instance forall k (a :: k). + GHC.Generics.Generic (T10604_deriving.Proxy k a) where + GHC.Generics.from T10604_deriving.Proxy + = GHC.Generics.M1 (GHC.Generics.M1 GHC.Generics.U1) + GHC.Generics.to (GHC.Generics.M1 (GHC.Generics.M1 GHC.Generics.U1)) + = T10604_deriving.Proxy + + instance GHC.Generics.Generic1 k (T10604_deriving.Proxy k) where + GHC.Generics.from1 T10604_deriving.Proxy + = GHC.Generics.M1 (GHC.Generics.M1 GHC.Generics.U1) + GHC.Generics.to1 + (GHC.Generics.M1 (GHC.Generics.M1 GHC.Generics.U1)) + = T10604_deriving.Proxy + + instance GHC.Generics.Generic (T10604_deriving.Wrap a) where + GHC.Generics.from (T10604_deriving.Wrap g1) + = GHC.Generics.M1 + (GHC.Generics.M1 (GHC.Generics.M1 (GHC.Generics.K1 g1))) + GHC.Generics.to + (GHC.Generics.M1 (GHC.Generics.M1 (GHC.Generics.M1 (GHC.Generics.K1 g1)))) + = T10604_deriving.Wrap g1 + + instance GHC.Generics.Generic1 + (GHC.Types.* -> GHC.Types.*) T10604_deriving.Wrap where + GHC.Generics.from1 (T10604_deriving.Wrap g1) + = GHC.Generics.M1 + (GHC.Generics.M1 (GHC.Generics.M1 (GHC.Generics.Rec1 g1))) + GHC.Generics.to1 + (GHC.Generics.M1 (GHC.Generics.M1 (GHC.Generics.M1 g1))) + = T10604_deriving.Wrap (GHC.Generics.unRec1 g1) + + instance forall k (a :: k -> GHC.Types.*). + GHC.Generics.Generic (T10604_deriving.Wrap2 k a) where + GHC.Generics.from (T10604_deriving.Wrap2 g1) + = GHC.Generics.M1 + (GHC.Generics.M1 (GHC.Generics.M1 (GHC.Generics.K1 g1))) + GHC.Generics.to + (GHC.Generics.M1 (GHC.Generics.M1 (GHC.Generics.M1 (GHC.Generics.K1 g1)))) + = T10604_deriving.Wrap2 g1 + + instance GHC.Generics.Generic1 + (k -> GHC.Types.*) (T10604_deriving.Wrap2 k) where + GHC.Generics.from1 (T10604_deriving.Wrap2 g1) + = GHC.Generics.M1 + (GHC.Generics.M1 + (GHC.Generics.M1 + ((GHC.Base..) + GHC.Generics.Comp1 (GHC.Base.fmap GHC.Generics.Rec1) g1))) + GHC.Generics.to1 + (GHC.Generics.M1 (GHC.Generics.M1 (GHC.Generics.M1 g1))) + = T10604_deriving.Wrap2 + ((GHC.Base..) + (GHC.Base.fmap GHC.Generics.unRec1) GHC.Generics.unComp1 g1) + + instance forall k (a :: k). + GHC.Generics.Generic (T10604_deriving.SumOfProducts k a) where + GHC.Generics.from (T10604_deriving.Prod1 g1 g2) + = GHC.Generics.M1 + (GHC.Generics.L1 + (GHC.Generics.M1 + ((GHC.Generics.:*:) + (GHC.Generics.M1 (GHC.Generics.K1 g1)) + (GHC.Generics.M1 (GHC.Generics.K1 g2))))) + GHC.Generics.from (T10604_deriving.Prod2 g1 g2) + = GHC.Generics.M1 + (GHC.Generics.R1 + (GHC.Generics.M1 + ((GHC.Generics.:*:) + (GHC.Generics.M1 (GHC.Generics.K1 g1)) + (GHC.Generics.M1 (GHC.Generics.K1 g2))))) + GHC.Generics.to + (GHC.Generics.M1 (GHC.Generics.L1 (GHC.Generics.M1 ((GHC.Generics.:*:) (GHC.Generics.M1 (GHC.Generics.K1 g1)) + (GHC.Generics.M1 (GHC.Generics.K1 g2)))))) + = T10604_deriving.Prod1 g1 g2 + GHC.Generics.to + (GHC.Generics.M1 (GHC.Generics.R1 (GHC.Generics.M1 ((GHC.Generics.:*:) (GHC.Generics.M1 (GHC.Generics.K1 g1)) + (GHC.Generics.M1 (GHC.Generics.K1 g2)))))) + = T10604_deriving.Prod2 g1 g2 + + instance GHC.Generics.Generic1 + k (T10604_deriving.SumOfProducts k) where + GHC.Generics.from1 (T10604_deriving.Prod1 g1 g2) + = GHC.Generics.M1 + (GHC.Generics.L1 + (GHC.Generics.M1 + ((GHC.Generics.:*:) + (GHC.Generics.M1 (GHC.Generics.Rec1 g1)) + (GHC.Generics.M1 (GHC.Generics.Rec1 g2))))) + GHC.Generics.from1 (T10604_deriving.Prod2 g1 g2) + = GHC.Generics.M1 + (GHC.Generics.R1 + (GHC.Generics.M1 + ((GHC.Generics.:*:) + (GHC.Generics.M1 (GHC.Generics.Rec1 g1)) + (GHC.Generics.M1 (GHC.Generics.Rec1 g2))))) + GHC.Generics.to1 + (GHC.Generics.M1 (GHC.Generics.L1 (GHC.Generics.M1 ((GHC.Generics.:*:) (GHC.Generics.M1 g1) + (GHC.Generics.M1 g2))))) + = T10604_deriving.Prod1 + (GHC.Generics.unRec1 g1) (GHC.Generics.unRec1 g2) + GHC.Generics.to1 + (GHC.Generics.M1 (GHC.Generics.R1 (GHC.Generics.M1 ((GHC.Generics.:*:) (GHC.Generics.M1 g1) + (GHC.Generics.M1 g2))))) + = T10604_deriving.Prod2 + (GHC.Generics.unRec1 g1) (GHC.Generics.unRec1 g2) + + instance GHC.Generics.Generic (T10604_deriving.Starify a) where + GHC.Generics.from (T10604_deriving.Starify1 g1) + = GHC.Generics.M1 + (GHC.Generics.L1 + (GHC.Generics.M1 (GHC.Generics.M1 (GHC.Generics.K1 g1)))) + GHC.Generics.from (T10604_deriving.Starify2 g1) + = GHC.Generics.M1 + (GHC.Generics.R1 + (GHC.Generics.M1 (GHC.Generics.M1 (GHC.Generics.K1 g1)))) + GHC.Generics.to + (GHC.Generics.M1 (GHC.Generics.L1 (GHC.Generics.M1 (GHC.Generics.M1 (GHC.Generics.K1 g1))))) + = T10604_deriving.Starify1 g1 + GHC.Generics.to + (GHC.Generics.M1 (GHC.Generics.R1 (GHC.Generics.M1 (GHC.Generics.M1 (GHC.Generics.K1 g1))))) + = T10604_deriving.Starify2 g1 + + instance GHC.Generics.Generic1 * T10604_deriving.Starify where + GHC.Generics.from1 (T10604_deriving.Starify1 g1) + = GHC.Generics.M1 + (GHC.Generics.L1 + (GHC.Generics.M1 (GHC.Generics.M1 (GHC.Generics.Par1 g1)))) + GHC.Generics.from1 (T10604_deriving.Starify2 g1) + = GHC.Generics.M1 + (GHC.Generics.R1 + (GHC.Generics.M1 (GHC.Generics.M1 (GHC.Generics.K1 g1)))) + GHC.Generics.to1 + (GHC.Generics.M1 (GHC.Generics.L1 (GHC.Generics.M1 (GHC.Generics.M1 g1)))) + = T10604_deriving.Starify1 (GHC.Generics.unPar1 g1) + GHC.Generics.to1 + (GHC.Generics.M1 (GHC.Generics.R1 (GHC.Generics.M1 (GHC.Generics.M1 g1)))) + = T10604_deriving.Starify2 (GHC.Generics.unK1 g1) + + +GHC.Generics representation types: + type GHC.Generics.Rep (T10604_deriving.Empty a) = GHC.Generics.D1 + * + ('GHC.Generics.MetaData + "Empty" + "T10604_deriving" + "main" + 'GHC.Types.False) + (GHC.Generics.V1 *) + type GHC.Generics.Rep1 + GHC.Types.Bool T10604_deriving.Empty = GHC.Generics.D1 + GHC.Types.Bool + ('GHC.Generics.MetaData + "Empty" + "T10604_deriving" + "main" + 'GHC.Types.False) + (GHC.Generics.V1 GHC.Types.Bool) + type GHC.Generics.Rep (T10604_deriving.Proxy k a) = GHC.Generics.D1 + * + ('GHC.Generics.MetaData + "Proxy" + "T10604_deriving" + "main" + 'GHC.Types.False) + (GHC.Generics.C1 + * + ('GHC.Generics.MetaCons + "Proxy" + 'GHC.Generics.PrefixI + 'GHC.Types.False) + (GHC.Generics.U1 *)) + type GHC.Generics.Rep1 + k (T10604_deriving.Proxy k) = GHC.Generics.D1 + k + ('GHC.Generics.MetaData + "Proxy" "T10604_deriving" "main" 'GHC.Types.False) + (GHC.Generics.C1 + k + ('GHC.Generics.MetaCons + "Proxy" 'GHC.Generics.PrefixI 'GHC.Types.False) + (GHC.Generics.U1 k)) + type GHC.Generics.Rep (T10604_deriving.Wrap a) = GHC.Generics.D1 + * + ('GHC.Generics.MetaData + "Wrap" + "T10604_deriving" + "main" + 'GHC.Types.False) + (GHC.Generics.C1 + * + ('GHC.Generics.MetaCons + "Wrap" + 'GHC.Generics.PrefixI + 'GHC.Types.False) + (GHC.Generics.S1 + * + ('GHC.Generics.MetaSel + ('GHC.Base.Nothing GHC.Types.Symbol) + 'GHC.Generics.NoSourceUnpackedness + 'GHC.Generics.NoSourceStrictness + 'GHC.Generics.DecidedLazy) + (GHC.Generics.Rec0 + * + (T10604_deriving.Proxy + (GHC.Types.* -> GHC.Types.*) a)))) + type GHC.Generics.Rep1 + (GHC.Types.* -> GHC.Types.*) T10604_deriving.Wrap = GHC.Generics.D1 + (GHC.Types.* -> GHC.Types.*) + ('GHC.Generics.MetaData + "Wrap" + "T10604_deriving" + "main" + 'GHC.Types.False) + (GHC.Generics.C1 + (GHC.Types.* -> GHC.Types.*) + ('GHC.Generics.MetaCons + "Wrap" + 'GHC.Generics.PrefixI + 'GHC.Types.False) + (GHC.Generics.S1 + (GHC.Types.* -> GHC.Types.*) + ('GHC.Generics.MetaSel + ('GHC.Base.Nothing + GHC.Types.Symbol) + 'GHC.Generics.NoSourceUnpackedness + 'GHC.Generics.NoSourceStrictness + 'GHC.Generics.DecidedLazy) + (GHC.Generics.Rec1 + (GHC.Types.* -> GHC.Types.*) + (T10604_deriving.Proxy + (GHC.Types.* + -> GHC.Types.*))))) + type GHC.Generics.Rep (T10604_deriving.Wrap2 k a) = GHC.Generics.D1 + * + ('GHC.Generics.MetaData + "Wrap2" + "T10604_deriving" + "main" + 'GHC.Types.False) + (GHC.Generics.C1 + * + ('GHC.Generics.MetaCons + "Wrap2" + 'GHC.Generics.PrefixI + 'GHC.Types.False) + (GHC.Generics.S1 + * + ('GHC.Generics.MetaSel + ('GHC.Base.Nothing + GHC.Types.Symbol) + 'GHC.Generics.NoSourceUnpackedness + 'GHC.Generics.NoSourceStrictness + 'GHC.Generics.DecidedLazy) + (GHC.Generics.Rec0 + * + (T10604_deriving.Proxy + * + (T10604_deriving.Proxy + (k -> GHC.Types.*) a))))) + type GHC.Generics.Rep1 + (k -> GHC.Types.*) (T10604_deriving.Wrap2 k) = GHC.Generics.D1 + (k -> GHC.Types.*) + ('GHC.Generics.MetaData + "Wrap2" + "T10604_deriving" + "main" + 'GHC.Types.False) + (GHC.Generics.C1 + (k -> GHC.Types.*) + ('GHC.Generics.MetaCons + "Wrap2" + 'GHC.Generics.PrefixI + 'GHC.Types.False) + (GHC.Generics.S1 + (k -> GHC.Types.*) + ('GHC.Generics.MetaSel + ('GHC.Base.Nothing + GHC.Types.Symbol) + 'GHC.Generics.NoSourceUnpackedness + 'GHC.Generics.NoSourceStrictness + 'GHC.Generics.DecidedLazy) + ((GHC.Generics.:.:) + (k -> GHC.Types.*) + * + (T10604_deriving.Proxy *) + (GHC.Generics.Rec1 + (k -> GHC.Types.*) + (T10604_deriving.Proxy + (k -> GHC.Types.*)))))) + type GHC.Generics.Rep + (T10604_deriving.SumOfProducts k a) = GHC.Generics.D1 + * + ('GHC.Generics.MetaData + "SumOfProducts" + "T10604_deriving" + "main" + 'GHC.Types.False) + ((GHC.Generics.:+:) + * + (GHC.Generics.C1 + * + ('GHC.Generics.MetaCons + "Prod1" + 'GHC.Generics.PrefixI + 'GHC.Types.False) + ((GHC.Generics.:*:) + * + (GHC.Generics.S1 + * + ('GHC.Generics.MetaSel + ('GHC.Base.Nothing GHC.Types.Symbol) + 'GHC.Generics.NoSourceUnpackedness + 'GHC.Generics.NoSourceStrictness + 'GHC.Generics.DecidedLazy) + (GHC.Generics.Rec0 + * (T10604_deriving.Proxy k a))) + (GHC.Generics.S1 + * + ('GHC.Generics.MetaSel + ('GHC.Base.Nothing GHC.Types.Symbol) + 'GHC.Generics.NoSourceUnpackedness + 'GHC.Generics.NoSourceStrictness + 'GHC.Generics.DecidedLazy) + (GHC.Generics.Rec0 + * (T10604_deriving.Proxy k a))))) + (GHC.Generics.C1 + * + ('GHC.Generics.MetaCons + "Prod2" + 'GHC.Generics.PrefixI + 'GHC.Types.False) + ((GHC.Generics.:*:) + * + (GHC.Generics.S1 + * + ('GHC.Generics.MetaSel + ('GHC.Base.Nothing GHC.Types.Symbol) + 'GHC.Generics.NoSourceUnpackedness + 'GHC.Generics.NoSourceStrictness + 'GHC.Generics.DecidedLazy) + (GHC.Generics.Rec0 + * (T10604_deriving.Proxy k a))) + (GHC.Generics.S1 + * + ('GHC.Generics.MetaSel + ('GHC.Base.Nothing GHC.Types.Symbol) + 'GHC.Generics.NoSourceUnpackedness + 'GHC.Generics.NoSourceStrictness + 'GHC.Generics.DecidedLazy) + (GHC.Generics.Rec0 + * (T10604_deriving.Proxy k a)))))) + type GHC.Generics.Rep1 + k (T10604_deriving.SumOfProducts k) = GHC.Generics.D1 + k + ('GHC.Generics.MetaData + "SumOfProducts" + "T10604_deriving" + "main" + 'GHC.Types.False) + ((GHC.Generics.:+:) + k + (GHC.Generics.C1 + k + ('GHC.Generics.MetaCons + "Prod1" + 'GHC.Generics.PrefixI + 'GHC.Types.False) + ((GHC.Generics.:*:) + k + (GHC.Generics.S1 + k + ('GHC.Generics.MetaSel + ('GHC.Base.Nothing GHC.Types.Symbol) + 'GHC.Generics.NoSourceUnpackedness + 'GHC.Generics.NoSourceStrictness + 'GHC.Generics.DecidedLazy) + (GHC.Generics.Rec1 + k (T10604_deriving.Proxy k))) + (GHC.Generics.S1 + k + ('GHC.Generics.MetaSel + ('GHC.Base.Nothing GHC.Types.Symbol) + 'GHC.Generics.NoSourceUnpackedness + 'GHC.Generics.NoSourceStrictness + 'GHC.Generics.DecidedLazy) + (GHC.Generics.Rec1 + k (T10604_deriving.Proxy k))))) + (GHC.Generics.C1 + k + ('GHC.Generics.MetaCons + "Prod2" + 'GHC.Generics.PrefixI + 'GHC.Types.False) + ((GHC.Generics.:*:) + k + (GHC.Generics.S1 + k + ('GHC.Generics.MetaSel + ('GHC.Base.Nothing GHC.Types.Symbol) + 'GHC.Generics.NoSourceUnpackedness + 'GHC.Generics.NoSourceStrictness + 'GHC.Generics.DecidedLazy) + (GHC.Generics.Rec1 + k (T10604_deriving.Proxy k))) + (GHC.Generics.S1 + k + ('GHC.Generics.MetaSel + ('GHC.Base.Nothing GHC.Types.Symbol) + 'GHC.Generics.NoSourceUnpackedness + 'GHC.Generics.NoSourceStrictness + 'GHC.Generics.DecidedLazy) + (GHC.Generics.Rec1 + k (T10604_deriving.Proxy k)))))) + type GHC.Generics.Rep (T10604_deriving.Starify a) = GHC.Generics.D1 + * + ('GHC.Generics.MetaData + "Starify" + "T10604_deriving" + "main" + 'GHC.Types.False) + ((GHC.Generics.:+:) + * + (GHC.Generics.C1 + * + ('GHC.Generics.MetaCons + "Starify1" + 'GHC.Generics.PrefixI + 'GHC.Types.False) + (GHC.Generics.S1 + * + ('GHC.Generics.MetaSel + ('GHC.Base.Nothing + GHC.Types.Symbol) + 'GHC.Generics.NoSourceUnpackedness + 'GHC.Generics.NoSourceStrictness + 'GHC.Generics.DecidedLazy) + (GHC.Generics.Rec0 * a))) + (GHC.Generics.C1 + * + ('GHC.Generics.MetaCons + "Starify2" + 'GHC.Generics.PrefixI + 'GHC.Types.False) + (GHC.Generics.S1 + * + ('GHC.Generics.MetaSel + ('GHC.Base.Nothing + GHC.Types.Symbol) + 'GHC.Generics.NoSourceUnpackedness + 'GHC.Generics.NoSourceStrictness + 'GHC.Generics.DecidedLazy) + (GHC.Generics.Rec0 + * GHC.Types.Int)))) + type GHC.Generics.Rep1 * T10604_deriving.Starify = GHC.Generics.D1 + * + ('GHC.Generics.MetaData + "Starify" + "T10604_deriving" + "main" + 'GHC.Types.False) + ((GHC.Generics.:+:) + * + (GHC.Generics.C1 + * + ('GHC.Generics.MetaCons + "Starify1" + 'GHC.Generics.PrefixI + 'GHC.Types.False) + (GHC.Generics.S1 + * + ('GHC.Generics.MetaSel + ('GHC.Base.Nothing + GHC.Types.Symbol) + 'GHC.Generics.NoSourceUnpackedness + 'GHC.Generics.NoSourceStrictness + 'GHC.Generics.DecidedLazy) + GHC.Generics.Par1)) + (GHC.Generics.C1 + * + ('GHC.Generics.MetaCons + "Starify2" + 'GHC.Generics.PrefixI + 'GHC.Types.False) + (GHC.Generics.S1 + * + ('GHC.Generics.MetaSel + ('GHC.Base.Nothing + GHC.Types.Symbol) + 'GHC.Generics.NoSourceUnpackedness + 'GHC.Generics.NoSourceStrictness + 'GHC.Generics.DecidedLazy) + (GHC.Generics.Rec0 + * GHC.Types.Int)))) + + diff --git a/testsuite/tests/generics/T10604/T10604_no_PolyKinds.hs b/testsuite/tests/generics/T10604/T10604_no_PolyKinds.hs new file mode 100644 index 0000000000..bdb98cab69 --- /dev/null +++ b/testsuite/tests/generics/T10604/T10604_no_PolyKinds.hs @@ -0,0 +1,7 @@ +{-# LANGUAGE DeriveGeneric #-} +{-# LANGUAGE KindSignatures #-} +module T10604_no_PolyKinds where + +import GHC.Generics + +data F (f :: * -> *) = F deriving Generic1 diff --git a/testsuite/tests/generics/T10604/T10604_no_PolyKinds.stderr b/testsuite/tests/generics/T10604/T10604_no_PolyKinds.stderr new file mode 100644 index 0000000000..69bc591d01 --- /dev/null +++ b/testsuite/tests/generics/T10604/T10604_no_PolyKinds.stderr @@ -0,0 +1,6 @@ + +T10604_no_PolyKinds.hs:7:35: error: + • Cannot derive well-kinded instance of form ‘Generic1 (F ...)’ + (Perhaps you intended to use PolyKinds) + Class ‘Generic1’ expects an argument of kind ‘* -> *’ + • In the data declaration for ‘F’ diff --git a/testsuite/tests/generics/T10604/all.T b/testsuite/tests/generics/T10604/all.T new file mode 100644 index 0000000000..9f1dbc52e2 --- /dev/null +++ b/testsuite/tests/generics/T10604/all.T @@ -0,0 +1,4 @@ +test('T10604_Authenticated', normal, compile, ['']) +test('T10604_deriving', normal, compile, ['-dsuppress-uniques']) +test('T10604_bad_variable_occurrence', normal, compile_fail, ['']) +test('T10604_no_PolyKinds', normal, compile_fail, ['']) |