summaryrefslogtreecommitdiff
path: root/testsuite/tests/polykinds
diff options
context:
space:
mode:
authorVladislav Zavialov <vlad.z.4096@gmail.com>2018-10-15 13:52:12 -0400
committerBen Gamari <ben@smart-cactus.org>2018-10-15 19:24:16 -0400
commit165d3d5ddaecc7dbe7f5ac051834a7619463efb0 (patch)
tree6ae7967d95ddc071a6dda7e3307f4a16cbf2229f /testsuite/tests/polykinds
parent058c2813d882266309e8045af7a72eedecbf2dbb (diff)
downloadhaskell-165d3d5ddaecc7dbe7f5ac051834a7619463efb0.tar.gz
Enable -Wcompat=error in the testsuite
Enabling -Werror=compat in the testsuite allows us to easily see the impact that a new warning has on code. It also means that in the period between adding the warning and making the actual breaking change, all new test cases that are being added to the testsuite will be forwards-compatible. This is good because it will make the actual breaking change contain less irrelevant testsuite updates. Things that -Wcompat warns about are things that are going to break in the future, so we can be proactive and keep our testsuite forwards-compatible. This patch consists of two main changes: * Add `TEST_HC_OPTS += -Werror=compat` to the testsuite configuration. * Fix all broken test cases. Test Plan: Validate Reviewers: hvr, goldfire, bgamari, simonpj, RyanGlScott Reviewed By: goldfire, RyanGlScott Subscribers: rwbarton, carter GHC Trac Issues: #15278 Differential Revision: https://phabricator.haskell.org/D5200
Diffstat (limited to 'testsuite/tests/polykinds')
-rw-r--r--testsuite/tests/polykinds/Freeman.hs40
-rw-r--r--testsuite/tests/polykinds/PolyInstances.hs4
-rw-r--r--testsuite/tests/polykinds/PolyKinds01.hs4
-rw-r--r--testsuite/tests/polykinds/PolyKinds09.hs12
-rw-r--r--testsuite/tests/polykinds/RedBlack.hs6
-rw-r--r--testsuite/tests/polykinds/T10670.hs3
-rw-r--r--testsuite/tests/polykinds/T11362.hs8
-rw-r--r--testsuite/tests/polykinds/T11480a.hs8
-rw-r--r--testsuite/tests/polykinds/T11821.hs7
-rw-r--r--testsuite/tests/polykinds/T14172a.hs5
-rw-r--r--testsuite/tests/polykinds/T14723.hs2
-rw-r--r--testsuite/tests/polykinds/T14873.hs2
-rw-r--r--testsuite/tests/polykinds/T5862.hs4
-rw-r--r--testsuite/tests/polykinds/T5937.hs4
-rw-r--r--testsuite/tests/polykinds/T5938.hs4
-rw-r--r--testsuite/tests/polykinds/T6002.hs10
-rw-r--r--testsuite/tests/polykinds/T6049.hs8
-rw-r--r--testsuite/tests/polykinds/T6068.hs8
-rw-r--r--testsuite/tests/polykinds/T6081.hs4
-rw-r--r--testsuite/tests/polykinds/T6093.hs6
-rw-r--r--testsuite/tests/polykinds/T6118.hs5
-rw-r--r--testsuite/tests/polykinds/T6137.hs16
-rw-r--r--testsuite/tests/polykinds/T7053a.hs4
-rw-r--r--testsuite/tests/polykinds/T7176.hs2
-rw-r--r--testsuite/tests/polykinds/T7332.hs3
-rw-r--r--testsuite/tests/polykinds/T7347.hs4
-rw-r--r--testsuite/tests/polykinds/T7404.hs4
-rw-r--r--testsuite/tests/polykinds/T7438a.hs4
-rw-r--r--testsuite/tests/polykinds/T7481.hs5
-rw-r--r--testsuite/tests/polykinds/T7601.hs6
-rw-r--r--testsuite/tests/polykinds/T7908.hs14
-rw-r--r--testsuite/tests/polykinds/T7916.hs7
-rw-r--r--testsuite/tests/polykinds/T7973.hs4
-rw-r--r--testsuite/tests/polykinds/T9200.hs4
-rw-r--r--testsuite/tests/polykinds/T9574.hs14
-rw-r--r--testsuite/tests/polykinds/T9725.hs10
-rw-r--r--testsuite/tests/polykinds/T9750.hs3
37 files changed, 158 insertions, 100 deletions
diff --git a/testsuite/tests/polykinds/Freeman.hs b/testsuite/tests/polykinds/Freeman.hs
index 13e5d5cc14..9480af66be 100644
--- a/testsuite/tests/polykinds/Freeman.hs
+++ b/testsuite/tests/polykinds/Freeman.hs
@@ -4,13 +4,13 @@
{-
In the following, I will write a polykinded version of the combinators
fold and unfold, along with three examples: folds for regular
-datatypes (specialized to kind *), folds for nested datatypes
-(specialized to kind * -> *), and folds for mutually recursive data
-types (specialized to the product kind (*,*)). The approach should
+datatypes (specialized to kind Type), folds for nested datatypes
+(specialized to kind Type -> Type), and folds for mutually recursive data
+types (specialized to the product kind (Type, Type)). The approach should
generalise easily enough to things such as types indexed by another
-kind (e.g. by specializing to kind Nat -> *, using the XDataKinds
+kind (e.g. by specializing to kind Nat -> Type, using the XDataKinds
extension), or higher order nested datatypes (e.g. by specializing to
-kind (* -> *) -> (* -> *)).
+kind (Type -> Type) -> (Type -> Type)).
The following will compile in the new GHC 7.4.1 release. We require
the following GHC extensions:
@@ -27,6 +27,8 @@ the following GHC extensions:
{-# LANGUAGE StandaloneDeriving #-}
module Main where
+import Data.Kind (Type)
+
{- The basic fold and unfold combinators can be written as follows:
fold phi = phi . fmap (fold phi) . out
@@ -45,9 +47,9 @@ object, and for every two compatible morphisms, the composition of
those morphisms.
In earlier versions of GHC, the type hom would have been specialized
-to kind * -> * -> *, but with the new PolyKinds extension, hom is
+to kind Type -> Type -> Type, but with the new PolyKinds extension, hom is
polykinded, and the Category typeclass can be instantiated to k -> k
--> * for any kind k. This means that in addition to all of the
+-> Type for any kind k. This means that in addition to all of the
Category instances that we could have written before, we can now write
instances of Category for type constructors, type constructor
constructors, etc.
@@ -67,10 +69,10 @@ transformations. A natural transformation is defined as follows: -}
newtype Nat f g = Nat { nu :: (forall a. f a -> g a) }
{- Here is the Category instance for natural transformations. This
-time the type hom is inferred to have kind (* -> *) -> (* -> *) ->
-*. Identity and composition are both defined pointwise. -}
+time the type hom is inferred to have kind (Type -> Type) -> (Type -> Type) ->
+Type. Identity and composition are both defined pointwise. -}
-instance Category (Nat :: (* -> *) -> (* -> *) -> *) where
+instance Category (Nat :: (Type -> Type) -> (Type -> Type) -> Type) where
ident = Nat id
compose f g = Nat (nu g . nu f)
@@ -143,14 +145,14 @@ depth = (fold :: (FTree a Int -> Int) -> Tree a -> Int) phi where
-- FCTree defines the type constructor CTree as its fixed point:
data FCTree f a = FCLeaf a | FCBranch (f (a, a))
- -- FCTree :: (* -> *) -> * -> *
+ -- FCTree :: (Type -> Type) -> Type -> Type
data CTree a = CLeaf a | CBranch (CTree (a, a))
-- Again, we define type class instances for HFunctor and Rec:
instance HFunctor Nat FCTree where
- hmap (f :: Nat (f :: * -> *) (g :: * -> *)) = Nat ff where
+ hmap (f :: Nat (f :: Type -> Type) (g :: Type -> Type)) = Nat ff where
ff :: forall a. FCTree f a -> FCTree g a
ff (FCLeaf a) = FCLeaf a
ff (FCBranch a) = FCBranch (nu f a)
@@ -167,7 +169,7 @@ instance Rec Nat FCTree CTree where
-- need a type constructor to act as the target of the fold. For our
-- purposes, a constant functor will do:
-data K a b = K a -- K :: forall k. * -> k -> *
+data K a b = K a -- K :: forall k. Type -> k -> Type
-- And finally, the following fold calculates the depth of a complete binary leaf tree:
@@ -183,8 +185,8 @@ datatype of lists of even and odd lengths. The fold will take a list
of even length and produce a list of pairs.
We cannot express type constructors in Haskell whose return kind is
-anything other than *, so we cheat a little and emulate the product
-kind using an arrow kind Choice -> *, where Choice is a two point
+anything other than Type, so we cheat a little and emulate the product
+kind using an arrow kind Choice -> Type, where Choice is a two point
kind, lifted using the XDataKinds extension: -}
data Choice = Fst | Snd
@@ -207,14 +209,14 @@ instance (Category h1, Category h2) => Category (PHom h1 h2) where
-- We can define the types of lists of even and odd length as
-- follows. Note that the kind annotation indicates the appearance of the
--- kind Choice -> *:
+-- kind Choice -> Type:
-data FAlt :: * -> (Choice -> *) -> Choice -> * where
+data FAlt :: Type -> (Choice -> Type) -> Choice -> Type where
FZero :: FAlt a p Fst
FSucc1 :: a -> (p Snd) -> FAlt a p Fst
FSucc2 :: a -> (p Fst) -> FAlt a p Snd
-data Alt :: * -> Choice -> * where
+data Alt :: Type -> Choice -> Type where
Zero :: Alt a Fst
Succ1 :: a -> Alt a Snd -> Alt a Fst
Succ2 :: a -> Alt a Fst -> Alt a Snd
@@ -244,7 +246,7 @@ instance HFunctor (PHom (->) (->)) (FAlt a) where
-- As before, we create a target type for our fold, and this time a type synonym as well:
-data K2 :: * -> * -> Choice -> * where
+data K2 :: Type -> Type -> Choice -> Type where
K21 :: a -> K2 a b Fst
K22 :: b -> K2 a b Snd
diff --git a/testsuite/tests/polykinds/PolyInstances.hs b/testsuite/tests/polykinds/PolyInstances.hs
index cc15126142..858e1b5233 100644
--- a/testsuite/tests/polykinds/PolyInstances.hs
+++ b/testsuite/tests/polykinds/PolyInstances.hs
@@ -4,14 +4,14 @@
module PolyInstances where
-import GHC.Exts
+import Data.Kind
import Data.Proxy
class C (a :: k)
instance (C a, C b) => C (a b)
-data Dict :: Constraint -> *
+data Dict :: Constraint -> Type
instance C Dict
diff --git a/testsuite/tests/polykinds/PolyKinds01.hs b/testsuite/tests/polykinds/PolyKinds01.hs
index 918e5a9a44..ab79bd6799 100644
--- a/testsuite/tests/polykinds/PolyKinds01.hs
+++ b/testsuite/tests/polykinds/PolyKinds01.hs
@@ -4,9 +4,11 @@
module PolyKinds01 where
+import Data.Kind (Type)
+
data Nat = Ze | Su Nat
-data Vec :: * -> Nat -> * where
+data Vec :: Type -> Nat -> Type where
VNil :: Vec a Ze
VCons :: a -> Vec a n -> Vec a (Su n)
diff --git a/testsuite/tests/polykinds/PolyKinds09.hs b/testsuite/tests/polykinds/PolyKinds09.hs
index b874d5ca16..d4f6950417 100644
--- a/testsuite/tests/polykinds/PolyKinds09.hs
+++ b/testsuite/tests/polykinds/PolyKinds09.hs
@@ -6,13 +6,15 @@
module Main where
+import Data.Kind (Type)
+
--------------------------------------------------------------------------------
-- Simple generic programming (instant-generics-like library)
--------------------------------------------------------------------------------
data U a = UNIT | SUM (U a) (U a) | PRODUCT (U a) (U a) | REC a
-- GADT interpretation
-data I :: U * -> * where
+data I :: U Type -> Type where
Unit :: I UNIT
Inl :: I a -> I (SUM a b)
Inr :: I b -> I (SUM a b)
@@ -20,13 +22,13 @@ data I :: U * -> * where
Rec :: a -> I (REC a)
-- Class embedding types and their generic representation
-class Generic (a :: *) where
- type Rep a :: U *
+class Generic (a :: Type) where
+ type Rep a :: U Type
from :: a -> I (Rep a)
to :: I (Rep a) -> a
-- Generic size on representations
-class GSize (a :: U *) where
+class GSize (a :: U Type) where
gsize :: I a -> Int
instance GSize UNIT where
@@ -43,7 +45,7 @@ instance (Size a) => GSize (REC a) where
gsize (Rec x) = 1 + size x
-- Size on datatypes
-class Size (a :: *) where
+class Size (a :: Type) where
size :: a -> Int
default size :: (Generic a, GSize (Rep a)) => a -> Int
size = gsize . from
diff --git a/testsuite/tests/polykinds/RedBlack.hs b/testsuite/tests/polykinds/RedBlack.hs
index 22ec6d2379..95a4f93eb0 100644
--- a/testsuite/tests/polykinds/RedBlack.hs
+++ b/testsuite/tests/polykinds/RedBlack.hs
@@ -7,6 +7,8 @@
{-# LANGUAGE KindSignatures#-}
module RedBlackTree where
+import Data.Kind (Type)
+
data Nat = Zero | Succ Nat deriving (Eq, Ord, Show)
type One = Succ Zero
@@ -17,7 +19,7 @@ data RedBlackTree a = forall n. T ( Node Black n a )
deriving instance Show a => Show (RedBlackTree a)
-- all paths from a node to a leaf have exactly n black nodes
-data Node :: RedBlack -> Nat -> * -> * where
+data Node :: RedBlack -> Nat -> Type -> Type where
-- all leafs are black
Leaf :: Node Black One a
-- internal black nodes can have children of either color
@@ -27,7 +29,7 @@ data Node :: RedBlack -> Nat -> * -> * where
deriving instance Show a => Show (Node c n a)
-- one-hole context for red-black trees
-data Context :: Nat -> RedBlack -> Nat -> * -> * where
+data Context :: Nat -> RedBlack -> Nat -> Type -> Type where
-- if we're at the root, the hole is a black node
Root :: Context n Black n a
-- we can go left or right from a red node hole, creating a hole for a black node
diff --git a/testsuite/tests/polykinds/T10670.hs b/testsuite/tests/polykinds/T10670.hs
index 5b9cc72e21..237ec25fa8 100644
--- a/testsuite/tests/polykinds/T10670.hs
+++ b/testsuite/tests/polykinds/T10670.hs
@@ -3,6 +3,7 @@
module T10670 where
import Unsafe.Coerce
+import Data.Kind (Type)
data TypeRepT (a::k) where
TRCon :: TypeRepT a
@@ -18,7 +19,7 @@ tyRepTArr :: TypeRepT (->)
{-# NOINLINE tyRepTArr #-}
tyRepTArr = TRCon
-s :: forall a x. TypeRepT (a :: *) -> Maybe x
+s :: forall a x. TypeRepT (a :: Type) -> Maybe x
s tf = case getT2 tyRepTArr tf :: Maybe (G2 (->) a) of
Just (G2 _ _) -> Nothing
_ -> Nothing
diff --git a/testsuite/tests/polykinds/T11362.hs b/testsuite/tests/polykinds/T11362.hs
index 945d68f825..d08ebe2461 100644
--- a/testsuite/tests/polykinds/T11362.hs
+++ b/testsuite/tests/polykinds/T11362.hs
@@ -7,20 +7,22 @@
module T11362 where
-- this file when compiled with -dunique-increment=-1 made GHC crash
+import Data.Kind (Type)
+
data Sum a b = L a | R b
-data Sum1 (a :: k1 -> *) (b :: k2 -> *) :: Sum k1 k2 -> * where
+data Sum1 (a :: k1 -> Type) (b :: k2 -> Type) :: Sum k1 k2 -> Type where
LL :: a i -> Sum1 a b (L i)
RR :: b i -> Sum1 a b (R i)
data Code i o = F (Code (Sum i o) o)
-- An interpretation for `Code` using a data family works:
-data family In (f :: Code i o) :: (i -> *) -> (o -> *)
+data family In (f :: Code i o) :: (i -> Type) -> (o -> Type)
data instance In (F f) r o where
MkIn :: In f (Sum1 r (In (F f) r)) o -> In (F f) r o
-- Requires polymorphic recursion
-data In' (f :: Code i o) :: (i -> *) -> o -> * where
+data In' (f :: Code i o) :: (i -> Type) -> o -> Type where
MkIn' :: In' g (Sum1 r (In' (F g) r)) t -> In' (F g) r t
diff --git a/testsuite/tests/polykinds/T11480a.hs b/testsuite/tests/polykinds/T11480a.hs
index eeeaf343fa..b491a21518 100644
--- a/testsuite/tests/polykinds/T11480a.hs
+++ b/testsuite/tests/polykinds/T11480a.hs
@@ -6,15 +6,15 @@
module T11480a where
-import GHC.Types (Constraint)
+import Data.Kind (Type, Constraint)
import qualified Prelude
-data Nat (c :: i -> i -> *) (d :: j -> j -> *) (f :: i -> j) (g :: i -> j)
+data Nat (c :: i -> i -> Type) (d :: j -> j -> Type) (f :: i -> j) (g :: i -> j)
-class Functor p (Nat p (->)) p => Category (p :: i -> i -> *)
+class Functor p (Nat p (->)) p => Category (p :: i -> i -> Type)
class (Category dom, Category cod)
- => Functor (dom :: i -> i -> *) (cod :: j -> j -> *) (f :: i -> j)
+ => Functor (dom :: i -> i -> Type) (cod :: j -> j -> Type) (f :: i -> j)
| f -> dom cod
instance (Category c, Category d) => Category (Nat c d)
diff --git a/testsuite/tests/polykinds/T11821.hs b/testsuite/tests/polykinds/T11821.hs
index 82efeb5f98..d59279af37 100644
--- a/testsuite/tests/polykinds/T11821.hs
+++ b/testsuite/tests/polykinds/T11821.hs
@@ -2,10 +2,11 @@
module NotInScope where
import Data.Proxy
+import Data.Kind (Type)
type KindOf (a :: k) = ('KProxy :: KProxy k)
-data TyFun :: * -> * -> *
-type family Apply (f :: TyFun k1 k2 -> *) (x :: k1) :: k2
+data TyFun :: Type -> Type -> Type
+type family Apply (f :: TyFun k1 k2 -> Type) (x :: k1) :: k2
data Lgo2 l1
l2
@@ -18,7 +19,7 @@ data Lgo2 l1
data Lgo1 l1
l2
l3
- (l4 :: TyFun b (TyFun [a] b -> *))
+ (l4 :: TyFun b (TyFun [a] b -> Type))
= forall (arg :: b) . KindOf (Apply (Lgo1 l1 l2 l3) arg) ~ KindOf (Lgo2 l1 l2 l3 arg) =>
Lgo1KindInference
diff --git a/testsuite/tests/polykinds/T14172a.hs b/testsuite/tests/polykinds/T14172a.hs
index b831372781..2484035e5a 100644
--- a/testsuite/tests/polykinds/T14172a.hs
+++ b/testsuite/tests/polykinds/T14172a.hs
@@ -8,6 +8,7 @@
{-# LANGUAGE UndecidableInstances #-}
module T14172a where
+import Data.Kind
import Data.Coerce
import Data.Functor.Compose
import Data.Functor.Identity
@@ -45,10 +46,10 @@ withIso ai k = case ai (Exchange id Identity) of
{-# INLINE withIso #-}
class Wrapped s where
- type Unwrapped s :: *
+ type Unwrapped s :: Type
_Wrapped' :: Iso' s (Unwrapped s)
-class Wrapped s => Rewrapped (s :: *) (t :: *)
+class Wrapped s => Rewrapped (s :: Type) (t :: Type)
class (Rewrapped s t, Rewrapped t s) => Rewrapping s t
instance (Rewrapped s t, Rewrapped t s) => Rewrapping s t
diff --git a/testsuite/tests/polykinds/T14723.hs b/testsuite/tests/polykinds/T14723.hs
index 9b2f3bf75e..be5d272b66 100644
--- a/testsuite/tests/polykinds/T14723.hs
+++ b/testsuite/tests/polykinds/T14723.hs
@@ -49,7 +49,7 @@ instance (ty ~ Ty x, Coercible x, Coercibles xs tys) => Coercibles (x, xs) '(ty,
qqMarker
:: forall
- -- k -- the kind variable shows up in Core
+ k -- the kind variable shows up in Core
(args_tys :: k) -- JType's of arguments
tyres -- JType of result
(input :: Symbol) -- input string of the quasiquoter
diff --git a/testsuite/tests/polykinds/T14873.hs b/testsuite/tests/polykinds/T14873.hs
index 9450a019bc..0c5462c89a 100644
--- a/testsuite/tests/polykinds/T14873.hs
+++ b/testsuite/tests/polykinds/T14873.hs
@@ -29,7 +29,7 @@ class PColumn (f :: Type -> Type) where
type Col (x :: f a) (y :: a) :: Bool
class SColumn (f :: Type -> Type) where
- sCol :: forall (x :: f a) (y :: a).
+ sCol :: forall a (x :: f a) (y :: a).
Sing x -> Sing y -> Sing (Col x y :: Bool)
instance (SColumn f, SingI x) => SingI (ColSym1 (x :: f a) :: a ~> Bool) where
diff --git a/testsuite/tests/polykinds/T5862.hs b/testsuite/tests/polykinds/T5862.hs
index 7376271865..68a74d3498 100644
--- a/testsuite/tests/polykinds/T5862.hs
+++ b/testsuite/tests/polykinds/T5862.hs
@@ -7,6 +7,8 @@
module T5862 where
+import Data.Kind (Type)
+
data Nat = Zero | Succ Nat
data SNat a where
@@ -24,4 +26,4 @@ data SMaybe a where
type family Sing (a :: k)
type instance Sing (a :: Nat) = SNat a
type instance Sing (a :: Bool) = SBool a
-type instance Sing (a :: Maybe *) = SMaybe a -- want to say Maybe k
+type instance Sing (a :: Maybe Type) = SMaybe a -- want to say Maybe k
diff --git a/testsuite/tests/polykinds/T5937.hs b/testsuite/tests/polykinds/T5937.hs
index 20bc59e6f1..9d51f207f1 100644
--- a/testsuite/tests/polykinds/T5937.hs
+++ b/testsuite/tests/polykinds/T5937.hs
@@ -1,6 +1,8 @@
{-# LANGUAGE PolyKinds, KindSignatures, DataKinds, GADTs #-}
module T5937 where
-data SMaybe :: (k -> *) -> Maybe k -> * where
+import Data.Kind (Type)
+
+data SMaybe :: (k -> Type) -> Maybe k -> Type where
SNothing :: SMaybe s 'Nothing
SJust :: s a -> SMaybe s ('Just a)
diff --git a/testsuite/tests/polykinds/T5938.hs b/testsuite/tests/polykinds/T5938.hs
index e2c63af8a2..aea6b52aad 100644
--- a/testsuite/tests/polykinds/T5938.hs
+++ b/testsuite/tests/polykinds/T5938.hs
@@ -1,7 +1,9 @@
{-# LANGUAGE PolyKinds, TypeFamilies, DataKinds #-}
module T5938 where
+import Data.Kind (Type)
+
type family KindFam (a :: k)
-type instance KindFam (a :: *) = Int
+type instance KindFam (a :: Type) = Int
type instance KindFam (a :: Bool) = Bool
type instance KindFam (a :: Maybe k) = Char -- doesn't work
diff --git a/testsuite/tests/polykinds/T6002.hs b/testsuite/tests/polykinds/T6002.hs
index 1d4fb7fb09..5a1b0edd3e 100644
--- a/testsuite/tests/polykinds/T6002.hs
+++ b/testsuite/tests/polykinds/T6002.hs
@@ -13,6 +13,8 @@ reimplemented in Haskell for our purposes. -}
RankNTypes, TypeFamilies, FlexibleInstances, IncoherentInstances #-}
module TypeMachinery where
+import Data.Kind (Type)
+
-- The natural numbers:
-- o first the phantom types
@@ -20,7 +22,7 @@ data Z; data S n
-- o the using the above the singleton type Nat'
-data Nat' :: * -> * where
+data Nat' :: Type -> Type where
Z :: Nat' Z
S :: Nat' n -> Nat' (S n)
@@ -28,7 +30,7 @@ deriving instance Show (Nat' a)
-- Type-level addition
-type family Plus m n :: *
+type family Plus m n :: Type
type instance Plus Z n = n
type instance Plus (S m) n = S (Plus m n)
@@ -48,7 +50,7 @@ sameNat' _ _ = False
-- A data type for existentially hiding
-- (e.g.) Nat' values
-data Hidden :: (* -> *) -> * where
+data Hidden :: (Type -> Type) -> Type where
Hide :: Show (a n) => a n -> Hidden a
deriving instance Show (Hidden t)
@@ -93,7 +95,7 @@ instance Integral (Hidden Nat') where
-- McBride's Fin data type. By counting backwards from the
-- result index, it only admits a fixed number of inhabitants.
-data Fin :: * -> * where
+data Fin :: Type -> Type where
Stop :: Fin (S Z)
Retreat :: Fin s -> Fin (S s)
diff --git a/testsuite/tests/polykinds/T6049.hs b/testsuite/tests/polykinds/T6049.hs
index 51e5958fa9..e332244243 100644
--- a/testsuite/tests/polykinds/T6049.hs
+++ b/testsuite/tests/polykinds/T6049.hs
@@ -2,7 +2,9 @@
module T6049 where
-data SMaybe :: (k -> *) -> Maybe k -> * where
- SNothing :: forall (s :: k -> *). SMaybe s Nothing
- SJust :: forall (s :: k -> *) (a :: k). SMaybe s (Just a)
+import Data.Kind (Type)
+
+data SMaybe :: (k -> Type) -> Maybe k -> Type where
+ SNothing :: forall k (s :: k -> Type). SMaybe s Nothing
+ SJust :: forall k (s :: k -> Type) (a :: k). SMaybe s (Just a)
diff --git a/testsuite/tests/polykinds/T6068.hs b/testsuite/tests/polykinds/T6068.hs
index 7b90b4ebaf..cce718e92f 100644
--- a/testsuite/tests/polykinds/T6068.hs
+++ b/testsuite/tests/polykinds/T6068.hs
@@ -5,8 +5,9 @@
module T6068 where
import Prelude hiding (Maybe, Nothing)
+import Data.Kind (Type)
-data Maybe :: * -> * where
+data Maybe :: Type -> Type where
Nothing :: Maybe a
data family Sing (a :: k)
@@ -14,7 +15,7 @@ data family Sing (a :: k)
data instance Sing (a :: Maybe k) where
SNothing :: Sing Nothing
-data KProxy (a :: *) = KProxy
+data KProxy (a :: Type) = KProxy
data Existential (p :: KProxy k) =
forall (a :: k). Exists (Sing a)
@@ -26,5 +27,6 @@ class Floop a b | a -> b
instance Floop a (mp :: KProxy (Maybe ak)) => HasSingleton (Maybe a) mp where
exists Nothing = Exists SNothing
--- instance forall (a ::*) (mp :: KProxy (Maybe ak)). HasSingleton (Maybe ak) (Maybe a) mp where
+-- instance forall (a ::Type) (mp :: KProxy (Maybe ak)).
+-- HasSingleton (Maybe ak) (Maybe a) mp where
-- exists Nothing = Exists SNothing
diff --git a/testsuite/tests/polykinds/T6081.hs b/testsuite/tests/polykinds/T6081.hs
index ac1bd98252..97b4e5c8f3 100644
--- a/testsuite/tests/polykinds/T6081.hs
+++ b/testsuite/tests/polykinds/T6081.hs
@@ -2,7 +2,9 @@
module T6081 where
-data KProxy (a :: *) = KP
+import Data.Kind (Type)
+
+data KProxy (a :: Type) = KP
class KindClass (kp :: KProxy k)
instance KindClass (KP :: KProxy [k])
diff --git a/testsuite/tests/polykinds/T6093.hs b/testsuite/tests/polykinds/T6093.hs
index 1063b8661d..6ba0878b87 100644
--- a/testsuite/tests/polykinds/T6093.hs
+++ b/testsuite/tests/polykinds/T6093.hs
@@ -1,12 +1,14 @@
{-# LANGUAGE GADTs, RankNTypes, PolyKinds #-}
module T6093 where
+import qualified Data.Kind as K (Type)
+
-- Polymorphic kind recursion
-data R :: forall k. k -> * where
+data R :: forall k. k -> K.Type where
MkR :: R f -> R (f ())
data IOWitness (a :: k) = IOW
-data Type :: forall k. k -> * where
+data Type :: forall k. k -> K.Type where
SimpleType :: IOWitness a -> Type a
ConstructedType :: Type f -> Type a -> Type (f a)
diff --git a/testsuite/tests/polykinds/T6118.hs b/testsuite/tests/polykinds/T6118.hs
index aaa78e7cee..355c8fb72a 100644
--- a/testsuite/tests/polykinds/T6118.hs
+++ b/testsuite/tests/polykinds/T6118.hs
@@ -3,13 +3,14 @@
module T6118 where
-import GHC.Exts
+import GHC.Exts (Any)
+import Data.Kind (Type)
data Nat = Zero | Succ Nat
data List a = Nil | Cons a (List a)
class SingE (a :: k) where
- type Demote a :: *
+ type Demote a :: Type
instance SingE (a :: Bool) where
type Demote a = Bool
diff --git a/testsuite/tests/polykinds/T6137.hs b/testsuite/tests/polykinds/T6137.hs
index aac4c1c8b6..b3f0c02ba6 100644
--- a/testsuite/tests/polykinds/T6137.hs
+++ b/testsuite/tests/polykinds/T6137.hs
@@ -6,29 +6,33 @@
module T6137 where
+import Data.Kind (Type)
+
data Sum a b = L a | R b
-data Sum1 (a :: k1 -> *) (b :: k2 -> *) :: Sum k1 k2 -> * where
+data Sum1 (a :: k1 -> Type) (b :: k2 -> Type) :: Sum k1 k2 -> Type where
LL :: a i -> Sum1 a b (L i)
RR :: b i -> Sum1 a b (R i)
data Code i o = F (Code (Sum i o) o)
-- An interpretation for `Code` using a data family works:
-data family In (f :: Code i o) :: (i -> *) -> (o -> *)
+data family In (f :: Code i o) :: (i -> Type) -> (o -> Type)
data instance In (F f) r x where
MkIn :: In f (Sum1 r (In (F f) r)) x -> In (F f) r x
{- data R:InioFrx o i f r x where
- where MkIn :: forall o i (f :: Code (Sum i o) o) (r :: i -> *) (x :: o).
+ where MkIn :: forall o i (f :: Code (Sum i o) o)
+ (r :: i -> Type)
+ (x :: o).
In (Sum i o) o f (Sum1 o i r (In i o ('F i o f) r)) x
-> R:InioFrx o i f r x
- So R:InioFrx :: forall o i. Code i o -> (i -> *) -> o -> *
+ So R:InioFrx :: forall o i. Code i o -> (i -> Type) -> o -> Type
- data family In i o (f :: Code i o) (a :: i -> *) (b :: o)
+ data family In i o (f :: Code i o) (a :: i -> Type) (b :: o)
axiom D:R:InioFrx0 ::
forall o i (f :: Code (Sum i o) o).
@@ -38,5 +42,5 @@ data instance In (F f) r x where
D:R:InioFrx0 :: R:InioFrx o i f ~ In i o ('F i o f)
-}
-- Requires polymorphic recursion
-data In' (f :: Code i o) :: (i -> *) -> o -> * where
+data In' (f :: Code i o) :: (i -> Type) -> o -> Type where
MkIn' :: In' g (Sum1 r (In' (F g) r)) t -> In' (F g) r t
diff --git a/testsuite/tests/polykinds/T7053a.hs b/testsuite/tests/polykinds/T7053a.hs
index f43f2f7602..d5ae04690b 100644
--- a/testsuite/tests/polykinds/T7053a.hs
+++ b/testsuite/tests/polykinds/T7053a.hs
@@ -2,7 +2,9 @@
module T7053a where
+import Data.Kind (Type)
+
-- This time with a fully-specified kind signature
-data TypeRep (a :: k) :: * where
+data TypeRep (a :: k) :: Type where
TyApp :: TypeRep a -> TypeRep b -> TypeRep (a b)
diff --git a/testsuite/tests/polykinds/T7176.hs b/testsuite/tests/polykinds/T7176.hs
index e3416d1420..013b18c55e 100644
--- a/testsuite/tests/polykinds/T7176.hs
+++ b/testsuite/tests/polykinds/T7176.hs
@@ -9,7 +9,7 @@ data SMaybe (a :: Maybe c) where
SJust :: Sing a -> SMaybe (Just a)
type instance Sing (a :: Maybe d) = SMaybe a
-sIsJust :: forall (a :: Maybe e). Sing a -> ()
+sIsJust :: forall e (a :: Maybe e). Sing a -> ()
sIsJust SNothing = ()
sIsJust (SJust _) = ()
diff --git a/testsuite/tests/polykinds/T7332.hs b/testsuite/tests/polykinds/T7332.hs
index 75a6cbc991..a4c1761e7f 100644
--- a/testsuite/tests/polykinds/T7332.hs
+++ b/testsuite/tests/polykinds/T7332.hs
@@ -8,6 +8,7 @@
module T7332 where
import GHC.Exts( IsString(..) )
+import Data.Kind (Type)
import Data.Monoid
import Data.Semigroup
@@ -19,7 +20,7 @@ instance IsString (DC String) where
class Monoid acc => Build acc r where
- type BuildR r :: * -- Result type
+ type BuildR r :: Type -- Result type
build :: (acc -> BuildR r) -> acc -> r
instance Monoid dc => Build dc (DC dx) where
diff --git a/testsuite/tests/polykinds/T7347.hs b/testsuite/tests/polykinds/T7347.hs
index dbc52f0e4e..2baab317b7 100644
--- a/testsuite/tests/polykinds/T7347.hs
+++ b/testsuite/tests/polykinds/T7347.hs
@@ -5,7 +5,9 @@
module T7347 where
+import Data.Kind (Type)
+
data K = forall a. T a -- Existential: promotion gives 'T :: forall k. k -> K
-data G :: K -> * where
+data G :: K -> Type where
D :: G (T []) -- Uses existential
diff --git a/testsuite/tests/polykinds/T7404.hs b/testsuite/tests/polykinds/T7404.hs
index e16c7d2c6a..653789c6fe 100644
--- a/testsuite/tests/polykinds/T7404.hs
+++ b/testsuite/tests/polykinds/T7404.hs
@@ -1,4 +1,6 @@
{-# LANGUAGE TypeFamilies, PolyKinds, ScopedTypeVariables #-}
module T7404 where
-type family Foo (x :: *) (y :: x)
+import Data.Kind (Type)
+
+type family Foo (x :: Type) (y :: x)
diff --git a/testsuite/tests/polykinds/T7438a.hs b/testsuite/tests/polykinds/T7438a.hs
index f48ed980df..ee452e94ba 100644
--- a/testsuite/tests/polykinds/T7438a.hs
+++ b/testsuite/tests/polykinds/T7438a.hs
@@ -2,7 +2,9 @@
module T7438a where
-data Thrist :: k -> k -> * where
+import Data.Kind (Type)
+
+data Thrist :: k -> k -> Type where
Nil :: Thrist a a
diff --git a/testsuite/tests/polykinds/T7481.hs b/testsuite/tests/polykinds/T7481.hs
index cb64d393a4..b402ce2b80 100644
--- a/testsuite/tests/polykinds/T7481.hs
+++ b/testsuite/tests/polykinds/T7481.hs
@@ -2,11 +2,12 @@
module T7481 where
+import Data.Kind (Type)
import Data.Proxy
data D a where
D1 :: a -> D a
D2 :: (a~Int) => D a
- D3 :: forall (a::k) b. Proxy a -> D b
+ D3 :: forall k (a::k) b. Proxy a -> D b
-data Foo :: D * -> * \ No newline at end of file
+data Foo :: D Type -> Type
diff --git a/testsuite/tests/polykinds/T7601.hs b/testsuite/tests/polykinds/T7601.hs
index f2325abc7c..4464c2b515 100644
--- a/testsuite/tests/polykinds/T7601.hs
+++ b/testsuite/tests/polykinds/T7601.hs
@@ -3,10 +3,10 @@
module T7601 where
-import GHC.Exts
+import Data.Kind
class C (a :: k) where
type F (a :: k)
-class Category (c :: k -> k -> *) where
- type Ob c :: k -> Constraint \ No newline at end of file
+class Category (c :: k -> k -> Type) where
+ type Ob c :: k -> Constraint
diff --git a/testsuite/tests/polykinds/T7908.hs b/testsuite/tests/polykinds/T7908.hs
index 5895bbeddf..14178b204e 100644
--- a/testsuite/tests/polykinds/T7908.hs
+++ b/testsuite/tests/polykinds/T7908.hs
@@ -2,7 +2,9 @@
module T7908 where
-class Monad' (m :: (k -> *) -> *) where
+import Data.Kind (Type)
+
+class Monad' (m :: (k -> Type) -> Type) where
return' :: c a -> m c
(>>>=) :: m c -> (forall a . c a -> m d) -> m d
(>>-) :: m c -> (forall a . c a -> d) -> d
@@ -14,15 +16,17 @@ data Nat' (n :: Nat) where
Z :: Nat' Z'
S :: Nat' n -> Nat' (S' n)
-data Hidden :: (k -> *) -> * where
+data Hidden :: (k -> Type) -> Type where
Hide :: m a -> Hidden m
instance Monad' Hidden where
- return' :: forall (c :: k -> *) (a :: k) . c a -> Hidden c
+ return' :: forall k (c :: k -> Type) (a :: k) . c a -> Hidden c
return' = Hide
- (>>>=) :: forall (c :: k -> *) (d :: k -> *) . Hidden c -> (forall (a :: k) . c a -> Hidden d) -> Hidden d
+ (>>>=) :: forall k (c :: k -> Type) (d :: k -> Type) .
+ Hidden c -> (forall (a :: k) . c a -> Hidden d) -> Hidden d
Hide a >>>= f = f a
- (>>-) :: forall (c :: k -> *) d . Hidden c -> (forall (a :: k) . c a -> d) -> d
+ (>>-) :: forall k (c :: k -> Type) d .
+ Hidden c -> (forall (a :: k) . c a -> d) -> d
Hide a >>- f = f a
diff --git a/testsuite/tests/polykinds/T7916.hs b/testsuite/tests/polykinds/T7916.hs
index c9368e70e4..0715c789ac 100644
--- a/testsuite/tests/polykinds/T7916.hs
+++ b/testsuite/tests/polykinds/T7916.hs
@@ -1,15 +1,16 @@
{-# LANGUAGE PolyKinds, ExplicitForAll #-}
module T7916 where
+import Data.Kind (Type)
-f :: forall (m :: k -> *) (a :: k). m a -> m a
+f :: forall k (m :: k -> Type) (a :: k). m a -> m a
f = id
--- g :: forall (m :: k -> *) (a :: k). m a -> m a
+-- g :: forall (m :: k -> Type) (a :: k). m a -> m a
g x = f x
data M f = M (f Int)
--- Test that g :: forall (m :: k -> *) (a :: k). m a -> m a
+-- Test that g :: forall (m :: k -> Type) (a :: k). m a -> m a
g1 = g :: [Int] -> [Int]
g2 = g :: M [] -> M []
diff --git a/testsuite/tests/polykinds/T7973.hs b/testsuite/tests/polykinds/T7973.hs
index 05787d2295..44e3ac0468 100644
--- a/testsuite/tests/polykinds/T7973.hs
+++ b/testsuite/tests/polykinds/T7973.hs
@@ -3,8 +3,10 @@
module Test where
+import Data.Kind (Type)
+
-- Kind-level proxies.
-data {-kind-} K (a :: *) = KP
+data {-kind-} K (a :: Type) = KP
-- A type with 1 kind-polymorphic type argument.
data T (n :: k)
diff --git a/testsuite/tests/polykinds/T9200.hs b/testsuite/tests/polykinds/T9200.hs
index 740536a516..63c934c91b 100644
--- a/testsuite/tests/polykinds/T9200.hs
+++ b/testsuite/tests/polykinds/T9200.hs
@@ -2,6 +2,8 @@
TypeFamilies #-}
module T9200 where
+
+import Data.Kind (Type)
import Data.Proxy
------
@@ -18,7 +20,7 @@ class C () a => D a
data T1 a b c = MkT1 (S True b c)
data T2 p q r = MkT2 (S p 5 r)
data T3 x y q = MkT3 (S x y '())
-type S (f :: k1) (g :: k2) (h :: k3) = ((T1 f g h, T2 f g h, T3 f g h) :: *)
+type S (f :: k1) (g :: k2) (h :: k3) = ((T1 f g h, T2 f g h, T3 f g h) :: Type)
----------
diff --git a/testsuite/tests/polykinds/T9574.hs b/testsuite/tests/polykinds/T9574.hs
index e806e2a6a2..3ad0bec9d2 100644
--- a/testsuite/tests/polykinds/T9574.hs
+++ b/testsuite/tests/polykinds/T9574.hs
@@ -1,18 +1,20 @@
{-# LANGUAGE PolyKinds, DataKinds, TypeFamilies, ScopedTypeVariables, GADTs, RankNTypes #-}
module T9574 where
-data KProxy (t :: *) = KProxy
+import Data.Kind (Type)
+
+data KProxy (t :: Type) = KProxy
data Proxy p
class Funct f where
- type Codomain f :: *
+ type Codomain f :: Type
instance Funct ('KProxy :: KProxy o) where
- type Codomain 'KProxy = NatTr (Proxy :: o -> *)
+ type Codomain 'KProxy = NatTr (Proxy :: o -> Type)
-data NatTr (c :: o -> *) where
- M :: (forall (a :: o). Proxy a) -> NatTr (c :: o -> *)
+data NatTr (c :: o -> Type) where
+ M :: (forall (a :: o). Proxy a) -> NatTr (c :: o -> Type)
-p :: forall (c :: o -> *). NatTr c
+p :: forall o (c :: o -> Type). NatTr c
p = M t where
M t = undefined :: Codomain ('KProxy :: KProxy o)
diff --git a/testsuite/tests/polykinds/T9725.hs b/testsuite/tests/polykinds/T9725.hs
index 9a3d529d96..c9ca2c6a9c 100644
--- a/testsuite/tests/polykinds/T9725.hs
+++ b/testsuite/tests/polykinds/T9725.hs
@@ -1,22 +1,24 @@
{-# LANGUAGE GADTs, DataKinds, KindSignatures, PolyKinds, FlexibleContexts, RankNTypes, ScopedTypeVariables #-}
module T9725 where
+import Data.Kind (Type)
+
data En = M Bool
class Kn (l :: En)
instance Kn (M b)
-data Fac :: En -> * where
+data Fac :: En -> Type where
Mo :: Kn (M b) => Fac (M b)
-data Fm :: * -> * where
+data Fm :: Type -> Type where
HiF :: Kn (ent b) => Fm (Fac (ent b)) -> Fm (O ent)
MoF :: Kn (M b) => Fm (Fac (M b))
-data O :: (k -> En) -> * where
+data O :: (k -> En) -> Type where
Hi :: Fac (ent k) -> O ent
-data Co :: (* -> *) -> * -> * where
+data Co :: (Type -> Type) -> Type -> Type where
Ab :: (t -> f t) -> Co f t
-- Restricted kind signature:
diff --git a/testsuite/tests/polykinds/T9750.hs b/testsuite/tests/polykinds/T9750.hs
index 59b8e60a31..9cce81d7a6 100644
--- a/testsuite/tests/polykinds/T9750.hs
+++ b/testsuite/tests/polykinds/T9750.hs
@@ -6,6 +6,7 @@
module T9750 where
+import Data.Kind (Type)
import GHC.TypeLits ( Symbol, KnownSymbol )
--------------------------------------------------------------------------------
@@ -14,7 +15,7 @@ data Meta = MetaCons Symbol
data M1 (c :: Meta) = M1
class Generic a where
- type Rep a :: *
+ type Rep a :: Type
from :: a -> Rep a
--------------------------------------------------------------------------------