diff options
author | Vladislav Zavialov <vlad.z.4096@gmail.com> | 2018-10-15 13:52:12 -0400 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2018-10-15 19:24:16 -0400 |
commit | 165d3d5ddaecc7dbe7f5ac051834a7619463efb0 (patch) | |
tree | 6ae7967d95ddc071a6dda7e3307f4a16cbf2229f /testsuite | |
parent | 058c2813d882266309e8045af7a72eedecbf2dbb (diff) | |
download | haskell-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')
301 files changed, 1277 insertions, 796 deletions
diff --git a/testsuite/mk/test.mk b/testsuite/mk/test.mk index d9a13aa711..f036110e07 100644 --- a/testsuite/mk/test.mk +++ b/testsuite/mk/test.mk @@ -53,6 +53,9 @@ TEST_HC_OPTS += -fdiagnostics-color=never TEST_HC_OPTS += -fno-diagnostics-show-caret endif +# See Trac #15278. +TEST_HC_OPTS += -Werror=compat + # Add the no-debug-output last as it is often convenient to copy the test invocation # removing this line. TEST_HC_OPTS += -dno-debug-output diff --git a/testsuite/tests/deSugar/should_compile/T10767.hs b/testsuite/tests/deSugar/should_compile/T10767.hs index 65d08f4c8b..f4829ed3ef 100644 --- a/testsuite/tests/deSugar/should_compile/T10767.hs +++ b/testsuite/tests/deSugar/should_compile/T10767.hs @@ -16,9 +16,10 @@ T10767.hs:43:1: Warning: -} import Data.Proxy +import Data.Kind (Type) class SpecList a where - type List a :: * + type List a :: Type slCase :: List a -> b -> (a -> List a -> b) -> b diff --git a/testsuite/tests/deSugar/should_compile/T12944.hs b/testsuite/tests/deSugar/should_compile/T12944.hs index 24d4c95d61..076812d6e7 100644 --- a/testsuite/tests/deSugar/should_compile/T12944.hs +++ b/testsuite/tests/deSugar/should_compile/T12944.hs @@ -3,6 +3,8 @@ module T12944 () where +import Data.Kind (Type) + class AdditiveGroup v where (^+^) :: v -> v -> v negateV :: v -> v @@ -10,7 +12,7 @@ class AdditiveGroup v where v ^-^ v' = v ^+^ negateV v' class AdditiveGroup v => VectorSpace v where - type Scalar v :: * + type Scalar v :: Type (*^) :: Scalar v -> v -> v data Poly1 a = Poly1 a a diff --git a/testsuite/tests/deSugar/should_run/dsrun010.hs b/testsuite/tests/deSugar/should_run/dsrun010.hs index 5657fb7526..1d4fc485e0 100644 --- a/testsuite/tests/deSugar/should_run/dsrun010.hs +++ b/testsuite/tests/deSugar/should_run/dsrun010.hs @@ -3,6 +3,7 @@ -- runtime exception {-# LANGUAGE NoMonadFailDesugaring #-} +{-# OPTIONS -Wno-missing-monadfail-instances #-} import Control.Monad import Data.Maybe diff --git a/testsuite/tests/dependent/should_compile/Dep1.hs b/testsuite/tests/dependent/should_compile/Dep1.hs index 086d759bbe..e1bdc9e441 100644 --- a/testsuite/tests/dependent/should_compile/Dep1.hs +++ b/testsuite/tests/dependent/should_compile/Dep1.hs @@ -6,7 +6,7 @@ import Data.Kind data Proxy k (a :: k) = P -x :: Proxy * Int +x :: Proxy Type Int x = P y :: Proxy Bool True diff --git a/testsuite/tests/dependent/should_compile/Dep3.hs b/testsuite/tests/dependent/should_compile/Dep3.hs index db10d2a8c6..bbad15eec2 100644 --- a/testsuite/tests/dependent/should_compile/Dep3.hs +++ b/testsuite/tests/dependent/should_compile/Dep3.hs @@ -5,16 +5,16 @@ module Dep3 where import Data.Kind import GHC.Exts ( Constraint ) -type Star1 = * +type Star1 = Type data Id1 (a :: Star1) where Id1 :: a -> Id1 a -data Id1' :: Star1 -> * where +data Id1' :: Star1 -> Type where Id1' :: a -> Id1' a type family Star2 x where - Star2 x = * + Star2 x = Type data Id2a (a :: Star2 Constraint) = Id2a a @@ -22,5 +22,5 @@ data Id2a (a :: Star2 Constraint) = Id2a a data Id2 (a :: Star2 Constraint) where Id2 :: a -> Id2 a -data Id2' :: Star2 Constraint -> * where +data Id2' :: Star2 Constraint -> Type where Id2' :: a -> Id2' a diff --git a/testsuite/tests/dependent/should_compile/KindEqualities.hs b/testsuite/tests/dependent/should_compile/KindEqualities.hs index 1caa46f7c3..b5c46768e5 100644 --- a/testsuite/tests/dependent/should_compile/KindEqualities.hs +++ b/testsuite/tests/dependent/should_compile/KindEqualities.hs @@ -5,7 +5,7 @@ module KindEqualities where import Data.Kind -data TyRep1 :: * -> * where +data TyRep1 :: Type -> Type where TyInt1 :: TyRep1 Int TyBool1 :: TyRep1 Bool @@ -15,13 +15,13 @@ zero1 TyBool1 = False data Proxy (a :: k) = P -data TyRep :: forall k. k -> * where +data TyRep :: forall k. k -> Type where TyInt :: TyRep Int TyBool :: TyRep Bool TyMaybe :: TyRep Maybe TyApp :: TyRep a -> TyRep b -> TyRep (a b) -zero :: forall (a :: *). TyRep a -> a +zero :: forall (a :: Type). TyRep a -> a zero TyInt = 0 zero TyBool = False zero (TyApp TyMaybe _) = Nothing diff --git a/testsuite/tests/dependent/should_compile/KindEqualities2.hs b/testsuite/tests/dependent/should_compile/KindEqualities2.hs index 0bdfcfa034..d24502bc71 100644 --- a/testsuite/tests/dependent/should_compile/KindEqualities2.hs +++ b/testsuite/tests/dependent/should_compile/KindEqualities2.hs @@ -8,7 +8,7 @@ import GHC.Exts ( Any ) data Kind = Star | Arr Kind Kind -data Ty :: Kind -> * where +data Ty :: Kind -> Type where TInt :: Ty Star TBool :: Ty Star TMaybe :: Ty (Arr Star Star) @@ -22,7 +22,7 @@ data TyRep (k :: Kind) (t :: Ty k) where TyApp :: TyRep (Arr k1 k2) a -> TyRep k1 b -> TyRep k2 (TApp a b) type family IK (k :: Kind) -type instance IK Star = * +type instance IK Star = Type type instance IK (Arr k1 k2) = IK k1 -> IK k2 $(return []) -- necessary because the following instances depend on the diff --git a/testsuite/tests/dependent/should_compile/KindLevels.hs b/testsuite/tests/dependent/should_compile/KindLevels.hs index 5540ce40cd..8bcd7b6e41 100644 --- a/testsuite/tests/dependent/should_compile/KindLevels.hs +++ b/testsuite/tests/dependent/should_compile/KindLevels.hs @@ -5,7 +5,7 @@ module KindLevels where import Data.Kind data A -data B :: A -> * -data C :: B a -> * -data D :: C b -> * -data E :: D c -> * +data B :: A -> Type +data C :: B a -> Type +data D :: C b -> Type +data E :: D c -> Type diff --git a/testsuite/tests/dependent/should_compile/RaeJobTalk.hs b/testsuite/tests/dependent/should_compile/RaeJobTalk.hs index 1a22573109..6c74e10a7c 100644 --- a/testsuite/tests/dependent/should_compile/RaeJobTalk.hs +++ b/testsuite/tests/dependent/should_compile/RaeJobTalk.hs @@ -104,7 +104,7 @@ type family Primitive (a :: k) :: Constraint where Primitive _ = (() :: Constraint) data TypeRep (a :: k) where - TyCon :: forall (a :: k). (Primitive a, Typeable k) => TyCon a -> TypeRep a + TyCon :: forall k (a :: k). (Primitive a, Typeable k) => TyCon a -> TypeRep a TyApp :: TypeRep a -> TypeRep b -> TypeRep (a b) -- Equality on TypeReps @@ -121,7 +121,7 @@ eqT _ _ = Nothing -- Existentials data TyConX where - TyConX :: forall (a :: k). (Primitive a, Typeable k) => TyCon a -> TyConX + TyConX :: forall k (a :: k). (Primitive a, Typeable k) => TyCon a -> TyConX instance Read TyConX where readsPrec _ "Int" = [(TyConX Int, "")] @@ -408,11 +408,11 @@ loadTable name schema = do -- propositions. In Haskell, these inductively defined propositions take the form of -- GADTs. In their original form, they would look like this: {- -data InProof :: Column -> Schema -> * where +data InProof :: Column -> Schema -> Type where InHere :: InProof col (col ': schTail) InThere :: InProof col cols -> InProof col (a ': cols) -data SubsetProof :: Schema -> Schema -> * where +data SubsetProof :: Schema -> Schema -> Type where SubsetEmpty :: SubsetProof '[] s' SubsetCons :: InProof col s' -> SubsetProof cols s' -> SubsetProof (col ': cols) s' diff --git a/testsuite/tests/dependent/should_compile/T11311.hs b/testsuite/tests/dependent/should_compile/T11311.hs index 88f0e45861..2dda869ce2 100644 --- a/testsuite/tests/dependent/should_compile/T11311.hs +++ b/testsuite/tests/dependent/should_compile/T11311.hs @@ -3,6 +3,6 @@ module T11311 where import Data.Kind foo :: () -foo = (id :: * -> *) undefined `seq` () +foo = (id :: Type -> Type) undefined `seq` () main = print foo diff --git a/testsuite/tests/dependent/should_compile/T11635.hs b/testsuite/tests/dependent/should_compile/T11635.hs index 61d9978e55..c767d5d3be 100644 --- a/testsuite/tests/dependent/should_compile/T11635.hs +++ b/testsuite/tests/dependent/should_compile/T11635.hs @@ -4,4 +4,4 @@ module T11635 where import Data.Kind -data X (a :: forall k. k -> * ) b = X +data X (a :: forall k. k -> Type) b = X diff --git a/testsuite/tests/dependent/should_compile/T15264.hs b/testsuite/tests/dependent/should_compile/T15264.hs index a03cf4346e..f3dec42564 100644 --- a/testsuite/tests/dependent/should_compile/T15264.hs +++ b/testsuite/tests/dependent/should_compile/T15264.hs @@ -1,5 +1,5 @@ {-# LANGUAGE ExplicitForAll, PolyKinds #-} -{-# OPTIONS -Wcompat #-} +{-# OPTIONS -Wcompat -Wno-error=implicit-kind-vars #-} module T15264 where diff --git a/testsuite/tests/dependent/should_compile/T15346.hs b/testsuite/tests/dependent/should_compile/T15346.hs index 3d8d49b9d2..be70911f7e 100644 --- a/testsuite/tests/dependent/should_compile/T15346.hs +++ b/testsuite/tests/dependent/should_compile/T15346.hs @@ -24,7 +24,7 @@ class SDecide k where instance SDecide () where test = undefined -test1 :: forall (a :: k). SDecide (Rep k) => Proxy a +test1 :: forall k (a :: k). SDecide (Rep k) => Proxy a test1 = seq (test @_ @(PFrom a)) Proxy test2 :: forall (a :: ()). Proxy a diff --git a/testsuite/tests/dependent/should_compile/T9632.hs b/testsuite/tests/dependent/should_compile/T9632.hs index f2099aa22b..f78726d035 100644 --- a/testsuite/tests/dependent/should_compile/T9632.hs +++ b/testsuite/tests/dependent/should_compile/T9632.hs @@ -5,7 +5,7 @@ module T9632 where import Data.Kind data B = T | F -data P :: B -> * +data P :: B -> Type type B' = B -data P' :: B' -> * +data P' :: B' -> Type diff --git a/testsuite/tests/dependent/should_compile/mkGADTVars.hs b/testsuite/tests/dependent/should_compile/mkGADTVars.hs index 9b48e8c395..70753256d8 100644 --- a/testsuite/tests/dependent/should_compile/mkGADTVars.hs +++ b/testsuite/tests/dependent/should_compile/mkGADTVars.hs @@ -5,5 +5,5 @@ module GADTVars where import Data.Kind import Data.Proxy -data T (k1 :: *) (k2 :: *) (a :: k2) (b :: k2) where - MkT :: T x1 * (Proxy (y :: x1), z) z +data T (k1 :: Type) (k2 :: Type) (a :: k2) (b :: k2) where + MkT :: T x1 Type (Proxy (y :: x1), z) z diff --git a/testsuite/tests/dependent/should_run/T11311.hs b/testsuite/tests/dependent/should_run/T11311.hs index 88f0e45861..2dda869ce2 100644 --- a/testsuite/tests/dependent/should_run/T11311.hs +++ b/testsuite/tests/dependent/should_run/T11311.hs @@ -3,6 +3,6 @@ module T11311 where import Data.Kind foo :: () -foo = (id :: * -> *) undefined `seq` () +foo = (id :: Type -> Type) undefined `seq` () main = print foo diff --git a/testsuite/tests/deriving/should_compile/T11416.hs b/testsuite/tests/deriving/should_compile/T11416.hs index 210d0423b7..6666764e3d 100644 --- a/testsuite/tests/deriving/should_compile/T11416.hs +++ b/testsuite/tests/deriving/should_compile/T11416.hs @@ -8,7 +8,7 @@ import Data.Kind type ConstantT a b = a -newtype T f (a :: ConstantT * f) = T (f a) +newtype T f (a :: ConstantT Type f) = T (f a) deriving Functor data family TFam1 (f :: k1) (a :: k2) @@ -16,5 +16,5 @@ newtype instance TFam1 f (ConstantT a f) = TFam1 (f a) deriving Functor data family TFam2 (f :: k1) (a :: k2) -newtype instance TFam2 f (a :: ConstantT * f) = TFam2 (f a) +newtype instance TFam2 f (a :: ConstantT Type f) = TFam2 (f a) deriving Functor diff --git a/testsuite/tests/deriving/should_compile/T11732c.hs b/testsuite/tests/deriving/should_compile/T11732c.hs index 55553045c0..c4dedf52d2 100644 --- a/testsuite/tests/deriving/should_compile/T11732c.hs +++ b/testsuite/tests/deriving/should_compile/T11732c.hs @@ -6,15 +6,15 @@ module T11732c where import Data.Kind -class Cat k (cat :: k -> k -> *) where +class Cat k (cat :: k -> k -> Type) where catId :: cat a a catComp :: cat b c -> cat a b -> cat a c -instance Cat * (->) where +instance Cat Type (->) where catId = id catComp = (.) -newtype Fun2 a b = Fun2 (a -> b) deriving (Cat *) +newtype Fun2 a b = Fun2 (a -> b) deriving (Cat Type) -- The ticket says this should work: -- newtype Fun1 a b = Fun1 (a -> b) deriving (Cat k) diff --git a/testsuite/tests/deriving/should_compile/T11833.hs b/testsuite/tests/deriving/should_compile/T11833.hs index 75d2a2d255..0097f54a30 100644 --- a/testsuite/tests/deriving/should_compile/T11833.hs +++ b/testsuite/tests/deriving/should_compile/T11833.hs @@ -2,8 +2,10 @@ {-# LANGUAGE PolyKinds #-} module T11833 where -class Category (cat :: k -> k -> *) where +import Data.Kind (Type) + +class Category (cat :: k -> k -> Type) where catId :: cat a a catComp :: cat b c -> cat a b -> cat a c -newtype T (c :: * -> * -> *) a b = MkT (c a b) deriving Category +newtype T (c :: Type -> Type -> Type) a b = MkT (c a b) deriving Category diff --git a/testsuite/tests/deriving/should_compile/T12144_1.hs b/testsuite/tests/deriving/should_compile/T12144_1.hs index f43d84ae6d..3b0b9ce930 100644 --- a/testsuite/tests/deriving/should_compile/T12144_1.hs +++ b/testsuite/tests/deriving/should_compile/T12144_1.hs @@ -2,5 +2,7 @@ {-# LANGUAGE KindSignatures #-} module T12144_1 where -class C (a :: * -> *) +import Data.Kind (Type) + +class C (a :: Type -> Type) data T a = MkT (a -> Int) deriving C diff --git a/testsuite/tests/deriving/should_compile/T13297.hs b/testsuite/tests/deriving/should_compile/T13297.hs index 604a64971f..bda39db24d 100644 --- a/testsuite/tests/deriving/should_compile/T13297.hs +++ b/testsuite/tests/deriving/should_compile/T13297.hs @@ -1,9 +1,11 @@ {-# Language TypeFamilies, StandaloneDeriving, GeneralizedNewtypeDeriving, UndecidableInstances #-} module T13297 where +import Data.Kind (Type) + newtype N p m a = N (((CT p) m) a) deriving instance (CT p ~ f, Functor (f m)) => Functor (N p m) deriving instance (CT p ~ f, Applicative (f m)) => Applicative (N p m) -- panic when this line added class C p where - type CT p :: (* -> *) -> * -> * + type CT p :: (Type -> Type) -> Type -> Type diff --git a/testsuite/tests/deriving/should_compile/T13758.hs b/testsuite/tests/deriving/should_compile/T13758.hs index 91ddd99b77..62825bd107 100644 --- a/testsuite/tests/deriving/should_compile/T13758.hs +++ b/testsuite/tests/deriving/should_compile/T13758.hs @@ -5,6 +5,9 @@ {-# LANGUAGE StandaloneDeriving #-} {-# LANGUAGE TypeOperators #-} {-# LANGUAGE UndecidableInstances #-} + +{-# OPTIONS -Wno-noncanonical-monoid-instances #-} + module T13758 where import Data.Coerce diff --git a/testsuite/tests/deriving/should_compile/T14933.hs b/testsuite/tests/deriving/should_compile/T14933.hs index 2682d6242f..de8562d189 100644 --- a/testsuite/tests/deriving/should_compile/T14933.hs +++ b/testsuite/tests/deriving/should_compile/T14933.hs @@ -3,8 +3,10 @@ {-# LANGUAGE TypeFamilies #-} module T14933 where +import Data.Kind (Type) + class Wrapped s where - type Unwrapped s :: * + type Unwrapped s :: Type class Fork m where fork :: (x, m) diff --git a/testsuite/tests/deriving/should_compile/T8165.hs b/testsuite/tests/deriving/should_compile/T8165.hs index dd56002648..a7292be2f7 100644 --- a/testsuite/tests/deriving/should_compile/T8165.hs +++ b/testsuite/tests/deriving/should_compile/T8165.hs @@ -5,6 +5,8 @@ {-# LANGUAGE UndecidableInstances #-} module T8165 where +import Data.Kind (Type) + ----------------------------------------------------------- class C a where @@ -30,8 +32,8 @@ newtype E = MkE Int ----------------------------------------------------------- class C2 a b where - type F b c a :: * - type G b (d :: * -> *) :: * -> * + type F b c a :: Type + type G b (d :: Type -> Type) :: Type -> Type instance C2 a y => C2 a (Either x y) where type F (Either x y) c a = F y c a diff --git a/testsuite/tests/deriving/should_compile/T8678.hs b/testsuite/tests/deriving/should_compile/T8678.hs index 655f530b5b..29e73b4a49 100644 --- a/testsuite/tests/deriving/should_compile/T8678.hs +++ b/testsuite/tests/deriving/should_compile/T8678.hs @@ -1,10 +1,12 @@ {-# LANGUAGE DataKinds, DeriveFunctor, FlexibleInstances, GADTs, KindSignatures, StandaloneDeriving #-} module T8678 where +import Data.Kind (Type) + data {- kind -} Nat = Z | S Nat -- GADT in parameter other than the last -data NonStandard :: Nat -> * -> * -> * where +data NonStandard :: Nat -> Type -> Type -> Type where Standard :: a -> NonStandard (S n) a b Non :: NonStandard n a b -> b -> NonStandard (S n) a b diff --git a/testsuite/tests/deriving/should_compile/T9359.hs b/testsuite/tests/deriving/should_compile/T9359.hs index 313d66e1ca..d541677911 100644 --- a/testsuite/tests/deriving/should_compile/T9359.hs +++ b/testsuite/tests/deriving/should_compile/T9359.hs @@ -1,12 +1,14 @@ {-# Language GADTs, PolyKinds, TypeFamilies, DataKinds #-} module Fam where +import Data.Kind (Type) + data Cmp a where Sup :: Cmp a V :: a -> Cmp a deriving (Show, Eq) -data family CmpInterval (a :: Cmp k) (b :: Cmp k) :: * +data family CmpInterval (a :: Cmp k) (b :: Cmp k) :: Type data instance CmpInterval (V c) Sup = Starting c deriving( Show ) diff --git a/testsuite/tests/deriving/should_compile/deriving-via-standalone.hs b/testsuite/tests/deriving/should_compile/deriving-via-standalone.hs index 0fa71d7e36..26484a2df2 100644 --- a/testsuite/tests/deriving/should_compile/deriving-via-standalone.hs +++ b/testsuite/tests/deriving/should_compile/deriving-via-standalone.hs @@ -8,27 +8,28 @@ {-# LANGUAGE StandaloneDeriving #-} module DerivingViaStandalone where +import Data.Kind (Type) import Control.Applicative import Data.Functor.Compose import Data.Proxy import Data.Semigroup -newtype App (f :: * -> *) a = App (f a) +newtype App (f :: Type -> Type) a = App (f a) deriving newtype (Functor, Applicative) instance (Applicative f, Semigroup a) => Semigroup (App f a) where (<>) = liftA2 (<>) -deriving via (App (Compose (f :: * -> *) g) a) +deriving via (App (Compose (f :: Type -> Type) g) a) instance (Applicative f, Applicative g, Semigroup a) => Semigroup (Compose f g a) -class C (a :: k -> *) +class C (a :: k -> Type) instance C Proxy newtype MyProxy a = MyProxy (Proxy a) -deriving via (Proxy :: * -> *) instance C MyProxy +deriving via (Proxy :: Type -> Type) instance C MyProxy class Z a b data T a diff --git a/testsuite/tests/determinism/determ004/determ004.hs b/testsuite/tests/determinism/determ004/determ004.hs index 1361d76a0e..643fa0769d 100644 --- a/testsuite/tests/determinism/determ004/determ004.hs +++ b/testsuite/tests/determinism/determ004/determ004.hs @@ -217,15 +217,17 @@ $s$wsFoldr1_szbtK = module List (sFoldr1) where +import Data.Kind (Type) + data Proxy t data family Sing (a :: k) -data TyFun (a :: *) (b :: *) +data TyFun (a :: Type) (b :: Type) -type family Apply (f :: TyFun k1 k2 -> *) (x :: k1) :: k2 +type family Apply (f :: TyFun k1 k2 -> Type) (x :: k1) :: k2 -data instance Sing (f :: TyFun k1 k2 -> *) = +data instance Sing (f :: TyFun k1 k2 -> Type) = SLambda { applySing :: forall t. Sing t -> Sing (Apply f t) } type SingFunction1 f = forall t. Sing t -> Sing (Apply f t) @@ -237,7 +239,7 @@ singFun2 _ f = SLambda (\x -> SLambda (f x)) data (:$$) (j :: a) (i :: TyFun [a] [a]) type instance Apply ((:$$) j) i = (:) j i -data (:$) (l :: TyFun a (TyFun [a] [a] -> *)) +data (:$) (l :: TyFun a (TyFun [a] [a] -> Type)) type instance Apply (:$) l = (:$$) l data instance Sing (z :: [a]) = z ~ '[] => @@ -255,30 +257,31 @@ type Let1627448493Xs f_afe9 wild_1627448474_afeb wild_1627448476_afec = Apply (Apply (:$) wild_1627448474_afeb) wild_1627448476_afec -type Foldr1Sym2 (t_afdY :: TyFun a_afdP (TyFun a_afdP a_afdP -> *) - -> *) +type Foldr1Sym2 (t_afdY :: TyFun a_afdP (TyFun a_afdP a_afdP -> Type) + -> Type) (t_afdZ :: [a_afdP]) = Foldr1 t_afdY t_afdZ -data Foldr1Sym1 (l_afe3 :: TyFun a_afdP (TyFun a_afdP a_afdP -> *) - -> *) +data Foldr1Sym1 (l_afe3 :: TyFun a_afdP (TyFun a_afdP a_afdP -> Type) + -> Type) (l_afe2 :: TyFun [a_afdP] a_afdP) type instance Apply (Foldr1Sym1 l_afe3) l_afe2 = Foldr1Sym2 l_afe3 l_afe2 data Foldr1Sym0 (l_afe0 :: TyFun (TyFun a_afdP (TyFun a_afdP a_afdP - -> *) - -> *) (TyFun [a_afdP] a_afdP -> *)) + -> Type) + -> Type) (TyFun [a_afdP] a_afdP -> Type)) type instance Apply Foldr1Sym0 l = Foldr1Sym1 l type family Foldr1 (a_afe5 :: TyFun a_afdP (TyFun a_afdP a_afdP - -> *) - -> *) + -> Type) + -> Type) (a_afe6 :: [a_afdP]) :: a_afdP where Foldr1 z_afe7 '[x_afe8] = x_afe8 Foldr1 f_afe9 ((:) x_afea ((:) wild_1627448474_afeb wild_1627448476_afec)) = Apply (Apply f_afe9 x_afea) (Apply (Apply Foldr1Sym0 f_afe9) (Let1627448493XsSym4 f_afe9 x_afea wild_1627448474_afeb wild_1627448476_afec)) Foldr1 z_afew '[] = Apply ErrorSym0 "Data.Singletons.List.foldr1: empty list" sFoldr1 :: - forall (x :: TyFun a_afdP (TyFun a_afdP a_afdP -> *) -> *) + forall a_afdP. + forall (x :: TyFun a_afdP (TyFun a_afdP a_afdP -> Type) -> Type) (y :: [a_afdP]). Sing x -> Sing y -> Sing (Apply (Apply Foldr1Sym0 x) y) diff --git a/testsuite/tests/driver/T13803/E.hs b/testsuite/tests/driver/T13803/E.hs index 2ae1908e34..4a655b16b4 100644 --- a/testsuite/tests/driver/T13803/E.hs +++ b/testsuite/tests/driver/T13803/E.hs @@ -2,10 +2,10 @@ {-# LANGUAGE TypeFamilies #-} module E where -import GHC.Exts (Constraint) +import Data.Kind (Type, Constraint) import {-# SOURCE #-} Y data E -type family CF a :: * -> Constraint +type family CF a :: Type -> Constraint type instance CF E = Y diff --git a/testsuite/tests/gadt/Gadt23_AST.hs b/testsuite/tests/gadt/Gadt23_AST.hs index 75b07c7611..f1014a6a88 100644 --- a/testsuite/tests/gadt/Gadt23_AST.hs +++ b/testsuite/tests/gadt/Gadt23_AST.hs @@ -2,9 +2,11 @@ module Gadt23_AST where +import Data.Kind (Type) + data Exp_; -data AST :: * -> * -> * where +data AST :: Type -> Type -> Type where Var :: String -> AST Exp_ tag Tag :: tag -> AST a tag -> AST a tag diff --git a/testsuite/tests/gadt/Session.hs b/testsuite/tests/gadt/Session.hs index 4403b6f869..2a9b3da6ef 100644 --- a/testsuite/tests/gadt/Session.hs +++ b/testsuite/tests/gadt/Session.hs @@ -4,6 +4,8 @@ module Main where +import Data.Kind (Type) + data Zero = Zero deriving (Show) @@ -16,7 +18,7 @@ class TyNum a where instance TyNum Zero where instance (TyNum p) => TyNum (Succ p) where -data List :: * -> * -> * where +data List :: Type -> Type -> Type where Nil :: List a Zero Cons :: (TyNum p) => a -> List a p -> List a (Succ p) diff --git a/testsuite/tests/gadt/T14320.hs b/testsuite/tests/gadt/T14320.hs index 4acd4c8f63..77c68ee92e 100644 --- a/testsuite/tests/gadt/T14320.hs +++ b/testsuite/tests/gadt/T14320.hs @@ -2,14 +2,16 @@ module T14320 where -data Exp :: * where +import Data.Kind (Type) + +data Exp :: Type where Lit :: (Int -> Exp) -newtype TypedExp :: * -> * where +newtype TypedExp :: Type -> Type where TEGood :: forall a . (Exp -> (TypedExp a)) -- The only difference here is that the type is wrapped in parentheses, -- but GHC 8.0.1 rejects this program -- -newtype TypedExpToo :: * -> * where +newtype TypedExpToo :: Type -> Type where TEBad :: (forall a . (Exp -> (TypedExpToo a))) diff --git a/testsuite/tests/gadt/T9380.hs b/testsuite/tests/gadt/T9380.hs index 99dfab8477..9a2d0f7354 100644 --- a/testsuite/tests/gadt/T9380.hs +++ b/testsuite/tests/gadt/T9380.hs @@ -4,6 +4,7 @@ {-# LANGUAGE GADTs #-} module Main where +import Data.Kind (Type) import Foreign import Unsafe.Coerce @@ -13,11 +14,11 @@ newtype S (a :: M) = S Int data SomeS = forall a . SomeS (S a) -data V0 :: M -> * where +data V0 :: M -> Type where V0A :: Int -> V0 A V0B :: Double -> V0 B -data V1 :: M -> * where +data V1 :: M -> Type where V1A :: Int -> V1 A V1B :: Double -> V1 B V1a :: () -> V1 a @@ -65,4 +66,4 @@ test2 = main = do test0 -- no output at all test1 -- A - test2 -- O_o
\ No newline at end of file + test2 -- O_o diff --git a/testsuite/tests/gadt/gadt20.hs b/testsuite/tests/gadt/gadt20.hs index c754831ce5..f2f4503c31 100644 --- a/testsuite/tests/gadt/gadt20.hs +++ b/testsuite/tests/gadt/gadt20.hs @@ -6,10 +6,12 @@ module Foo where -data Pair :: (* -> *) -> * where +import Data.Kind (Type) + +data Pair :: (Type -> Type) -> Type where Pair :: a b -> b -> Pair a -data Sel :: * -> * where +data Sel :: Type -> Type where A :: Sel Bool B :: Sel Integer diff --git a/testsuite/tests/gadt/gadt22.hs b/testsuite/tests/gadt/gadt22.hs index 67d17c7a67..2bd6b74e44 100644 --- a/testsuite/tests/gadt/gadt22.hs +++ b/testsuite/tests/gadt/gadt22.hs @@ -8,6 +8,7 @@ module Expr where +import qualified Data.Kind as K (Type) import Data.Set (Set) data Type a where @@ -15,7 +16,7 @@ data Type a where TypeSet :: Ord a => Type a -> Type (Set a) TypeFun :: Type a -> Type b -> Type (a -> b) -data Expr :: * -> * where +data Expr :: K.Type -> K.Type where Const :: Type a -> a -> Expr a data DynExpr = forall a. DynExpr (Expr a) diff --git a/testsuite/tests/gadt/gadt8.hs b/testsuite/tests/gadt/gadt8.hs index ebd8b04c49..ba5ecaa603 100644 --- a/testsuite/tests/gadt/gadt8.hs +++ b/testsuite/tests/gadt/gadt8.hs @@ -6,7 +6,9 @@ -- kind signatures module ShouldCompile where -data Expr :: * -> * where { +import Data.Kind (Type) + +data Expr :: Type -> Type where { EInt :: Int -> Expr Int ; EBool :: Bool -> Expr Bool ; EIf :: (Expr Bool) -> (Expr a) -> (Expr a) -> Expr a ; diff --git a/testsuite/tests/gadt/josef.hs b/testsuite/tests/gadt/josef.hs index 34bd41ba3f..818a6dd20d 100644 --- a/testsuite/tests/gadt/josef.hs +++ b/testsuite/tests/gadt/josef.hs @@ -18,6 +18,8 @@ module Bug where +import Data.Kind (Type) + class Category arr where idA :: arr a a comp :: arr a b -> arr b c -> arr a c @@ -51,7 +53,7 @@ data V prod env t where Z :: V prod (prod env t) t S :: V prod env t -> V prod (prod env x) t -data Lambda terminal (exp :: * -> * -> *) prod env t where +data Lambda terminal (exp :: Type -> Type -> Type) prod env t where Unit :: Lambda foo exp prod env foo Var :: V prod env t -> Lambda terminal exp prod env t {- Lam :: Lambda terminal exp prod (prod env a) t diff --git a/testsuite/tests/gadt/karl1.hs b/testsuite/tests/gadt/karl1.hs index b671db7cd3..e201a711f6 100644 --- a/testsuite/tests/gadt/karl1.hs +++ b/testsuite/tests/gadt/karl1.hs @@ -6,7 +6,9 @@ module Expr1 where -data Expr :: * -> * where -- Not a GADT at all +import Data.Kind (Type) + +data Expr :: Type -> Type where -- Not a GADT at all Const :: Show a => a -> Expr a -- Note the Show constraint here Var :: Var a -> Expr a diff --git a/testsuite/tests/gadt/karl2.hs b/testsuite/tests/gadt/karl2.hs index aa96d689d7..1f46df37ee 100644 --- a/testsuite/tests/gadt/karl2.hs +++ b/testsuite/tests/gadt/karl2.hs @@ -5,11 +5,13 @@ module Expr0 where -- See Trac #301 -- This one *does* use GADTs (Fct) -data Expr :: * -> * where +import Data.Kind (Type) + +data Expr :: Type -> Type where Const :: Show a => a -> Expr a Apply :: Fct a b -> Expr a -> Expr b -data Fct :: * -> * -> * where +data Fct :: Type -> Type -> Type where Succ :: Fct Int Int EqZero :: Fct Int Bool Add :: Fct Int (Int -> Int) diff --git a/testsuite/tests/generics/T10604/T10604_deriving.hs b/testsuite/tests/generics/T10604/T10604_deriving.hs index 5bdf586e75..1a5b234c4e 100644 --- a/testsuite/tests/generics/T10604/T10604_deriving.hs +++ b/testsuite/tests/generics/T10604/T10604_deriving.hs @@ -6,14 +6,15 @@ module T10604_deriving where import GHC.Generics +import Data.Kind (Type) data Empty (a :: Bool) deriving (Generic, Generic1) data Proxy (a :: k) = Proxy deriving (Functor, Generic, Generic1) -data Wrap (a :: * -> *) = Wrap (Proxy a) +data Wrap (a :: Type -> Type) = Wrap (Proxy a) deriving (Generic, Generic1) -data Wrap2 (a :: k -> *) = Wrap2 (Proxy (Proxy a)) +data Wrap2 (a :: k -> Type) = Wrap2 (Proxy (Proxy a)) deriving (Generic, Generic1) data SumOfProducts a = Prod1 (Proxy a) (Proxy a) | Prod2 (Proxy a) (Proxy a) deriving (Generic, Generic1) diff --git a/testsuite/tests/generics/T8479.hs b/testsuite/tests/generics/T8479.hs index 77c95f5449..b3a900249b 100644 --- a/testsuite/tests/generics/T8479.hs +++ b/testsuite/tests/generics/T8479.hs @@ -5,8 +5,9 @@ module T8479 where import GHC.Generics +import Data.Kind (Type) -class Blah (a :: * -> *) where - type F a :: * -> * +class Blah (a :: Type -> Type) where + type F a :: Type -> Type -data Foo (f :: * -> *) a = MkFoo ((F f) a) deriving Generic1 +data Foo (f :: Type -> Type) a = MkFoo ((F f) a) deriving Generic1 diff --git a/testsuite/tests/generics/T9563.hs b/testsuite/tests/generics/T9563.hs index fd128658e9..83c3535619 100644 --- a/testsuite/tests/generics/T9563.hs +++ b/testsuite/tests/generics/T9563.hs @@ -5,9 +5,10 @@ module T9563 where +import Data.Kind (Type) import GHC.Generics -data family F typ :: * -> * +data family F typ :: Type -> Type data A data instance F A a = AData a deriving (Generic, Generic1) diff --git a/testsuite/tests/ghci/scripts/GhciKinds.hs b/testsuite/tests/ghci/scripts/GhciKinds.hs index 8e1af372ee..2b60c8c106 100644 --- a/testsuite/tests/ghci/scripts/GhciKinds.hs +++ b/testsuite/tests/ghci/scripts/GhciKinds.hs @@ -1,7 +1,9 @@ {-# LANGUAGE TypeFamilies #-} module GhciKinds where -type family F a :: * +import Data.Kind (Type) + +type family F a :: Type type instance F [a] = a -> F a type instance F Int = Bool diff --git a/testsuite/tests/ghci/scripts/T12550.script b/testsuite/tests/ghci/scripts/T12550.script index 7c07e8f1dd..2834aeb7d9 100644 --- a/testsuite/tests/ghci/scripts/T12550.script +++ b/testsuite/tests/ghci/scripts/T12550.script @@ -1,4 +1,5 @@ :set -fprint-explicit-foralls -XKindSignatures -XExplicitNamespaces -XUnicodeSyntax +:set -Wno-star-is-type import Data.Kind (type Type) diff --git a/testsuite/tests/ghci/scripts/T4175.hs b/testsuite/tests/ghci/scripts/T4175.hs index 0fc53e76e9..ef34a4891d 100644 --- a/testsuite/tests/ghci/scripts/T4175.hs +++ b/testsuite/tests/ghci/scripts/T4175.hs @@ -2,7 +2,7 @@ {-# LANGUAGE ConstraintKinds #-} module T4175 where -import GHC.Exts +import Data.Kind type family A a b type instance A Int Int = () @@ -30,5 +30,5 @@ class Z a class F (a :: Constraint) instance F (Z a) -class G (a :: * -> *) +class G (a :: Type -> Type) instance G B diff --git a/testsuite/tests/ghci/scripts/T4175.stdout b/testsuite/tests/ghci/scripts/T4175.stdout index 75d6c27506..e95d9c76af 100644 --- a/testsuite/tests/ghci/scripts/T4175.stdout +++ b/testsuite/tests/ghci/scripts/T4175.stdout @@ -3,7 +3,7 @@ type instance A (Maybe a) a = a -- Defined at T4175.hs:9:15 type instance A Int Int = () -- Defined at T4175.hs:8:15 type instance A (B a) b = () -- Defined at T4175.hs:10:15 data family B a -- Defined at T4175.hs:12:1 -instance G B -- Defined at T4175.hs:34:10 +instance [safe] G B -- Defined at T4175.hs:34:10 type instance A (B a) b = () -- Defined at T4175.hs:10:15 data instance B () = MkB -- Defined at T4175.hs:13:15 class C a where @@ -17,7 +17,7 @@ type family E a :: * E Int = String -- Defined at T4175.hs:24:1 data () = () -- Defined in ‘GHC.Tuple’ -instance C () -- Defined at T4175.hs:21:10 +instance [safe] C () -- Defined at T4175.hs:21:10 instance Eq () -- Defined in ‘GHC.Classes’ instance Monoid () -- Defined in ‘GHC.Base’ instance Ord () -- Defined in ‘GHC.Classes’ @@ -43,8 +43,8 @@ instance Read a => Read (Maybe a) -- Defined in ‘GHC.Read’ instance Foldable Maybe -- Defined in ‘Data.Foldable’ instance Traversable Maybe -- Defined in ‘Data.Traversable’ type instance A (Maybe a) a = a -- Defined at T4175.hs:9:15 -data Int = I# Int# -- Defined in ‘GHC.Types’ -instance C Int -- Defined at T4175.hs:18:10 +data Int = GHC.Types.I# GHC.Prim.Int# -- Defined in ‘GHC.Types’ +instance [safe] C Int -- Defined at T4175.hs:18:10 instance Eq Int -- Defined in ‘GHC.Classes’ instance Ord Int -- Defined in ‘GHC.Classes’ instance Show Int -- Defined in ‘GHC.Show’ @@ -57,4 +57,4 @@ instance Integral Int -- Defined in ‘GHC.Real’ type instance D Int () = String -- Defined at T4175.hs:19:10 type instance A Int Int = () -- Defined at T4175.hs:8:15 class Z a -- Defined at T4175.hs:28:1 -instance F (Z a) -- Defined at T4175.hs:31:10 +instance [safe] F (Z a) -- Defined at T4175.hs:31:10 diff --git a/testsuite/tests/ghci/scripts/T5417.stdout b/testsuite/tests/ghci/scripts/T5417.stdout index 30178a44ab..ab2827730f 100644 --- a/testsuite/tests/ghci/scripts/T5417.stdout +++ b/testsuite/tests/ghci/scripts/T5417.stdout @@ -5,5 +5,5 @@ class C.C1 a where data family C.F a class C.C1 a where data family C.F a - -- Defined at T5417a.hs:5:5 + -- Defined at T5417a.hs:7:5 data instance C.F (B1 a) = B2 a -- Defined at T5417.hs:8:10 diff --git a/testsuite/tests/ghci/scripts/T5417a.hs b/testsuite/tests/ghci/scripts/T5417a.hs index 8143023e9e..2663245c42 100644 --- a/testsuite/tests/ghci/scripts/T5417a.hs +++ b/testsuite/tests/ghci/scripts/T5417a.hs @@ -1,5 +1,7 @@ {-# LANGUAGE TypeFamilies #-} module T5417a where + import Data.Kind (Type) + class C1 a where - data F a :: * + data F a :: Type diff --git a/testsuite/tests/ghci/scripts/T6018ghcifail.script b/testsuite/tests/ghci/scripts/T6018ghcifail.script index 4a382307db..b8c38cbd58 100644 --- a/testsuite/tests/ghci/scripts/T6018ghcifail.script +++ b/testsuite/tests/ghci/scripts/T6018ghcifail.script @@ -2,10 +2,10 @@ :set -XDataKinds :set -XUndecidableInstances :set -XPolyKinds +import Data.Kind (Type) - -type family F a b c = (result :: *) | result -> a b c +type family F a b c = (result :: Type) | result -> a b c type instance F Int Char Bool = Bool type instance F Char Bool Int = Int type instance F Bool Int Char = Int diff --git a/testsuite/tests/ghci/scripts/T9293.stdout b/testsuite/tests/ghci/scripts/T9293.stdout index 2e5adc404c..6d140bc9f7 100644 --- a/testsuite/tests/ghci/scripts/T9293.stdout +++ b/testsuite/tests/ghci/scripts/T9293.stdout @@ -13,6 +13,11 @@ other dynamic, non-language, flag settings: -fimplicit-import-qualified -fshow-warning-groups warning settings: + -Wimplicit-kind-vars + -Wmissing-monadfail-instances + -Wsemigroup + -Wnoncanonical-monoid-instances + -Wstar-is-type Should fail, GADTs is not enabled options currently set: none. base language is: Haskell2010 @@ -32,6 +37,11 @@ other dynamic, non-language, flag settings: -fimplicit-import-qualified -fshow-warning-groups warning settings: + -Wimplicit-kind-vars + -Wmissing-monadfail-instances + -Wsemigroup + -Wnoncanonical-monoid-instances + -Wstar-is-type Should work, GADTs is in force from :set options currently set: none. base language is: Haskell2010 @@ -50,6 +60,11 @@ other dynamic, non-language, flag settings: -fimplicit-import-qualified -fshow-warning-groups warning settings: + -Wimplicit-kind-vars + -Wmissing-monadfail-instances + -Wsemigroup + -Wnoncanonical-monoid-instances + -Wstar-is-type Should fail, GADTs is now disabled base language is: Haskell2010 with the following modifiers: @@ -70,5 +85,10 @@ other dynamic, non-language, flag settings: -fimplicit-import-qualified -fshow-warning-groups warning settings: + -Wimplicit-kind-vars + -Wmissing-monadfail-instances + -Wsemigroup + -Wnoncanonical-monoid-instances + -Wstar-is-type Should fail, GADTs is only enabled at the prompt C :: T Int diff --git a/testsuite/tests/ghci/scripts/TypeAppData.script b/testsuite/tests/ghci/scripts/TypeAppData.script index 9d571e11ac..f569473d23 100644 --- a/testsuite/tests/ghci/scripts/TypeAppData.script +++ b/testsuite/tests/ghci/scripts/TypeAppData.script @@ -16,7 +16,8 @@ data P6 = forall k (a :: k). P6 (P1 a) pattern P7 :: P1 a ; pattern P7 = P1 pattern P8 :: forall a. P1 a ; pattern P8 = P1 pattern P9 :: forall k (a :: k). P1 a ; pattern P9 = P1 -pattern P10 :: forall (a :: k). P1 a ; pattern P10 = P1 +-- P10 commented out because implicit kind variables are no longer allowed +-- pattern P10 :: forall (a :: k). P1 a ; pattern P10 = P1 pattern P11 :: () => P1 a -> P5 ; pattern P11 a = P5 a pattern P12 :: () => forall a. P1 a -> P5 ; pattern P12 a = P5 a pattern P13 :: () => forall k (a :: k). P1 a -> P5 ; pattern P13 a = P5 a @@ -24,7 +25,6 @@ pattern P14 :: () => forall (a :: k). P1 a -> P5 ; pattern P14 a = P5 a :type P7 :type P8 :type P9 -:type P10 :type P11 :type P12 :type P13 diff --git a/testsuite/tests/ghci/scripts/TypeAppData.stdout b/testsuite/tests/ghci/scripts/TypeAppData.stdout index 0fd5506638..dd548c85da 100644 --- a/testsuite/tests/ghci/scripts/TypeAppData.stdout +++ b/testsuite/tests/ghci/scripts/TypeAppData.stdout @@ -7,7 +7,6 @@ P6 :: forall {k} {a :: k}. P1 a -> P6 P7 :: forall {k} {a :: k}. P1 a P8 :: forall {k} {a :: k}. P1 a P9 :: forall {k} {a :: k}. P1 a -P10 :: forall {k} {a :: k}. P1 a P11 :: forall {k} {a :: k}. P1 a -> P5 P12 :: forall {k} {a :: k}. P1 a -> P5 P13 :: forall {k} {a :: k}. P1 a -> P5 diff --git a/testsuite/tests/ghci/scripts/ghci024.stdout b/testsuite/tests/ghci/scripts/ghci024.stdout index f38393bad4..863184ad49 100644 --- a/testsuite/tests/ghci/scripts/ghci024.stdout +++ b/testsuite/tests/ghci/scripts/ghci024.stdout @@ -14,6 +14,11 @@ other dynamic, non-language, flag settings: -fimplicit-import-qualified -fshow-warning-groups warning settings: + -Wimplicit-kind-vars + -Wmissing-monadfail-instances + -Wsemigroup + -Wnoncanonical-monoid-instances + -Wstar-is-type ~~~~~~~~~~ Testing :set -a options currently set: none. base language is: Haskell2010 diff --git a/testsuite/tests/ghci/scripts/ghci050.script b/testsuite/tests/ghci/scripts/ghci050.script index 277e803294..a463e153b4 100644 --- a/testsuite/tests/ghci/scripts/ghci050.script +++ b/testsuite/tests/ghci/scripts/ghci050.script @@ -1,7 +1,8 @@ --Testing for proper name printing in complex error messages (a previous bug) :set -XTypeFamilies :set -XFlexibleInstances -class Listable t where ; type ListableElem t :: * ; asList :: t -> [ListableElem t] +import Data.Kind (Type) +class Listable t where ; type ListableElem t :: Type; asList :: t -> [ListableElem t] instance Listable (a,a) where ; asList (a,b) = [a,b] instance Listable (a,a) where ; type ListableElem (a,a) = a ; asList (a,b) = [a,b] asList ("as","df") diff --git a/testsuite/tests/ghci/scripts/ghci050.stderr b/testsuite/tests/ghci/scripts/ghci050.stderr index a488269f73..25a0507199 100644 --- a/testsuite/tests/ghci/scripts/ghci050.stderr +++ b/testsuite/tests/ghci/scripts/ghci050.stderr @@ -1,14 +1,15 @@ -<interactive>:5:49: error: +<interactive>:6:49: error: • Couldn't match expected type ‘ListableElem (a, a)’ with actual type ‘a’ ‘a’ is a rigid type variable bound by - the instance declaration at <interactive>:5:10-23 + the instance declaration + at <interactive>:6:10-23 • In the expression: a In the expression: [a, b] In an equation for ‘asList’: asList (a, b) = [a, b] • Relevant bindings include - b :: a (bound at <interactive>:5:43) - a :: a (bound at <interactive>:5:41) + b :: a (bound at <interactive>:6:43) + a :: a (bound at <interactive>:6:41) asList :: (a, a) -> [ListableElem (a, a)] - (bound at <interactive>:5:33) + (bound at <interactive>:6:33) diff --git a/testsuite/tests/ghci/scripts/ghci057.stdout b/testsuite/tests/ghci/scripts/ghci057.stdout index 2e5adc404c..6d140bc9f7 100644 --- a/testsuite/tests/ghci/scripts/ghci057.stdout +++ b/testsuite/tests/ghci/scripts/ghci057.stdout @@ -13,6 +13,11 @@ other dynamic, non-language, flag settings: -fimplicit-import-qualified -fshow-warning-groups warning settings: + -Wimplicit-kind-vars + -Wmissing-monadfail-instances + -Wsemigroup + -Wnoncanonical-monoid-instances + -Wstar-is-type Should fail, GADTs is not enabled options currently set: none. base language is: Haskell2010 @@ -32,6 +37,11 @@ other dynamic, non-language, flag settings: -fimplicit-import-qualified -fshow-warning-groups warning settings: + -Wimplicit-kind-vars + -Wmissing-monadfail-instances + -Wsemigroup + -Wnoncanonical-monoid-instances + -Wstar-is-type Should work, GADTs is in force from :set options currently set: none. base language is: Haskell2010 @@ -50,6 +60,11 @@ other dynamic, non-language, flag settings: -fimplicit-import-qualified -fshow-warning-groups warning settings: + -Wimplicit-kind-vars + -Wmissing-monadfail-instances + -Wsemigroup + -Wnoncanonical-monoid-instances + -Wstar-is-type Should fail, GADTs is now disabled base language is: Haskell2010 with the following modifiers: @@ -70,5 +85,10 @@ other dynamic, non-language, flag settings: -fimplicit-import-qualified -fshow-warning-groups warning settings: + -Wimplicit-kind-vars + -Wmissing-monadfail-instances + -Wsemigroup + -Wnoncanonical-monoid-instances + -Wstar-is-type Should fail, GADTs is only enabled at the prompt C :: T Int diff --git a/testsuite/tests/indexed-types/should_compile/ATLoop_help.hs b/testsuite/tests/indexed-types/should_compile/ATLoop_help.hs index 6c366915cd..acb79a783b 100644 --- a/testsuite/tests/indexed-types/should_compile/ATLoop_help.hs +++ b/testsuite/tests/indexed-types/should_compile/ATLoop_help.hs @@ -1,8 +1,10 @@ {-# LANGUAGE TypeFamilies #-} module ATLoop_help where +import Data.Kind (Type) + class Foo a where - data FooT a :: * + data FooT a :: Type int :: FooT a -> Int instance Foo Int where diff --git a/testsuite/tests/indexed-types/should_compile/Class1.hs b/testsuite/tests/indexed-types/should_compile/Class1.hs index 4e58e13d58..3630b4e5a0 100644 --- a/testsuite/tests/indexed-types/should_compile/Class1.hs +++ b/testsuite/tests/indexed-types/should_compile/Class1.hs @@ -4,11 +4,13 @@ module Class1 where +import Data.Kind (Type) + class C a where foo :: a x -> a y class C (T a) => D a where - type T a :: * -> * + type T a :: Type -> Type bar :: a -> T a x -> T a y diff --git a/testsuite/tests/indexed-types/should_compile/GADT12.hs b/testsuite/tests/indexed-types/should_compile/GADT12.hs index 89362f3cbb..275b687fd3 100644 --- a/testsuite/tests/indexed-types/should_compile/GADT12.hs +++ b/testsuite/tests/indexed-types/should_compile/GADT12.hs @@ -6,10 +6,12 @@ module ShouldCompile where +import qualified Data.Kind as K (Type) + data Typed data Untyped -type family TU a b :: * +type family TU a b :: K.Type type instance TU Typed b = b type instance TU Untyped b = () @@ -20,7 +22,7 @@ data Type a where TypeString :: Type String TypeList :: Type t -> Type [t] -data Expr :: * -> * -> * {- tu a -} where +data Expr :: K.Type -> K.Type -> K.Type {- tu a -} where Const :: Type a -> a -> Expr tu (TU tu a) Var2 :: a -> TU tu (Type a) -> Expr tu (TU tu a) diff --git a/testsuite/tests/indexed-types/should_compile/GADT13.hs b/testsuite/tests/indexed-types/should_compile/GADT13.hs index b5724b2500..a5fb9e5cd9 100644 --- a/testsuite/tests/indexed-types/should_compile/GADT13.hs +++ b/testsuite/tests/indexed-types/should_compile/GADT13.hs @@ -2,7 +2,9 @@ module GADT13 where -data family HiThere a :: * +import Data.Kind (Type) + +data family HiThere a :: Type data instance HiThere () where HiThere :: HiThere () diff --git a/testsuite/tests/indexed-types/should_compile/Ind2_help.hs b/testsuite/tests/indexed-types/should_compile/Ind2_help.hs index b088302fec..e5f11a5a25 100644 --- a/testsuite/tests/indexed-types/should_compile/Ind2_help.hs +++ b/testsuite/tests/indexed-types/should_compile/Ind2_help.hs @@ -2,8 +2,10 @@ module Ind2_help where +import Data.Kind (Type) + class C a where - data T a :: * + data T a :: Type unT :: T a -> a mkT :: a -> T a diff --git a/testsuite/tests/indexed-types/should_compile/InstContextNorm.hs b/testsuite/tests/indexed-types/should_compile/InstContextNorm.hs index 87aecb0e01..3dc97921cb 100644 --- a/testsuite/tests/indexed-types/should_compile/InstContextNorm.hs +++ b/testsuite/tests/indexed-types/should_compile/InstContextNorm.hs @@ -5,7 +5,9 @@ module InstContextNorm where -data EX _x _y (p :: * -> *) +import Data.Kind (Type) + +data EX _x _y (p :: Type -> Type) data ANY class Base p @@ -34,4 +36,4 @@ instance Prop BAR where -- Needs Base (Def BAR) -- And (Def Bar = Ex () () FOO) - -- so we need Base (Def (Foo ANY))
\ No newline at end of file + -- so we need Base (Def (Foo ANY)) diff --git a/testsuite/tests/indexed-types/should_compile/Kind.hs b/testsuite/tests/indexed-types/should_compile/Kind.hs index 73c528df11..65089fa6f0 100644 --- a/testsuite/tests/indexed-types/should_compile/Kind.hs +++ b/testsuite/tests/indexed-types/should_compile/Kind.hs @@ -2,7 +2,9 @@ module Kind where -class C (a :: * -> *) where +import Data.Kind (Type) + +class C (a :: Type -> Type) where type T a foo :: a x -> T a diff --git a/testsuite/tests/indexed-types/should_compile/OversatDecomp.hs b/testsuite/tests/indexed-types/should_compile/OversatDecomp.hs index 898c4d8e06..203a8886cc 100644 --- a/testsuite/tests/indexed-types/should_compile/OversatDecomp.hs +++ b/testsuite/tests/indexed-types/should_compile/OversatDecomp.hs @@ -2,11 +2,13 @@ module OversatDecomp where +import Data.Kind (Type) + class Blah f a where blah :: a -> T f f a -class A (f :: * -> *) where - type T f :: (* -> *) -> * -> * +class A (f :: Type -> Type) where + type T f :: (Type -> Type) -> Type -> Type wrapper :: Blah f a => a -> T f f a wrapper x = blah x diff --git a/testsuite/tests/indexed-types/should_compile/Refl.hs b/testsuite/tests/indexed-types/should_compile/Refl.hs index 0b1b1f7a36..344f7f9c3a 100644 --- a/testsuite/tests/indexed-types/should_compile/Refl.hs +++ b/testsuite/tests/indexed-types/should_compile/Refl.hs @@ -2,7 +2,9 @@ module Refl where -type family T a :: * -> * +import Data.Kind (Type) + +type family T a :: Type -> Type foo :: a x -> a y foo = undefined diff --git a/testsuite/tests/indexed-types/should_compile/Refl2.hs b/testsuite/tests/indexed-types/should_compile/Refl2.hs index b6f5d056b5..fb45e3b175 100644 --- a/testsuite/tests/indexed-types/should_compile/Refl2.hs +++ b/testsuite/tests/indexed-types/should_compile/Refl2.hs @@ -2,7 +2,9 @@ module Refl2 where -type family T (a :: * -> *) :: * -> * +import Data.Kind (Type) + +type family T (a :: Type -> Type) :: Type -> Type data U a x = U (T a x) diff --git a/testsuite/tests/indexed-types/should_compile/Roman1.hs b/testsuite/tests/indexed-types/should_compile/Roman1.hs index 490ea03f42..46f26a8196 100644 --- a/testsuite/tests/indexed-types/should_compile/Roman1.hs +++ b/testsuite/tests/indexed-types/should_compile/Roman1.hs @@ -6,9 +6,10 @@ module Roman where import Control.Monad.ST +import Data.Kind (Type) -type family Mut (v :: * -> *) :: * -> * -> * -type family State (m :: * -> *) +type family Mut (v :: Type -> Type) :: Type -> Type -> Type +type family State (m :: Type -> Type) type instance State (ST s) = s unsafeFreeze :: Mut v (State (ST s)) a -> ST s (v a) @@ -22,10 +23,10 @@ new p = runST (do --------------------------------------------- -- Here's a simpler version that also failed -type family FMut :: * -> * -- No args - -- Same thing happens with one arg +type family FMut :: Type -> Type -- No args + -- Same thing happens with one arg -type family FState (m :: *) +type family FState (m :: Type) type instance FState Char = Int funsafeFreeze :: FMut (FState Char) -> () diff --git a/testsuite/tests/indexed-types/should_compile/Simple1.hs b/testsuite/tests/indexed-types/should_compile/Simple1.hs index e442042bb1..d06cf52eca 100644 --- a/testsuite/tests/indexed-types/should_compile/Simple1.hs +++ b/testsuite/tests/indexed-types/should_compile/Simple1.hs @@ -2,10 +2,12 @@ module ShouldCompile where +import Data.Kind (Type) + class C a where - data Sd a :: * - data Sn a :: * - type St a :: * + data Sd a :: Type + data Sn a :: Type + type St a :: Type instance C Int where data Sd Int = SdC Char diff --git a/testsuite/tests/indexed-types/should_compile/Simple16.hs b/testsuite/tests/indexed-types/should_compile/Simple16.hs index f1958c3ffd..eeceec2dde 100644 --- a/testsuite/tests/indexed-types/should_compile/Simple16.hs +++ b/testsuite/tests/indexed-types/should_compile/Simple16.hs @@ -2,7 +2,9 @@ -- submitted by g9ks157k@acme.softbase.org as #1713 module TypeFamilyBug where -type family TestFamily a :: * +import Data.Kind (Type) + +type family TestFamily a :: Type type instance TestFamily () = [()] @@ -10,4 +12,4 @@ testFunction :: value -> TestFamily value -> () testFunction = const (const ()) testApplication :: () -testApplication = testFunction () (return ())
\ No newline at end of file +testApplication = testFunction () (return ()) diff --git a/testsuite/tests/indexed-types/should_compile/Simple19.hs b/testsuite/tests/indexed-types/should_compile/Simple19.hs index 8df1fd4c4b..9e46e28491 100644 --- a/testsuite/tests/indexed-types/should_compile/Simple19.hs +++ b/testsuite/tests/indexed-types/should_compile/Simple19.hs @@ -4,7 +4,9 @@ module ShouldCompile where -type family Element c :: * +import Data.Kind (Type) + +type family Element c :: Type f :: x -> Element x f x = undefined diff --git a/testsuite/tests/indexed-types/should_compile/Simple24.hs b/testsuite/tests/indexed-types/should_compile/Simple24.hs index fbca4aaadd..e4a97a73dd 100644 --- a/testsuite/tests/indexed-types/should_compile/Simple24.hs +++ b/testsuite/tests/indexed-types/should_compile/Simple24.hs @@ -3,12 +3,14 @@ module Simple24 where +import Data.Kind (Type) + linear :: HasTrie (Basis v) => (Basis v, v) linear = basisValue class HasTrie a where -type family Basis u :: * +type family Basis u :: Type basisValue :: (Basis v,v) basisValue = error "urk" diff --git a/testsuite/tests/indexed-types/should_compile/Simple3.hs b/testsuite/tests/indexed-types/should_compile/Simple3.hs index aa37ac215d..dff7b94c80 100644 --- a/testsuite/tests/indexed-types/should_compile/Simple3.hs +++ b/testsuite/tests/indexed-types/should_compile/Simple3.hs @@ -2,8 +2,10 @@ module ShouldCompile where +import Data.Kind (Type) + class C7 a b where - data S7 b :: * + data S7 b :: Type instance C7 Char (a, Bool) where data S7 (a, Bool) = S7_1 diff --git a/testsuite/tests/indexed-types/should_compile/Simple4.hs b/testsuite/tests/indexed-types/should_compile/Simple4.hs index bd8ae3d66a..3e93ef76f0 100644 --- a/testsuite/tests/indexed-types/should_compile/Simple4.hs +++ b/testsuite/tests/indexed-types/should_compile/Simple4.hs @@ -2,8 +2,10 @@ module ShouldCompile where +import Data.Kind (Type) + class C8 a where - data S8 a :: * -> * + data S8 a :: Type -> Type instance C8 Int where data S8 Int a = S8Int a diff --git a/testsuite/tests/indexed-types/should_compile/Simple5.hs b/testsuite/tests/indexed-types/should_compile/Simple5.hs index ecae60d53d..d8c8bb46fb 100644 --- a/testsuite/tests/indexed-types/should_compile/Simple5.hs +++ b/testsuite/tests/indexed-types/should_compile/Simple5.hs @@ -2,7 +2,9 @@ module ShouldCompile where -data family C9 a b :: * +import Data.Kind (Type) + +data family C9 a b :: Type data instance C9 Int Int = C9IntInt data instance C9 [a] Int = C9ListInt data instance C9 [Int] [a] = C9ListList2 diff --git a/testsuite/tests/indexed-types/should_compile/Simple6.hs b/testsuite/tests/indexed-types/should_compile/Simple6.hs index ead121ab2d..6b8d1e3bc6 100644 --- a/testsuite/tests/indexed-types/should_compile/Simple6.hs +++ b/testsuite/tests/indexed-types/should_compile/Simple6.hs @@ -3,6 +3,7 @@ module ShouldCompile where import Data.IORef +import Data.Kind (Type) data family T a data instance T a = T @@ -13,5 +14,5 @@ foo T = T type family S a type instance S a = a -type family SMRef (m:: * -> *) :: * -> * -type instance SMRef IO = IORef
\ No newline at end of file +type family SMRef (m:: Type -> Type) :: Type -> Type +type instance SMRef IO = IORef diff --git a/testsuite/tests/indexed-types/should_compile/Simple7.hs b/testsuite/tests/indexed-types/should_compile/Simple7.hs index 61ba22117f..9299e52bd1 100644 --- a/testsuite/tests/indexed-types/should_compile/Simple7.hs +++ b/testsuite/tests/indexed-types/should_compile/Simple7.hs @@ -2,8 +2,10 @@ module ShouldCompile where +import Data.Kind (Type) + class C1 a where - data S1 a :: * + data S1 a :: Type -- instance of data families can be data or newtypes instance C1 Char where diff --git a/testsuite/tests/indexed-types/should_compile/Simple9.hs b/testsuite/tests/indexed-types/should_compile/Simple9.hs index 4075d4845f..09baa5d388 100644 --- a/testsuite/tests/indexed-types/should_compile/Simple9.hs +++ b/testsuite/tests/indexed-types/should_compile/Simple9.hs @@ -2,12 +2,14 @@ module Simple9 where +import Data.Kind (Type) + -- The test succeeds with -- -- type family F a b -- type instance F () b = Maybe b -type family F a :: * -> * +type family F a :: Type -> Type type instance F () = Maybe type family G a diff --git a/testsuite/tests/indexed-types/should_compile/Sock.hs b/testsuite/tests/indexed-types/should_compile/Sock.hs index 7b89e9ac77..9d7d638bef 100644 --- a/testsuite/tests/indexed-types/should_compile/Sock.hs +++ b/testsuite/tests/indexed-types/should_compile/Sock.hs @@ -9,7 +9,7 @@ module Sock where import Data.Proxy -import GHC.Exts +import Data.Kind data Message @@ -17,11 +17,11 @@ data SocketType = Dealer | Push | Pull data SocketOperation = Read | Write -data SockOp :: SocketType -> SocketOperation -> * where +data SockOp :: SocketType -> SocketOperation -> Type where SRead :: Foo 'Read sock => SockOp sock 'Read SWrite :: Foo Write sock => SockOp sock Write -data Socket :: SocketType -> * where +data Socket :: SocketType -> Type where Socket :: proxy sock -> (forall op . Foo op sock => SockOp sock op -> Operation op) -> Socket sock @@ -30,7 +30,7 @@ type family Foo (op :: SocketOperation) (s :: SocketType) :: Constraint where Foo 'Read s = Readable s Foo Write s = Writable s -type family Operation (op :: SocketOperation) :: * where +type family Operation (op :: SocketOperation) :: Type where Operation 'Read = IO Message Operation Write = Message -> IO () diff --git a/testsuite/tests/indexed-types/should_compile/T10139.hs b/testsuite/tests/indexed-types/should_compile/T10139.hs index 8963b7cb1c..07e0ef711d 100644 --- a/testsuite/tests/indexed-types/should_compile/T10139.hs +++ b/testsuite/tests/indexed-types/should_compile/T10139.hs @@ -4,8 +4,9 @@ module T10139 where -import GHC.Exts import Data.Monoid +import Data.Kind +import Data.Coerce class Monoid v => Measured v a | a -> v where _measure :: v -> a @@ -16,10 +17,10 @@ singleton = undefined class DOps a where plus :: a -> D a -> a -type family D a :: * +type family D a :: Type type instance D (FingerTree (Size Int, v) (Sized a)) = [Diff (Normal a)] -type family Normal a :: * +type family Normal a :: Type data Diff a = Add Int a diff --git a/testsuite/tests/indexed-types/should_compile/T10318.hs b/testsuite/tests/indexed-types/should_compile/T10318.hs index 04a2ca105c..001f6feb43 100644 --- a/testsuite/tests/indexed-types/should_compile/T10318.hs +++ b/testsuite/tests/indexed-types/should_compile/T10318.hs @@ -4,12 +4,14 @@ module T10318 where +import Data.Kind (Type) + -- | Product of non-zero elements always non-zero. -- Every integral domain has a field of fractions. -- The field of fractions of any field is itself. class (Frac (Frac a) ~ Frac a, Fractional (Frac a), IntegralDomain (Frac a)) => IntegralDomain a where - type Frac a :: * + type Frac a :: Type embed :: a -> Frac a instance IntegralDomain Integer where diff --git a/testsuite/tests/indexed-types/should_compile/T10753.hs b/testsuite/tests/indexed-types/should_compile/T10753.hs index 6939ce1570..cc96c2ea63 100644 --- a/testsuite/tests/indexed-types/should_compile/T10753.hs +++ b/testsuite/tests/indexed-types/should_compile/T10753.hs @@ -3,6 +3,7 @@ {-# OPTIONS_GHC -fno-warn-redundant-constraints -fno-warn-missing-methods #-} module T10753 where +import Data.Kind (Type) class MonadState s m | m -> s where get :: m s @@ -14,7 +15,7 @@ instance (Functor m) => Functor (StateT s m) where instance (Monad m) => MonadState s (StateT s m) where -class HasConns (m :: * -> *) where +class HasConns (m :: Type -> Type) where type Conn m foo :: (Monad m) => StateT (Conn m) m () diff --git a/testsuite/tests/indexed-types/should_compile/T10931.hs b/testsuite/tests/indexed-types/should_compile/T10931.hs index 2c0ea204d3..5766fece25 100644 --- a/testsuite/tests/indexed-types/should_compile/T10931.hs +++ b/testsuite/tests/indexed-types/should_compile/T10931.hs @@ -6,11 +6,13 @@ module T10931 ( BugC(..) ) where +import Data.Kind (Type) + data IdT f a = IdC (f a) -class ( m ~ Outer m (Inner m) ) => BugC (m :: * -> *) where - type Inner m :: * -> * - type Outer m :: (* -> *) -> * -> * +class ( m ~ Outer m (Inner m) ) => BugC (m :: Type -> Type) where + type Inner m :: Type -> Type + type Outer m :: (Type -> Type) -> Type -> Type bug :: ( forall n. ( n ~ Outer n (Inner n) , Outer n ~ Outer m diff --git a/testsuite/tests/indexed-types/should_compile/T11361.hs b/testsuite/tests/indexed-types/should_compile/T11361.hs index 7da0062652..89153d4d0b 100644 --- a/testsuite/tests/indexed-types/should_compile/T11361.hs +++ b/testsuite/tests/indexed-types/should_compile/T11361.hs @@ -5,8 +5,10 @@ module T11361 where +import Data.Kind (Type) + class Cls a where - type Fam a b :: * + type Fam a b :: Type -- Multiple defaults! type Fam a x = FamHelper a x diff --git a/testsuite/tests/indexed-types/should_compile/T11581.hs b/testsuite/tests/indexed-types/should_compile/T11581.hs index 7815a86a7e..4abd07d2c7 100644 --- a/testsuite/tests/indexed-types/should_compile/T11581.hs +++ b/testsuite/tests/indexed-types/should_compile/T11581.hs @@ -2,7 +2,9 @@ module T11581 where -type family F a :: * -> * +import Data.Kind (Type) + +type family F a :: Type -> Type type family G a type instance G [a] = F a (Int,Bool) diff --git a/testsuite/tests/indexed-types/should_compile/T12526.hs b/testsuite/tests/indexed-types/should_compile/T12526.hs index 35a653a544..71d635d609 100644 --- a/testsuite/tests/indexed-types/should_compile/T12526.hs +++ b/testsuite/tests/indexed-types/should_compile/T12526.hs @@ -1,10 +1,12 @@ {-# LANGUAGE TypeFamilies, MonoLocalBinds #-} module T12526 where -type family P (s :: * -> *) :: * -> * -> * +import Data.Kind (Type) + +type family P (s :: Type -> Type) :: Type -> Type -> Type type instance P Signal = Causal -type family S (p :: * -> * -> *) :: * -> * +type family S (p :: Type -> Type -> Type) :: Type -> Type type instance S Causal = Signal class (P (S p) ~ p) => CP p diff --git a/testsuite/tests/indexed-types/should_compile/T13662.hs b/testsuite/tests/indexed-types/should_compile/T13662.hs index 5898f25d12..f95628b025 100644 --- a/testsuite/tests/indexed-types/should_compile/T13662.hs +++ b/testsuite/tests/indexed-types/should_compile/T13662.hs @@ -2,9 +2,11 @@ {-# LANGUAGE MultiParamTypeClasses #-} module T13662 (run) where +import Data.Kind (Type) + newtype Value a = Value a -type family Repr (f :: * -> *) a :: * +type family Repr (f :: Type -> Type) a :: Type type instance Repr f Int = f Int class (Repr Value i ~ Value ir) => Native i ir where diff --git a/testsuite/tests/indexed-types/should_compile/T14131.hs b/testsuite/tests/indexed-types/should_compile/T14131.hs index e8b15790a1..d4965aa92f 100644 --- a/testsuite/tests/indexed-types/should_compile/T14131.hs +++ b/testsuite/tests/indexed-types/should_compile/T14131.hs @@ -8,20 +8,20 @@ module T14131 where import Data.Kind import Data.Proxy -data family Nat :: k -> k -> * -newtype instance Nat :: (k -> *) -> (k -> *) -> * where +data family Nat :: k -> k -> Type +newtype instance Nat :: (k -> Type) -> (k -> Type) -> Type where Nat :: (forall xx. f xx -> g xx) -> Nat f g type family F :: Maybe a type instance F = (Nothing :: Maybe a) class C k where - data CD :: k -> k -> * + data CD :: k -> k -> Type type CT :: k instance C (Maybe a) where - data CD :: Maybe a -> Maybe a -> * where - CD :: forall (m :: Maybe a) (n :: Maybe a). Proxy m -> Proxy n -> CD m n + data CD :: Maybe a -> Maybe a -> Type where + CD :: forall a (m :: Maybe a) (n :: Maybe a). Proxy m -> Proxy n -> CD m n type CT = (Nothing :: Maybe a) class Z k where diff --git a/testsuite/tests/indexed-types/should_compile/T2291.hs b/testsuite/tests/indexed-types/should_compile/T2291.hs index 99f48b4896..b73a673515 100644 --- a/testsuite/tests/indexed-types/should_compile/T2291.hs +++ b/testsuite/tests/indexed-types/should_compile/T2291.hs @@ -1,9 +1,11 @@ {-# LANGUAGE TypeFamilies #-} module Small where +import Data.Kind (Type) + class CoCCC k where - type Coexp k :: * -> * -> * - type Sum k :: * -> * -> * + type Coexp k :: Type -> Type -> Type + type Sum k :: Type -> Type -> Type coapply' :: k b (Sum k (Coexp k a b) a) cocurry' :: k c (Sum k a b) -> k (Coexp k b c) a uncocurry' :: k (Coexp k b c) a -> k c (Sum k a b) diff --git a/testsuite/tests/indexed-types/should_compile/T2448.hs b/testsuite/tests/indexed-types/should_compile/T2448.hs index 7393eb1e6b..8c3744340e 100644 --- a/testsuite/tests/indexed-types/should_compile/T2448.hs +++ b/testsuite/tests/indexed-types/should_compile/T2448.hs @@ -3,10 +3,12 @@ module T2448 where +import Data.Kind (Type) + -- Demonstrates a bug in propagating type equality constraints class VectorSpace v where - type Scalar v :: * + type Scalar v :: Type class VectorSpace v => InnerSpace v diff --git a/testsuite/tests/indexed-types/should_compile/T2715.hs b/testsuite/tests/indexed-types/should_compile/T2715.hs index c283467b82..a979910fd0 100644 --- a/testsuite/tests/indexed-types/should_compile/T2715.hs +++ b/testsuite/tests/indexed-types/should_compile/T2715.hs @@ -8,19 +8,21 @@ module T2715 where +import Data.Kind (Type) + data Interval v where Intv :: (Ord v, Enum v) => (v,v) -> Interval v -type family Domain (d :: * -> *) :: * -> * +type family Domain (d :: Type -> Type) :: Type -> Type type instance Domain Interval = Interval -type family Value (d :: * -> *) :: * +type family Value (d :: Type -> Type) :: Type class IDomain d where empty :: (Ord (Value d), Enum (Value d)) => Domain d (Value d) class (IDomain d1) -- (IDomain d1, IDomain d2, Value d1 ~ Value d2) - => IIDomain (d1 :: * -> *) (d2 :: * -> * ) where + => IIDomain (d1 :: Type -> Type) (d2 :: Type -> Type ) where equals :: Domain d1 (Value d1) -> Domain d2 (Value d2) -> Bool diff --git a/testsuite/tests/indexed-types/should_compile/T2767.hs b/testsuite/tests/indexed-types/should_compile/T2767.hs index 7104db2fa3..f7d0c85d31 100644 --- a/testsuite/tests/indexed-types/should_compile/T2767.hs +++ b/testsuite/tests/indexed-types/should_compile/T2767.hs @@ -2,6 +2,8 @@ module T2767a where +import Data.Kind (Type) + main = return () -- eval' :: Solver solver => Tree solver a -> [(Label solver,Tree solver a)] -> solver [a] @@ -17,7 +19,7 @@ data Tree s a | NewVar (Term s -> Tree s a) class Monad solver => Solver solver where - type Term solver :: * - type Label solver :: * + type Term solver :: Type + type Label solver :: Type newvarSM :: solver (Term solver) gotoSM :: Label solver -> solver () diff --git a/testsuite/tests/indexed-types/should_compile/T2850.hs b/testsuite/tests/indexed-types/should_compile/T2850.hs index 2c6af5b3b1..68bae857cf 100644 --- a/testsuite/tests/indexed-types/should_compile/T2850.hs +++ b/testsuite/tests/indexed-types/should_compile/T2850.hs @@ -2,11 +2,13 @@ module T2850 where +import Data.Kind (Type) + class K a where bar :: a -> a class K (B a) => M a where - data B a :: * + data B a :: Type foo :: B a -> B a instance M Bool where diff --git a/testsuite/tests/indexed-types/should_compile/T2944.hs b/testsuite/tests/indexed-types/should_compile/T2944.hs index 19c009b0f9..8470a9dc95 100644 --- a/testsuite/tests/indexed-types/should_compile/T2944.hs +++ b/testsuite/tests/indexed-types/should_compile/T2944.hs @@ -3,7 +3,9 @@ module T2944 where -type family T a :: * +import Data.Kind (Type) + +type family T a :: Type f1 :: T a ~ () => a f1 = f2 diff --git a/testsuite/tests/indexed-types/should_compile/T3220.hs b/testsuite/tests/indexed-types/should_compile/T3220.hs index 7d6190a7fa..3c94eb2de8 100644 --- a/testsuite/tests/indexed-types/should_compile/T3220.hs +++ b/testsuite/tests/indexed-types/should_compile/T3220.hs @@ -2,8 +2,10 @@ module T3220 where +import Data.Kind (Type) + class Foo m where - type Bar m :: * + type Bar m :: Type action :: m -> Bar m -> m right x m = action m (Right x) @@ -20,4 +22,4 @@ instance Foo Float where action m a = either (*) (+) a m foo = print $ right (1::Int) (3 :: Int) -bar = print $ right (1::Float) (3 :: Float)
\ No newline at end of file +bar = print $ right (1::Float) (3 :: Float) diff --git a/testsuite/tests/indexed-types/should_compile/T3590.hs b/testsuite/tests/indexed-types/should_compile/T3590.hs index d160fc8c52..6cc79a6f02 100644 --- a/testsuite/tests/indexed-types/should_compile/T3590.hs +++ b/testsuite/tests/indexed-types/should_compile/T3590.hs @@ -4,11 +4,13 @@ module T3590 where +import Data.Kind (Type) + newtype ListT m a = ListT { runListT :: m (Maybe (a, ListT m a)) } class Monad (ItemM l) => List l where - type ItemM l :: * -> * + type ItemM l :: Type -> Type joinL :: [ItemM l (l a) -> l a] instance Monad m => List (ListT m) where diff --git a/testsuite/tests/indexed-types/should_compile/T3787.hs b/testsuite/tests/indexed-types/should_compile/T3787.hs index 06063ff113..5e14092611 100644 --- a/testsuite/tests/indexed-types/should_compile/T3787.hs +++ b/testsuite/tests/indexed-types/should_compile/T3787.hs @@ -31,6 +31,7 @@ import Control.Monad.Trans (MonadTrans(..)) import Data.Foldable (toList) import Data.Maybe (maybe) import Data.Sequence (Seq, viewl) +import Data.Kind (Type) par, pseq :: a -> b -> b par = error "urk" @@ -359,7 +360,7 @@ type SinkFunctor a x = EitherFunctor a (TryYield x) -- | A 'Sink' can be used to yield values from any nested `Trampoline` computation whose functor provably descends from -- the functor /a/. It's the write-only end of a 'Pipe' communication channel. -data Sink (m :: * -> *) a x = +data Sink (m :: Type -> Type) a x = Sink { -- | Function 'put' tries to put a value into the given `Sink`. The intervening 'Trampoline' computations suspend up @@ -373,7 +374,7 @@ data Sink (m :: * -> *) a x = -- | A 'Source' can be used to read values into any nested `Trampoline` computation whose functor provably descends from -- the functor /a/. It's the read-only end of a 'Pipe' communication channel. -newtype Source (m :: * -> *) a x = +newtype Source (m :: Type -> Type) a x = Source { -- | Function 'get' tries to get a value from the given 'Source' argument. The intervening 'Trampoline' computations diff --git a/testsuite/tests/indexed-types/should_compile/T3851.hs b/testsuite/tests/indexed-types/should_compile/T3851.hs index 7c2f252c7f..c0bd01b85e 100644 --- a/testsuite/tests/indexed-types/should_compile/T3851.hs +++ b/testsuite/tests/indexed-types/should_compile/T3851.hs @@ -2,7 +2,9 @@ module T3851 where -type family TF a :: * -> * +import Data.Kind (Type) + +type family TF a :: Type -> Type type instance TF () = App (Equ ()) data Equ ix ix' where Refl :: Equ ix ix @@ -17,7 +19,7 @@ ar :: App (Equ ()) () -> () ar (App Refl) = () ------------------ -data family DF a :: * -> * +data family DF a :: Type -> Type data instance DF () a = D (App (Equ ()) a) bar_df :: DF () () -> () diff --git a/testsuite/tests/indexed-types/should_compile/T4120.hs b/testsuite/tests/indexed-types/should_compile/T4120.hs index ffa729aa8a..180472232f 100644 --- a/testsuite/tests/indexed-types/should_compile/T4120.hs +++ b/testsuite/tests/indexed-types/should_compile/T4120.hs @@ -5,12 +5,13 @@ module Data.Vector.Unboxed where import Control.Monad.ST ( ST ) +import Data.Kind (Type) data MVector s a = MV data Vector a = V -type family Mutable (v :: * -> *) :: * -> * -> * +type family Mutable (v :: Type -> Type) :: Type -> Type -> Type type instance Mutable Vector = MVector create :: (forall s. MVector s a) -> Int diff --git a/testsuite/tests/indexed-types/should_compile/T4160.hs b/testsuite/tests/indexed-types/should_compile/T4160.hs index 4472bf2f14..a838206a5b 100644 --- a/testsuite/tests/indexed-types/should_compile/T4160.hs +++ b/testsuite/tests/indexed-types/should_compile/T4160.hs @@ -4,9 +4,14 @@ module Foo where +import Data.Kind (Type) + data P f g r = f r :*: g r -type family TrieMapT (f :: * -> *) :: * -> (* -> *) -> * -> * -newtype PMap m1 (m2 :: * -> (* -> *) -> * -> *) k (a :: * -> *) ix = PMap (m1 k (m2 k a) ix) +type family TrieMapT (f :: Type -> Type) :: + Type -> (Type -> Type) -> Type -> Type +newtype PMap m1 (m2 :: Type -> (Type -> Type) -> Type -> Type) + k (a :: Type -> Type) ix + = PMap (m1 k (m2 k a) ix) type instance TrieMapT (P f g) = PMap (TrieMapT f) (TrieMapT g) class TrieKeyT f m where diff --git a/testsuite/tests/indexed-types/should_compile/T4185.hs b/testsuite/tests/indexed-types/should_compile/T4185.hs index d7fdbd52f3..aa9c06ec99 100644 --- a/testsuite/tests/indexed-types/should_compile/T4185.hs +++ b/testsuite/tests/indexed-types/should_compile/T4185.hs @@ -1,7 +1,9 @@ {-# LANGUAGE DeriveFunctor, StandaloneDeriving, FlexibleInstances, TypeFamilies, GeneralizedNewtypeDeriving #-} module T4185 where -data family Foo k :: * -> * +import Data.Kind (Type) + +data family Foo k :: Type -> Type ------------- Generalised newtype deriving of user class ----------- class Bar f where diff --git a/testsuite/tests/indexed-types/should_compile/T4200.hs b/testsuite/tests/indexed-types/should_compile/T4200.hs index a9a1a5bd63..0169f023c2 100644 --- a/testsuite/tests/indexed-types/should_compile/T4200.hs +++ b/testsuite/tests/indexed-types/should_compile/T4200.hs @@ -3,8 +3,10 @@ module T4200 where +import Data.Kind (Type) + class C a where - type In a :: * + type In a :: Type op :: In a -> a -> Int -- Should be ok; no -XUndecidableInstances required diff --git a/testsuite/tests/indexed-types/should_compile/T4356.hs b/testsuite/tests/indexed-types/should_compile/T4356.hs index 400314eeb2..a952176c97 100644 --- a/testsuite/tests/indexed-types/should_compile/T4356.hs +++ b/testsuite/tests/indexed-types/should_compile/T4356.hs @@ -1,7 +1,9 @@ {-# LANGUAGE TypeFamilies #-} module T4356 where -type family T t :: * -> * -> * +import Data.Kind (Type) + +type family T t :: Type -> Type -> Type type instance T Bool = (->) f :: T Bool Bool Bool diff --git a/testsuite/tests/indexed-types/should_compile/T4484.hs b/testsuite/tests/indexed-types/should_compile/T4484.hs index 94a76ee7d4..203f19a440 100644 --- a/testsuite/tests/indexed-types/should_compile/T4484.hs +++ b/testsuite/tests/indexed-types/should_compile/T4484.hs @@ -2,15 +2,17 @@ module T4484 where -type family F f :: * +import Data.Kind (Type) + +type family F f :: Type data Id c = Id type instance F (Id c) = c -data C :: * -> * where +data C :: Type -> Type where C :: f -> C (W (F f)) -data W :: * -> * +data W :: Type -> Type fails :: C a -> C a fails (C _) diff --git a/testsuite/tests/indexed-types/should_compile/T5591b.hs b/testsuite/tests/indexed-types/should_compile/T5591b.hs index 20f4225907..66d59a4c09 100644 --- a/testsuite/tests/indexed-types/should_compile/T5591b.hs +++ b/testsuite/tests/indexed-types/should_compile/T5591b.hs @@ -2,10 +2,12 @@ GADTs, FlexibleInstances, FlexibleContexts #-} module T5591b where +import Data.Kind (Type) + class Monad m => Effect p e r m | p e m -> r where fin :: p e m -> e -> m r -data ErrorEff :: * -> (* -> *) -> * where +data ErrorEff :: Type -> (Type -> Type) -> Type where CatchError :: (e -> m a) -> ErrorEff ((e -> m a) -> m a) m instance Monad m => Effect ErrorEff ((e -> m a) -> m a) a m where diff --git a/testsuite/tests/indexed-types/should_compile/T7082.hs b/testsuite/tests/indexed-types/should_compile/T7082.hs index 9750f97984..005e5f84d9 100644 --- a/testsuite/tests/indexed-types/should_compile/T7082.hs +++ b/testsuite/tests/indexed-types/should_compile/T7082.hs @@ -1,8 +1,10 @@ {-# LANGUAGE TypeFamilies #-} module T7082 where +import Data.Kind (Type) + class R m where - type D m a :: * + type D m a :: Type type D m a = () -- (1) f :: m a -> D m a -> () diff --git a/testsuite/tests/indexed-types/should_compile/T7280.hs b/testsuite/tests/indexed-types/should_compile/T7280.hs index 2cb7a09bb4..eb1c6751b6 100644 --- a/testsuite/tests/indexed-types/should_compile/T7280.hs +++ b/testsuite/tests/indexed-types/should_compile/T7280.hs @@ -3,8 +3,10 @@ module T7280 where -type family Mutable (v :: * -> *) :: * -> * -> * -class MVector (v :: * -> * -> *) a +import Data.Kind (Type) + +type family Mutable (v :: Type -> Type) :: Type -> Type -> Type +class MVector (v :: Type -> Type -> Type) a class MVector (Mutable v) a => Vector v a where copy :: Monad m => Mutable v s a -> v a -> m () diff --git a/testsuite/tests/indexed-types/should_compile/T7282.hs b/testsuite/tests/indexed-types/should_compile/T7282.hs index a357d17647..682186795e 100644 --- a/testsuite/tests/indexed-types/should_compile/T7282.hs +++ b/testsuite/tests/indexed-types/should_compile/T7282.hs @@ -2,8 +2,10 @@ module T7282 where +import Data.Kind (Type) + class Foo (xs :: [k]) where - type Bar xs :: * + type Bar xs :: Type instance Foo '[] where type Bar '[] = Int diff --git a/testsuite/tests/indexed-types/should_compile/T7474.hs b/testsuite/tests/indexed-types/should_compile/T7474.hs index 081b7d11d0..ba3d2422e1 100644 --- a/testsuite/tests/indexed-types/should_compile/T7474.hs +++ b/testsuite/tests/indexed-types/should_compile/T7474.hs @@ -3,9 +3,11 @@ module T7474 where -type family T :: * -> * +import Data.Kind (Type) -data E :: * -> * where +type family T :: Type -> Type + +data E :: Type -> Type where E :: C p => T (T p) -> E p class C' b a where c :: T b -> a diff --git a/testsuite/tests/indexed-types/should_compile/T7489.hs b/testsuite/tests/indexed-types/should_compile/T7489.hs index 70cb560687..1bf09ecb45 100644 --- a/testsuite/tests/indexed-types/should_compile/T7489.hs +++ b/testsuite/tests/indexed-types/should_compile/T7489.hs @@ -2,10 +2,12 @@ module T7489 where +import Data.Kind (Type) + data Credit data Debit -data family Account (s :: *) (t :: *) +data family Account (s :: Type) (t :: Type) data instance Account Int t where CAccount :: Account Int Credit diff --git a/testsuite/tests/indexed-types/should_compile/T8913.hs b/testsuite/tests/indexed-types/should_compile/T8913.hs index 062a252149..0f9dbbc539 100644 --- a/testsuite/tests/indexed-types/should_compile/T8913.hs +++ b/testsuite/tests/indexed-types/should_compile/T8913.hs @@ -5,6 +5,8 @@ module T8913 where +import Data.Kind (Type) + class GCat f where gcat :: f p -> Int @@ -12,5 +14,5 @@ cat :: (GCat (MyRep a), MyGeneric a) => a -> Int cat x = gcat (from x) class MyGeneric a where - type MyRep a :: * -> * + type MyRep a :: Type -> Type from :: a -> (MyRep a) p diff --git a/testsuite/tests/indexed-types/should_compile/T8978.hs b/testsuite/tests/indexed-types/should_compile/T8978.hs index 077a07db31..9b78796c85 100644 --- a/testsuite/tests/indexed-types/should_compile/T8978.hs +++ b/testsuite/tests/indexed-types/should_compile/T8978.hs @@ -1,10 +1,12 @@ {-# LANGUAGE FlexibleContexts, TypeFamilies #-} module T8978 where +import Data.Kind (Type) + type Syn a = Associated a class Eq (Associated a) => Foo a where - type Associated a :: * + type Associated a :: Type foo :: a -> Syn a -> Bool instance Foo () where diff --git a/testsuite/tests/indexed-types/should_compile/T9316.hs b/testsuite/tests/indexed-types/should_compile/T9316.hs index 473c213965..cac5a72a1f 100644 --- a/testsuite/tests/indexed-types/should_compile/T9316.hs +++ b/testsuite/tests/indexed-types/should_compile/T9316.hs @@ -14,12 +14,12 @@ module SingletonsBug where import Control.Applicative import Data.Traversable (for) -import GHC.Exts( Constraint ) +import Data.Kind (Type, Constraint) ----------------------------------- -- From 'constraints' library -- import Data.Constraint (Dict(..)) -data Dict :: Constraint -> * where +data Dict :: Constraint -> Type where Dict :: a => Dict a ----------------------------------- @@ -33,7 +33,7 @@ class SingI (a :: k) where data family Sing (a :: k) -data KProxy (a :: *) = KProxy +data KProxy (a :: Type) = KProxy data SomeSing (kproxy :: KProxy k) where SomeSing :: Sing (a :: k) -> SomeSing ('KProxy :: KProxy k) @@ -42,7 +42,7 @@ data SomeSing (kproxy :: KProxy k) where class (kparam ~ 'KProxy) => SingKind (kparam :: KProxy k) where -- | Get a base type from a proxy for the promoted kind. For example, -- @DemoteRep ('KProxy :: KProxy Bool)@ will be the type @Bool@. - type DemoteRep kparam :: * + type DemoteRep kparam :: Type -- | Convert a singleton to its unrefined version. fromSing :: Sing (a :: k) -> DemoteRep kparam @@ -71,7 +71,7 @@ instance SingKind ('KProxy :: KProxy SubscriptionChannel) where instance SingI BookingsChannel where sing = SBookingsChannel -type family T (c :: SubscriptionChannel) :: * +type family T (c :: SubscriptionChannel) :: Type type instance T 'BookingsChannel = Bool witnessC :: Sing channel -> Dict (Show (T channel), SingI channel) diff --git a/testsuite/tests/indexed-types/should_compile/T9840.hs b/testsuite/tests/indexed-types/should_compile/T9840.hs index 2584be6a99..0dc96bb9c7 100644 --- a/testsuite/tests/indexed-types/should_compile/T9840.hs +++ b/testsuite/tests/indexed-types/should_compile/T9840.hs @@ -2,11 +2,12 @@ module T9840 where +import Data.Kind (Type) import T9840a -type family X :: * -> * where +type family X :: Type -> Type where -type family F (a :: * -> *) where +type family F (a :: Type -> Type) where foo :: G (F X) -> G (F X) foo x = x diff --git a/testsuite/tests/indexed-types/should_compile/T9840.hs-boot b/testsuite/tests/indexed-types/should_compile/T9840.hs-boot index 36fb05892e..b60a8db0ac 100644 --- a/testsuite/tests/indexed-types/should_compile/T9840.hs-boot +++ b/testsuite/tests/indexed-types/should_compile/T9840.hs-boot @@ -2,9 +2,11 @@ module T9840 where +import Data.Kind (Type) + -- X is an abstract type family (it might be empty or not, though it -- will turn out to be empty when we check the hs file) -type family X :: * -> * where .. +type family X :: Type -> Type where .. -- F is known to be empty in the hs-boot file -type family F (a :: * -> *) where +type family F (a :: Type -> Type) where diff --git a/testsuite/tests/indexed-types/should_compile/ind1.hs b/testsuite/tests/indexed-types/should_compile/ind1.hs index 48203a1519..d46ea883af 100644 --- a/testsuite/tests/indexed-types/should_compile/ind1.hs +++ b/testsuite/tests/indexed-types/should_compile/ind1.hs @@ -4,7 +4,9 @@ module ShouldCompile where -data family T a :: * +import Data.Kind (Type) + +data family T a :: Type data instance T Bool = TBool !Bool diff --git a/testsuite/tests/indexed-types/should_compile/red-black-delete.hs b/testsuite/tests/indexed-types/should_compile/red-black-delete.hs index c1ce0fb71f..69931d4d8c 100644 --- a/testsuite/tests/indexed-types/should_compile/red-black-delete.hs +++ b/testsuite/tests/indexed-types/should_compile/red-black-delete.hs @@ -15,6 +15,7 @@ import Prelude hiding (max) import Data.List(nub,sort) import Control.Monad(liftM) import Data.Type.Equality +import Data.Kind (Type) import Data.Maybe(isJust) -- @@ -35,7 +36,7 @@ data Nat = Z | S Nat -- Well-formed Red/Black trees -- n statically tracks the black height of the tree -- c statically tracks the color of the root node -data CT (n :: Nat) (c :: Color) (a :: *) where +data CT (n :: Nat) (c :: Color) (a :: Type) where E :: CT Z Black a T :: Valid c c1 c2 => SColor c -> (CT n c1 a) -> a -> (CT n c2 a) -> CT (Incr c n) c a diff --git a/testsuite/tests/indexed-types/should_fail/ClosedFam3.hs-boot b/testsuite/tests/indexed-types/should_fail/ClosedFam3.hs-boot index 503e1adfd3..5a10841ba4 100644 --- a/testsuite/tests/indexed-types/should_fail/ClosedFam3.hs-boot +++ b/testsuite/tests/indexed-types/should_fail/ClosedFam3.hs-boot @@ -2,6 +2,8 @@ module ClosedFam3 where +import Data.Kind (Type) + type family Foo a where Foo Int = Bool @@ -9,5 +11,5 @@ type family Bar a where Bar Int = Bool Bar Double = Char -type family Baz (a :: k) :: * where +type family Baz (a :: k) :: Type where Baz Int = Bool diff --git a/testsuite/tests/indexed-types/should_fail/ClosedFam3.stderr b/testsuite/tests/indexed-types/should_fail/ClosedFam3.stderr index cab50784e1..28e71792ca 100644 --- a/testsuite/tests/indexed-types/should_fail/ClosedFam3.stderr +++ b/testsuite/tests/indexed-types/should_fail/ClosedFam3.stderr @@ -1,5 +1,5 @@ -ClosedFam3.hs-boot:5:1: error: +ClosedFam3.hs-boot:7:1: error: Type constructor ‘Foo’ has conflicting definitions in the module and its hs-boot file Main module: type family Foo a :: * @@ -9,7 +9,7 @@ ClosedFam3.hs-boot:5:1: error: Boot file: type family Foo a :: * where Foo Int = Bool -ClosedFam3.hs-boot:8:1: error: +ClosedFam3.hs-boot:10:1: error: Type constructor ‘Bar’ has conflicting definitions in the module and its hs-boot file Main module: type family Bar a :: * @@ -21,7 +21,7 @@ ClosedFam3.hs-boot:8:1: error: Bar Int = Bool Bar Double = Char -ClosedFam3.hs-boot:12:1: error: +ClosedFam3.hs-boot:14:1: error: Type constructor ‘Baz’ has conflicting definitions in the module and its hs-boot file Main module: type family Baz a :: * diff --git a/testsuite/tests/indexed-types/should_fail/NonLinearSigErr.hs b/testsuite/tests/indexed-types/should_fail/NonLinearSigErr.hs index 34a9fd3ff6..6d1a08da3b 100644 --- a/testsuite/tests/indexed-types/should_fail/NonLinearSigErr.hs +++ b/testsuite/tests/indexed-types/should_fail/NonLinearSigErr.hs @@ -4,5 +4,7 @@ module NonLinearSigErr where +import Data.Kind (Type) + type family E a b -type instance E a (a :: *) = [a] +type instance E a (a :: Type) = [a] diff --git a/testsuite/tests/indexed-types/should_fail/OverA.hs b/testsuite/tests/indexed-types/should_fail/OverA.hs index 0f0573782f..4cea919c71 100644 --- a/testsuite/tests/indexed-types/should_fail/OverA.hs +++ b/testsuite/tests/indexed-types/should_fail/OverA.hs @@ -3,6 +3,8 @@ module OverA (C, D) where -data family C a b :: * +import Data.Kind (Type) -type family D a b :: *
\ No newline at end of file +data family C a b :: Type + +type family D a b :: Type diff --git a/testsuite/tests/indexed-types/should_fail/OverDirectThisModA.hs b/testsuite/tests/indexed-types/should_fail/OverDirectThisModA.hs index d2655b6937..d099f48c31 100644 --- a/testsuite/tests/indexed-types/should_fail/OverDirectThisModA.hs +++ b/testsuite/tests/indexed-types/should_fail/OverDirectThisModA.hs @@ -3,6 +3,8 @@ module OverDirectThisModA (C, D) where -data family C a b :: * +import Data.Kind (Type) -type family D a b :: * +data family C a b :: Type + +type family D a b :: Type diff --git a/testsuite/tests/indexed-types/should_fail/OverIndirectThisModA.hs b/testsuite/tests/indexed-types/should_fail/OverIndirectThisModA.hs index f316ac159c..1651dd3d24 100644 --- a/testsuite/tests/indexed-types/should_fail/OverIndirectThisModA.hs +++ b/testsuite/tests/indexed-types/should_fail/OverIndirectThisModA.hs @@ -3,6 +3,8 @@ module OverIndirectThisModA (C, D) where -data family C a b :: * +import Data.Kind (Type) -type family D a b :: * +data family C a b :: Type + +type family D a b :: Type diff --git a/testsuite/tests/indexed-types/should_fail/SimpleFail10.hs b/testsuite/tests/indexed-types/should_fail/SimpleFail10.hs index 4bd7bde8df..a6cccc1563 100644 --- a/testsuite/tests/indexed-types/should_fail/SimpleFail10.hs +++ b/testsuite/tests/indexed-types/should_fail/SimpleFail10.hs @@ -2,8 +2,10 @@ module ShouldFail where +import Data.Kind (Type) + class C8 a where - data S8 a :: * -> * + data S8 a :: Type -> Type instance C8 Int where data S8 Int a = S8Int a diff --git a/testsuite/tests/indexed-types/should_fail/SimpleFail4.hs b/testsuite/tests/indexed-types/should_fail/SimpleFail4.hs index dad09a27fd..589372cd5e 100644 --- a/testsuite/tests/indexed-types/should_fail/SimpleFail4.hs +++ b/testsuite/tests/indexed-types/should_fail/SimpleFail4.hs @@ -2,7 +2,9 @@ module ShouldFail where +import Data.Kind (Type) + -- must fail: defaults have no patterns class C2 a b where - type S2 a :: * + type S2 a :: Type type S2 Int = Char diff --git a/testsuite/tests/indexed-types/should_fail/SimpleFail4.stderr b/testsuite/tests/indexed-types/should_fail/SimpleFail4.stderr index 8c4c743a56..8768c66613 100644 --- a/testsuite/tests/indexed-types/should_fail/SimpleFail4.stderr +++ b/testsuite/tests/indexed-types/should_fail/SimpleFail4.stderr @@ -1,5 +1,5 @@ -SimpleFail4.hs:8:11: +SimpleFail4.hs:10:11: error: Unexpected type ‘Int’ In the default declaration for ‘S2’ A default declaration should have form diff --git a/testsuite/tests/indexed-types/should_fail/T7354b.hs b/testsuite/tests/indexed-types/should_fail/T7354b.hs index c5395cfd92..c3c20dc48c 100644 --- a/testsuite/tests/indexed-types/should_fail/T7354b.hs +++ b/testsuite/tests/indexed-types/should_fail/T7354b.hs @@ -1,7 +1,9 @@ {-# LANGUAGE TypeFamilies, FlexibleContexts #-} module T7354b where -type family Base t :: * -> * +import Data.Kind (Type) + +type family Base t :: Type -> Type class Unfoldable t where embed :: Base t t -> t diff --git a/testsuite/tests/indexed-types/should_fail/T8227.hs b/testsuite/tests/indexed-types/should_fail/T8227.hs index 97e8ef5855..05d8222ff4 100644 --- a/testsuite/tests/indexed-types/should_fail/T8227.hs +++ b/testsuite/tests/indexed-types/should_fail/T8227.hs @@ -4,9 +4,10 @@ module T8227 absoluteToParam ) where +import Data.Kind (Type) import T8227a -type family Scalar a :: * +type family Scalar a :: Type type instance Scalar (a -> v) = a -> Scalar v arcLengthToParam :: Scalar (V p) -> p -> Scalar (V p) -> Scalar (V p) diff --git a/testsuite/tests/indexed-types/should_fail/T8227.stderr b/testsuite/tests/indexed-types/should_fail/T8227.stderr index 88f4732df1..f86ac68d95 100644 --- a/testsuite/tests/indexed-types/should_fail/T8227.stderr +++ b/testsuite/tests/indexed-types/should_fail/T8227.stderr @@ -1,5 +1,5 @@ -T8227.hs:16:27: error: +T8227.hs:17:27: error: • Couldn't match type ‘Scalar (V a)’ with ‘Scalar (V a) -> Scalar (V a)’ Expected type: Scalar (V a) @@ -9,7 +9,7 @@ T8227.hs:16:27: error: In an equation for ‘absoluteToParam’: absoluteToParam eps seg = arcLengthToParam eps eps • Relevant bindings include - seg :: a (bound at T8227.hs:16:21) - eps :: Scalar (V a) (bound at T8227.hs:16:17) + seg :: a (bound at T8227.hs:17:21) + eps :: Scalar (V a) (bound at T8227.hs:17:17) absoluteToParam :: Scalar (V a) -> a -> Scalar (V a) - (bound at T8227.hs:16:1) + (bound at T8227.hs:17:1) diff --git a/testsuite/tests/indexed-types/should_fail/T8227a.hs b/testsuite/tests/indexed-types/should_fail/T8227a.hs index 157d4bdd2b..fc1b219148 100644 --- a/testsuite/tests/indexed-types/should_fail/T8227a.hs +++ b/testsuite/tests/indexed-types/should_fail/T8227a.hs @@ -1,7 +1,9 @@ {-# LANGUAGE TypeFamilies #-} module T8227a where -type family V a :: * +import Data.Kind (Type) + +type family V a :: Type type instance V Double = Double -type instance V (a -> b) = V b
\ No newline at end of file +type instance V (a -> b) = V b diff --git a/testsuite/tests/indexed-types/should_fail/T9580a.hs b/testsuite/tests/indexed-types/should_fail/T9580a.hs index 578c8bafb8..684bf4203c 100644 --- a/testsuite/tests/indexed-types/should_fail/T9580a.hs +++ b/testsuite/tests/indexed-types/should_fail/T9580a.hs @@ -1,5 +1,7 @@ {-# LANGUAGE KindSignatures, TypeFamilies #-} module T9580a( Dimensional ) where -data family Dimensional var :: * -> * +import Data.Kind (Type) + +data family Dimensional var :: Type -> Type newtype instance Dimensional Int v = Quantity' v diff --git a/testsuite/tests/indexed-types/should_run/GMapAssoc.hs b/testsuite/tests/indexed-types/should_run/GMapAssoc.hs index 71cd726b3f..3bd09b5dcf 100644 --- a/testsuite/tests/indexed-types/should_run/GMapAssoc.hs +++ b/testsuite/tests/indexed-types/should_run/GMapAssoc.hs @@ -5,13 +5,13 @@ module Main where import Prelude hiding (lookup) import Data.Char (ord) import qualified Data.Map as Map - +import Data.Kind (Type) -- Generic maps as ATs -- ------------------- class GMapKey k where - data GMap k :: * -> * + data GMap k :: Type -> Type empty :: GMap k v lookup :: k -> GMap k v -> Maybe v insert :: k -> v -> GMap k v -> GMap k v diff --git a/testsuite/tests/indexed-types/should_run/GMapTop.hs b/testsuite/tests/indexed-types/should_run/GMapTop.hs index 5f817a31dc..3717cc49b6 100644 --- a/testsuite/tests/indexed-types/should_run/GMapTop.hs +++ b/testsuite/tests/indexed-types/should_run/GMapTop.hs @@ -5,12 +5,13 @@ module Main where import Prelude hiding (lookup) import Data.Char (ord) import qualified Data.Map as Map +import Data.Kind (Type) -- Generic maps as toplevel indexed data types ---------------------------------------------- -data family GMap k :: * -> * +data family GMap k :: Type -> Type data instance GMap Int v = GMapInt (Map.Map Int v) data instance GMap Char v = GMapChar (GMap Int v) data instance GMap () v = GMapUnit (Maybe v) diff --git a/testsuite/tests/indexed-types/should_run/T11465a.hs b/testsuite/tests/indexed-types/should_run/T11465a.hs index 93d72545e3..9f47701dfc 100644 --- a/testsuite/tests/indexed-types/should_run/T11465a.hs +++ b/testsuite/tests/indexed-types/should_run/T11465a.hs @@ -7,7 +7,7 @@ import GHC.Exts import GHC.Types class BoxIt (a :: TYPE 'WordRep) where - type Boxed a :: * + type Boxed a :: Type boxed :: a -> Boxed a instance BoxIt Char# where diff --git a/testsuite/tests/monadfail/MonadFailWarnings.hs b/testsuite/tests/monadfail/MonadFailWarnings.hs index f540201c53..7e3d7fc428 100644 --- a/testsuite/tests/monadfail/MonadFailWarnings.hs +++ b/testsuite/tests/monadfail/MonadFailWarnings.hs @@ -2,7 +2,7 @@ -- Ensure that MonadFail warnings are issued correctly if the warning flag -- is enabled {-# LANGUAGE NoMonadFailDesugaring #-} -{-# OPTIONS_GHC -Wmissing-monadfail-instances #-} +{-# OPTIONS_GHC -Wmissing-monadfail-instances -Wno-error=compat #-} module MonadFailWarnings where diff --git a/testsuite/tests/monadfail/MonadFailWarningsDisabled.hs b/testsuite/tests/monadfail/MonadFailWarningsDisabled.hs index c6fd34a67e..858a212b45 100644 --- a/testsuite/tests/monadfail/MonadFailWarningsDisabled.hs +++ b/testsuite/tests/monadfail/MonadFailWarningsDisabled.hs @@ -6,6 +6,7 @@ -- to disable to keep supporting this test-case -- {-# LANGUAGE NoMonadFailDesugaring #-} +{-# OPTIONS -Wno-missing-monadfail-instances #-} module MonadFailWarnings where diff --git a/testsuite/tests/monadfail/MonadFailWarningsWithRebindableSyntax.hs b/testsuite/tests/monadfail/MonadFailWarningsWithRebindableSyntax.hs index 6126e24e26..b369fc019f 100644 --- a/testsuite/tests/monadfail/MonadFailWarningsWithRebindableSyntax.hs +++ b/testsuite/tests/monadfail/MonadFailWarningsWithRebindableSyntax.hs @@ -2,7 +2,7 @@ -- RebindableSyntax does not play that well with MonadFail, so here we ensure -- that when both settings are enabled we get the proper warning. -{-# OPTIONS_GHC -Wmissing-monadfail-instances #-} +{-# OPTIONS_GHC -Wmissing-monadfail-instances -Wno-error=compat #-} {-# LANGUAGE RebindableSyntax #-} module MonadFailWarningsWithRebindableSyntax where diff --git a/testsuite/tests/parser/should_compile/DumpRenamedAst.hs b/testsuite/tests/parser/should_compile/DumpRenamedAst.hs index bf3e372461..c617febd40 100644 --- a/testsuite/tests/parser/should_compile/DumpRenamedAst.hs +++ b/testsuite/tests/parser/should_compile/DumpRenamedAst.hs @@ -1,18 +1,20 @@ {-# LANGUAGE DataKinds, GADTs, PolyKinds, RankNTypes, TypeOperators, - TypeFamilies, StarIsType #-} + TypeFamilies #-} module DumpRenamedAst where +import Data.Kind (Type) + data Peano = Zero | Succ Peano type family Length (as :: [k]) :: Peano where Length (a : as) = Succ (Length as) Length '[] = Zero -data family Nat :: k -> k -> * +data family Nat :: k -> k -> Type -- Ensure that the `k` in the type pattern and `k` in the kind signature have -- the same binding site. -newtype instance Nat (a :: k -> *) :: (k -> *) -> * where +newtype instance Nat (a :: k -> Type) :: (k -> Type) -> Type where Nat :: (forall xx. f xx -> g xx) -> Nat f g main = putStrLn "hello" diff --git a/testsuite/tests/parser/should_compile/DumpRenamedAst.stderr b/testsuite/tests/parser/should_compile/DumpRenamedAst.stderr index d27e6d96e0..f20c450a9a 100644 --- a/testsuite/tests/parser/should_compile/DumpRenamedAst.stderr +++ b/testsuite/tests/parser/should_compile/DumpRenamedAst.stderr @@ -10,39 +10,39 @@ [((,) (NonRecursive) {Bag(Located (HsBind Name)): - [({ DumpRenamedAst.hs:18:1-23 } + [({ DumpRenamedAst.hs:20:1-23 } (FunBind {NameSet: []} - ({ DumpRenamedAst.hs:18:1-4 } + ({ DumpRenamedAst.hs:20:1-4 } {Name: DumpRenamedAst.main}) (MG (NoExt) - ({ DumpRenamedAst.hs:18:1-23 } - [({ DumpRenamedAst.hs:18:1-23 } + ({ DumpRenamedAst.hs:20:1-23 } + [({ DumpRenamedAst.hs:20:1-23 } (Match (NoExt) (FunRhs - ({ DumpRenamedAst.hs:18:1-4 } + ({ DumpRenamedAst.hs:20:1-4 } {Name: DumpRenamedAst.main}) (Prefix) (NoSrcStrict)) [] (GRHSs (NoExt) - [({ DumpRenamedAst.hs:18:6-23 } + [({ DumpRenamedAst.hs:20:6-23 } (GRHS (NoExt) [] - ({ DumpRenamedAst.hs:18:8-23 } + ({ DumpRenamedAst.hs:20:8-23 } (HsApp (NoExt) - ({ DumpRenamedAst.hs:18:8-15 } + ({ DumpRenamedAst.hs:20:8-15 } (HsVar (NoExt) - ({ DumpRenamedAst.hs:18:8-15 } + ({ DumpRenamedAst.hs:20:8-15 } {Name: System.IO.putStrLn}))) - ({ DumpRenamedAst.hs:18:17-23 } + ({ DumpRenamedAst.hs:20:17-23 } (HsLit (NoExt) (HsString @@ -59,13 +59,13 @@ [] [(TyClGroup (NoExt) - [({ DumpRenamedAst.hs:6:1-30 } + [({ DumpRenamedAst.hs:8:1-30 } (DataDecl (DataDeclRn (True) {NameSet: [{Name: DumpRenamedAst.Peano}]}) - ({ DumpRenamedAst.hs:6:6-10 } + ({ DumpRenamedAst.hs:8:6-10 } {Name: DumpRenamedAst.Peano}) (HsQTvs (HsQTvsRn @@ -81,10 +81,10 @@ []) (Nothing) (Nothing) - [({ DumpRenamedAst.hs:6:14-17 } + [({ DumpRenamedAst.hs:8:14-17 } (ConDeclH98 (NoExt) - ({ DumpRenamedAst.hs:6:14-17 } + ({ DumpRenamedAst.hs:8:14-17 } {Name: DumpRenamedAst.Zero}) ({ <no location info> } (False)) @@ -93,21 +93,21 @@ (PrefixCon []) (Nothing))) - ,({ DumpRenamedAst.hs:6:21-30 } + ,({ DumpRenamedAst.hs:8:21-30 } (ConDeclH98 (NoExt) - ({ DumpRenamedAst.hs:6:21-24 } + ({ DumpRenamedAst.hs:8:21-24 } {Name: DumpRenamedAst.Succ}) ({ <no location info> } (False)) [] (Nothing) (PrefixCon - [({ DumpRenamedAst.hs:6:26-30 } + [({ DumpRenamedAst.hs:8:26-30 } (HsTyVar (NoExt) (NotPromoted) - ({ DumpRenamedAst.hs:6:26-30 } + ({ DumpRenamedAst.hs:8:26-30 } {Name: DumpRenamedAst.Peano})))]) (Nothing)))] ({ <no location info> } @@ -116,131 +116,131 @@ []) ,(TyClGroup (NoExt) - [({ DumpRenamedAst.hs:8:1-39 } + [({ DumpRenamedAst.hs:10:1-39 } (FamDecl (NoExt) (FamilyDecl (NoExt) (ClosedTypeFamily (Just - [({ DumpRenamedAst.hs:9:3-36 } + [({ DumpRenamedAst.hs:11:3-36 } (HsIB [{Name: a} ,{Name: as}] (FamEqn (NoExt) - ({ DumpRenamedAst.hs:9:3-8 } + ({ DumpRenamedAst.hs:11:3-8 } {Name: DumpRenamedAst.Length}) - [({ DumpRenamedAst.hs:9:10-17 } + [({ DumpRenamedAst.hs:11:10-17 } (HsParTy (NoExt) - ({ DumpRenamedAst.hs:9:11-16 } + ({ DumpRenamedAst.hs:11:11-16 } (HsOpTy (NoExt) - ({ DumpRenamedAst.hs:9:11 } + ({ DumpRenamedAst.hs:11:11 } (HsTyVar (NoExt) (NotPromoted) - ({ DumpRenamedAst.hs:9:11 } + ({ DumpRenamedAst.hs:11:11 } {Name: a}))) - ({ DumpRenamedAst.hs:9:13 } + ({ DumpRenamedAst.hs:11:13 } {Name: :}) - ({ DumpRenamedAst.hs:9:15-16 } + ({ DumpRenamedAst.hs:11:15-16 } (HsTyVar (NoExt) (NotPromoted) - ({ DumpRenamedAst.hs:9:15-16 } + ({ DumpRenamedAst.hs:11:15-16 } {Name: as})))))))] (Prefix) - ({ DumpRenamedAst.hs:9:21-36 } + ({ DumpRenamedAst.hs:11:21-36 } (HsAppTy (NoExt) - ({ DumpRenamedAst.hs:9:21-24 } + ({ DumpRenamedAst.hs:11:21-24 } (HsTyVar (NoExt) (NotPromoted) - ({ DumpRenamedAst.hs:9:21-24 } + ({ DumpRenamedAst.hs:11:21-24 } {Name: DumpRenamedAst.Succ}))) - ({ DumpRenamedAst.hs:9:26-36 } + ({ DumpRenamedAst.hs:11:26-36 } (HsParTy (NoExt) - ({ DumpRenamedAst.hs:9:27-35 } + ({ DumpRenamedAst.hs:11:27-35 } (HsAppTy (NoExt) - ({ DumpRenamedAst.hs:9:27-32 } + ({ DumpRenamedAst.hs:11:27-32 } (HsTyVar (NoExt) (NotPromoted) - ({ DumpRenamedAst.hs:9:27-32 } + ({ DumpRenamedAst.hs:11:27-32 } {Name: DumpRenamedAst.Length}))) - ({ DumpRenamedAst.hs:9:34-35 } + ({ DumpRenamedAst.hs:11:34-35 } (HsTyVar (NoExt) (NotPromoted) - ({ DumpRenamedAst.hs:9:34-35 } + ({ DumpRenamedAst.hs:11:34-35 } {Name: as})))))))))))) - ,({ DumpRenamedAst.hs:10:3-24 } + ,({ DumpRenamedAst.hs:12:3-24 } (HsIB [] (FamEqn (NoExt) - ({ DumpRenamedAst.hs:10:3-8 } + ({ DumpRenamedAst.hs:12:3-8 } {Name: DumpRenamedAst.Length}) - [({ DumpRenamedAst.hs:10:10-12 } + [({ DumpRenamedAst.hs:12:10-12 } (HsExplicitListTy (NoExt) (Promoted) []))] (Prefix) - ({ DumpRenamedAst.hs:10:21-24 } + ({ DumpRenamedAst.hs:12:21-24 } (HsTyVar (NoExt) (NotPromoted) - ({ DumpRenamedAst.hs:10:21-24 } + ({ DumpRenamedAst.hs:12:21-24 } {Name: DumpRenamedAst.Zero}))))))])) - ({ DumpRenamedAst.hs:8:13-18 } + ({ DumpRenamedAst.hs:10:13-18 } {Name: DumpRenamedAst.Length}) (HsQTvs (HsQTvsRn [{Name: k}] {NameSet: []}) - [({ DumpRenamedAst.hs:8:21-29 } + [({ DumpRenamedAst.hs:10:21-29 } (KindedTyVar (NoExt) - ({ DumpRenamedAst.hs:8:21-22 } + ({ DumpRenamedAst.hs:10:21-22 } {Name: as}) - ({ DumpRenamedAst.hs:8:27-29 } + ({ DumpRenamedAst.hs:10:27-29 } (HsListTy (NoExt) - ({ DumpRenamedAst.hs:8:28 } + ({ DumpRenamedAst.hs:10:28 } (HsTyVar (NoExt) (NotPromoted) - ({ DumpRenamedAst.hs:8:28 } + ({ DumpRenamedAst.hs:10:28 } {Name: k})))))))]) (Prefix) - ({ DumpRenamedAst.hs:8:32-39 } + ({ DumpRenamedAst.hs:10:32-39 } (KindSig (NoExt) - ({ DumpRenamedAst.hs:8:35-39 } + ({ DumpRenamedAst.hs:10:35-39 } (HsTyVar (NoExt) (NotPromoted) - ({ DumpRenamedAst.hs:8:35-39 } + ({ DumpRenamedAst.hs:10:35-39 } {Name: DumpRenamedAst.Peano}))))) (Nothing))))] [] []) ,(TyClGroup (NoExt) - [({ DumpRenamedAst.hs:12:1-30 } + [({ DumpRenamedAst.hs:14:1-33 } (FamDecl (NoExt) (FamilyDecl (NoExt) (DataFamily) - ({ DumpRenamedAst.hs:12:13-15 } + ({ DumpRenamedAst.hs:14:13-15 } {Name: DumpRenamedAst.Nat}) (HsQTvs (HsQTvsRn @@ -249,34 +249,36 @@ []}) []) (Prefix) - ({ DumpRenamedAst.hs:12:17-30 } + ({ DumpRenamedAst.hs:14:17-33 } (KindSig (NoExt) - ({ DumpRenamedAst.hs:12:20-30 } + ({ DumpRenamedAst.hs:14:20-33 } (HsFunTy (NoExt) - ({ DumpRenamedAst.hs:12:20 } + ({ DumpRenamedAst.hs:14:20 } (HsTyVar (NoExt) (NotPromoted) - ({ DumpRenamedAst.hs:12:20 } + ({ DumpRenamedAst.hs:14:20 } {Name: k}))) - ({ DumpRenamedAst.hs:12:25-30 } + ({ DumpRenamedAst.hs:14:25-33 } (HsFunTy (NoExt) - ({ DumpRenamedAst.hs:12:25 } + ({ DumpRenamedAst.hs:14:25 } (HsTyVar (NoExt) (NotPromoted) - ({ DumpRenamedAst.hs:12:25 } + ({ DumpRenamedAst.hs:14:25 } {Name: k}))) - ({ DumpRenamedAst.hs:12:30 } - (HsStarTy + ({ DumpRenamedAst.hs:14:30-33 } + (HsTyVar (NoExt) - (False))))))))) + (NotPromoted) + ({ DumpRenamedAst.hs:14:30-33 } + {Name: GHC.Types.Type}))))))))) (Nothing))))] [] - [({ DumpRenamedAst.hs:(15,1)-(16,45) } + [({ DumpRenamedAst.hs:(17,1)-(18,45) } (DataFamInstD (NoExt) (DataFamInstDecl @@ -285,33 +287,35 @@ ,{Name: a}] (FamEqn (NoExt) - ({ DumpRenamedAst.hs:15:18-20 } + ({ DumpRenamedAst.hs:17:18-20 } {Name: DumpRenamedAst.Nat}) - [({ DumpRenamedAst.hs:15:22-34 } + [({ DumpRenamedAst.hs:17:22-37 } (HsParTy (NoExt) - ({ DumpRenamedAst.hs:15:23-33 } + ({ DumpRenamedAst.hs:17:23-36 } (HsKindSig (NoExt) - ({ DumpRenamedAst.hs:15:23 } + ({ DumpRenamedAst.hs:17:23 } (HsTyVar (NoExt) (NotPromoted) - ({ DumpRenamedAst.hs:15:23 } + ({ DumpRenamedAst.hs:17:23 } {Name: a}))) - ({ DumpRenamedAst.hs:15:28-33 } + ({ DumpRenamedAst.hs:17:28-36 } (HsFunTy (NoExt) - ({ DumpRenamedAst.hs:15:28 } + ({ DumpRenamedAst.hs:17:28 } (HsTyVar (NoExt) (NotPromoted) - ({ DumpRenamedAst.hs:15:28 } + ({ DumpRenamedAst.hs:17:28 } {Name: k}))) - ({ DumpRenamedAst.hs:15:33 } - (HsStarTy + ({ DumpRenamedAst.hs:17:33-36 } + (HsTyVar (NoExt) - (False)))))))))] + (NotPromoted) + ({ DumpRenamedAst.hs:17:33-36 } + {Name: GHC.Types.Type})))))))))] (Prefix) (HsDataDefn (NoExt) @@ -320,35 +324,39 @@ []) (Nothing) (Just - ({ DumpRenamedAst.hs:15:39-51 } + ({ DumpRenamedAst.hs:17:42-60 } (HsFunTy (NoExt) - ({ DumpRenamedAst.hs:15:39-46 } + ({ DumpRenamedAst.hs:17:42-52 } (HsParTy (NoExt) - ({ DumpRenamedAst.hs:15:40-45 } + ({ DumpRenamedAst.hs:17:43-51 } (HsFunTy (NoExt) - ({ DumpRenamedAst.hs:15:40 } + ({ DumpRenamedAst.hs:17:43 } (HsTyVar (NoExt) (NotPromoted) - ({ DumpRenamedAst.hs:15:40 } + ({ DumpRenamedAst.hs:17:43 } {Name: k}))) - ({ DumpRenamedAst.hs:15:45 } - (HsStarTy + ({ DumpRenamedAst.hs:17:48-51 } + (HsTyVar (NoExt) - (False))))))) - ({ DumpRenamedAst.hs:15:51 } - (HsStarTy + (NotPromoted) + ({ DumpRenamedAst.hs:17:48-51 } + {Name: GHC.Types.Type}))))))) + ({ DumpRenamedAst.hs:17:57-60 } + (HsTyVar (NoExt) - (False)))))) - [({ DumpRenamedAst.hs:16:3-45 } + (NotPromoted) + ({ DumpRenamedAst.hs:17:57-60 } + {Name: GHC.Types.Type})))))) + [({ DumpRenamedAst.hs:18:3-45 } (ConDeclGADT (NoExt) - [({ DumpRenamedAst.hs:16:3-5 } + [({ DumpRenamedAst.hs:18:3-5 } {Name: DumpRenamedAst.Nat})] - ({ DumpRenamedAst.hs:16:10-45 } + ({ DumpRenamedAst.hs:18:10-45 } (False)) (HsQTvs (HsQTvsRn @@ -359,73 +367,73 @@ []) (Nothing) (PrefixCon - [({ DumpRenamedAst.hs:16:10-34 } + [({ DumpRenamedAst.hs:18:10-34 } (HsParTy (NoExt) - ({ DumpRenamedAst.hs:16:11-33 } + ({ DumpRenamedAst.hs:18:11-33 } (HsForAllTy (NoExt) - [({ DumpRenamedAst.hs:16:18-19 } + [({ DumpRenamedAst.hs:18:18-19 } (UserTyVar (NoExt) - ({ DumpRenamedAst.hs:16:18-19 } + ({ DumpRenamedAst.hs:18:18-19 } {Name: xx})))] - ({ DumpRenamedAst.hs:16:22-33 } + ({ DumpRenamedAst.hs:18:22-33 } (HsFunTy (NoExt) - ({ DumpRenamedAst.hs:16:22-25 } + ({ DumpRenamedAst.hs:18:22-25 } (HsAppTy (NoExt) - ({ DumpRenamedAst.hs:16:22 } + ({ DumpRenamedAst.hs:18:22 } (HsTyVar (NoExt) (NotPromoted) - ({ DumpRenamedAst.hs:16:22 } + ({ DumpRenamedAst.hs:18:22 } {Name: f}))) - ({ DumpRenamedAst.hs:16:24-25 } + ({ DumpRenamedAst.hs:18:24-25 } (HsTyVar (NoExt) (NotPromoted) - ({ DumpRenamedAst.hs:16:24-25 } + ({ DumpRenamedAst.hs:18:24-25 } {Name: xx}))))) - ({ DumpRenamedAst.hs:16:30-33 } + ({ DumpRenamedAst.hs:18:30-33 } (HsAppTy (NoExt) - ({ DumpRenamedAst.hs:16:30 } + ({ DumpRenamedAst.hs:18:30 } (HsTyVar (NoExt) (NotPromoted) - ({ DumpRenamedAst.hs:16:30 } + ({ DumpRenamedAst.hs:18:30 } {Name: g}))) - ({ DumpRenamedAst.hs:16:32-33 } + ({ DumpRenamedAst.hs:18:32-33 } (HsTyVar (NoExt) (NotPromoted) - ({ DumpRenamedAst.hs:16:32-33 } + ({ DumpRenamedAst.hs:18:32-33 } {Name: xx})))))))))))]) - ({ DumpRenamedAst.hs:16:39-45 } + ({ DumpRenamedAst.hs:18:39-45 } (HsAppTy (NoExt) - ({ DumpRenamedAst.hs:16:39-43 } + ({ DumpRenamedAst.hs:18:39-43 } (HsAppTy (NoExt) - ({ DumpRenamedAst.hs:16:39-41 } + ({ DumpRenamedAst.hs:18:39-41 } (HsTyVar (NoExt) (NotPromoted) - ({ DumpRenamedAst.hs:16:39-41 } + ({ DumpRenamedAst.hs:18:39-41 } {Name: DumpRenamedAst.Nat}))) - ({ DumpRenamedAst.hs:16:43 } + ({ DumpRenamedAst.hs:18:43 } (HsTyVar (NoExt) (NotPromoted) - ({ DumpRenamedAst.hs:16:43 } + ({ DumpRenamedAst.hs:18:43 } {Name: f}))))) - ({ DumpRenamedAst.hs:16:45 } + ({ DumpRenamedAst.hs:18:45 } (HsTyVar (NoExt) (NotPromoted) - ({ DumpRenamedAst.hs:16:45 } + ({ DumpRenamedAst.hs:18:45 } {Name: g}))))) (Nothing)))] ({ <no location info> } @@ -450,7 +458,30 @@ (False) (True) (Nothing) - (Nothing)))] + (Nothing))) + ,({ DumpRenamedAst.hs:6:1-23 } + (ImportDecl + (NoExt) + (NoSourceText) + ({ DumpRenamedAst.hs:6:8-16 } + {ModuleName: Data.Kind}) + (Nothing) + (False) + (False) + (False) + (False) + (Nothing) + (Just + ((,) + (False) + ({ DumpRenamedAst.hs:6:18-23 } + [({ DumpRenamedAst.hs:6:19-22 } + (IEThingAbs + (NoExt) + ({ DumpRenamedAst.hs:6:19-22 } + (IEName + ({ DumpRenamedAst.hs:6:19-22 } + {Name: GHC.Types.Type})))))])))))] (Nothing) (Nothing))) diff --git a/testsuite/tests/parser/should_compile/T10379.hs b/testsuite/tests/parser/should_compile/T10379.hs index eb231c4415..aa62d17233 100644 --- a/testsuite/tests/parser/should_compile/T10379.hs +++ b/testsuite/tests/parser/should_compile/T10379.hs @@ -1,4 +1,5 @@ {-# LANGUAGE KindSignatures, GADTs, DataKinds #-} +{-# OPTIONS -Wno-star-is-type #-} module Foo where data Foo1 :: [*] -> * where diff --git a/testsuite/tests/parser/should_compile/T13747.hs b/testsuite/tests/parser/should_compile/T13747.hs index 749d8d2fc4..670005c756 100644 --- a/testsuite/tests/parser/should_compile/T13747.hs +++ b/testsuite/tests/parser/should_compile/T13747.hs @@ -3,11 +3,13 @@ module T13747 where +import Data.Kind (Type) + class C a where - type family TC a :: * + type family TC a :: Type class D a where - data family TD a :: * + data family TD a :: Type instance C Int where type instance TC Int = Int diff --git a/testsuite/tests/parser/should_compile/read026.hs b/testsuite/tests/parser/should_compile/read026.hs index 0605ca054d..5fc89f3df6 100644 --- a/testsuite/tests/parser/should_compile/read026.hs +++ b/testsuite/tests/parser/should_compile/read026.hs @@ -1,5 +1,7 @@ module ShouldCompile where +import Prelude hiding ((<>)) + (<>) :: (a -> Maybe b) -> (b -> Maybe c) -> (a -> Maybe c) (m1 <> m2) a1 = case m1 a1 of Nothing -> Nothing diff --git a/testsuite/tests/parser/should_compile/read050.hs b/testsuite/tests/parser/should_compile/read050.hs index d991bb01c7..9934310958 100644 --- a/testsuite/tests/parser/should_compile/read050.hs +++ b/testsuite/tests/parser/should_compile/read050.hs @@ -3,5 +3,7 @@ module Foo where -data Foo (a :: *) = Foo a +import Data.Kind (Type) + +data Foo (a :: Type) = Foo a diff --git a/testsuite/tests/parser/should_compile/read051.hs b/testsuite/tests/parser/should_compile/read051.hs index 3e95241862..6a4d3444e9 100644 --- a/testsuite/tests/parser/should_compile/read051.hs +++ b/testsuite/tests/parser/should_compile/read051.hs @@ -3,5 +3,7 @@ module Foo where -data Foo (a :: *) = Foo a +import Data.Kind (Type) + +data Foo (a :: Type) = Foo a diff --git a/testsuite/tests/partial-sigs/should_compile/T13482.hs b/testsuite/tests/partial-sigs/should_compile/T13482.hs index 3af3a74231..0a2c619f66 100644 --- a/testsuite/tests/partial-sigs/should_compile/T13482.hs +++ b/testsuite/tests/partial-sigs/should_compile/T13482.hs @@ -5,10 +5,12 @@ module T12382 where +import Data.Kind (Type) + minimal1_noksig :: forall m. ( _ ) => Int -> Bool minimal1_noksig _ = (mempty :: m) == (mempty :: m) -minimal1 :: forall (m :: *). _ => Bool +minimal1 :: forall (m :: Type). _ => Bool minimal1 = (mempty :: m) == (mempty :: m) minimal2 :: forall m. (Eq m, _) => Bool diff --git a/testsuite/tests/partial-sigs/should_compile/T13482.stderr b/testsuite/tests/partial-sigs/should_compile/T13482.stderr index dd46400b1a..a21b7dcac4 100644 --- a/testsuite/tests/partial-sigs/should_compile/T13482.stderr +++ b/testsuite/tests/partial-sigs/should_compile/T13482.stderr @@ -1,31 +1,31 @@ -T13482.hs:8:32: warning: [-Wpartial-type-signatures (in -Wdefault)] +T13482.hs:10:32: warning: [-Wpartial-type-signatures (in -Wdefault)] • Found type wildcard ‘_’ standing for ‘(Eq m, Monoid m)’ Where: ‘m’ is a rigid type variable bound by the inferred type of minimal1_noksig :: (Eq m, Monoid m) => Int -> Bool - at T13482.hs:9:1-50 + at T13482.hs:11:1-50 • In the type signature: minimal1_noksig :: forall m. _ => Int -> Bool -T13482.hs:11:30: warning: [-Wpartial-type-signatures (in -Wdefault)] +T13482.hs:13:33: warning: [-Wpartial-type-signatures (in -Wdefault)] • Found type wildcard ‘_’ standing for ‘(Eq m, Monoid m)’ Where: ‘m’ is a rigid type variable bound by the inferred type of minimal1 :: (Eq m, Monoid m) => Bool - at T13482.hs:12:1-41 - • In the type signature: minimal1 :: forall (m :: *). _ => Bool + at T13482.hs:14:1-41 + • In the type signature: minimal1 :: forall (m :: Type). _ => Bool -T13482.hs:14:30: warning: [-Wpartial-type-signatures (in -Wdefault)] +T13482.hs:16:30: warning: [-Wpartial-type-signatures (in -Wdefault)] • Found type wildcard ‘_’ standing for ‘Monoid m’ Where: ‘m’ is a rigid type variable bound by the inferred type of minimal2 :: (Eq m, Monoid m) => Bool - at T13482.hs:15:1-41 + at T13482.hs:17:1-41 • In the type signature: minimal2 :: forall m. (Eq m, _) => Bool -T13482.hs:17:34: warning: [-Wpartial-type-signatures (in -Wdefault)] +T13482.hs:19:34: warning: [-Wpartial-type-signatures (in -Wdefault)] • Found type wildcard ‘_’ standing for ‘Eq m’ Where: ‘m’ is a rigid type variable bound by the inferred type of minimal3 :: (Monoid m, Eq m) => Bool - at T13482.hs:18:1-41 + at T13482.hs:20:1-41 • In the type signature: minimal3 :: forall m. (Monoid m, _) => Bool diff --git a/testsuite/tests/partial-sigs/should_compile/TypeFamilyInstanceLHS.hs b/testsuite/tests/partial-sigs/should_compile/TypeFamilyInstanceLHS.hs index c3172b7cd0..cd009ca8d5 100644 --- a/testsuite/tests/partial-sigs/should_compile/TypeFamilyInstanceLHS.hs +++ b/testsuite/tests/partial-sigs/should_compile/TypeFamilyInstanceLHS.hs @@ -1,7 +1,9 @@ {-# LANGUAGE TypeFamilies #-} module TypeFamilyInstanceLHS where -type family F (a :: *) (b :: *) :: * +import Data.Kind (Type) + +type family F (a :: Type) (b :: Type) :: Type type instance F Int _ = Int type instance F Bool _ = Bool diff --git a/testsuite/tests/partial-sigs/should_compile/TypeFamilyInstanceLHS.stderr b/testsuite/tests/partial-sigs/should_compile/TypeFamilyInstanceLHS.stderr index 1a783cba74..76c5b3fbc3 100644 --- a/testsuite/tests/partial-sigs/should_compile/TypeFamilyInstanceLHS.stderr +++ b/testsuite/tests/partial-sigs/should_compile/TypeFamilyInstanceLHS.stderr @@ -5,9 +5,9 @@ TYPE CONSTRUCTORS F :: * -> * -> * COERCION AXIOMS axiom TypeFamilyInstanceLHS.D:R:FBool_ :: - F Bool _ = Bool -- Defined at TypeFamilyInstanceLHS.hs:6:15 + F Bool _ = Bool -- Defined at TypeFamilyInstanceLHS.hs:8:15 axiom TypeFamilyInstanceLHS.D:R:FInt_ :: - F Int _ = Int -- Defined at TypeFamilyInstanceLHS.hs:5:15 + F Int _ = Int -- Defined at TypeFamilyInstanceLHS.hs:7:15 FAMILY INSTANCES type instance F Int _ type instance F Bool _ diff --git a/testsuite/tests/patsyn/should_compile/T10997_1a.hs b/testsuite/tests/patsyn/should_compile/T10997_1a.hs index f6a292aa54..11af525c53 100644 --- a/testsuite/tests/patsyn/should_compile/T10997_1a.hs +++ b/testsuite/tests/patsyn/should_compile/T10997_1a.hs @@ -1,11 +1,11 @@ {-# LANGUAGE PatternSynonyms, ViewPatterns, ConstraintKinds, TypeFamilies, PolyKinds, KindSignatures #-} module T10997_1a where -import GHC.Exts +import Data.Kind type family Showable (a :: k) :: Constraint where - Showable (a :: *) = (Show a) - Showable a = () + Showable (a :: Type) = (Show a) + Showable a = () extractJust :: Maybe a -> (Bool, a) extractJust (Just a) = (True, a) diff --git a/testsuite/tests/patsyn/should_compile/T12968.hs b/testsuite/tests/patsyn/should_compile/T12968.hs index 99626df1a7..e4b58ed8ac 100644 --- a/testsuite/tests/patsyn/should_compile/T12968.hs +++ b/testsuite/tests/patsyn/should_compile/T12968.hs @@ -6,7 +6,8 @@ module T12968 where data TypeRep (a :: k) data TRAppG (fun :: k2) where - TRAppG :: forall k1 (a :: k1 -> k2) (b :: k1) . TypeRep a -> TypeRep b -> TRAppG (a b) + TRAppG :: forall k1 k2 (a :: k1 -> k2) (b :: k1) . + TypeRep a -> TypeRep b -> TRAppG (a b) pattern TRApp :: forall k2 (fun :: k2). () => forall k1 (a :: k1 -> k2) (b :: k1). (fun ~ a b) diff --git a/testsuite/tests/patsyn/should_compile/T8966.hs b/testsuite/tests/patsyn/should_compile/T8966.hs index 895ff1b764..655969e3bb 100644 --- a/testsuite/tests/patsyn/should_compile/T8966.hs +++ b/testsuite/tests/patsyn/should_compile/T8966.hs @@ -2,7 +2,9 @@ module T8966 where -data NQ :: [k] -> * where +import Data.Kind (Type) + +data NQ :: [k] -> Type where D :: NQ '[a] pattern Q = D diff --git a/testsuite/tests/patsyn/should_compile/T8968-1.hs b/testsuite/tests/patsyn/should_compile/T8968-1.hs index a0e3285a4b..adef52f1ff 100644 --- a/testsuite/tests/patsyn/should_compile/T8968-1.hs +++ b/testsuite/tests/patsyn/should_compile/T8968-1.hs @@ -1,7 +1,9 @@ {-# LANGUAGE GADTs, KindSignatures, PatternSynonyms #-} module ShouldCompile where -data X :: (* -> *) -> * -> * where +import Data.Kind (Type) + +data X :: (Type -> Type) -> Type -> Type where Y :: f a -> X f (Maybe a) pattern C :: a -> X Maybe (Maybe a) diff --git a/testsuite/tests/patsyn/should_compile/T8968-2.hs b/testsuite/tests/patsyn/should_compile/T8968-2.hs index 0b196a5f88..2ec4d2dfb5 100644 --- a/testsuite/tests/patsyn/should_compile/T8968-2.hs +++ b/testsuite/tests/patsyn/should_compile/T8968-2.hs @@ -1,7 +1,9 @@ {-# LANGUAGE GADTs, KindSignatures, PatternSynonyms, FlexibleContexts #-} module ShouldCompile where -data X :: (* -> *) -> * -> * where +import Data.Kind (Type) + +data X :: (Type -> Type) -> Type -> Type where Y :: (Show a) => f a -> X f (Maybe a) pattern C :: (Show (a, Bool)) => a -> X Maybe (Maybe (a, Bool)) diff --git a/testsuite/tests/perf/compiler/T5030.hs b/testsuite/tests/perf/compiler/T5030.hs index 4983ee69a3..958d7b1427 100644 --- a/testsuite/tests/perf/compiler/T5030.hs +++ b/testsuite/tests/perf/compiler/T5030.hs @@ -4,6 +4,7 @@ module SlowComp where import Control.Monad +import Data.Kind ------------------------------------------------------------------------------- -- Usual Peano integers. @@ -111,7 +112,7 @@ class CPU cpu where -- immediate width. type ImmSize cpu -- variables in CPU - register indices, command format variables, etc. - type CPUVars cpu :: * -> * + type CPUVars cpu :: Type -> Type data Const size = Const Integer diff --git a/testsuite/tests/perf/compiler/T5837.hs b/testsuite/tests/perf/compiler/T5837.hs index 0a500fb826..48eb039865 100644 --- a/testsuite/tests/perf/compiler/T5837.hs +++ b/testsuite/tests/perf/compiler/T5837.hs @@ -2,7 +2,9 @@ module T5837 where -type family TF a :: * +import Data.Kind + +type family TF a :: Type type instance TF (a,b) = (TF a, TF b) t :: (a ~ TF (a,Int)) => Int diff --git a/testsuite/tests/pmcheck/should_compile/EmptyCase002.hs b/testsuite/tests/pmcheck/should_compile/EmptyCase002.hs index 8af96be77c..416913a6ea 100644 --- a/testsuite/tests/pmcheck/should_compile/EmptyCase002.hs +++ b/testsuite/tests/pmcheck/should_compile/EmptyCase002.hs @@ -5,6 +5,8 @@ -- Check some newtypes, in combination with GADTs and TypeFamilies module EmptyCase002 where +import Data.Kind (Type) + newtype T = MkT H newtype G = MkG T newtype H = MkH G @@ -17,15 +19,15 @@ data A data B = B1 | B2 -data C :: * -> * where +data C :: Type -> Type where C1 :: C Int C2 :: C Bool -data D :: * -> * -> * where +data D :: Type -> Type -> Type where D1 :: D Int Bool D2 :: D Bool Char -type family E (a :: *) :: * where +type family E (a :: Type) :: Type where E Int = Bool E Bool = Char diff --git a/testsuite/tests/pmcheck/should_compile/EmptyCase002.stderr b/testsuite/tests/pmcheck/should_compile/EmptyCase002.stderr index 8979fda155..cbb79efd59 100644 --- a/testsuite/tests/pmcheck/should_compile/EmptyCase002.stderr +++ b/testsuite/tests/pmcheck/should_compile/EmptyCase002.stderr @@ -1,22 +1,23 @@ -EmptyCase002.hs:14:6: warning: [-Wincomplete-patterns (in -Wextra)] + +EmptyCase002.hs:16:6: warning: [-Wincomplete-patterns (in -Wextra)] Pattern match(es) are non-exhaustive In a case alternative: Patterns not matched: (MkT _) -EmptyCase002.hs:41:6: warning: [-Wincomplete-patterns (in -Wextra)] +EmptyCase002.hs:43:6: warning: [-Wincomplete-patterns (in -Wextra)] Pattern match(es) are non-exhaustive In a case alternative: Patterns not matched: (MkT1 B1) (MkT1 B2) -EmptyCase002.hs:45:6: warning: [-Wincomplete-patterns (in -Wextra)] +EmptyCase002.hs:47:6: warning: [-Wincomplete-patterns (in -Wextra)] Pattern match(es) are non-exhaustive In a case alternative: Patterns not matched: (MkT1 False) (MkT1 True) -EmptyCase002.hs:49:6: warning: [-Wincomplete-patterns (in -Wextra)] +EmptyCase002.hs:51:6: warning: [-Wincomplete-patterns (in -Wextra)] Pattern match(es) are non-exhaustive In a case alternative: Patterns not matched: (MkT1 (MkT2 (MkT1 D2))) diff --git a/testsuite/tests/pmcheck/should_compile/EmptyCase003.hs b/testsuite/tests/pmcheck/should_compile/EmptyCase003.hs index 14f5c60747..fedbbf1513 100644 --- a/testsuite/tests/pmcheck/should_compile/EmptyCase003.hs +++ b/testsuite/tests/pmcheck/should_compile/EmptyCase003.hs @@ -5,7 +5,9 @@ -- Check some type families and type synonyms module EmptyCase003 where -type family A (a :: *) :: * +import Data.Kind (Type) + +type family A (a :: Type) :: Type -- Conservatively considered non-exhaustive (A a missing), -- since A a does not reduce to anything. @@ -14,14 +16,14 @@ f1 = \case data Void -type family B (a :: *) :: * +type family B (a :: Type) :: Type type instance B a = Void -- Exhaustive f2 :: B a -> b f2 = \case -type family C (a :: *) :: * +type family C (a :: Type) :: Type type instance C Int = Char type instance C Bool = Void @@ -38,7 +40,7 @@ f4 = \case f5 :: C Bool -> a f5 = \case --- type family D (a :: *) :: * +-- type family D (a :: Type) :: Type -- type instance D x = D x -- non-terminating -- -- -- Exhaustive but *impossible* to detect that, since rewriting @@ -57,7 +59,7 @@ type Ten = TenC Zero type Hundred = TenC (TenC (TenC (TenC (TenC (TenC (TenC (TenC (TenC (TenC Zero))))))))) -type family E (n :: *) (a :: *) :: * +type family E (n :: Type) (a :: Type) :: Type type instance E Zero b = b type instance E (Succ n) b = E n b @@ -69,11 +71,11 @@ f7 = \case f8 :: E Hundred Void -> b f8 = \case -type family Add (a :: *) (b :: *) :: * +type family Add (a :: Type) (b :: Type) :: Type type instance Add Zero m = m type instance Add (Succ n) m = Succ (Add n m) -type family Mult (a :: *) (b :: *) :: * +type family Mult (a :: Type) (b :: Type) :: Type type instance Mult Zero m = Zero type instance Mult (Succ n) m = Add m (Mult n m) diff --git a/testsuite/tests/pmcheck/should_compile/EmptyCase003.stderr b/testsuite/tests/pmcheck/should_compile/EmptyCase003.stderr index 8db12ac5b5..4c10a09085 100644 --- a/testsuite/tests/pmcheck/should_compile/EmptyCase003.stderr +++ b/testsuite/tests/pmcheck/should_compile/EmptyCase003.stderr @@ -1,11 +1,12 @@ -EmptyCase003.hs:13:6: warning: [-Wincomplete-patterns (in -Wextra)] + +EmptyCase003.hs:15:6: warning: [-Wincomplete-patterns (in -Wextra)] Pattern match(es) are non-exhaustive In a case alternative: Patterns not matched: _ :: A a -EmptyCase003.hs:30:6: warning: [-Wincomplete-patterns (in -Wextra)] +EmptyCase003.hs:32:6: warning: [-Wincomplete-patterns (in -Wextra)] Pattern match(es) are non-exhaustive In a case alternative: Patterns not matched: _ :: C a -EmptyCase003.hs:35:6: warning: [-Wincomplete-patterns (in -Wextra)] +EmptyCase003.hs:37:6: warning: [-Wincomplete-patterns (in -Wextra)] Pattern match(es) are non-exhaustive In a case alternative: Patterns not matched: _ :: Char diff --git a/testsuite/tests/pmcheck/should_compile/EmptyCase004.hs b/testsuite/tests/pmcheck/should_compile/EmptyCase004.hs index 31ba020c33..c94af49030 100644 --- a/testsuite/tests/pmcheck/should_compile/EmptyCase004.hs +++ b/testsuite/tests/pmcheck/should_compile/EmptyCase004.hs @@ -4,7 +4,9 @@ -- Check some GADTs module EmptyCase004 where -data A :: * -> * where +import Data.Kind (Type) + +data A :: Type -> Type where A1 :: A Int A2 :: A Bool @@ -20,7 +22,7 @@ f2 = \case f3 :: A [a] -> b f3 = \case -data B :: * -> * -> * where +data B :: Type -> Type -> Type where B1 :: Int -> B Bool Bool B2 :: B Int Bool diff --git a/testsuite/tests/pmcheck/should_compile/EmptyCase004.stderr b/testsuite/tests/pmcheck/should_compile/EmptyCase004.stderr index 1e002e18c5..ba36499285 100644 --- a/testsuite/tests/pmcheck/should_compile/EmptyCase004.stderr +++ b/testsuite/tests/pmcheck/should_compile/EmptyCase004.stderr @@ -1,36 +1,37 @@ -EmptyCase004.hs:13:6: warning: [-Wincomplete-patterns (in -Wextra)] + +EmptyCase004.hs:15:6: warning: [-Wincomplete-patterns (in -Wextra)] Pattern match(es) are non-exhaustive In a case alternative: Patterns not matched: A2 -EmptyCase004.hs:17:6: warning: [-Wincomplete-patterns (in -Wextra)] +EmptyCase004.hs:19:6: warning: [-Wincomplete-patterns (in -Wextra)] Pattern match(es) are non-exhaustive In a case alternative: Patterns not matched: A1 A2 -EmptyCase004.hs:29:8: warning: [-Wincomplete-patterns (in -Wextra)] +EmptyCase004.hs:31:8: warning: [-Wincomplete-patterns (in -Wextra)] Pattern match(es) are non-exhaustive In a case alternative: Patterns not matched: (B1 _) -EmptyCase004.hs:33:6: warning: [-Wincomplete-patterns (in -Wextra)] +EmptyCase004.hs:35:6: warning: [-Wincomplete-patterns (in -Wextra)] Pattern match(es) are non-exhaustive In a case alternative: Patterns not matched: (B1 _) B2 -EmptyCase004.hs:45:6: warning: [-Wincomplete-patterns (in -Wextra)] +EmptyCase004.hs:47:6: warning: [-Wincomplete-patterns (in -Wextra)] Pattern match(es) are non-exhaustive In a case alternative: Patterns not matched: A1 A2 -EmptyCase004.hs:48:9: warning: [-Wincomplete-patterns (in -Wextra)] +EmptyCase004.hs:50:9: warning: [-Wincomplete-patterns (in -Wextra)] Pattern match(es) are non-exhaustive In a case alternative: Patterns not matched: B2 -EmptyCase004.hs:49:9: warning: [-Wincomplete-patterns (in -Wextra)] +EmptyCase004.hs:51:9: warning: [-Wincomplete-patterns (in -Wextra)] Pattern match(es) are non-exhaustive In a case alternative: Patterns not matched: (B1 _) diff --git a/testsuite/tests/pmcheck/should_compile/EmptyCase006.hs b/testsuite/tests/pmcheck/should_compile/EmptyCase006.hs index bf902b766d..3c54f8f7dc 100644 --- a/testsuite/tests/pmcheck/should_compile/EmptyCase006.hs +++ b/testsuite/tests/pmcheck/should_compile/EmptyCase006.hs @@ -4,7 +4,9 @@ -- Check interaction between Newtypes and GADTs module EmptyCase006 where -data GA :: * -> * where +import Data.Kind (Type) + +data GA :: Type -> Type where MkGA1 :: GA Int MkGA2 :: GA a -> GA [a] MkGA3 :: GA (a,a) diff --git a/testsuite/tests/pmcheck/should_compile/EmptyCase006.stderr b/testsuite/tests/pmcheck/should_compile/EmptyCase006.stderr index a1d372b14f..f63a438a11 100644 --- a/testsuite/tests/pmcheck/should_compile/EmptyCase006.stderr +++ b/testsuite/tests/pmcheck/should_compile/EmptyCase006.stderr @@ -1,8 +1,9 @@ -EmptyCase006.hs:16:7: warning: [-Wincomplete-patterns (in -Wextra)] + +EmptyCase006.hs:18:7: warning: [-Wincomplete-patterns (in -Wextra)] Pattern match(es) are non-exhaustive In a case alternative: Patterns not matched: (Foo1 MkGA1) -EmptyCase006.hs:24:7: warning: [-Wincomplete-patterns (in -Wextra)] +EmptyCase006.hs:26:7: warning: [-Wincomplete-patterns (in -Wextra)] Pattern match(es) are non-exhaustive In a case alternative: Patterns not matched: diff --git a/testsuite/tests/pmcheck/should_compile/EmptyCase007.hs b/testsuite/tests/pmcheck/should_compile/EmptyCase007.hs index 71a3d2606c..2d0d41668a 100644 --- a/testsuite/tests/pmcheck/should_compile/EmptyCase007.hs +++ b/testsuite/tests/pmcheck/should_compile/EmptyCase007.hs @@ -4,7 +4,9 @@ -- Check interaction between Newtypes and Type Families module EmptyCase007 where -type family FA a :: * -- just an open type family +import Data.Kind (Type) + +type family FA a :: Type -- just an open type family type instance FA Int = (Char, Bool) type instance FA Char = Char type instance FA [a] = [FA a] diff --git a/testsuite/tests/pmcheck/should_compile/EmptyCase007.stderr b/testsuite/tests/pmcheck/should_compile/EmptyCase007.stderr index 822baee3bb..f0c36b9a6f 100644 --- a/testsuite/tests/pmcheck/should_compile/EmptyCase007.stderr +++ b/testsuite/tests/pmcheck/should_compile/EmptyCase007.stderr @@ -1,24 +1,25 @@ -EmptyCase007.hs:19:7: warning: [-Wincomplete-patterns (in -Wextra)] + +EmptyCase007.hs:21:7: warning: [-Wincomplete-patterns (in -Wextra)] Pattern match(es) are non-exhaustive In a case alternative: Patterns not matched: _ :: Foo2 a -EmptyCase007.hs:23:7: warning: [-Wincomplete-patterns (in -Wextra)] +EmptyCase007.hs:25:7: warning: [-Wincomplete-patterns (in -Wextra)] Pattern match(es) are non-exhaustive In a case alternative: Patterns not matched: _ :: Foo2 (a, a) -EmptyCase007.hs:31:7: warning: [-Wincomplete-patterns (in -Wextra)] +EmptyCase007.hs:33:7: warning: [-Wincomplete-patterns (in -Wextra)] Pattern match(es) are non-exhaustive In a case alternative: Patterns not matched: (Foo2 (_, _)) -EmptyCase007.hs:35:7: warning: [-Wincomplete-patterns (in -Wextra)] +EmptyCase007.hs:37:7: warning: [-Wincomplete-patterns (in -Wextra)] Pattern match(es) are non-exhaustive In a case alternative: Patterns not matched: (Foo2 _) -EmptyCase007.hs:42:17: warning: [-Wincomplete-patterns (in -Wextra)] +EmptyCase007.hs:44:17: warning: [-Wincomplete-patterns (in -Wextra)] Pattern match(es) are non-exhaustive In a case alternative: Patterns not matched: _ :: Char -EmptyCase007.hs:46:7: warning: [-Wincomplete-patterns (in -Wextra)] +EmptyCase007.hs:48:7: warning: [-Wincomplete-patterns (in -Wextra)] Pattern match(es) are non-exhaustive In a case alternative: Patterns not matched: diff --git a/testsuite/tests/pmcheck/should_compile/EmptyCase008.hs b/testsuite/tests/pmcheck/should_compile/EmptyCase008.hs index b1f6a0ae73..3bc43cd93d 100644 --- a/testsuite/tests/pmcheck/should_compile/EmptyCase008.hs +++ b/testsuite/tests/pmcheck/should_compile/EmptyCase008.hs @@ -4,6 +4,8 @@ -- Check interaction between Newtypes and DataFamilies module EmptyCase008 where +import Data.Kind (Type) + data family DA a newtype Foo3 a = Foo3 (DA a) @@ -25,7 +27,7 @@ f13 :: Foo3 () -> () f13 = \case -- ---------------- -data family DB a :: * -> * +data family DB a :: Type -> Type data instance DB Int a where MkDB1 :: DB Int () diff --git a/testsuite/tests/pmcheck/should_compile/EmptyCase008.stderr b/testsuite/tests/pmcheck/should_compile/EmptyCase008.stderr index a13e61aa67..99991937d0 100644 --- a/testsuite/tests/pmcheck/should_compile/EmptyCase008.stderr +++ b/testsuite/tests/pmcheck/should_compile/EmptyCase008.stderr @@ -1,18 +1,19 @@ -EmptyCase008.hs:15:7: warning: [-Wincomplete-patterns (in -Wextra)] + +EmptyCase008.hs:17:7: warning: [-Wincomplete-patterns (in -Wextra)] Pattern match(es) are non-exhaustive In a case alternative: Patterns not matched: (Foo3 (MkDA1 _)) (Foo3 MkDA2) -EmptyCase008.hs:19:7: warning: [-Wincomplete-patterns (in -Wextra)] +EmptyCase008.hs:21:7: warning: [-Wincomplete-patterns (in -Wextra)] Pattern match(es) are non-exhaustive In a case alternative: Patterns not matched: _ :: Foo3 a -EmptyCase008.hs:38:7: warning: [-Wincomplete-patterns (in -Wextra)] +EmptyCase008.hs:40:7: warning: [-Wincomplete-patterns (in -Wextra)] Pattern match(es) are non-exhaustive In a case alternative: Patterns not matched: (Foo4 MkDB1) -EmptyCase008.hs:46:7: warning: [-Wincomplete-patterns (in -Wextra)] +EmptyCase008.hs:48:7: warning: [-Wincomplete-patterns (in -Wextra)] Pattern match(es) are non-exhaustive In a case alternative: Patterns not matched: _ :: Foo4 a b diff --git a/testsuite/tests/pmcheck/should_compile/EmptyCase009.hs b/testsuite/tests/pmcheck/should_compile/EmptyCase009.hs index f6741b88c8..a4a1d557b4 100644 --- a/testsuite/tests/pmcheck/should_compile/EmptyCase009.hs +++ b/testsuite/tests/pmcheck/should_compile/EmptyCase009.hs @@ -4,7 +4,9 @@ -- Arrow Kind, Newtypes, GADTs, DataFamilies module EmptyCase009 where -data family DB a :: * -> * +import Data.Kind (Type) + +data family DB a :: Type -> Type data instance DB Int a where MkDB1 :: DB Int () @@ -30,7 +32,7 @@ data instance DB () a where f19 :: Bar (DB ()) -> () f19 = \case -data GB :: * -> * where +data GB :: Type -> Type where MkGB1 :: Int -> GB () MkGB2 :: GB (a,a) MkGB3 :: GB b diff --git a/testsuite/tests/pmcheck/should_compile/EmptyCase009.stderr b/testsuite/tests/pmcheck/should_compile/EmptyCase009.stderr index ab3fb0a45f..7d2e84cb6c 100644 --- a/testsuite/tests/pmcheck/should_compile/EmptyCase009.stderr +++ b/testsuite/tests/pmcheck/should_compile/EmptyCase009.stderr @@ -1,11 +1,12 @@ -EmptyCase009.hs:19:9: warning: [-Wincomplete-patterns (in -Wextra)] + +EmptyCase009.hs:21:9: warning: [-Wincomplete-patterns (in -Wextra)] Pattern match(es) are non-exhaustive In a case alternative: Patterns not matched: _ :: Bar f -EmptyCase009.hs:31:7: warning: [-Wincomplete-patterns (in -Wextra)] +EmptyCase009.hs:33:7: warning: [-Wincomplete-patterns (in -Wextra)] Pattern match(es) are non-exhaustive In a case alternative: Patterns not matched: (Bar MkDB2_u) -EmptyCase009.hs:40:7: warning: [-Wincomplete-patterns (in -Wextra)] +EmptyCase009.hs:42:7: warning: [-Wincomplete-patterns (in -Wextra)] Pattern match(es) are non-exhaustive In a case alternative: Patterns not matched: (Bar MkGB3) diff --git a/testsuite/tests/pmcheck/should_compile/EmptyCase010.hs b/testsuite/tests/pmcheck/should_compile/EmptyCase010.hs index 48b1a247b8..adc45d6539 100644 --- a/testsuite/tests/pmcheck/should_compile/EmptyCase010.hs +++ b/testsuite/tests/pmcheck/should_compile/EmptyCase010.hs @@ -5,11 +5,13 @@ -- Newtypes, PolyKinds, DataKinds, GADTs, DataFamilies module EmptyCase010 where -newtype Baz (f :: k -> *) (a :: k) = Baz (f a) +import Data.Kind (Type) + +newtype Baz (f :: k -> Type) (a :: k) = Baz (f a) data T = T1 | T2 T | T3 T T | T4 () -- only promoted -data GC :: T -> * where +data GC :: T -> Type where MkGC1 :: GC 'T1 MkGC2 :: T -> GC (T4 '()) @@ -25,7 +27,7 @@ f22 = \case f23 :: Baz GC 'T1 -> () f23 = \case -data GD :: (* -> *) -> * where +data GD :: (Type -> Type) -> Type where MkGD1 :: GD Maybe MkGD2 :: GD [] MkGD3 :: GD f @@ -42,7 +44,7 @@ f25 x = case x of {} f26 :: Baz GD f -> () f26 = \case -data family DC a :: * -> * +data family DC a :: Type -> Type data instance DC () Int -- Empty type diff --git a/testsuite/tests/pmcheck/should_compile/EmptyCase010.stderr b/testsuite/tests/pmcheck/should_compile/EmptyCase010.stderr index d4ccce34bb..d4caf6466c 100644 --- a/testsuite/tests/pmcheck/should_compile/EmptyCase010.stderr +++ b/testsuite/tests/pmcheck/should_compile/EmptyCase010.stderr @@ -1,26 +1,27 @@ -EmptyCase010.hs:22:7: warning: [-Wincomplete-patterns (in -Wextra)] + +EmptyCase010.hs:24:7: warning: [-Wincomplete-patterns (in -Wextra)] Pattern match(es) are non-exhaustive In a case alternative: Patterns not matched: (Baz MkGC1) (Baz (MkGC2 _)) -EmptyCase010.hs:26:7: warning: [-Wincomplete-patterns (in -Wextra)] +EmptyCase010.hs:28:7: warning: [-Wincomplete-patterns (in -Wextra)] Pattern match(es) are non-exhaustive In a case alternative: Patterns not matched: (Baz MkGC1) -EmptyCase010.hs:35:7: warning: [-Wincomplete-patterns (in -Wextra)] +EmptyCase010.hs:37:7: warning: [-Wincomplete-patterns (in -Wextra)] Pattern match(es) are non-exhaustive In a case alternative: Patterns not matched: (Baz MkGD1) (Baz MkGD3) -EmptyCase010.hs:39:9: warning: [-Wincomplete-patterns (in -Wextra)] +EmptyCase010.hs:41:9: warning: [-Wincomplete-patterns (in -Wextra)] Pattern match(es) are non-exhaustive In a case alternative: Patterns not matched: (Baz MkGD3) -EmptyCase010.hs:43:7: warning: [-Wincomplete-patterns (in -Wextra)] +EmptyCase010.hs:45:7: warning: [-Wincomplete-patterns (in -Wextra)] Pattern match(es) are non-exhaustive In a case alternative: Patterns not matched: @@ -28,14 +29,14 @@ EmptyCase010.hs:43:7: warning: [-Wincomplete-patterns (in -Wextra)] (Baz MkGD2) (Baz MkGD3) -EmptyCase010.hs:55:7: warning: [-Wincomplete-patterns (in -Wextra)] +EmptyCase010.hs:57:7: warning: [-Wincomplete-patterns (in -Wextra)] Pattern match(es) are non-exhaustive In a case alternative: Patterns not matched: _ :: Baz (DC ()) a -EmptyCase010.hs:67:7: warning: [-Wincomplete-patterns (in -Wextra)] +EmptyCase010.hs:69:7: warning: [-Wincomplete-patterns (in -Wextra)] Pattern match(es) are non-exhaustive In a case alternative: Patterns not matched: (Baz MkDC2) -EmptyCase010.hs:71:9: warning: [-Wincomplete-patterns (in -Wextra)] +EmptyCase010.hs:73:9: warning: [-Wincomplete-patterns (in -Wextra)] Pattern match(es) are non-exhaustive In a case alternative: Patterns not matched: _ :: Baz f a diff --git a/testsuite/tests/pmcheck/should_compile/T8970.hs b/testsuite/tests/pmcheck/should_compile/T8970.hs index 37e3756918..103a3cd016 100644 --- a/testsuite/tests/pmcheck/should_compile/T8970.hs +++ b/testsuite/tests/pmcheck/should_compile/T8970.hs @@ -3,15 +3,17 @@ module T8970 where +import Data.Kind (Type) + data K = Foo | Bar -data D1 :: K -> * where +data D1 :: K -> Type where F1 :: D1 Foo B1 :: D1 Bar -class C (a :: K -> *) where - data D2 a :: K -> * +class C (a :: K -> Type) where + data D2 a :: K -> Type foo :: a k -> D2 a k -> Bool instance C D1 where 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 -------------------------------------------------------------------------------- diff --git a/testsuite/tests/rebindable/rebindable2.hs b/testsuite/tests/rebindable/rebindable2.hs index e1f328954c..9fe15150f4 100644 --- a/testsuite/tests/rebindable/rebindable2.hs +++ b/testsuite/tests/rebindable/rebindable2.hs @@ -1,4 +1,5 @@ {-# LANGUAGE RebindableSyntax, NPlusKPatterns #-} +{-# OPTIONS -Wno-error=missing-monadfail-instances #-} module Main where { diff --git a/testsuite/tests/rebindable/rebindable3.hs b/testsuite/tests/rebindable/rebindable3.hs index 0434c1d0fd..c5fd3b255b 100644 --- a/testsuite/tests/rebindable/rebindable3.hs +++ b/testsuite/tests/rebindable/rebindable3.hs @@ -1,4 +1,5 @@ {-# LANGUAGE RebindableSyntax, NPlusKPatterns #-} +{-# OPTIONS -Wno-error=missing-monadfail-instances #-} module Main where { diff --git a/testsuite/tests/rebindable/rebindable4.hs b/testsuite/tests/rebindable/rebindable4.hs index f657683a08..26adc87e21 100644 --- a/testsuite/tests/rebindable/rebindable4.hs +++ b/testsuite/tests/rebindable/rebindable4.hs @@ -1,4 +1,5 @@ {-# LANGUAGE RebindableSyntax, NPlusKPatterns #-} +{-# OPTIONS -Wno-error=missing-monadfail-instances #-} module Main where { diff --git a/testsuite/tests/rebindable/rebindable5.hs b/testsuite/tests/rebindable/rebindable5.hs index 3120ea1a90..2ce735b670 100644 --- a/testsuite/tests/rebindable/rebindable5.hs +++ b/testsuite/tests/rebindable/rebindable5.hs @@ -1,5 +1,6 @@ {-# LANGUAGE RebindableSyntax, NPlusKPatterns, FlexibleInstances, MultiParamTypeClasses, FunctionalDependencies #-} +{-# OPTIONS -Wno-error=missing-monadfail-instances #-} module Main where { diff --git a/testsuite/tests/rename/should_compile/T15149A.hs b/testsuite/tests/rename/should_compile/T15149A.hs index 09b9beb36f..ba4980f885 100644 --- a/testsuite/tests/rename/should_compile/T15149A.hs +++ b/testsuite/tests/rename/should_compile/T15149A.hs @@ -1,4 +1,6 @@ {-# LANGUAGE TypeFamilies #-} module T15149A where -data family An c :: * +import Data.Kind (Type) + +data family An c :: Type diff --git a/testsuite/tests/roles/should_compile/Roles1.hs b/testsuite/tests/roles/should_compile/Roles1.hs index ca040c4353..8488665fc6 100644 --- a/testsuite/tests/roles/should_compile/Roles1.hs +++ b/testsuite/tests/roles/should_compile/Roles1.hs @@ -2,10 +2,12 @@ module Roles1 where +import Data.Kind (Type) + data T1 a = K1 a data T2 a = K2 a data T3 (a :: k) = K3 -data T4 (a :: * -> *) b = K4 (a b) +data T4 (a :: Type -> Type) b = K4 (a b) data T5 a = K5 a data T6 a = K6 @@ -15,4 +17,4 @@ type role T1 nominal type role T2 representational type role T3 phantom type role T4 nominal _ -type role T5 _
\ No newline at end of file +type role T5 _ diff --git a/testsuite/tests/simplCore/should_compile/T11562.hs b/testsuite/tests/simplCore/should_compile/T11562.hs index 873e1afc0f..e273f6002e 100644 --- a/testsuite/tests/simplCore/should_compile/T11562.hs +++ b/testsuite/tests/simplCore/should_compile/T11562.hs @@ -9,13 +9,14 @@ -- with a compiler built with -DDEBUG module T11562 where -import qualified GHC.Types as C (Constraint) -class Category (cat :: k -> k -> *) where +import Data.Kind + +class Category (cat :: k -> k -> Type) where id :: cat a a (.) :: cat b c -> cat a b -> cat a c -data Dict :: C.Constraint -> * where +data Dict :: Constraint -> Type where Dict :: a => Dict a newtype C2D a b = Sub (a => Dict b) diff --git a/testsuite/tests/simplCore/should_compile/T11644.hs b/testsuite/tests/simplCore/should_compile/T11644.hs index e0d020dcf9..d3ab5b58eb 100644 --- a/testsuite/tests/simplCore/should_compile/T11644.hs +++ b/testsuite/tests/simplCore/should_compile/T11644.hs @@ -2,8 +2,10 @@ module T11644 where +import Data.Kind (Type) + class Foo m where - type Bar m :: * + type Bar m :: Type action :: m -> Bar m -> m right x m = action m (Right x) diff --git a/testsuite/tests/simplCore/should_compile/T13410.hs b/testsuite/tests/simplCore/should_compile/T13410.hs index 9db017d777..91444f47fa 100644 --- a/testsuite/tests/simplCore/should_compile/T13410.hs +++ b/testsuite/tests/simplCore/should_compile/T13410.hs @@ -13,6 +13,7 @@ import Control.Monad (liftM2) import Data.Functor.Identity (Identity(..)) import GHC.ST (ST, runST) import Text.Read (ReadPrec, readPrec) +import Data.Kind (Type) ----- @@ -28,7 +29,7 @@ class GMVector v a where gmbasicUnsafeNew :: PrimMonad m => Int -> m (v (PrimState m) a) gmbasicUnsafeWrite :: PrimMonad m => v (PrimState m) a -> Int -> a -> m () -type family GMutable (v :: * -> *) :: * -> * -> * +type family GMutable (v :: Type -> Type) :: Type -> Type -> Type class GMVector (GMutable v) a => GVector v a where gbasicUnsafeFreeze :: PrimMonad m => GMutable v (PrimState m) a -> m (v a) @@ -126,7 +127,9 @@ greadPrec = do ----- -data MVector :: (* -> * -> *) -> (* -> * -> *) -> * -> * -> * where +data MVector :: (Type -> Type -> Type) -> + (Type -> Type -> Type) -> + (Type -> Type -> Type) where MV :: !(u s a) -> !(v s b) -> MVector u v s (a, b) instance (GMVector u a, GMVector v b) => GMVector (MVector u v) (a, b) where @@ -141,7 +144,7 @@ instance (GMVector u a, GMVector v b) => GMVector (MVector u v) (a, b) where gmbasicUnsafeWrite ks n k gmbasicUnsafeWrite vs n v -data Vector :: (* -> *) -> (* -> *) -> * -> * +data Vector :: (Type -> Type) -> (Type -> Type) -> Type -> Type type instance GMutable (Vector u v) = MVector (GMutable u) (GMutable v) diff --git a/testsuite/tests/simplCore/should_compile/T14270a.hs b/testsuite/tests/simplCore/should_compile/T14270a.hs index 5054b43a2c..d8cc497f62 100644 --- a/testsuite/tests/simplCore/should_compile/T14270a.hs +++ b/testsuite/tests/simplCore/should_compile/T14270a.hs @@ -17,7 +17,7 @@ f :: T (a :: Type) -> Bool f (T1 x) = f x f T2 = True -g :: forall (a :: k). K a -> T a -> Bool +g :: forall k (a :: k). K a -> T a -> Bool g kv x = case kv of K1 -> f @a T2 -- f @a (T1 x) gives a different crash k2 -> True diff --git a/testsuite/tests/simplCore/should_compile/T15186.hs b/testsuite/tests/simplCore/should_compile/T15186.hs index c04de6adfa..0ebd3a038c 100644 --- a/testsuite/tests/simplCore/should_compile/T15186.hs +++ b/testsuite/tests/simplCore/should_compile/T15186.hs @@ -4,6 +4,7 @@ {-# LANGUAGE PatternSynonyms #-} module Bar (pattern PointerExpr) where +import Data.Kind (Type) import T15186A ------------------------------------------------------------------------------- @@ -21,7 +22,7 @@ data TypeRepr (tp :: CrucibleType) where BVRepr :: TypeRepr tp TypeReprDummy :: TypeRepr tp -data App (f :: CrucibleType -> *) (tp :: CrucibleType) where +data App (f :: CrucibleType -> Type) (tp :: CrucibleType) where RollRecursive :: !(Assignment TypeRepr ctx) -> !(Expr tp) -> App f ('RecursiveType ctx) diff --git a/testsuite/tests/simplCore/should_compile/T15517a.hs b/testsuite/tests/simplCore/should_compile/T15517a.hs index 28ca664969..2c8f6c4b32 100644 --- a/testsuite/tests/simplCore/should_compile/T15517a.hs +++ b/testsuite/tests/simplCore/should_compile/T15517a.hs @@ -9,16 +9,17 @@ {-# LANGUAGE TypeOperators #-} module T15517a () where +import Data.Kind (Type) import Data.Proxy -newtype Rep (ki :: kon -> *) (phi :: Nat -> *) (code :: [[Atom kon]]) +newtype Rep (ki :: kon -> Type) (phi :: Nat -> Type) (code :: [[Atom kon]]) = Rep (NS (PoA ki phi) code) -data NA :: (kon -> *) -> (Nat -> *) -> Atom kon -> * where +data NA :: (kon -> Type) -> (Nat -> Type) -> Atom kon -> Type where NA_I :: (IsNat k) => phi k -> NA ki phi (I k) NA_K :: ki k -> NA ki phi (K k) -data NP :: (k -> *) -> [k] -> * where +data NP :: (k -> Type) -> [k] -> Type where NP0 :: NP p '[] (:*) :: p x -> NP p xs -> NP p (x : xs) @@ -32,33 +33,33 @@ instance IsNat n => IsNat (S n) where proxyUnsuc :: Proxy (S n) -> Proxy n proxyUnsuc _ = Proxy -type PoA (ki :: kon -> *) (phi :: Nat -> *) = NP (NA ki phi) +type PoA (ki :: kon -> Type) (phi :: Nat -> Type) = NP (NA ki phi) data Atom kon = K kon | I Nat data Nat = S Nat | Z -data SNat :: Nat -> * where +data SNat :: Nat -> Type where SZ :: SNat Z SS :: SNat n -> SNat (S n) data Kon = KInt -data Singl (kon :: Kon) :: * where +data Singl (kon :: Kon) :: Type where SInt :: Int -> Singl KInt type family Lkup (n :: Nat) (ks :: [k]) :: k where Lkup Z (k : ks) = k Lkup (S n) (k : ks) = Lkup n ks -data El :: [*] -> Nat -> * where +data El :: [Type] -> Nat -> Type where El :: IsNat ix => Lkup ix fam -> El fam ix -data NS :: (k -> *) -> [k] -> * where +data NS :: (k -> Type) -> [k] -> Type where There :: NS p xs -> NS p (x : xs) Here :: p x -> NS p (x : xs) -class Family (ki :: kon -> *) (fam :: [*]) (codes :: [[[Atom kon]]]) +class Family (ki :: kon -> Type) (fam :: [Type]) (codes :: [[[Atom kon]]]) | fam -> ki codes , ki codes -> fam where sfrom' :: SNat ix -> El fam ix -> Rep ki (El fam) (Lkup ix codes) diff --git a/testsuite/tests/simplCore/should_compile/T5303.hs b/testsuite/tests/simplCore/should_compile/T5303.hs index 18a4f982c0..e17bff9a49 100644 --- a/testsuite/tests/simplCore/should_compile/T5303.hs +++ b/testsuite/tests/simplCore/should_compile/T5303.hs @@ -3,22 +3,23 @@ module T5303( showContextSeries ) where import Control.Monad.State.Strict( StateT ) import Control.Monad.Trans ( lift ) +import Data.Kind (Type) -data Tree (m :: * -> *) = Tree {} +data Tree (m :: Type -> Type) = Tree {} -data FL (a :: * -> * -> *) x z where +data FL (a :: Type -> Type -> Type) x z where (:>:) :: a x y -> FL a y z -> FL a x z NilFL :: FL a x x -class (Functor m, Monad m) => ApplyMonad m (state :: (* -> *) -> *) +class (Functor m, Monad m) => ApplyMonad m (state :: (Type -> Type) -> Type) -class Apply (p :: * -> * -> *) where - type ApplyState p :: (* -> *) -> * +class Apply (p :: Type -> Type -> Type) where + type ApplyState p :: (Type -> Type) -> Type apply :: ApplyMonad m (ApplyState p) => p x y -> m () class (Functor m, Monad m, ApplyMonad (ApplyMonadOver m state) state) - => ApplyMonadTrans m (state :: (* -> *) -> *) where - type ApplyMonadOver m state :: * -> * + => ApplyMonadTrans m (state :: (Type -> Type) -> Type) where + type ApplyMonadOver m state :: Type -> Type runApplyMonad :: (ApplyMonadOver m state) x -> state m -> m (x, state m) instance (Functor m, Monad m) => ApplyMonadTrans m Tree where diff --git a/testsuite/tests/simplCore/should_compile/T7785.hs b/testsuite/tests/simplCore/should_compile/T7785.hs index ecde1ff020..21fba28589 100644 --- a/testsuite/tests/simplCore/should_compile/T7785.hs +++ b/testsuite/tests/simplCore/should_compile/T7785.hs @@ -3,7 +3,7 @@ module Foo( shared, foo, bar) where -- module Foo where -import GHC.Exts +import Data.Kind {- foo :: [Int] -> [Int] @@ -16,7 +16,7 @@ foo = let f = map negate -} -type family Domain (f :: * -> *) a :: Constraint +type family Domain (f :: Type -> Type) a :: Constraint type instance Domain [] a = () diff --git a/testsuite/tests/simplCore/should_compile/simpl011.hs b/testsuite/tests/simplCore/should_compile/simpl011.hs index b31ea0a6b3..81022f9e8c 100644 --- a/testsuite/tests/simplCore/should_compile/simpl011.hs +++ b/testsuite/tests/simplCore/should_compile/simpl011.hs @@ -6,6 +6,7 @@ module MHashTable (STHashTable, new, update) where +import Data.Kind (Type) import Data.Int (Int32) import Control.Monad.ST (ST) import Data.STRef (STRef) @@ -35,7 +36,8 @@ type STHashTable s key val = HashTable key val (STArray s) (STRef s) (ST s) newtype HashTable key val arr ref m = HashTable (ref (HT key val arr ref m)) -data HT key val arr (ref :: * -> *) (m :: * -> *) = HT { dir :: (arr Int32 (arr Int32 [(key,val)])) } +data HT key val arr (ref :: Type -> Type) (m :: Type -> Type) = + HT { dir :: (arr Int32 (arr Int32 [(key,val)])) } new :: forall arr ref m key val. (MutHash arr ref m) => m (HashTable key val arr ref m) new = do diff --git a/testsuite/tests/simplCore/should_run/T3591.hs b/testsuite/tests/simplCore/should_run/T3591.hs index 27bb52432e..6b2b23b2ba 100644 --- a/testsuite/tests/simplCore/should_run/T3591.hs +++ b/testsuite/tests/simplCore/should_run/T3591.hs @@ -43,7 +43,9 @@ module Main where +import Data.Kind (Type) import Control.Monad (liftM, liftM2, when, ap) +import Control.Monad.Fail (MonadFail(fail)) -- import Control.Monad.Identity import Debug.Trace (trace) @@ -96,6 +98,9 @@ instance (Monad m, Functor s) => Monad (Trampoline m s) where where apply f (Done x) = bounce (f x) apply f (Suspend s) = return (Suspend (fmap (>>= f) s)) +instance (Monad m, Functor s) => MonadFail (Trampoline m s) where + fail = error + data Yield x y = Yield! x y instance Functor (Yield x) where fmap f (Yield x y) = trace "fmap yield" $ Yield x (f y) @@ -176,10 +181,10 @@ liftOut (Trampoline ma) = trace "liftOut" $ Trampoline (liftM inject ma) inject (Suspend a) = trace "inject suspend" $ Suspend (liftFunctor $ trace "calling fmap" $ fmap liftOut (trace "poking a" a)) -data Sink (m :: * -> *) a x = +data Sink (m :: Type -> Type) a x = Sink {put :: forall d. (AncestorFunctor (EitherFunctor a (TryYield x)) d) => x -> Trampoline m d Bool, canPut :: forall d. (AncestorFunctor (EitherFunctor a (TryYield x)) d) => Trampoline m d Bool} -newtype Source (m :: * -> *) a x = +newtype Source (m :: Type -> Type) a x = Source {get :: forall d. (AncestorFunctor (EitherFunctor a (Await (Maybe x))) d) => Trampoline m d (Maybe x)} pipe :: forall m a x r1 r2. (Monad m, Functor a) => diff --git a/testsuite/tests/th/T10828.hs b/testsuite/tests/th/T10828.hs index fd4d940195..94d9b3967b 100644 --- a/testsuite/tests/th/T10828.hs +++ b/testsuite/tests/th/T10828.hs @@ -3,11 +3,12 @@ module T10828 where -import Language.Haskell.TH +import Language.Haskell.TH hiding (Type) import System.IO +import Data.Kind (Type) -$( do { decl <- [d| data family D a :: * -> * - data instance D Int Bool :: * where +$( do { decl <- [d| data family D a :: Type -> Type + data instance D Int Bool :: Type where DInt :: D Int Bool data E where @@ -16,7 +17,7 @@ $( do { decl <- [d| data family D a :: * -> * data Foo a b where MkFoo, MkFoo' :: a -> Foo a b - newtype Bar :: * -> Bool -> * where + newtype Bar :: Type -> Bool -> Type where MkBar :: a -> Bar a b |] @@ -24,7 +25,7 @@ $( do { decl <- [d| data family D a :: * -> * ; return decl } ) --- data T a :: * where +-- data T a :: Type where -- MkT :: a -> a -> T a -- MkC :: forall a b. (a ~ Int) => { foo :: a, bar :: b } -> T Int @@ -65,7 +66,7 @@ $( do { -- test reification -- test quoting ; d <- runQ $ [d| - data T' a :: * where + data T' a :: Type where MkT' :: a -> a -> T' a MkC' :: forall a b. (a ~ Int) => { foo :: a, bar :: b } -> T' Int |] diff --git a/testsuite/tests/th/T10891.hs b/testsuite/tests/th/T10891.hs index d91caf94f6..030c5ebb10 100644 --- a/testsuite/tests/th/T10891.hs +++ b/testsuite/tests/th/T10891.hs @@ -2,19 +2,20 @@ module T10891 where -import Language.Haskell.TH +import Language.Haskell.TH hiding (Type) import System.IO +import Data.Kind (Type) class C a where f :: a -> Int class C' a where - type F a :: * + type F a :: Type type F a = a f' :: a -> Int class C'' a where - data Fd a :: * + data Fd a :: Type instance C' Int where type F Int = Bool diff --git a/testsuite/tests/th/T11463.hs b/testsuite/tests/th/T11463.hs index 3cb57d1cea..e6a0ff312c 100644 --- a/testsuite/tests/th/T11463.hs +++ b/testsuite/tests/th/T11463.hs @@ -2,13 +2,13 @@ {-# LANGUAGE DataKinds, PolyKinds #-} module Main where -import Data.Kind -import Language.Haskell.TH +import Data.Kind (Type) +import Language.Haskell.TH hiding (Type) type Id1 a = a type Id2 k (a :: k) = a -data Proxy1 (a :: Id1 k) = Proxy1 -data Proxy2 (a :: Id2 * k) = Proxy2 +data Proxy1 (a :: Id1 k) = Proxy1 +data Proxy2 (a :: Id2 Type k) = Proxy2 $(return []) diff --git a/testsuite/tests/th/T11484.hs b/testsuite/tests/th/T11484.hs index e1e30fc694..9a32e2b75f 100644 --- a/testsuite/tests/th/T11484.hs +++ b/testsuite/tests/th/T11484.hs @@ -4,6 +4,6 @@ module T11484 where import Data.Kind -type TySyn (k :: *) (a :: k) = () +type TySyn (k :: Type) (a :: k) = () -$([d| type TySyn2 (k :: *) (a :: k) = () |]) +$([d| type TySyn2 (k :: Type) (a :: k) = () |]) diff --git a/testsuite/tests/th/T12646.hs b/testsuite/tests/th/T12646.hs index 197d59e67b..b3ba86e54c 100644 --- a/testsuite/tests/th/T12646.hs +++ b/testsuite/tests/th/T12646.hs @@ -3,12 +3,13 @@ {-# LANGUAGE TypeFamilies #-} module T12646 where -import Language.Haskell.TH +import Language.Haskell.TH hiding (Type) import System.IO +import Data.Kind (Type) -type family F (a :: k) :: * where - F (a :: * -> *) = Int - F (a :: k) = Char +type family F (a :: k) :: Type where + F (a :: Type -> Type) = Int + F (a :: k) = Char $(do info <- reify ''F runIO $ putStrLn $ pprint info diff --git a/testsuite/tests/th/T13123.hs b/testsuite/tests/th/T13123.hs index d7e1006b9e..19bf3d9db3 100644 --- a/testsuite/tests/th/T13123.hs +++ b/testsuite/tests/th/T13123.hs @@ -6,32 +6,32 @@ {-# LANGUAGE TemplateHaskell #-} module T13123 where -import GHC.Exts (Constraint) +import Data.Kind (Type, Constraint) -$([d| idProxy :: forall proxy (a :: k). proxy a -> proxy a +$([d| idProxy :: forall k proxy (a :: k). proxy a -> proxy a idProxy x = x |]) $([d| id2 :: Show a => a -> a id2 x = x - {-# SPECIALIZE id2 :: forall proxy (a :: k). Show (proxy a) + {-# SPECIALIZE id2 :: forall k proxy (a :: k). Show (proxy a) => proxy a -> proxy a #-} |]) $([d| wibble :: Maybe Int - wibble = (undefined :: forall proxy (a :: k). proxy a) + wibble = (undefined :: forall k proxy (a :: k). proxy a) |]) $([d| class Foo b where - bar :: forall proxy (a :: k). proxy a -> b - default bar :: forall proxy (a :: k). proxy a -> b + bar :: forall k proxy (a :: k). proxy a -> b + default bar :: forall k proxy (a :: k). proxy a -> b bar = undefined |]) $([d| data GADT where - MkGADT :: forall proxy (a :: k). proxy a -> GADT + MkGADT :: forall k proxy (a :: k). proxy a -> GADT |]) -$([d| data Dec13 :: (* -> Constraint) -> * where +$([d| data Dec13 :: (Type -> Constraint) -> Type where MkDec13 :: c a => a -> Dec13 c |]) diff --git a/testsuite/tests/th/T13782.hs b/testsuite/tests/th/T13782.hs index 7172e07988..0346749ce4 100644 --- a/testsuite/tests/th/T13782.hs +++ b/testsuite/tests/th/T13782.hs @@ -8,7 +8,8 @@ import Language.Haskell.TH $(do TyConI (DataD _ _ [KindedTV a1 _] _ _ _) <- reify ''Maybe [f,a2] <- mapM newName ["f","a"] - return [ SigD f (ForallT [KindedTV a2 (AppT (ConT ''Maybe) (VarT a1))] + return [ SigD f (ForallT [PlainTV a1, + KindedTV a2 (AppT (ConT ''Maybe) (VarT a1))] [] (ConT ''Int)) , ValD (VarP f) (NormalB (LitE (IntegerL 42))) [] ]) diff --git a/testsuite/tests/th/T14817.hs b/testsuite/tests/th/T14817.hs index 1019decb61..35206af542 100644 --- a/testsuite/tests/th/T14817.hs +++ b/testsuite/tests/th/T14817.hs @@ -2,5 +2,7 @@ {-# LANGUAGE TypeFamilies #-} module T14817 where -$([d| data family Foo :: * - data instance Foo :: * |]) +import Data.Kind (Type) + +$([d| data family Foo :: Type + data instance Foo :: Type |]) diff --git a/testsuite/tests/th/T14817.stderr b/testsuite/tests/th/T14817.stderr index 7c63763bae..034c9e3bed 100644 --- a/testsuite/tests/th/T14817.stderr +++ b/testsuite/tests/th/T14817.stderr @@ -1,7 +1,7 @@ -T14817.hs:(5,3)-(6,31): Splicing declarations - [d| data family Foo :: * +T14817.hs:(7,3)-(8,34): Splicing declarations + [d| data family Foo :: Type - data instance Foo :: * |] + data instance Foo :: Type |] ======> - data family Foo :: GHC.Types.Type - data instance Foo :: GHC.Types.Type + data family Foo :: Type + data instance Foo :: Type diff --git a/testsuite/tests/th/T3920.hs b/testsuite/tests/th/T3920.hs index d7ea28de5b..e5e9e17e69 100644 --- a/testsuite/tests/th/T3920.hs +++ b/testsuite/tests/th/T3920.hs @@ -1,16 +1,19 @@ {-# LANGUAGE EmptyDataDecls, TypeFamilies, TemplateHaskell #-} module Main where -import Language.Haskell.TH +import Language.Haskell.TH hiding (Type) +import Data.Kind (Type) -type family S :: (* -> (* -> * -> *)) -> (* -> *) -> * +type family S :: (Type -> (Type -> Type -> Type)) + -> (Type -> Type) -> Type $(return []) test :: String test = $(do test <- [d| - type family T :: (* -> (* -> * -> *)) -> (* -> *) -> * |] + type family T :: (Type -> (Type -> Type -> Type)) + -> (Type -> Type) -> Type |] blah <- reify ''S return (LitE (StringL (pprint test ++ "\n" ++ pprint blah)))) diff --git a/testsuite/tests/th/T5452.hs b/testsuite/tests/th/T5452.hs index de6a1771f7..c1de6e8642 100644 --- a/testsuite/tests/th/T5452.hs +++ b/testsuite/tests/th/T5452.hs @@ -1,10 +1,12 @@ {-# LANGUAGE TemplateHaskell, KindSignatures, FlexibleInstances #-} module T5452 where -import Language.Haskell.TH -class C (f :: * -> *) -class D (f :: * -> *) +import Language.Haskell.TH hiding (Type) +import Data.Kind (Type) + +class C (f :: Type -> Type) +class D (f :: Type -> Type) instance C ((,) Int) diff --git a/testsuite/tests/th/T5882.hs b/testsuite/tests/th/T5882.hs index 73805bf082..b4590a2b12 100644 --- a/testsuite/tests/th/T5882.hs +++ b/testsuite/tests/th/T5882.hs @@ -1,10 +1,13 @@ {-# LANGUAGE GADTSyntax, TemplateHaskell, KindSignatures #-} module T5882 where -data Foo :: * -> * where + +import Data.Kind (Type) + +data Foo :: Type -> Type where Foo :: a -> Foo a -$( [d| data Bar :: * -> * where +$( [d| data Bar :: Type -> Type where Bar :: a -> Bar a |] ) diff --git a/testsuite/tests/th/T5886a.hs b/testsuite/tests/th/T5886a.hs index 95aefc2792..33b4d0e1e2 100644 --- a/testsuite/tests/th/T5886a.hs +++ b/testsuite/tests/th/T5886a.hs @@ -4,10 +4,11 @@ module T5886a where -import Language.Haskell.TH +import Language.Haskell.TH hiding (Type) +import Data.Kind (Type) class C α where - type AT α ∷ ★ + type AT α ∷ Type bang ∷ DecsQ bang = return [InstanceD Nothing [] (AppT (ConT ''C) (ConT ''Int)) diff --git a/testsuite/tests/th/T8031.hs b/testsuite/tests/th/T8031.hs index 08081ed6fd..870d7d4fc9 100644 --- a/testsuite/tests/th/T8031.hs +++ b/testsuite/tests/th/T8031.hs @@ -9,7 +9,7 @@ import Data.Kind data SList :: [k] -> Type where SCons :: Proxy h -> Proxy t -> SList (h ': t) -$( [d| foo :: forall (a :: k). Proxy a +$( [d| foo :: forall k (a :: k). Proxy a -> forall (b :: [k]). Proxy b -> SList (a ': b) foo a b = SCons a b |] ) diff --git a/testsuite/tests/th/T8953.hs b/testsuite/tests/th/T8953.hs index ba5833d581..24945887c7 100644 --- a/testsuite/tests/th/T8953.hs +++ b/testsuite/tests/th/T8953.hs @@ -4,34 +4,35 @@ module T8953 where import Data.Proxy -import Language.Haskell.TH +import Language.Haskell.TH hiding (Type) +import Data.Kind (Type) import System.IO -type family Poly (a :: k) :: * +type family Poly (a :: k) :: Type type instance Poly (x :: Bool) = Int type instance Poly (x :: Maybe k) = Double -type family Silly :: k -> * -type instance Silly = (Proxy :: * -> *) -type instance Silly = (Proxy :: (* -> *) -> *) +type family Silly :: k -> Type +type instance Silly = (Proxy :: Type -> Type) +type instance Silly = (Proxy :: (Type -> Type) -> Type) -a :: Proxy (Proxy :: * -> *) -b :: Proxy (Proxy :: (* -> *) -> *) +a :: Proxy (Proxy :: Type -> Type) +b :: Proxy (Proxy :: (Type -> Type) -> Type) a = undefined b = undefined -type StarProxy (a :: *) = Proxy a +type StarProxy (a :: Type) = Proxy a class PC (a :: k) -instance PC (a :: *) -instance PC (Proxy :: (k -> *) -> *) +instance PC (a :: Type) +instance PC (Proxy :: (k -> Type) -> Type) -data T1 :: k1 -> k2 -> * -data T2 :: k1 -> k2 -> * +data T1 :: k1 -> k2 -> Type +data T2 :: k1 -> k2 -> Type type family F a :: k type family G (a :: k) :: k type instance G T1 = T2 -type instance F Char = (G T1 Bool :: (* -> *) -> *) +type instance F Char = (G T1 Bool :: (Type -> Type) -> Type) $( do infos <- mapM reify [''Poly, ''Silly, 'a, 'b, ''StarProxy, ''PC, ''F, ''G] runIO $ mapM (putStrLn . pprint) infos diff --git a/testsuite/tests/th/T9199.hs b/testsuite/tests/th/T9199.hs index aa41198b57..597be70203 100644 --- a/testsuite/tests/th/T9199.hs +++ b/testsuite/tests/th/T9199.hs @@ -2,8 +2,10 @@ module T9160 where +import Data.Kind (Type) + $( [d| class C (a :: k) where - type F (a :: k) :: * + type F (a :: k) :: Type |] ) diff --git a/testsuite/tests/th/T9692.hs b/testsuite/tests/th/T9692.hs index 770290d7db..7f44342604 100644 --- a/testsuite/tests/th/T9692.hs +++ b/testsuite/tests/th/T9692.hs @@ -2,13 +2,14 @@ module T9692 where -import Language.Haskell.TH -import Language.Haskell.TH.Syntax +import Data.Kind (Type) +import Language.Haskell.TH hiding (Type) +import Language.Haskell.TH.Syntax hiding (Type) import Language.Haskell.TH.Ppr import System.IO class C a where - data F a (b :: k) :: * + data F a (b :: k) :: Type instance C Int where data F Int x = FInt x diff --git a/testsuite/tests/th/TH_RichKinds.hs b/testsuite/tests/th/TH_RichKinds.hs index 3ec2dd8e8e..1c417cdc55 100644 --- a/testsuite/tests/th/TH_RichKinds.hs +++ b/testsuite/tests/th/TH_RichKinds.hs @@ -6,15 +6,16 @@ module TH_RichKinds where -import GHC.Exts -import Language.Haskell.TH +import Data.Kind (Type, Constraint) +import Language.Haskell.TH hiding (Type) $(do tys <- sequence [ [t| forall a. (a :: Bool) |] , [t| forall a. (a :: Constraint) |] - , [t| forall a. (a :: [*]) |] - , [t| forall a. (a :: (*, Bool)) |] + , [t| forall a. (a :: [Type]) |] + , [t| forall a. (a :: (Type, Bool)) |] , [t| forall a. (a :: ()) |] - , [t| forall a. (a :: (* -> Bool) -> ((*, * -> *) -> Bool)) |] + , [t| forall a. (a :: (Type -> Bool) + -> ((Type, Type -> Type) -> Bool)) |] ] reportWarning (pprint tys) diff --git a/testsuite/tests/th/TH_tf1.hs b/testsuite/tests/th/TH_tf1.hs index 2b5d3f8887..43ac2d3379 100644 --- a/testsuite/tests/th/TH_tf1.hs +++ b/testsuite/tests/th/TH_tf1.hs @@ -2,6 +2,8 @@ module TH_tf1 where +import Data.Kind (Type) + $( [d| data family T a |] ) $( [d| data instance T Int = TInt Bool |] ) @@ -14,7 +16,7 @@ $( [d| type instance S Int = Bool |] ) bar :: S Int -> Int bar c = if c then 1 else 2 -$( [d| type family R (a :: * -> *) :: * -> * |] ) +$( [d| type family R (a :: Type -> Type) :: Type -> Type |] ) $( [d| type instance R Maybe = [] |] ) baz :: R Maybe Int -> Int diff --git a/testsuite/tests/typecheck/should_compile/T10195.hs b/testsuite/tests/typecheck/should_compile/T10195.hs index d79929bb2a..ffe9b8b4a6 100644 --- a/testsuite/tests/typecheck/should_compile/T10195.hs +++ b/testsuite/tests/typecheck/should_compile/T10195.hs @@ -5,10 +5,10 @@ module T10195 where -import GHC.Exts +import Data.Kind data Foo m zp r'q = Foo zp -data Dict :: Constraint -> * where +data Dict :: Constraint -> Type where Dict :: a => Dict a type family BarFamily a b :: Bool diff --git a/testsuite/tests/typecheck/should_compile/T10432.hs b/testsuite/tests/typecheck/should_compile/T10432.hs index ec46f17f14..def9091ef8 100644 --- a/testsuite/tests/typecheck/should_compile/T10432.hs +++ b/testsuite/tests/typecheck/should_compile/T10432.hs @@ -7,11 +7,11 @@ import Data.Type.Equality data WrappedType = forall a. WrapType a; -matchReflK :: forall (a :: ka) (b :: kb) (r :: Type). +matchReflK :: forall ka kb (a :: ka) (b :: kb) (r :: Type). ('WrapType a :~: 'WrapType b) -> (('WrapType a ~ 'WrapType b) => r) -> r; matchReflK Refl r = r; -matchReflK2 :: forall (a :: ka) (b :: kb) (r :: Type). +matchReflK2 :: forall ka kb (a :: ka) (b :: kb) (r :: Type). ('WrapType a :~: 'WrapType b) -> r matchReflK2 x = let foo :: ('WrapType a ~ 'WrapType b) => r foo = undefined diff --git a/testsuite/tests/typecheck/should_compile/T10564.hs b/testsuite/tests/typecheck/should_compile/T10564.hs index 4579dbec77..8ea7f5eb50 100644 --- a/testsuite/tests/typecheck/should_compile/T10564.hs +++ b/testsuite/tests/typecheck/should_compile/T10564.hs @@ -4,17 +4,19 @@ module T10564 where -class HasFieldM (l :: k) r (v :: Maybe *) +import Data.Kind (Type) + +class HasFieldM (l :: k) r (v :: Maybe Type) | l r -> v -class HasFieldM1 (b :: Maybe [*]) (l :: k) r v +class HasFieldM1 (b :: Maybe [Type]) (l :: k) r v | b l r -> v class HMemberM (e1 :: k) (l :: [k]) (r :: Maybe [k]) | e1 l -> r data Label a -type family LabelsOf (a :: [*]) :: [*] +type family LabelsOf (a :: [Type]) :: [Type] instance (HMemberM (Label (l::k)) (LabelsOf xs) b, HasFieldM1 b l (r xs) v) diff --git a/testsuite/tests/typecheck/should_compile/T10592.hs b/testsuite/tests/typecheck/should_compile/T10592.hs index 6c532906a4..a5bbb9534c 100644 --- a/testsuite/tests/typecheck/should_compile/T10592.hs +++ b/testsuite/tests/typecheck/should_compile/T10592.hs @@ -4,6 +4,7 @@ module T10592 where +import Data.Kind (Type) import Prelude (Bool(True,False),Integer,Ordering) import qualified Prelude @@ -11,7 +12,7 @@ import qualified Prelude -- class hierarchy class Boolean (Logic a) => Eq a where - type Logic a :: * + type Logic a :: Type (==) :: a -> a -> Logic a (/=) :: a -> a -> Logic a diff --git a/testsuite/tests/typecheck/should_compile/T11401.hs b/testsuite/tests/typecheck/should_compile/T11401.hs index 5235aaf2e2..54a494c1a7 100644 --- a/testsuite/tests/typecheck/should_compile/T11401.hs +++ b/testsuite/tests/typecheck/should_compile/T11401.hs @@ -3,6 +3,8 @@ {-# LANGUAGE FlexibleInstances #-} module T11401 where +import Data.Kind (Type) + newtype Value a = Value a newtype CodeGen r a = CodeGen a @@ -12,9 +14,9 @@ bind (CodeGen a) k = k a class (f ~ CalledFunction g, r ~ CallerResult g, g ~ CallerFunction f r) => CallArgs f g r where - type CalledFunction g :: * - type CallerResult g :: * - type CallerFunction f r :: * + type CalledFunction g :: Type + type CallerResult g :: Type + type CallerFunction f r :: Type call :: f -> g instance CallArgs (IO a) (CodeGen r (Value a)) r where diff --git a/testsuite/tests/typecheck/should_compile/T11811.hs b/testsuite/tests/typecheck/should_compile/T11811.hs index a3fadb92e7..e3e0f810b3 100644 --- a/testsuite/tests/typecheck/should_compile/T11811.hs +++ b/testsuite/tests/typecheck/should_compile/T11811.hs @@ -4,5 +4,5 @@ module T11811 where import Data.Kind -data Test (a :: x) (b :: x) :: x -> * +data Test (a :: x) (b :: x) :: x -> Type where K :: Test Int Bool Double diff --git a/testsuite/tests/typecheck/should_compile/T12797.hs b/testsuite/tests/typecheck/should_compile/T12797.hs index 01bf5af781..c5ef2cdfef 100644 --- a/testsuite/tests/typecheck/should_compile/T12797.hs +++ b/testsuite/tests/typecheck/should_compile/T12797.hs @@ -7,8 +7,9 @@ module T12797 where import Prelude import Control.Monad.IO.Class +import Data.Kind (Type) -type family FuncArg (m :: (* -> *)) :: Maybe * +type family FuncArg (m :: (Type -> Type)) :: Maybe Type test2 :: (MonadIO m, FuncArg m ~ 'Nothing) => m () test2 = liftIO $ print 6 diff --git a/testsuite/tests/typecheck/should_compile/T12911.hs b/testsuite/tests/typecheck/should_compile/T12911.hs index af3af3c5f3..8c91632686 100644 --- a/testsuite/tests/typecheck/should_compile/T12911.hs +++ b/testsuite/tests/typecheck/should_compile/T12911.hs @@ -6,4 +6,4 @@ module T12911 where import GHC.Exts data X where - MkX :: forall (a :: TYPE r). (a -> a) -> X + MkX :: forall r (a :: TYPE r). (a -> a) -> X diff --git a/testsuite/tests/typecheck/should_compile/T13333.hs b/testsuite/tests/typecheck/should_compile/T13333.hs index 5aca099c3b..9a84e87265 100644 --- a/testsuite/tests/typecheck/should_compile/T13333.hs +++ b/testsuite/tests/typecheck/should_compile/T13333.hs @@ -14,7 +14,7 @@ import GHC.Exts (Constraint) data T (phantom :: k) = T data D (p :: k -> Constraint) (x :: j) where - D :: forall (p :: k -> Constraint) (x :: k). p x => D p x + D :: forall k (p :: k -> Constraint) (x :: k). p x => D p x class Possibly p x where possibly :: proxy1 p -> proxy2 x -> Maybe (D p x) diff --git a/testsuite/tests/typecheck/should_compile/T13585a.hs b/testsuite/tests/typecheck/should_compile/T13585a.hs index fda3d7048a..0652ece370 100644 --- a/testsuite/tests/typecheck/should_compile/T13585a.hs +++ b/testsuite/tests/typecheck/should_compile/T13585a.hs @@ -4,6 +4,7 @@ module T13585a where import Data.Monoid (First(..)) import Data.Functor.Identity +import Data.Kind (Type) class Profunctor p where dimap :: (a -> b) -> (c -> d) -> p b c -> p a d @@ -54,10 +55,10 @@ instance Wrapped (First a) where _Wrapped' = iso getFirst First {-# INLINE _Wrapped' #-} -class Wrapped s => Rewrapped (s :: *) (t :: *) +class Wrapped s => Rewrapped (s :: Type) (t :: Type) class Wrapped s where - type Unwrapped s :: * + type Unwrapped s :: Type _Wrapped' :: Iso' s (Unwrapped s) _Wrapping :: Rewrapping s t => (Unwrapped s -> s) -> Iso s t (Unwrapped s) (Unwrapped t) diff --git a/testsuite/tests/typecheck/should_compile/T13881.hs b/testsuite/tests/typecheck/should_compile/T13881.hs index 5f79f99ef8..50efb0db55 100644 --- a/testsuite/tests/typecheck/should_compile/T13881.hs +++ b/testsuite/tests/typecheck/should_compile/T13881.hs @@ -12,6 +12,6 @@ data instance Sing (z :: [a]) where SNil :: Sing '[] SCons :: Sing x -> Sing xs -> Sing (x ': xs) -fl :: forall (l :: [a]). Sing l -> Sing l +fl :: forall a (l :: [a]). Sing l -> Sing l fl (SNil :: Sing (l :: [y])) = SNil fl (SCons x xs) = SCons x xs diff --git a/testsuite/tests/typecheck/should_compile/T1470.hs b/testsuite/tests/typecheck/should_compile/T1470.hs index 3206fa8a95..b8009f2bc3 100644 --- a/testsuite/tests/typecheck/should_compile/T1470.hs +++ b/testsuite/tests/typecheck/should_compile/T1470.hs @@ -5,8 +5,10 @@ module Foo where +import Data.Kind (Type) + class Sat a -class Data (ctx :: * -> *) a +class Data (ctx :: Type -> Type) a instance Sat (ctx Char) => Data ctx Char instance (Sat (ctx [a]), Data ctx a) => Data ctx [a] diff --git a/testsuite/tests/typecheck/should_compile/T14732.hs b/testsuite/tests/typecheck/should_compile/T14732.hs index 4fa070ed09..d0c6a8b465 100644 --- a/testsuite/tests/typecheck/should_compile/T14732.hs +++ b/testsuite/tests/typecheck/should_compile/T14732.hs @@ -8,6 +8,7 @@ module T14732 where import Prelude hiding (zip, zipWith) +import Data.Kind (Type) zipWith :: (a -> b -> c) -> Bundle v a @@ -15,10 +16,10 @@ zipWith :: (a -> b -> c) -> Bundle v c zipWith = undefined -class GVector (v :: * -> *) a +class GVector (v :: Type -> Type) a instance GVector Vector a -data Bundle (v :: * -> *) a +data Bundle (v :: Type -> Type) a data Vector a class Unbox a diff --git a/testsuite/tests/typecheck/should_compile/T14763.hs b/testsuite/tests/typecheck/should_compile/T14763.hs index 1af13f65cb..c159291322 100644 --- a/testsuite/tests/typecheck/should_compile/T14763.hs +++ b/testsuite/tests/typecheck/should_compile/T14763.hs @@ -4,12 +4,14 @@ {-# LANGUAGE MultiParamTypeClasses #-} module T14763 where +import Data.Kind (Type) + data Value a = Value a data SomeValue expr where SomeValue :: Esqueleto query expr backend => expr (Value a) -> SomeValue expr -class Esqueleto (query :: * -> *) (expr :: * -> *) backend +class Esqueleto (query :: Type -> Type) (expr :: Type -> Type) backend | query -> expr backend, expr -> query backend data SqlQuery a diff --git a/testsuite/tests/typecheck/should_compile/T15368.hs b/testsuite/tests/typecheck/should_compile/T15368.hs index 2db485740f..a3ac8d0800 100644 --- a/testsuite/tests/typecheck/should_compile/T15368.hs +++ b/testsuite/tests/typecheck/should_compile/T15368.hs @@ -2,10 +2,12 @@ module T15368 where +import Data.Kind (Type) + transitive :: (a, b) -> (b, c) -> (a, c) transitive = undefined trigger :: a -> b -> (F a b, F b a) trigger _ _ = _ `transitive` trigger _ _ -type family F (n :: *) (m :: *) :: * +type family F (n :: Type) (m :: Type) :: Type diff --git a/testsuite/tests/typecheck/should_compile/T15368.stderr b/testsuite/tests/typecheck/should_compile/T15368.stderr index 36650d0506..693779e1f5 100644 --- a/testsuite/tests/typecheck/should_compile/T15368.stderr +++ b/testsuite/tests/typecheck/should_compile/T15368.stderr @@ -1,20 +1,20 @@ -T15368.hs:9:15: warning: [-Wtyped-holes (in -Wdefault)] +T15368.hs:11:15: warning: [-Wtyped-holes (in -Wdefault)] • Found hole: _ :: (F a b, F a0 b0) Where: ‘a0’ is an ambiguous type variable ‘b0’ is an ambiguous type variable ‘a’, ‘b’ are rigid type variables bound by the type signature for: trigger :: forall a b. a -> b -> (F a b, F b a) - at T15368.hs:8:1-35 + at T15368.hs:10:1-35 • In the first argument of ‘transitive’, namely ‘_’ In the expression: _ `transitive` trigger _ _ In an equation for ‘trigger’: trigger _ _ = _ `transitive` trigger _ _ • Relevant bindings include - trigger :: a -> b -> (F a b, F b a) (bound at T15368.hs:9:1) + trigger :: a -> b -> (F a b, F b a) (bound at T15368.hs:11:1) -T15368.hs:9:15: warning: [-Wdeferred-type-errors (in -Wdefault)] +T15368.hs:11:15: warning: [-Wdeferred-type-errors (in -Wdefault)] • Couldn't match type ‘F b a’ with ‘F b0 a0’ Expected type: (F a b, F b a) Actual type: (F a b, F b0 a0) @@ -24,22 +24,22 @@ T15368.hs:9:15: warning: [-Wdeferred-type-errors (in -Wdefault)] In an equation for ‘trigger’: trigger _ _ = _ `transitive` trigger _ _ • Relevant bindings include - trigger :: a -> b -> (F a b, F b a) (bound at T15368.hs:9:1) + trigger :: a -> b -> (F a b, F b a) (bound at T15368.hs:11:1) -T15368.hs:9:38: warning: [-Wtyped-holes (in -Wdefault)] +T15368.hs:11:38: warning: [-Wtyped-holes (in -Wdefault)] • Found hole: _ :: a0 Where: ‘a0’ is an ambiguous type variable • In the first argument of ‘trigger’, namely ‘_’ In the second argument of ‘transitive’, namely ‘trigger _ _’ In the expression: _ `transitive` trigger _ _ • Relevant bindings include - trigger :: a -> b -> (F a b, F b a) (bound at T15368.hs:9:1) + trigger :: a -> b -> (F a b, F b a) (bound at T15368.hs:11:1) -T15368.hs:9:40: warning: [-Wtyped-holes (in -Wdefault)] +T15368.hs:11:40: warning: [-Wtyped-holes (in -Wdefault)] • Found hole: _ :: b0 Where: ‘b0’ is an ambiguous type variable • In the second argument of ‘trigger’, namely ‘_’ In the second argument of ‘transitive’, namely ‘trigger _ _’ In the expression: _ `transitive` trigger _ _ • Relevant bindings include - trigger :: a -> b -> (F a b, F b a) (bound at T15368.hs:9:1) + trigger :: a -> b -> (F a b, F b a) (bound at T15368.hs:11:1) diff --git a/testsuite/tests/typecheck/should_compile/T15370.hs b/testsuite/tests/typecheck/should_compile/T15370.hs index acccf030bd..7c1d7a942a 100644 --- a/testsuite/tests/typecheck/should_compile/T15370.hs +++ b/testsuite/tests/typecheck/should_compile/T15370.hs @@ -13,7 +13,7 @@ data S (a :: Either x y) mkRefl :: n :~: j mkRefl = Refl -right :: forall (r :: Either x y). +right :: forall x y (r :: Either x y). S r -> () right no = case mkRefl @x @y of diff --git a/testsuite/tests/typecheck/should_compile/T4310.hs b/testsuite/tests/typecheck/should_compile/T4310.hs index 43b82cae9a..83b04d9617 100644 --- a/testsuite/tests/typecheck/should_compile/T4310.hs +++ b/testsuite/tests/typecheck/should_compile/T4310.hs @@ -1,9 +1,11 @@ {-# LANGUAGE TypeFamilies, RankNTypes, ScopedTypeVariables, KindSignatures #-} module T4310 where + import GHC.ST +import Data.Kind (Type) -type family Mutable a :: * -> * -> * +type family Mutable a :: Type -> Type -> Type data New v a = New (forall s. ST s (Mutable v s a)) diff --git a/testsuite/tests/typecheck/should_compile/T4952.hs b/testsuite/tests/typecheck/should_compile/T4952.hs index 0788ad148a..3ec255c5a4 100644 --- a/testsuite/tests/typecheck/should_compile/T4952.hs +++ b/testsuite/tests/typecheck/should_compile/T4952.hs @@ -8,6 +8,7 @@ module Storage.Hashed.Monad () where import Control.Applicative (Applicative(..)) +import Data.Kind (Type) class Monad m => TreeRO m where withDirectory :: (MonadError e m) => Int -> m a -> m a @@ -19,7 +20,7 @@ instance (Monad m, MonadError e m) => TreeRO (M m) where _ <- expandTo dir undefined -data M (m :: * -> *) a +data M (m :: Type -> Type) a instance Functor (M m) where fmap = undefined diff --git a/testsuite/tests/typecheck/should_compile/T5595.hs b/testsuite/tests/typecheck/should_compile/T5595.hs index d9f9e137b2..e2597b622c 100644 --- a/testsuite/tests/typecheck/should_compile/T5595.hs +++ b/testsuite/tests/typecheck/should_compile/T5595.hs @@ -1,8 +1,10 @@ {-# LANGUAGE UnicodeSyntax, RankNTypes, TypeFamilies #-} module T5595 where +import Data.Kind (Type) + class MonadTransControl t where - type St t :: * → * + type St t :: Type → Type liftControl :: Monad m =>(Run t → m a) → t m a diff --git a/testsuite/tests/typecheck/should_compile/T5655.hs b/testsuite/tests/typecheck/should_compile/T5655.hs index 8db7a485a3..5da477a466 100644 --- a/testsuite/tests/typecheck/should_compile/T5655.hs +++ b/testsuite/tests/typecheck/should_compile/T5655.hs @@ -1,7 +1,7 @@ {-# LANGUAGE TypeFamilies, GADTs, ConstraintKinds, RankNTypes #-} module T5655 where -import Data.Kind (Constraint) +import Data.Kind (Type, Constraint) class Show a => Twice a where twice :: a -> a @@ -10,7 +10,7 @@ instance Twice Int where twice = (*2) data ETwice where ETwice :: Twice a => a -> ETwice class E e where - type C e :: * -> Constraint + type C e :: Type -> Constraint ap :: (forall a. C e a => a -> r) -> e -> r instance E ETwice where diff --git a/testsuite/tests/typecheck/should_compile/T6011.hs b/testsuite/tests/typecheck/should_compile/T6011.hs index 867d69b2fd..0582aa6ae9 100644 --- a/testsuite/tests/typecheck/should_compile/T6011.hs +++ b/testsuite/tests/typecheck/should_compile/T6011.hs @@ -2,7 +2,9 @@ module T6011 where -data family GenMod :: Modulus * -> * -> * +import Data.Kind (Type) + +data family GenMod :: Modulus Type -> Type -> Type type Mod n = GenMod (FiniteRing n) Integer diff --git a/testsuite/tests/typecheck/should_compile/T6018.hs b/testsuite/tests/typecheck/should_compile/T6018.hs index b3094fe948..8605cec1a7 100644 --- a/testsuite/tests/typecheck/should_compile/T6018.hs +++ b/testsuite/tests/typecheck/should_compile/T6018.hs @@ -40,6 +40,7 @@ type family Gi a = r | r -> a type instance Gi Int = Char -} +import Data.Kind (Type) import T6018a -- defines G, identical to F type family F a b c = (result :: k) | result -> a b c @@ -81,7 +82,7 @@ type family FClosed a b c = result | result -> a b c where FClosed Char Bool Int = Int FClosed Bool Int Char = Char -type family IClosed (a :: *) (b :: *) (c :: *) = r | r -> a b where +type family IClosed (a :: Type) (b :: Type) (c :: Type) = r | r -> a b where IClosed Int Char Bool = Bool IClosed Int Char Int = Bool IClosed Bool Int Int = Int @@ -204,10 +205,10 @@ type family L (a :: k1) = (r :: k2) | r -> k1 where L Maybe = 3 L IO = 3 -data KProxy (a :: *) = KProxy +data KProxy (a :: Type) = KProxy type family KP (kproxy :: KProxy k) = r | r -> k type instance KP ('KProxy :: KProxy Bool) = Int -type instance KP ('KProxy :: KProxy *) = Char +type instance KP ('KProxy :: KProxy Type) = Char kproxy_id :: KP ('KProxy :: KProxy k) -> KP ('KProxy :: KProxy k) kproxy_id x = x @@ -264,7 +265,8 @@ type family Fa (a :: k) (b :: k) = (r :: k2) | r -> k type instance Fa a b = a -- Taken from #9587. This exposed a bug in the solver. -type family Arr (repr :: * -> *) (a :: *) (b :: *) = (r :: *) | r -> repr a b +type family Arr (repr :: Type -> Type) (a :: Type) (b :: Type) + = (r :: Type) | r -> repr a b class ESymantics repr where int :: Int -> repr Int diff --git a/testsuite/tests/typecheck/should_compile/T6018.hs-boot b/testsuite/tests/typecheck/should_compile/T6018.hs-boot index 43641b5996..e12db97b6e 100644 --- a/testsuite/tests/typecheck/should_compile/T6018.hs-boot +++ b/testsuite/tests/typecheck/should_compile/T6018.hs-boot @@ -2,9 +2,12 @@ module T6018 where +import Data.Kind (Type) + -- these declarations use different type variables than the ones in the source -- file but they should be accepted nevertheless type family F d e f = (r :: k) | r -> d e f -type family FClosed (d :: *) (e :: *) (f :: *) = (r :: *) | r -> d e f where .. +type family FClosed (d :: Type) (e :: Type) (f :: Type) + = (r :: Type) | r -> d e f where .. diff --git a/testsuite/tests/typecheck/should_compile/T6018.stderr b/testsuite/tests/typecheck/should_compile/T6018.stderr index b29260ec33..c4baec422d 100644 --- a/testsuite/tests/typecheck/should_compile/T6018.stderr +++ b/testsuite/tests/typecheck/should_compile/T6018.stderr @@ -2,10 +2,10 @@ [2 of 3] Compiling T6018a ( T6018a.hs, T6018a.o ) [3 of 3] Compiling T6018 ( T6018.hs, T6018.o ) -T6018.hs:107:5: warning: +T6018.hs:108:5: warning: Type family instance equation is overlapped: - Foo Bool = Bool -- Defined at T6018.hs:107:5 + Foo Bool = Bool -- Defined at T6018.hs:108:5 -T6018.hs:114:5: warning: +T6018.hs:115:5: warning: Type family instance equation is overlapped: - Bar Bool = Char -- Defined at T6018.hs:114:5 + Bar Bool = Char -- Defined at T6018.hs:115:5 diff --git a/testsuite/tests/typecheck/should_compile/T6018a.hs b/testsuite/tests/typecheck/should_compile/T6018a.hs index 3feb7fabbd..3dc983c0d1 100644 --- a/testsuite/tests/typecheck/should_compile/T6018a.hs +++ b/testsuite/tests/typecheck/should_compile/T6018a.hs @@ -2,9 +2,10 @@ module T6018a where +import Data.Kind (Type) import {-# SOURCE #-} T6018 -- test support for hs-boot files -type family G a b c = (result :: *) | result -> a b c +type family G a b c = (result :: Type) | result -> a b c type instance G Int Char Bool = Bool type instance G Char Bool Int = Int diff --git a/testsuite/tests/typecheck/should_compile/T7196.hs b/testsuite/tests/typecheck/should_compile/T7196.hs index f4c54c5119..fb0e80603f 100644 --- a/testsuite/tests/typecheck/should_compile/T7196.hs +++ b/testsuite/tests/typecheck/should_compile/T7196.hs @@ -7,14 +7,16 @@ module Patch (qc_prim) where -class PrimPatch (prim :: * -> * -> *) +import Data.Kind (Type) + +class PrimPatch (prim :: Type -> Type -> Type) class PrimPatch (PrimOf p) => PrimPatchBase p where - type PrimOf (p :: * -> * -> *) :: * -> * -> * + type PrimOf (p :: Type -> Type -> Type) :: Type -> Type -> Type type TestGenerator thing gen = (forall t ctx . (forall xx yy . thing xx yy -> t) -> (gen ctx -> t)) -type family ModelOf (patch :: * -> * -> *) :: * -> * +type family ModelOf (patch :: Type -> Type -> Type) :: Type -> Type data WithState s p x y = WithState { _wsStartState :: s x diff --git a/testsuite/tests/typecheck/should_compile/T7875.hs b/testsuite/tests/typecheck/should_compile/T7875.hs index fdfdc72d32..7ea0520133 100644 --- a/testsuite/tests/typecheck/should_compile/T7875.hs +++ b/testsuite/tests/typecheck/should_compile/T7875.hs @@ -9,10 +9,12 @@ module T7875 where +import Data.Kind (Type) + class Het a b | a -> b where het :: m (f c) -> a -> m b -class GHet (a :: * -> *) (b :: * -> *) | a -> b +class GHet (a :: Type -> Type) (b :: Type -> Type) | a -> b instance GHet (K a) (K [a]) instance Het a b => GHet (K a) (K b) diff --git a/testsuite/tests/typecheck/should_compile/T7891.hs b/testsuite/tests/typecheck/should_compile/T7891.hs index 6538dbefbc..9e244638c0 100644 --- a/testsuite/tests/typecheck/should_compile/T7891.hs +++ b/testsuite/tests/typecheck/should_compile/T7891.hs @@ -5,6 +5,8 @@ module T7891 where +import Data.Kind (Type) + newtype T = T (forall t. t -> t) tf :: T @@ -27,7 +29,7 @@ b = f 'b' ------------- class C t where - data F t :: * + data F t :: Type mkF :: t -> F t instance C () where diff --git a/testsuite/tests/typecheck/should_compile/T7903.hs b/testsuite/tests/typecheck/should_compile/T7903.hs index e631677806..c4cb5d45c0 100644 --- a/testsuite/tests/typecheck/should_compile/T7903.hs +++ b/testsuite/tests/typecheck/should_compile/T7903.hs @@ -3,5 +3,7 @@ module T7903 where -instance Eq (((->) a :: * -> *) b) +import Data.Kind (Type) + +instance Eq (((->) a :: Type -> Type) b) instance (Ord b) => Ord (((->) a) b) diff --git a/testsuite/tests/typecheck/should_compile/T7903.stderr b/testsuite/tests/typecheck/should_compile/T7903.stderr index efffb2e8ad..515cd6eb28 100644 --- a/testsuite/tests/typecheck/should_compile/T7903.stderr +++ b/testsuite/tests/typecheck/should_compile/T7903.stderr @@ -1,10 +1,10 @@ -T7903.hs:6:10: warning: [-Wmissing-methods (in -Wdefault)] +T7903.hs:8:10: warning: [-Wmissing-methods (in -Wdefault)] • No explicit implementation for either ‘==’ or ‘/=’ • In the instance declaration for ‘Eq (a -> b)’ -T7903.hs:7:10: warning: [-Wmissing-methods (in -Wdefault)] +T7903.hs:9:10: warning: [-Wmissing-methods (in -Wdefault)] • No explicit implementation for either ‘compare’ or ‘<=’ • In the instance declaration for ‘Ord (a -> b)’ diff --git a/testsuite/tests/typecheck/should_compile/Tc245_A.hs b/testsuite/tests/typecheck/should_compile/Tc245_A.hs index 6b03118723..8f0be27dd8 100644 --- a/testsuite/tests/typecheck/should_compile/Tc245_A.hs +++ b/testsuite/tests/typecheck/should_compile/Tc245_A.hs @@ -1,5 +1,7 @@ - {-# LANGUAGE TypeFamilies #-} module Tc245_A where + +import Data.Kind (Type) + class Foo a where - data Bar a :: * -> * + data Bar a :: Type -> Type diff --git a/testsuite/tests/typecheck/should_compile/Tc251_Help.hs b/testsuite/tests/typecheck/should_compile/Tc251_Help.hs index 6f3243c065..c4d29d45bc 100644 --- a/testsuite/tests/typecheck/should_compile/Tc251_Help.hs +++ b/testsuite/tests/typecheck/should_compile/Tc251_Help.hs @@ -1,6 +1,8 @@ {-# LANGUAGE TypeFamilies #-} module Tc251_Help where +import Data.Kind (Type) + class Cls a where - type Fam a :: * + type Fam a :: Type type Fam a = Maybe a diff --git a/testsuite/tests/typecheck/should_compile/Vta1.hs b/testsuite/tests/typecheck/should_compile/Vta1.hs index c3ba43de54..3498b7068b 100644 --- a/testsuite/tests/typecheck/should_compile/Vta1.hs +++ b/testsuite/tests/typecheck/should_compile/Vta1.hs @@ -5,6 +5,8 @@ module Vta1 where +import Data.Kind (Type) + quad :: a -> b -> c -> d -> (a, b, c, d) quad = (,,,) @@ -58,9 +60,9 @@ pairnum = pair 3 e = (pair 3 :: forall a. Num a => forall b. b -> (a, b)) @Int @Bool True h = pairnum @Int @Bool True -data First (a :: * -> *) = F +data First (a :: Type -> Type) = F data Proxy (a :: k) = P -- This expands to P (kind variable) (type variable) -data Three (a :: * -> k -> *) = T +data Three (a :: Type -> k -> Type) = T foo :: Proxy a -> Int foo _ = 0 @@ -88,7 +90,7 @@ n = MkN show boo = unMkN n @Bool -boo2 :: forall (a :: * -> *) . Proxy a -> Bool +boo2 :: forall (a :: Type -> Type) . Proxy a -> Bool boo2 _ = False base = boo2 P diff --git a/testsuite/tests/typecheck/should_compile/tc190.hs b/testsuite/tests/typecheck/should_compile/tc190.hs index 366a487ee3..d60aa8cd35 100644 --- a/testsuite/tests/typecheck/should_compile/tc190.hs +++ b/testsuite/tests/typecheck/should_compile/tc190.hs @@ -4,7 +4,9 @@ module Foo where -data HT (ref :: * -> *) +import Data.Kind (Type) + +data HT (ref :: Type -> Type) = HT { kcount :: Int } set_kcount :: Int -> HT s -> HT s diff --git a/testsuite/tests/typecheck/should_compile/tc247.hs b/testsuite/tests/typecheck/should_compile/tc247.hs index abfc9ac9a4..6b7e62457c 100644 --- a/testsuite/tests/typecheck/should_compile/tc247.hs +++ b/testsuite/tests/typecheck/should_compile/tc247.hs @@ -2,16 +2,18 @@ module ShouldCompile where +import Data.Kind (Type) + -- Various forms of empty data type declarations data T1 data T2 where -data T3 :: * -> * +data T3 :: Type -> Type -data T4 a :: * -> * +data T4 a :: Type -> Type -data T5 a :: * -> * where +data T5 a :: Type -> Type where diff --git a/testsuite/tests/typecheck/should_compile/tc250.hs b/testsuite/tests/typecheck/should_compile/tc250.hs index 7464a078aa..5d6e8beeb9 100644 --- a/testsuite/tests/typecheck/should_compile/tc250.hs +++ b/testsuite/tests/typecheck/should_compile/tc250.hs @@ -1,8 +1,10 @@ {-# LANGUAGE TypeFamilies #-} module ShouldCompile where +import Data.Kind (Type) + class Cls a where - type Fam a :: * + type Fam a :: Type type Fam a = Maybe a instance Cls Int where diff --git a/testsuite/tests/typecheck/should_compile/tc252.hs b/testsuite/tests/typecheck/should_compile/tc252.hs index f5b129f6bf..215e1ff8cc 100644 --- a/testsuite/tests/typecheck/should_compile/tc252.hs +++ b/testsuite/tests/typecheck/should_compile/tc252.hs @@ -1,8 +1,10 @@ {-# LANGUAGE TypeFamilies #-} module ShouldCompile where +import Data.Kind (Type) + class Cls a where - type Fam a :: * + type Fam a :: Type type Fam a = Maybe a instance Cls Int where diff --git a/testsuite/tests/typecheck/should_compile/tc253.hs b/testsuite/tests/typecheck/should_compile/tc253.hs index 2fd528b296..7a337ed639 100644 --- a/testsuite/tests/typecheck/should_compile/tc253.hs +++ b/testsuite/tests/typecheck/should_compile/tc253.hs @@ -3,8 +3,10 @@ -- this is needed because |FamHelper a x| /< |Fam a x| module ShouldCompile where +import Data.Kind (Type) + class Cls a where - type Fam a b :: * + type Fam a b :: Type -- Multiple defaults! type Fam a x = FamHelper a x diff --git a/testsuite/tests/typecheck/should_compile/tc255.hs b/testsuite/tests/typecheck/should_compile/tc255.hs index e5690bb08d..d6a631fe15 100644 --- a/testsuite/tests/typecheck/should_compile/tc255.hs +++ b/testsuite/tests/typecheck/should_compile/tc255.hs @@ -1,9 +1,9 @@ {-# LANGUAGE TypeFamilies, ConstraintKinds, UndecidableInstances #-} module Ctx where -import Data.Kind ( Constraint ) +import Data.Kind ( Type, Constraint ) -type family Indirect :: * -> Constraint +type family Indirect :: Type -> Constraint type instance Indirect = Show class Cls a where diff --git a/testsuite/tests/typecheck/should_compile/tc256.hs b/testsuite/tests/typecheck/should_compile/tc256.hs index 15c096e81c..2fd80d593e 100644 --- a/testsuite/tests/typecheck/should_compile/tc256.hs +++ b/testsuite/tests/typecheck/should_compile/tc256.hs @@ -1,9 +1,9 @@ {-# LANGUAGE TypeFamilies, ConstraintKinds, UndecidableInstances, UndecidableSuperClasses #-} module Ctx where -import Data.Kind ( Constraint ) +import Data.Kind ( Type, Constraint ) -type family Indirect :: * -> Constraint +type family Indirect :: Type -> Constraint type instance Indirect = Show class Indirect a => Cls a where diff --git a/testsuite/tests/typecheck/should_compile/tc257.hs b/testsuite/tests/typecheck/should_compile/tc257.hs index d5742aa779..a2b913d79c 100644 --- a/testsuite/tests/typecheck/should_compile/tc257.hs +++ b/testsuite/tests/typecheck/should_compile/tc257.hs @@ -1,16 +1,16 @@ {-# LANGUAGE KindSignatures, ConstraintKinds, MultiParamTypeClasses, FlexibleInstances, UndecidableInstances #-} module Ctx where -import Data.Kind ( Constraint ) +import Data.Kind ( Type, Constraint ) -data Proxy (ctxt :: * -> Constraint) = Proxy +data Proxy (ctxt :: Type -> Constraint) = Proxy -- At one time, this one worked: nonmeth :: ctxt Int => Proxy ctxt -> a nonmeth prox = nonmeth prox -class Foo (ctxt :: * -> Constraint) a where +class Foo (ctxt :: Type -> Constraint) a where meth :: ctxt a => Proxy ctxt -> a instance ctxt Int => Foo ctxt Int where diff --git a/testsuite/tests/typecheck/should_fail/ContextStack2.hs b/testsuite/tests/typecheck/should_fail/ContextStack2.hs index d66103c880..53634a5cd5 100644 --- a/testsuite/tests/typecheck/should_fail/ContextStack2.hs +++ b/testsuite/tests/typecheck/should_fail/ContextStack2.hs @@ -2,7 +2,9 @@ module ContextStack2 where -type family TF a :: * +import Data.Kind (Type) + +type family TF a :: Type type instance TF (a,b) = (TF a, TF b) -- Succeeds with new approach to fuvs diff --git a/testsuite/tests/typecheck/should_fail/T6018Afail.hs b/testsuite/tests/typecheck/should_fail/T6018Afail.hs index 66e67fe8a6..9bddf2d8db 100644 --- a/testsuite/tests/typecheck/should_fail/T6018Afail.hs +++ b/testsuite/tests/typecheck/should_fail/T6018Afail.hs @@ -2,6 +2,8 @@ module T6018Afail where -type family G a b c = (result :: *) | result -> a b c +import Data.Kind (Type) + +type family G a b c = (result :: Type) | result -> a b c type instance G Int Char Bool = Bool type instance G Char Bool Int = Int diff --git a/testsuite/tests/typecheck/should_fail/T6018Bfail.hs b/testsuite/tests/typecheck/should_fail/T6018Bfail.hs index 6ebed3061e..167bf6cc59 100644 --- a/testsuite/tests/typecheck/should_fail/T6018Bfail.hs +++ b/testsuite/tests/typecheck/should_fail/T6018Bfail.hs @@ -2,4 +2,6 @@ module T6018Bfail where -type family H a b c = (result :: *) | result -> a b c +import Data.Kind (Type) + +type family H a b c = (result :: Type) | result -> a b c diff --git a/testsuite/tests/typecheck/should_fail/T6018fail.hs b/testsuite/tests/typecheck/should_fail/T6018fail.hs index bb3c93c67b..fbbe9d453b 100644 --- a/testsuite/tests/typecheck/should_fail/T6018fail.hs +++ b/testsuite/tests/typecheck/should_fail/T6018fail.hs @@ -3,11 +3,13 @@ module T6018fail where +import Data.Kind (Type) + import T6018Afail -- defines G, identical to F import T6018Cfail -- imports H from T6018Bfail, defines some equations for H import T6018Dfail -- imports H from T6018Bfail, defines conflicting eqns -type family F a b c = (result :: *) | result -> a b c +type family F a b c = (result :: Type) | result -> a b c type instance F Int Char Bool = Bool type instance F Char Bool Int = Int type instance F Bool Int Char = Int @@ -118,7 +120,7 @@ type family G7 a b (c :: k) = r | r -> a b c type instance G7 a b c = [G7a a b c] class C a b where - type FC a (b :: *) = r | r -> b + type FC a (b :: Type) = r | r -> b type instance FC a b = b instance C Int Char where diff --git a/testsuite/tests/typecheck/should_fail/T6018fail.stderr b/testsuite/tests/typecheck/should_fail/T6018fail.stderr index f2fdf82b25..0265250dbe 100644 --- a/testsuite/tests/typecheck/should_fail/T6018fail.stderr +++ b/testsuite/tests/typecheck/should_fail/T6018fail.stderr @@ -4,155 +4,155 @@ [4 of 5] Compiling T6018Dfail ( T6018Dfail.hs, T6018Dfail.o ) [5 of 5] Compiling T6018fail ( T6018fail.hs, T6018fail.o ) -T6018Afail.hs:7:15: error: +T6018Afail.hs:9:15: error: Type family equations violate injectivity annotation: - G Char Bool Int = Int -- Defined at T6018Afail.hs:7:15 - G Bool Int Char = Int -- Defined at T6018fail.hs:15:15 + G Char Bool Int = Int -- Defined at T6018Afail.hs:9:15 + G Bool Int Char = Int -- Defined at T6018fail.hs:17:15 T6018Cfail.hs:8:15: error: Type family equations violate injectivity annotation: T6018Bfail.H Char Bool Int = Int -- Defined at T6018Cfail.hs:8:15 T6018Bfail.H Bool Int Char = Int -- Defined at T6018Dfail.hs:7:15 -T6018fail.hs:13:15: error: +T6018fail.hs:15:15: error: Type family equations violate injectivity annotation: - F Bool Int Char = Int -- Defined at T6018fail.hs:13:15 - F Char Bool Int = Int -- Defined at T6018fail.hs:12:15 + F Bool Int Char = Int -- Defined at T6018fail.hs:15:15 + F Char Bool Int = Int -- Defined at T6018fail.hs:14:15 -T6018fail.hs:19:15: error: +T6018fail.hs:21:15: error: Type family equations violate injectivity annotation: - I Int Int Int = Bool -- Defined at T6018fail.hs:19:15 - I Int Char Bool = Bool -- Defined at T6018fail.hs:18:15 + I Int Int Int = Bool -- Defined at T6018fail.hs:21:15 + I Int Char Bool = Bool -- Defined at T6018fail.hs:20:15 -T6018fail.hs:28:15: error: +T6018fail.hs:30:15: error: Type family equation violates injectivity annotation. RHS of injective type family equation cannot be a type family: - IdProxy a = Id a -- Defined at T6018fail.hs:28:15 + IdProxy a = Id a -- Defined at T6018fail.hs:30:15 -T6018fail.hs:36:15: error: +T6018fail.hs:38:15: error: Type family equation violates injectivity annotation. RHS of injective type family equation is a bare type variable but these LHS type and kind patterns are not bare variables: ‘'Z’ - P 'Z m = m -- Defined at T6018fail.hs:36:15 + P 'Z m = m -- Defined at T6018fail.hs:38:15 -T6018fail.hs:37:15: error: +T6018fail.hs:39:15: error: Type family equations violate injectivity annotation: - P ('S n) m = 'S (P n m) -- Defined at T6018fail.hs:37:15 - P 'Z m = m -- Defined at T6018fail.hs:36:15 + P ('S n) m = 'S (P n m) -- Defined at T6018fail.hs:39:15 + P 'Z m = m -- Defined at T6018fail.hs:38:15 -T6018fail.hs:42:15: error: +T6018fail.hs:44:15: error: Type family equation violates injectivity annotation. Type variable ‘b’ cannot be inferred from the right-hand side. In the type family equation: - J Int b c = Char -- Defined at T6018fail.hs:42:15 + J Int b c = Char -- Defined at T6018fail.hs:44:15 -T6018fail.hs:46:15: error: +T6018fail.hs:48:15: error: Type family equation violates injectivity annotation. Type variable ‘n’ cannot be inferred from the right-hand side. In the type family equation: - K ('S n) m = 'S m -- Defined at T6018fail.hs:46:15 + K ('S n) m = 'S m -- Defined at T6018fail.hs:48:15 -T6018fail.hs:51:15: error: +T6018fail.hs:53:15: error: Type family equation violates injectivity annotation. RHS of injective type family equation cannot be a type family: - L a = MaybeSyn a -- Defined at T6018fail.hs:51:15 + L a = MaybeSyn a -- Defined at T6018fail.hs:53:15 -T6018fail.hs:59:10: error: +T6018fail.hs:61:10: error: Type family equation violates injectivity annotation. Kind variable ‘k1’ cannot be inferred from the right-hand side. Use -fprint-explicit-kinds to see the kind arguments In the type family equation: - PolyKindVarsF '[] = '[] -- Defined at T6018fail.hs:59:10 + PolyKindVarsF '[] = '[] -- Defined at T6018fail.hs:61:10 -T6018fail.hs:62:15: error: +T6018fail.hs:64:15: error: Type family equation violates injectivity annotation. Kind variable ‘k1’ cannot be inferred from the right-hand side. Use -fprint-explicit-kinds to see the kind arguments In the type family equation: - PolyKindVars '[] = '[] -- Defined at T6018fail.hs:62:15 + PolyKindVars '[] = '[] -- Defined at T6018fail.hs:64:15 -T6018fail.hs:66:15: error: +T6018fail.hs:68:15: error: Type family equation violates injectivity annotation. Kind variable ‘k’ cannot be inferred from the right-hand side. Use -fprint-explicit-kinds to see the kind arguments In the type family equation: forall k (a :: k) (b :: k). - Fc a b = Int -- Defined at T6018fail.hs:66:15 + Fc a b = Int -- Defined at T6018fail.hs:68:15 -T6018fail.hs:70:15: error: +T6018fail.hs:72:15: error: Type family equation violates injectivity annotation. Type and kind variables ‘k’, ‘a’, ‘b’ cannot be inferred from the right-hand side. Use -fprint-explicit-kinds to see the kind arguments In the type family equation: forall k (a :: k) (b :: k). - Gc a b = Int -- Defined at T6018fail.hs:70:15 + Gc a b = Int -- Defined at T6018fail.hs:72:15 -T6018fail.hs:74:15: error: +T6018fail.hs:76:15: error: Type family equations violate injectivity annotation: - F1 [a] = Maybe (GF1 a) -- Defined at T6018fail.hs:74:15 - F1 (Maybe a) = Maybe (GF2 a) -- Defined at T6018fail.hs:75:15 + F1 [a] = Maybe (GF1 a) -- Defined at T6018fail.hs:76:15 + F1 (Maybe a) = Maybe (GF2 a) -- Defined at T6018fail.hs:77:15 -T6018fail.hs:87:15: error: +T6018fail.hs:89:15: error: Type family equation violates injectivity annotation. RHS of injective type family equation is a bare type variable but these LHS type and kind patterns are not bare variables: ‘[a]’ - W1 [a] = a -- Defined at T6018fail.hs:87:15 + W1 [a] = a -- Defined at T6018fail.hs:89:15 -T6018fail.hs:90:15: error: +T6018fail.hs:92:15: error: Type family equation violates injectivity annotation. RHS of injective type family equation cannot be a type family: - W2 [a] = W2 a -- Defined at T6018fail.hs:90:15 + W2 [a] = W2 a -- Defined at T6018fail.hs:92:15 -T6018fail.hs:95:15: error: +T6018fail.hs:97:15: error: Type family equations violate injectivity annotation: - Z1 (Maybe b) = (b, [b]) -- Defined at T6018fail.hs:95:15 - Z1 [a] = (a, a) -- Defined at T6018fail.hs:94:15 + Z1 (Maybe b) = (b, [b]) -- Defined at T6018fail.hs:97:15 + Z1 [a] = (a, a) -- Defined at T6018fail.hs:96:15 -T6018fail.hs:99:15: error: +T6018fail.hs:101:15: error: Type family equations violate injectivity annotation: - G1 (Maybe b) = [(b, b)] -- Defined at T6018fail.hs:99:15 - G1 [a] = [a] -- Defined at T6018fail.hs:98:15 + G1 (Maybe b) = [(b, b)] -- Defined at T6018fail.hs:101:15 + G1 [a] = [a] -- Defined at T6018fail.hs:100:15 -T6018fail.hs:103:15: error: +T6018fail.hs:105:15: error: Type family equations violate injectivity annotation: - G3 a Bool = (Bool, a) -- Defined at T6018fail.hs:103:15 - G3 a Int = (a, Int) -- Defined at T6018fail.hs:102:15 + G3 a Bool = (Bool, a) -- Defined at T6018fail.hs:105:15 + G3 a Int = (a, Int) -- Defined at T6018fail.hs:104:15 -T6018fail.hs:106:15: error: +T6018fail.hs:108:15: error: Type family equation violates injectivity annotation. Type variable ‘b’ cannot be inferred from the right-hand side. In the type family equation: - G4 a b = [a] -- Defined at T6018fail.hs:106:15 + G4 a b = [a] -- Defined at T6018fail.hs:108:15 -T6018fail.hs:110:15: error: +T6018fail.hs:112:15: error: Type family equations violate injectivity annotation: - G5 Int = [Bool] -- Defined at T6018fail.hs:110:15 - G5 [a] = [GF1 a] -- Defined at T6018fail.hs:109:15 + G5 Int = [Bool] -- Defined at T6018fail.hs:112:15 + G5 [a] = [GF1 a] -- Defined at T6018fail.hs:111:15 -T6018fail.hs:113:15: error: +T6018fail.hs:115:15: error: Type family equation violates injectivity annotation. Type variable ‘a’ cannot be inferred from the right-hand side. In the type family equation: - G6 [a] = [HF1 a] -- Defined at T6018fail.hs:113:15 + G6 [a] = [HF1 a] -- Defined at T6018fail.hs:115:15 -T6018fail.hs:118:15: error: +T6018fail.hs:120:15: error: Type family equation violates injectivity annotation. Type and kind variables ‘k’, ‘c’ cannot be inferred from the right-hand side. Use -fprint-explicit-kinds to see the kind arguments In the type family equation: forall k a b (c :: k). - G7 a b c = [G7a a b c] -- Defined at T6018fail.hs:118:15 + G7 a b c = [G7a a b c] -- Defined at T6018fail.hs:120:15 -T6018fail.hs:129:1: error: +T6018fail.hs:131:1: error: Type family equations violate injectivity annotation: - FC Int Bool = Bool -- Defined at T6018fail.hs:129:1 - FC Int Char = Bool -- Defined at T6018fail.hs:125:10 + FC Int Bool = Bool -- Defined at T6018fail.hs:131:1 + FC Int Char = Bool -- Defined at T6018fail.hs:127:10 -T6018fail.hs:134:1: error: +T6018fail.hs:136:1: error: Type family equation violates injectivity annotation. RHS of injective type family equation is a bare type variable but these LHS type and kind patterns are not bare variables: ‘*’, ‘Char’ - FC Char a = a -- Defined at T6018fail.hs:134:1 + FC Char a = a -- Defined at T6018fail.hs:136:1 diff --git a/testsuite/tests/typecheck/should_fail/tcfail188.hs b/testsuite/tests/typecheck/should_fail/tcfail188.hs index d9b3058e19..821f0c69dc 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail188.hs +++ b/testsuite/tests/typecheck/should_fail/tcfail188.hs @@ -5,10 +5,14 @@ module ShouldFail where -data D (f :: (* -> *) -> * -> *) (af :: * -> *) (ax :: *) = +import Data.Kind (Type) + +data D (f :: (Type -> Type) -> Type -> Type) + (af :: Type -> Type) + (ax :: Type) = D (af (f af ax)) -data CList (f :: (* -> *) -> * -> *) (a :: *) = +data CList (f :: (Type -> Type) -> Type -> Type) (a :: Type) = RCons a (CList (D f) a) type CycleList a = forall f. CList f a diff --git a/testsuite/tests/typecheck/should_run/T3500a.hs b/testsuite/tests/typecheck/should_run/T3500a.hs index b614008ad4..fdf827daf3 100644 --- a/testsuite/tests/typecheck/should_run/T3500a.hs +++ b/testsuite/tests/typecheck/should_run/T3500a.hs @@ -4,7 +4,9 @@ module Main where -type family F a :: * +import Data.Kind (Type) + +type family F a :: Type type instance F Int = (Int, ()) class C a diff --git a/testsuite/tests/typecheck/should_run/T9858c.hs b/testsuite/tests/typecheck/should_run/T9858c.hs index 7120715110..2a8f333e35 100644 --- a/testsuite/tests/typecheck/should_run/T9858c.hs +++ b/testsuite/tests/typecheck/should_run/T9858c.hs @@ -2,10 +2,10 @@ module Main(main) where import Data.Typeable -import GHC.Exts +import Data.Kind test1 :: Bool -test1 = typeRep (Proxy :: Proxy (() :: *)) == +test1 = typeRep (Proxy :: Proxy (() :: Type)) == typeRep (Proxy :: Proxy (() :: Constraint)) test2 :: Bool diff --git a/testsuite/tests/typecheck/should_run/TypeOf.hs b/testsuite/tests/typecheck/should_run/TypeOf.hs index 11601a9a89..cec6833b64 100644 --- a/testsuite/tests/typecheck/should_run/TypeOf.hs +++ b/testsuite/tests/typecheck/should_run/TypeOf.hs @@ -1,4 +1,5 @@ {-# LANGUAGE DataKinds, UnicodeSyntax #-} +{-# OPTIONS -Wno-star-is-type #-} import Data.Typeable import GHC.Types diff --git a/testsuite/tests/typecheck/should_run/TypeRep.hs b/testsuite/tests/typecheck/should_run/TypeRep.hs index 43d774a6b5..beae93f6b3 100644 --- a/testsuite/tests/typecheck/should_run/TypeRep.hs +++ b/testsuite/tests/typecheck/should_run/TypeRep.hs @@ -11,6 +11,8 @@ {-# LANGUAGE StarIsType #-} {-# LANGUAGE UnicodeSyntax #-} +{-# OPTIONS -Wno-star-is-type #-} + import Data.Typeable import Data.Kind import GHC.Exts diff --git a/testsuite/tests/warnings/should_compile/StarBinder.hs b/testsuite/tests/warnings/should_compile/StarBinder.hs index 09f51684ac..4b69f44d66 100644 --- a/testsuite/tests/warnings/should_compile/StarBinder.hs +++ b/testsuite/tests/warnings/should_compile/StarBinder.hs @@ -1,4 +1,5 @@ {-# LANGUAGE TypeOperators, TypeFamilies #-} +{-# OPTIONS -Wno-star-is-type #-} module X (type (X.*)) where diff --git a/testsuite/tests/warnings/should_compile/StarBinder.stderr b/testsuite/tests/warnings/should_compile/StarBinder.stderr index 2dbcf0e800..a8bdc9b6e5 100644 --- a/testsuite/tests/warnings/should_compile/StarBinder.stderr +++ b/testsuite/tests/warnings/should_compile/StarBinder.stderr @@ -1,10 +1,10 @@ -StarBinder.hs:5:14: warning: [-Wstar-binder (in -Wdefault)] +StarBinder.hs:6:14: warning: [-Wstar-binder (in -Wdefault)] Found binding occurrence of ‘*’ yet StarIsType is enabled. NB. To use (or export) this operator in modules with StarIsType, including the definition module, you must qualify it. -StarBinder.hs:5:30: warning: [-Wstar-binder (in -Wdefault)] +StarBinder.hs:6:30: warning: [-Wstar-binder (in -Wdefault)] Found binding occurrence of ‘*’ yet StarIsType is enabled. NB. To use (or export) this operator in modules with StarIsType, including the definition module, you must qualify it. diff --git a/testsuite/tests/wcompat-warnings/WCompatWarningsNotOn.hs b/testsuite/tests/wcompat-warnings/WCompatWarningsNotOn.hs deleted file mode 100644 index 7cd6a421e9..0000000000 --- a/testsuite/tests/wcompat-warnings/WCompatWarningsNotOn.hs +++ /dev/null @@ -1,5 +0,0 @@ --- Test purpose: --- Ensure that not using -Wcompat does not enable its warnings - -{-# LANGUAGE CPP #-} -#include "Template.hs" diff --git a/testsuite/tests/wcompat-warnings/WCompatWarningsOn.hs b/testsuite/tests/wcompat-warnings/WCompatWarningsOn.hs index 9c7598269b..ccb6c911e3 100644 --- a/testsuite/tests/wcompat-warnings/WCompatWarningsOn.hs +++ b/testsuite/tests/wcompat-warnings/WCompatWarningsOn.hs @@ -1,6 +1,6 @@ -- Test purpose: -- Ensure that -Wcompat switches on the right warnings -{-# OPTIONS_GHC -Wcompat #-} +{-# OPTIONS_GHC -Wcompat -Wno-error=compat #-} {-# LANGUAGE CPP #-} #include "Template.hs" diff --git a/testsuite/tests/wcompat-warnings/all.T b/testsuite/tests/wcompat-warnings/all.T index 5d624665ab..a472f7bf54 100644 --- a/testsuite/tests/wcompat-warnings/all.T +++ b/testsuite/tests/wcompat-warnings/all.T @@ -1,5 +1,4 @@ # N.B. the source files are all stubs; edit Template.hs test('WCompatWarningsOn', extra_files(['Template.hs']), compile, ['']) test('WCompatWarningsOff', extra_files(['Template.hs']), compile, ['']) -test('WCompatWarningsNotOn', extra_files(['Template.hs']), compile, ['']) test('WCompatWarningsOnOff', extra_files(['Template.hs']), compile, ['']) |