diff options
author | Vladislav Zavialov <vlad.z.4096@gmail.com> | 2019-03-29 10:18:03 +0300 |
---|---|---|
committer | Vladislav Zavialov <vlad.z.4096@gmail.com> | 2019-09-25 21:06:04 +0300 |
commit | 0b5eede97804ec3dfbfa9df9f97bcfe2aa369f6b (patch) | |
tree | c6f6452ba5ae3a3d9f2986c79e054ea55a601884 /testsuite | |
parent | 795986aaf33e2ffc233836b86a92a77366c91db2 (diff) | |
download | haskell-0b5eede97804ec3dfbfa9df9f97bcfe2aa369f6b.tar.gz |
Standalone kind signatures (#16794)wip/top-level-kind-signatures
Implements GHC Proposal #54: .../ghc-proposals/blob/master/proposals/0054-kind-signatures.rst
With this patch, a type constructor can now be given an explicit
standalone kind signature:
{-# LANGUAGE StandaloneKindSignatures #-}
type Functor :: (Type -> Type) -> Constraint
class Functor f where
fmap :: (a -> b) -> f a -> f b
This is a replacement for CUSKs (complete user-specified
kind signatures), which are now scheduled for deprecation.
User-facing changes
-------------------
* A new extension flag has been added, -XStandaloneKindSignatures, which
implies -XNoCUSKs.
* There is a new syntactic construct, a standalone kind signature:
type <name> :: <kind>
Declarations of data types, classes, data families, type families, and
type synonyms may be accompanied by a standalone kind signature.
* A standalone kind signature enables polymorphic recursion in types,
just like a function type signature enables polymorphic recursion in
terms. This obviates the need for CUSKs.
* TemplateHaskell AST has been extended with 'KiSigD' to represent
standalone kind signatures.
* GHCi :info command now prints the kind signature of type constructors:
ghci> :info Functor
type Functor :: (Type -> Type) -> Constraint
...
Limitations
-----------
* 'forall'-bound type variables of a standalone kind signature do not
scope over the declaration body, even if the -XScopedTypeVariables is
enabled. See #16635 and #16734.
* Wildcards are not allowed in standalone kind signatures, as partial
signatures do not allow for polymorphic recursion.
* Associated types may not be given an explicit standalone kind
signature. Instead, they are assumed to have a CUSK if the parent class
has a standalone kind signature and regardless of the -XCUSKs flag.
* Standalone kind signatures do not support multiple names at the moment:
type T1, T2 :: Type -> Type -- rejected
type T1 = Maybe
type T2 = Either String
See #16754.
* Creative use of equality constraints in standalone kind signatures may
lead to GHC panics:
type C :: forall (a :: Type) -> a ~ Int => Constraint
class C a where
f :: C a => a -> Int
See #16758.
Implementation notes
--------------------
* The heart of this patch is the 'kcDeclHeader' function, which is used to
kind-check a declaration header against its standalone kind signature.
It does so in two rounds:
1. check user-written binders
2. instantiate invisible binders a la 'checkExpectedKind'
* 'kcTyClGroup' now partitions declarations into declarations with a
standalone kind signature or a CUSK (kinded_decls) and declarations
without either (kindless_decls):
* 'kinded_decls' are kind-checked with 'checkInitialKinds'
* 'kindless_decls' are kind-checked with 'getInitialKinds'
* DerivInfo has been extended with a new field:
di_scoped_tvs :: ![(Name,TyVar)]
These variables must be added to the context in case the deriving clause
references tcTyConScopedTyVars. See #16731.
Diffstat (limited to 'testsuite')
208 files changed, 1571 insertions, 200 deletions
diff --git a/testsuite/tests/backpack/should_fail/bkpfail04.stderr b/testsuite/tests/backpack/should_fail/bkpfail04.stderr index 07159cf277..0cb8d9cfe0 100644 --- a/testsuite/tests/backpack/should_fail/bkpfail04.stderr +++ b/testsuite/tests/backpack/should_fail/bkpfail04.stderr @@ -8,8 +8,10 @@ bkpfail04.bkp:7:9: error: • Type constructor ‘A’ has conflicting definitions in the module and its hsig file - Main module: data A = A {foo :: Int} - Hsig file: data A = A {bar :: Bool} + Main module: type A :: * + data A = A {foo :: Int} + Hsig file: type A :: * + data A = A {bar :: Bool} The constructors do not match: The record label lists for ‘A’ differ The types for ‘A’ differ diff --git a/testsuite/tests/backpack/should_fail/bkpfail06.stderr b/testsuite/tests/backpack/should_fail/bkpfail06.stderr index 27e0ddf006..a707bf06b6 100644 --- a/testsuite/tests/backpack/should_fail/bkpfail06.stderr +++ b/testsuite/tests/backpack/should_fail/bkpfail06.stderr @@ -14,7 +14,9 @@ bkpfail06.bkp:10:9: error: • Type constructor ‘T’ has conflicting definitions in the module and its hsig file - Main module: data T = T GHC.Types.Bool - Hsig file: data T = T GHC.Types.Int + Main module: type T :: * + data T = T GHC.Types.Bool + Hsig file: type T :: * + data T = T GHC.Types.Int The constructors do not match: The types for ‘T’ differ • while checking that qimpl:H implements signature H in p[H=qimpl:H] diff --git a/testsuite/tests/backpack/should_fail/bkpfail07.stderr b/testsuite/tests/backpack/should_fail/bkpfail07.stderr index f8cf6b000a..05277035dd 100644 --- a/testsuite/tests/backpack/should_fail/bkpfail07.stderr +++ b/testsuite/tests/backpack/should_fail/bkpfail07.stderr @@ -10,7 +10,9 @@ bkpfail07.bkp:6:9: error: • Type constructor ‘T’ has conflicting definitions in the module and its hsig file - Main module: data T = T GHC.Types.Bool - Hsig file: data T = T GHC.Types.Int + Main module: type T :: * + data T = T GHC.Types.Bool + Hsig file: type T :: * + data T = T GHC.Types.Int The constructors do not match: The types for ‘T’ differ • while checking that h[A=<A>]:H implements signature H in p[H=h[A=<A>]:H] diff --git a/testsuite/tests/backpack/should_fail/bkpfail10.stderr b/testsuite/tests/backpack/should_fail/bkpfail10.stderr index 70b0853dc5..78ceaffb30 100644 --- a/testsuite/tests/backpack/should_fail/bkpfail10.stderr +++ b/testsuite/tests/backpack/should_fail/bkpfail10.stderr @@ -12,8 +12,10 @@ bkpfail10.bkp:8:9: error: • Type constructor ‘H’ has conflicting definitions in the module and its hsig file - Main module: data H a = H a - Hsig file: data H + Main module: type H :: * -> * + data H a = H a + Hsig file: type H :: * + data H The types have different kinds • while checking that q:H implements signature H in p[H=q:H] diff --git a/testsuite/tests/backpack/should_fail/bkpfail17.stderr b/testsuite/tests/backpack/should_fail/bkpfail17.stderr index 7bd5c5778d..81e47ec524 100644 --- a/testsuite/tests/backpack/should_fail/bkpfail17.stderr +++ b/testsuite/tests/backpack/should_fail/bkpfail17.stderr @@ -9,8 +9,10 @@ <no location info>: error: • Type constructor ‘Either’ has conflicting definitions in the module and its hsig file - Main module: data Either a b = Left a | Right b + Main module: type Either :: * -> * -> * + data Either a b = Left a | Right b Hsig file: type role Either representational phantom phantom + type Either :: * -> * -> * -> * data Either a b c = Left a The types have different kinds • while checking that Prelude implements signature ShouldFail in p[ShouldFail=Prelude] diff --git a/testsuite/tests/backpack/should_fail/bkpfail22.stderr b/testsuite/tests/backpack/should_fail/bkpfail22.stderr index fe066bd039..cb0a0e23fa 100644 --- a/testsuite/tests/backpack/should_fail/bkpfail22.stderr +++ b/testsuite/tests/backpack/should_fail/bkpfail22.stderr @@ -16,6 +16,8 @@ bkpfail22.bkp:16:9: error: • Type constructor ‘S’ has conflicting definitions in the module and its hsig file - Main module: type S = () - Hsig file: type S = GHC.Types.Bool + Main module: type S :: * + type S = () + Hsig file: type S :: * + type S = GHC.Types.Bool • while checking that badimpl:H2 implements signature H2 in q[H2=badimpl:H2] diff --git a/testsuite/tests/backpack/should_fail/bkpfail23.stderr b/testsuite/tests/backpack/should_fail/bkpfail23.stderr index 00a19e2001..6a2eb8ce1e 100644 --- a/testsuite/tests/backpack/should_fail/bkpfail23.stderr +++ b/testsuite/tests/backpack/should_fail/bkpfail23.stderr @@ -13,8 +13,10 @@ bkpfail23.bkp:14:9: error: • Type constructor ‘F’ has conflicting definitions in the module and its hsig file - Main module: type F a = () + Main module: type F :: * -> * + type F a = () Hsig file: type role F phantom + type F :: * -> * data F a Illegal parameterized type synonym in implementation of abstract data. (Try eta reducing your type synonym so that it is nullary.) diff --git a/testsuite/tests/backpack/should_fail/bkpfail25.stderr b/testsuite/tests/backpack/should_fail/bkpfail25.stderr index 1a9c573157..cedcd30399 100644 --- a/testsuite/tests/backpack/should_fail/bkpfail25.stderr +++ b/testsuite/tests/backpack/should_fail/bkpfail25.stderr @@ -18,7 +18,9 @@ bkpfail25.bkp:7:18: warning: [-Wmissing-methods (in -Wdefault)] bkpfail25.bkp:12:9: error: • Type constructor ‘T’ has conflicting definitions in the module and its hsig file - Main module: type T a = a + Main module: type T :: * -> * + type T a = a Hsig file: type role T nominal + type T :: * -> * data T a • while checking that q:H implements signature H in p[H=q:H] diff --git a/testsuite/tests/backpack/should_fail/bkpfail26.stderr b/testsuite/tests/backpack/should_fail/bkpfail26.stderr index 3de59a22c7..09410cedfe 100644 --- a/testsuite/tests/backpack/should_fail/bkpfail26.stderr +++ b/testsuite/tests/backpack/should_fail/bkpfail26.stderr @@ -13,8 +13,10 @@ bkpfail26.bkp:15:9: error: • Type constructor ‘T’ has conflicting definitions in the module and its hsig file - Main module: type T a = [a] + Main module: type T :: * -> * + type T a = [a] Hsig file: type role T nominal + type T :: * -> * data T a Illegal parameterized type synonym in implementation of abstract data. (Try eta reducing your type synonym so that it is nullary.) diff --git a/testsuite/tests/backpack/should_fail/bkpfail27.stderr b/testsuite/tests/backpack/should_fail/bkpfail27.stderr index dfadb40773..bc5a8c6bd5 100644 --- a/testsuite/tests/backpack/should_fail/bkpfail27.stderr +++ b/testsuite/tests/backpack/should_fail/bkpfail27.stderr @@ -13,7 +13,9 @@ bkpfail27.bkp:15:9: error: • Type constructor ‘T’ has conflicting definitions in the module and its hsig file - Main module: type T = F - Hsig file: data T + Main module: type T :: * + type T = F + Hsig file: type T :: * + data T Illegal type family application in implementation of abstract data. • while checking that q:H implements signature H in p[H=q:H] diff --git a/testsuite/tests/backpack/should_fail/bkpfail41.stderr b/testsuite/tests/backpack/should_fail/bkpfail41.stderr index 9a1b4218e0..6cd72dcad1 100644 --- a/testsuite/tests/backpack/should_fail/bkpfail41.stderr +++ b/testsuite/tests/backpack/should_fail/bkpfail41.stderr @@ -10,10 +10,12 @@ bkpfail41.bkp:10:9: error: • Class ‘C’ has conflicting definitions in the module and its hsig file - Main module: class C a where + Main module: type C :: * -> Constraint + class C a where f :: a -> a {-# MINIMAL f #-} - Hsig file: class C a where + Hsig file: type C :: * -> Constraint + class C a where f :: a -> a default f :: a -> a The methods do not match: diff --git a/testsuite/tests/backpack/should_fail/bkpfail42.stderr b/testsuite/tests/backpack/should_fail/bkpfail42.stderr index 467ab717aa..5b078910f9 100644 --- a/testsuite/tests/backpack/should_fail/bkpfail42.stderr +++ b/testsuite/tests/backpack/should_fail/bkpfail42.stderr @@ -6,10 +6,12 @@ bkpfail42.bkp:9:9: error: • Type constructor ‘F’ has conflicting definitions in the module and its hsig file - Main module: type family F a :: * - where F a = Int - Hsig file: type family F a :: * - where F a = Bool + Main module: type F :: * -> * + type family F a where + F a = Int + Hsig file: type F :: * -> * + type family F a where + F a = Bool • while merging the signatures from: • p[A=<A>]:A • ...and the local signature for A diff --git a/testsuite/tests/backpack/should_fail/bkpfail45.stderr b/testsuite/tests/backpack/should_fail/bkpfail45.stderr index 737769384d..f28f18316b 100644 --- a/testsuite/tests/backpack/should_fail/bkpfail45.stderr +++ b/testsuite/tests/backpack/should_fail/bkpfail45.stderr @@ -14,8 +14,10 @@ bkpfail45.bkp:13:9: error: • Type constructor ‘T’ has conflicting definitions in the module and its hsig file Main module: type role T phantom + type T :: * -> * data T a = T Hsig file: type role T nominal + type T :: * -> * data T a = T The roles do not match. Roles on abstract types default to ‘representational’ in boot files. diff --git a/testsuite/tests/backpack/should_fail/bkpfail46.stderr b/testsuite/tests/backpack/should_fail/bkpfail46.stderr index 9aeaccbb7e..908866f67c 100644 --- a/testsuite/tests/backpack/should_fail/bkpfail46.stderr +++ b/testsuite/tests/backpack/should_fail/bkpfail46.stderr @@ -13,8 +13,10 @@ bkpfail46.bkp:15:9: error: • Type constructor ‘K’ has conflicting definitions in the module and its hsig file - Main module: type K a = GHC.Classes.Eq a :: Constraint - Hsig file: class K a + Main module: type K :: * -> Constraint + type K a = GHC.Classes.Eq a :: Constraint + Hsig file: type K :: * -> Constraint + class K a Illegal parameterized type synonym in implementation of abstract data. (Try eta reducing your type synonym so that it is nullary.) • while checking that q:A implements signature A in p[A=q:A] diff --git a/testsuite/tests/backpack/should_fail/bkpfail47.stderr b/testsuite/tests/backpack/should_fail/bkpfail47.stderr index b2bc08b4c2..0eb58d8ee4 100644 --- a/testsuite/tests/backpack/should_fail/bkpfail47.stderr +++ b/testsuite/tests/backpack/should_fail/bkpfail47.stderr @@ -9,8 +9,10 @@ bkpfail47.bkp:9:9: error: • Type constructor ‘T’ has conflicting definitions in the module and its hsig file Main module: type role T representational nominal + type T :: * -> * -> * data T a b = MkT Hsig file: type role T nominal representational + type T :: * -> * -> * data T a b The roles are not compatible: Main module: [representational, nominal] diff --git a/testsuite/tests/dependent/should_compile/Rae31.hs b/testsuite/tests/dependent/should_compile/Rae31.hs index 7a50b606ee..5bc41b997e 100644 --- a/testsuite/tests/dependent/should_compile/Rae31.hs +++ b/testsuite/tests/dependent/should_compile/Rae31.hs @@ -1,5 +1,5 @@ {-# LANGUAGE TemplateHaskell, TypeOperators, PolyKinds, DataKinds, - TypeFamilies #-} + TypeFamilies, RankNTypes #-} module A where diff --git a/testsuite/tests/dependent/should_compile/mkGADTVars.hs b/testsuite/tests/dependent/should_compile/mkGADTVars.hs index 70753256d8..13ac0248bf 100644 --- a/testsuite/tests/dependent/should_compile/mkGADTVars.hs +++ b/testsuite/tests/dependent/should_compile/mkGADTVars.hs @@ -1,4 +1,4 @@ -{-# LANGUAGE GADTs, PolyKinds #-} +{-# LANGUAGE GADTs, PolyKinds, RankNTypes #-} module GADTVars where diff --git a/testsuite/tests/driver/T4437.hs b/testsuite/tests/driver/T4437.hs index c432e4b90e..fd70fccad3 100644 --- a/testsuite/tests/driver/T4437.hs +++ b/testsuite/tests/driver/T4437.hs @@ -41,6 +41,7 @@ expectedGhcOnlyExtensions = ["RelaxedLayout", "AlternativeLayoutRuleTransitional", "UnliftedNewtypes", "CUSKs", + "StandaloneKindSignatures", "ImportQualifiedPost"] expectedCabalOnlyExtensions :: [String] diff --git a/testsuite/tests/ghci/prog008/ghci.prog008.stdout b/testsuite/tests/ghci/prog008/ghci.prog008.stdout index 5601247c3c..41efe8294b 100644 --- a/testsuite/tests/ghci/prog008/ghci.prog008.stdout +++ b/testsuite/tests/ghci/prog008/ghci.prog008.stdout @@ -1,8 +1,10 @@ +type C :: * -> * -> Constraint class C a b where c1 :: Num b => a -> b c2 :: (Num b, Show b) => a -> b c3 :: a1 -> b {-# MINIMAL c1, c2, c3 #-} +type C :: * -> * -> Constraint class C a b where c1 :: Num b => a -> b c2 :: (Num b, Show b) => a -> b diff --git a/testsuite/tests/ghci/scripts/T10018.stdout b/testsuite/tests/ghci/scripts/T10018.stdout index 4f7d4807b2..069ea31d19 100644 --- a/testsuite/tests/ghci/scripts/T10018.stdout +++ b/testsuite/tests/ghci/scripts/T10018.stdout @@ -1,2 +1,4 @@ -data Infix a b = a :@: b -- Defined at <interactive>:2:18 +type Infix :: * -> * -> * +data Infix a b = a :@: b + -- Defined at <interactive>:2:18 infixl 4 :@: diff --git a/testsuite/tests/ghci/scripts/T10059.stdout b/testsuite/tests/ghci/scripts/T10059.stdout index 955c95a966..3832719cee 100644 --- a/testsuite/tests/ghci/scripts/T10059.stdout +++ b/testsuite/tests/ghci/scripts/T10059.stdout @@ -1,4 +1,7 @@ -class (a ~ b) => (~) (a :: k) (b :: k) -- Defined in ‘GHC.Types’ +type (~) :: forall k. k -> k -> Constraint +class (a ~ b) => (~) a b + -- Defined in ‘GHC.Types’ (~) :: k -> k -> Constraint -class (a GHC.Prim.~# b) => (~) (a :: k) (b :: k) +type (~) :: forall k. k -> k -> Constraint +class (a GHC.Prim.~# b) => (~) a b -- Defined in ‘GHC.Types’ diff --git a/testsuite/tests/ghci/scripts/T11051a.stdout b/testsuite/tests/ghci/scripts/T11051a.stdout index 44fb93cae5..0a380fecd5 100644 --- a/testsuite/tests/ghci/scripts/T11051a.stdout +++ b/testsuite/tests/ghci/scripts/T11051a.stdout @@ -1 +1,2 @@ +type Hi :: * data Hi diff --git a/testsuite/tests/ghci/scripts/T11051b.stdout b/testsuite/tests/ghci/scripts/T11051b.stdout index 613bf15c3a..8eea41e3a5 100644 --- a/testsuite/tests/ghci/scripts/T11051b.stdout +++ b/testsuite/tests/ghci/scripts/T11051b.stdout @@ -1 +1,2 @@ +type Hello :: * data Hello = ... diff --git a/testsuite/tests/ghci/scripts/T12005.stdout b/testsuite/tests/ghci/scripts/T12005.stdout index 34cde4ad97..5e4b70ca6e 100644 --- a/testsuite/tests/ghci/scripts/T12005.stdout +++ b/testsuite/tests/ghci/scripts/T12005.stdout @@ -1,4 +1,5 @@ -class Defer (p :: Constraint) where +type Defer :: Constraint -> Constraint +class Defer p where defer :: (p => r) -> r {-# MINIMAL defer #-} -- Defined at <interactive>:5:1 diff --git a/testsuite/tests/ghci/scripts/T12550.stdout b/testsuite/tests/ghci/scripts/T12550.stdout index c7173fc426..81be552e5c 100644 --- a/testsuite/tests/ghci/scripts/T12550.stdout +++ b/testsuite/tests/ghci/scripts/T12550.stdout @@ -11,12 +11,14 @@ f ∷ ∀ {a ∷ ★ → ★} {b}. C a ⇒ a b f ∷ ∀ {a ∷ ★ → ★} {b}. C a ⇒ a b f ∷ ∀ {a ∷ ★ → ★} {b}. C a ⇒ a b fmap ∷ ∀ {f ∷ ★ → ★} {a} {b}. Functor f ⇒ (a → b) → f a → f b -class Functor (f ∷ ★ → ★) where +type Functor :: (★ → ★) → Constraint +class Functor f where fmap ∷ ∀ a b. (a → b) → f a → f b ... -- Defined in ‘GHC.Base’ Functor ∷ (★ → ★) → Constraint -class Functor (f ∷ ★ → ★) where +type Functor :: (★ → ★) → Constraint +class Functor f where fmap ∷ ∀ a b. (a → b) → f a → f b (<$) ∷ ∀ a b. a → f b → f a {-# MINIMAL fmap #-} @@ -56,7 +58,8 @@ datatypeName ∷ ∀ {d} {t ∷ ★ → (★ → ★) → ★ → ★} {f ∷ ★ → ★} {a}. Datatype d ⇒ t d f a → [Char] -class Datatype (d ∷ k) where +type Datatype :: ∀ {k}. k → Constraint +class Datatype d where datatypeName ∷ ∀ k1 (t ∷ k → (k1 → ★) → k1 → ★) (f ∷ k1 → ★) (a ∷ k1). t d f a → [Char] diff --git a/testsuite/tests/ghci/scripts/T13407.stdout b/testsuite/tests/ghci/scripts/T13407.stdout index 083f3a8b1f..85d73d9e89 100644 --- a/testsuite/tests/ghci/scripts/T13407.stdout +++ b/testsuite/tests/ghci/scripts/T13407.stdout @@ -1,3 +1,4 @@ type role Foo phantom phantom -data Foo (a :: * -> *) (b :: k) +type Foo :: (* -> *) -> forall k. k -> * +data Foo a b -- Defined at <interactive>:3:1 diff --git a/testsuite/tests/ghci/scripts/T13420.stdout b/testsuite/tests/ghci/scripts/T13420.stdout index c6dbaf2755..030b902677 100644 --- a/testsuite/tests/ghci/scripts/T13420.stdout +++ b/testsuite/tests/ghci/scripts/T13420.stdout @@ -1,4 +1,5 @@ -type family F a :: * where +type F :: * -> * +type family F a where F [Int] = Bool F [a] = Double F (a b) = Char diff --git a/testsuite/tests/ghci/scripts/T13699.stdout b/testsuite/tests/ghci/scripts/T13699.stdout index b5950a757b..7c30448563 100644 --- a/testsuite/tests/ghci/scripts/T13699.stdout +++ b/testsuite/tests/ghci/scripts/T13699.stdout @@ -1,8 +1,10 @@ +type Foo :: * data Foo = Foo {foo1 :: Int, foo2 :: !Int, foo3 :: Maybe Int, foo4 :: !(Maybe Int)} -- Defined at T13699.hs:3:1 +type Bar :: * data Bar = Bar Int !Int (Maybe Int) !(Maybe Int) -- Defined at T13699.hs:10:1 diff --git a/testsuite/tests/ghci/scripts/T15341.stdout b/testsuite/tests/ghci/scripts/T15341.stdout index e2555f9ac9..403b50456b 100644 --- a/testsuite/tests/ghci/scripts/T15341.stdout +++ b/testsuite/tests/ghci/scripts/T15341.stdout @@ -1,6 +1,8 @@ -type family Foo (a :: k) :: k where +type Foo :: forall k. k -> k +type family Foo a where forall k (a :: k). Foo a = a -- Defined at T15341.hs:5:1 -type family Foo @k (a :: k) :: k where +type Foo :: forall k. k -> k +type family Foo @k a where forall k (a :: k). Foo @k a = a -- Defined at T15341.hs:5:1 diff --git a/testsuite/tests/ghci/scripts/T15546.stdout b/testsuite/tests/ghci/scripts/T15546.stdout index 5dc8cf3679..d14b442bb8 100644 --- a/testsuite/tests/ghci/scripts/T15546.stdout +++ b/testsuite/tests/ghci/scripts/T15546.stdout @@ -1,8 +1,10 @@ -type family E a b :: * where +type E :: * -> * -> * +type family E a b where E a a = () E a b = Bool -- Defined at <interactive>:2:1 -type family E a b :: * where +type E :: * -> * -> * +type family E a b where {- #0 -} E a a = () {- #1 -} E a b = Bool -- incompatible with: #0 diff --git a/testsuite/tests/ghci/scripts/T15827.stdout b/testsuite/tests/ghci/scripts/T15827.stdout index 50df504e58..8b403d4043 100644 --- a/testsuite/tests/ghci/scripts/T15827.stdout +++ b/testsuite/tests/ghci/scripts/T15827.stdout @@ -1,9 +1,14 @@ -type family F1 (a :: k) :: * -- Defined at T15827.hs:9:1 +type F1 :: forall k. k -> * +type family F1 a + -- Defined at T15827.hs:9:1 type instance forall k (a :: k). F1 a = Proxy a -- Defined at T15827.hs:10:34 -type family F2 (a :: k) :: * where +type F2 :: forall k. k -> * +type family F2 a where forall k (a :: k). F2 a = Proxy a -- Defined at T15827.hs:12:1 -data family D (a :: k) -- Defined at T15827.hs:15:1 +type D :: forall k. k -> * +data family D a + -- Defined at T15827.hs:15:1 data instance forall k (a :: k). D a = MkD (Proxy a) -- Defined at T15827.hs:16:34 diff --git a/testsuite/tests/ghci/scripts/T15872.stdout b/testsuite/tests/ghci/scripts/T15872.stdout index 623631162a..e1aa200425 100644 --- a/testsuite/tests/ghci/scripts/T15872.stdout +++ b/testsuite/tests/ghci/scripts/T15872.stdout @@ -1,5 +1,6 @@ MkFun :: (a -> b) -> Fun a b Fun :: (a ~ 'OP) => * -> * -> * +type Fun :: forall (a :: WHICH). (a ~ 'OP) => * -> * -> * data Fun b c where MkFun :: (b -> c) -> Fun b c -- Defined at T15872.hs:11:1 @@ -7,10 +8,10 @@ MkFun :: (a -> b) -> Fun @'OP @{'GHC.Types.Eq# @WHICH @'OP @'OP <>} a b Fun :: ((a :: WHICH) ~ ('OP :: WHICH)) => * -> * -> * type role Fun nominal nominal representational representational -data Fun @(a :: WHICH) - @{a1 :: (a :: WHICH) ~ ('OP :: WHICH)} - b - c where +type Fun :: forall (a :: WHICH). + ((a :: WHICH) ~ ('OP :: WHICH)) => + * -> * -> * +data Fun @a @{a1} b c where MkFun :: (b -> c) -> Fun @'OP @{'GHC.Types.Eq# @WHICH @'OP @'OP <>} b c -- Defined at T15872.hs:11:1 diff --git a/testsuite/tests/ghci/scripts/T15941.stdout b/testsuite/tests/ghci/scripts/T15941.stdout index c6f31a7334..f9e6d339f9 100644 --- a/testsuite/tests/ghci/scripts/T15941.stdout +++ b/testsuite/tests/ghci/scripts/T15941.stdout @@ -1,3 +1,4 @@ +type T :: * -> * -> * type T = (->) @{'GHC.Types.LiftedRep} @{'GHC.Types.LiftedRep} :: * -> * -> * -- Defined at <interactive>:2:1 diff --git a/testsuite/tests/ghci/scripts/T16030.stdout b/testsuite/tests/ghci/scripts/T16030.stdout index d1691a6758..4efa27ce70 100644 --- a/testsuite/tests/ghci/scripts/T16030.stdout +++ b/testsuite/tests/ghci/scripts/T16030.stdout @@ -1,20 +1,26 @@ type role Foo1 phantom -data Foo1 (a :: k) where +type Foo1 :: forall k. k -> * +data Foo1 a where MkFoo1a :: forall k (a :: k). Proxy a -> Int -> Foo1 a MkFoo1b :: forall k (a :: k). {a :: Proxy a, b :: Int} -> Foo1 a -- Defined at T16030.hs:8:1 -data family Foo2 (a :: k) -- Defined at T16030.hs:12:1 +type Foo2 :: forall k. k -> * +data family Foo2 a + -- Defined at T16030.hs:12:1 data instance forall k (a :: k). Foo2 a where MkFoo2a :: forall k (a :: k). Proxy a -> Int -> Foo2 a MkFoo2b :: forall k (a :: k). {c :: Proxy a, d :: Int} -> Foo2 a -- Defined at T16030.hs:13:15 type role Foo1 nominal phantom -data Foo1 @k (a :: k) where +type Foo1 :: forall k. k -> * +data Foo1 @k a where MkFoo1a :: forall k (a :: k). Proxy @{k} a -> Int -> Foo1 @k a MkFoo1b :: forall k (a :: k). {a :: Proxy @{k} a, b :: Int} -> Foo1 @k a -- Defined at T16030.hs:8:1 -data family Foo2 @k (a :: k) -- Defined at T16030.hs:12:1 +type Foo2 :: forall k. k -> * +data family Foo2 @k a + -- Defined at T16030.hs:12:1 data instance forall k (a :: k). Foo2 @k a where MkFoo2a :: forall k (a :: k). Proxy @{k} a -> Int -> Foo2 @k a MkFoo2b :: forall k (a :: k). diff --git a/testsuite/tests/ghci/scripts/T16527.stdout b/testsuite/tests/ghci/scripts/T16527.stdout index fd4e0ef735..40688b571e 100644 --- a/testsuite/tests/ghci/scripts/T16527.stdout +++ b/testsuite/tests/ghci/scripts/T16527.stdout @@ -1,3 +1,4 @@ +type T :: * data T where MkT1 :: (Int -> Int) -> T MkT2 :: (forall a. Maybe a) -> T diff --git a/testsuite/tests/ghci/scripts/T4015.stdout b/testsuite/tests/ghci/scripts/T4015.stdout index 4ce312c581..cd8867212b 100644 --- a/testsuite/tests/ghci/scripts/T4015.stdout +++ b/testsuite/tests/ghci/scripts/T4015.stdout @@ -1,20 +1,31 @@ +type R :: * data R = R {x :: Char, y :: Int, z :: Float} | S {x :: Char} | T {y :: Int, z :: Float} | W +type R :: * data R = R {x :: Char, y :: Int, z :: Float} | S {x :: Char} | T {y :: Int, z :: Float} | W -- Defined at T4015.hs:3:1 -data R = ... | S {...} | ... -- Defined at T4015.hs:4:10 -data R = ... | T {...} | ... -- Defined at T4015.hs:5:10 -data R = ... | W -- Defined at T4015.hs:6:10 +type R :: * +data R = ... | S {...} | ... + -- Defined at T4015.hs:4:10 +type R :: * +data R = ... | T {...} | ... + -- Defined at T4015.hs:5:10 +type R :: * +data R = ... | W + -- Defined at T4015.hs:6:10 +type R :: * data R = R {x :: Char, ...} | S {x :: Char} | ... -- Defined at T4015.hs:3:14 +type R :: * data R = R {..., y :: Int, ...} | ... | T {y :: Int, ...} | ... -- Defined at T4015.hs:3:25 +type R :: * data R = R {..., z :: Float} | ... | T {..., z :: Float} | ... -- Defined at T4015.hs:3:35 diff --git a/testsuite/tests/ghci/scripts/T4087.stdout b/testsuite/tests/ghci/scripts/T4087.stdout index 3f600bd78d..8dafaa881d 100644 --- a/testsuite/tests/ghci/scripts/T4087.stdout +++ b/testsuite/tests/ghci/scripts/T4087.stdout @@ -1,4 +1,5 @@ type role Equal nominal nominal +type Equal :: * -> * -> * data Equal a b where Equal :: Equal a a -- Defined at T4087.hs:5:1 diff --git a/testsuite/tests/ghci/scripts/T4175.stdout b/testsuite/tests/ghci/scripts/T4175.stdout index 9dfcd6c0d6..52d8a688c7 100644 --- a/testsuite/tests/ghci/scripts/T4175.stdout +++ b/testsuite/tests/ghci/scripts/T4175.stdout @@ -1,21 +1,30 @@ -type family A a b :: * -- Defined at T4175.hs:7:1 +type A :: * -> * -> * +type family A a b + -- Defined at T4175.hs:7:1 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 +type B :: * -> * +data family B a + -- Defined at T4175.hs:12:1 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 +type C :: * -> Constraint class C a where - type family D a b :: * + type D :: * -> * -> * + type family D a b -- Defined at T4175.hs:16:5 type instance D () () = Bool -- Defined at T4175.hs:22:10 type instance D Int () = String -- Defined at T4175.hs:19:10 -type family E a :: * where +type E :: * -> * +type family E a where E () = Bool E Int = String -- Defined at T4175.hs:24:1 -data () = () -- Defined in ‘GHC.Tuple’ +type () :: * +data () = () + -- Defined in ‘GHC.Tuple’ instance [safe] C () -- Defined at T4175.hs:21:10 instance Eq () -- Defined in ‘GHC.Classes’ instance Monoid () -- Defined in ‘GHC.Base’ @@ -28,7 +37,9 @@ instance Bounded () -- Defined in ‘GHC.Enum’ type instance D () () = Bool -- Defined at T4175.hs:22:10 type instance D Int () = String -- Defined at T4175.hs:19:10 data instance B () = MkB -- Defined at T4175.hs:13:15 -data Maybe a = Nothing | Just a -- Defined in ‘GHC.Maybe’ +type Maybe :: * -> * +data Maybe a = Nothing | Just a + -- Defined in ‘GHC.Maybe’ instance Applicative Maybe -- Defined in ‘GHC.Base’ instance Eq a => Eq (Maybe a) -- Defined in ‘GHC.Maybe’ instance Functor Maybe -- Defined in ‘GHC.Base’ @@ -43,7 +54,9 @@ 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 = GHC.Types.I# GHC.Prim.Int# -- Defined in ‘GHC.Types’ +type Int :: * +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’ @@ -56,5 +69,7 @@ instance Bounded Int -- Defined in ‘GHC.Enum’ 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 +type Z :: * -> Constraint +class Z a + -- Defined at T4175.hs:28:1 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 ab2827730f..163a9236de 100644 --- a/testsuite/tests/ghci/scripts/T5417.stdout +++ b/testsuite/tests/ghci/scripts/T5417.stdout @@ -1,9 +1,15 @@ +type B1 :: * -> * data B1 a = B1 a data instance C.F (B1 a) = B2 a +type D :: * -> * data family D a +type C.C1 :: * -> Constraint class C.C1 a where + type C.F :: * -> * data family C.F a +type C.C1 :: * -> Constraint class C.C1 a where + type C.F :: * -> * data family C.F a -- 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/T5820.stdout b/testsuite/tests/ghci/scripts/T5820.stdout index a8dddd3863..faa5f6fc76 100644 --- a/testsuite/tests/ghci/scripts/T5820.stdout +++ b/testsuite/tests/ghci/scripts/T5820.stdout @@ -1,4 +1,8 @@ -data Foo = Foo -- Defined at T5820.hs:2:1 +type Foo :: * +data Foo = Foo + -- Defined at T5820.hs:2:1 instance [safe] Eq Foo -- Defined at T5820.hs:3:10 -data Foo = Foo -- Defined at T5820.hs:2:1 +type Foo :: * +data Foo = Foo + -- Defined at T5820.hs:2:1 instance [safe] Eq Foo -- Defined at T5820.hs:3:10 diff --git a/testsuite/tests/ghci/scripts/T6027ghci.stdout b/testsuite/tests/ghci/scripts/T6027ghci.stdout index be1034b0c7..7711a3003f 100644 --- a/testsuite/tests/ghci/scripts/T6027ghci.stdout +++ b/testsuite/tests/ghci/scripts/T6027ghci.stdout @@ -1 +1,3 @@ -data (?) -- Defined at <interactive>:2:1 +type (?) :: * +data (?) + -- Defined at <interactive>:2:1 diff --git a/testsuite/tests/ghci/scripts/T7627.stdout b/testsuite/tests/ghci/scripts/T7627.stdout index ea9aaafb80..b86ea432ff 100644 --- a/testsuite/tests/ghci/scripts/T7627.stdout +++ b/testsuite/tests/ghci/scripts/T7627.stdout @@ -1,4 +1,6 @@ -data () = () -- Defined in ‘GHC.Tuple’ +type () :: * +data () = () + -- Defined in ‘GHC.Tuple’ instance Eq () -- Defined in ‘GHC.Classes’ instance Monoid () -- Defined in ‘GHC.Base’ instance Ord () -- Defined in ‘GHC.Classes’ @@ -7,12 +9,16 @@ instance Enum () -- Defined in ‘GHC.Enum’ instance Show () -- Defined in ‘GHC.Show’ instance Read () -- Defined in ‘GHC.Read’ instance Bounded () -- Defined in ‘GHC.Enum’ -data (##) = (##) -- Defined in ‘GHC.Prim’ +type (##) :: TYPE ('GHC.Types.TupleRep '[]) +data (##) = (##) + -- Defined in ‘GHC.Prim’ () :: () (##) :: (# #) ( ) :: () (# #) :: (# #) -data (,) a b = (,) a b -- Defined in ‘GHC.Tuple’ +type (,) :: * -> * -> * +data (,) a b = (,) a b + -- Defined in ‘GHC.Tuple’ instance Monoid a => Applicative ((,) a) -- Defined in ‘GHC.Base’ instance (Eq a, Eq b) => Eq (a, b) -- Defined in ‘GHC.Classes’ instance Functor ((,) a) -- Defined in ‘GHC.Base’ @@ -28,7 +34,12 @@ instance Foldable ((,) a) -- Defined in ‘Data.Foldable’ instance Traversable ((,) a) -- Defined in ‘Data.Traversable’ instance (Bounded a, Bounded b) => Bounded (a, b) -- Defined in ‘GHC.Enum’ -data (#,#) (a :: TYPE k0) (b :: TYPE k1) = (#,#) a b +type (#,#) :: * + -> * + -> TYPE + ('GHC.Types.TupleRep + '[ 'GHC.Types.LiftedRep, 'GHC.Types.LiftedRep]) +data (#,#) a b = (#,#) a b -- Defined in ‘GHC.Prim’ (,) :: a -> b -> (a, b) (#,#) :: a -> b -> (# a, b #) diff --git a/testsuite/tests/ghci/scripts/T7730.stdout b/testsuite/tests/ghci/scripts/T7730.stdout index bf9c1d025b..9c3e385c71 100644 --- a/testsuite/tests/ghci/scripts/T7730.stdout +++ b/testsuite/tests/ghci/scripts/T7730.stdout @@ -1,7 +1,9 @@ type role A phantom phantom -data A (x :: k) (y :: k1) +type A :: forall k k1. k -> k1 -> * +data A x y -- Defined at <interactive>:2:1 A :: k1 -> k2 -> * type role T phantom -data T (a :: k) = forall a1. MkT a1 +type T :: forall k. k -> * +data T a = forall a1. MkT a1 -- Defined at <interactive>:6:1 diff --git a/testsuite/tests/ghci/scripts/T7872.stdout b/testsuite/tests/ghci/scripts/T7872.stdout index 4c577ce1cd..4c8c1dd772 100644 --- a/testsuite/tests/ghci/scripts/T7872.stdout +++ b/testsuite/tests/ghci/scripts/T7872.stdout @@ -1,2 +1,6 @@ -type T = forall a. a -> a -- Defined at <interactive>:2:1 -data D = MkT (forall b. b -> b) -- Defined at <interactive>:3:1 +type T :: * +type T = forall a. a -> a + -- Defined at <interactive>:2:1 +type D :: * +data D = MkT (forall b. b -> b) + -- Defined at <interactive>:3:1 diff --git a/testsuite/tests/ghci/scripts/T7873.stdout b/testsuite/tests/ghci/scripts/T7873.stdout index bcdebe71e1..4abcab8c18 100644 --- a/testsuite/tests/ghci/scripts/T7873.stdout +++ b/testsuite/tests/ghci/scripts/T7873.stdout @@ -1,5 +1,7 @@ +type D2 :: * data D2 = forall k. MkD2 (forall (p :: k -> *) (a :: k). p a -> Int) -- Defined at <interactive>:3:1 +type D3 :: * data D3 = MkD3 (forall k (p :: k -> *) (a :: k). p a -> Int) -- Defined at <interactive>:4:1 diff --git a/testsuite/tests/ghci/scripts/T7939.stdout b/testsuite/tests/ghci/scripts/T7939.stdout index 4c2a602f4f..1b6b04e3f9 100644 --- a/testsuite/tests/ghci/scripts/T7939.stdout +++ b/testsuite/tests/ghci/scripts/T7939.stdout @@ -1,24 +1,32 @@ -class Foo (a :: k) where - type family Bar (a :: k) b :: * +type Foo :: forall k. k -> Constraint +class Foo a where + type Bar :: forall k. k -> * -> * + type family Bar a b -- Defined at T7939.hs:6:4 Bar :: k -> * -> * -type family F a :: * -- Defined at T7939.hs:8:1 +type F :: * -> * +type family F a + -- Defined at T7939.hs:8:1 type instance F Int = Bool -- Defined at T7939.hs:9:15 F :: * -> * -type family G a :: * where +type G :: * -> * +type family G a where G Int = Bool -- Defined at T7939.hs:11:1 G :: * -> * -type family H (a :: Bool) :: Bool where +type H :: Bool -> Bool +type family H a where H 'False = 'True -- Defined at T7939.hs:14:1 H :: Bool -> Bool -type family J (a :: [k]) :: Bool where +type J :: forall k. [k] -> Bool +type family J a where J '[] = 'False forall k (h :: k) (t :: [k]). J (h : t) = 'True -- Defined at T7939.hs:17:1 J :: [k] -> Bool -type family K (a1 :: [a]) :: Maybe a where +type K :: forall a. [a] -> Maybe a +type family K a1 where K '[] = 'Nothing forall a (h :: a) (t :: [a]). K (h : t) = 'Just h -- Defined at T7939.hs:21:1 diff --git a/testsuite/tests/ghci/scripts/T8469.stdout b/testsuite/tests/ghci/scripts/T8469.stdout index 1a511e6b55..7cad316fee 100644 --- a/testsuite/tests/ghci/scripts/T8469.stdout +++ b/testsuite/tests/ghci/scripts/T8469.stdout @@ -1,4 +1,6 @@ -data Int = GHC.Types.I# GHC.Prim.Int# -- Defined in ‘GHC.Types’ +type Int :: * +data Int = GHC.Types.I# GHC.Prim.Int# + -- Defined in ‘GHC.Types’ instance Eq Int -- Defined in ‘GHC.Classes’ instance Ord Int -- Defined in ‘GHC.Classes’ instance Enum Int -- Defined in ‘GHC.Enum’ diff --git a/testsuite/tests/ghci/scripts/T8535.stdout b/testsuite/tests/ghci/scripts/T8535.stdout index 4effb90a52..7a949cd465 100644 --- a/testsuite/tests/ghci/scripts/T8535.stdout +++ b/testsuite/tests/ghci/scripts/T8535.stdout @@ -1,4 +1,6 @@ -data (->) (a :: TYPE q) (b :: TYPE r) -- Defined in ‘GHC.Prim’ +type (->) :: * -> * -> * +data (->) a b + -- Defined in ‘GHC.Prim’ infixr -1 -> instance Applicative ((->) r) -- Defined in ‘GHC.Base’ instance Functor ((->) r) -- Defined in ‘GHC.Base’ diff --git a/testsuite/tests/ghci/scripts/T8579.stdout b/testsuite/tests/ghci/scripts/T8579.stdout index 2db09d7fd4..b9f7c748f4 100644 --- a/testsuite/tests/ghci/scripts/T8579.stdout +++ b/testsuite/tests/ghci/scripts/T8579.stdout @@ -1,2 +1,6 @@ -data A = Y -- Defined at <interactive>:2:1 -data A = Y -- Defined at <interactive>:2:1 +type A :: * +data A = Y + -- Defined at <interactive>:2:1 +type A :: * +data A = Y + -- Defined at <interactive>:2:1 diff --git a/testsuite/tests/ghci/scripts/T8674.stdout b/testsuite/tests/ghci/scripts/T8674.stdout index d938f95692..7d7beeb1cd 100644 --- a/testsuite/tests/ghci/scripts/T8674.stdout +++ b/testsuite/tests/ghci/scripts/T8674.stdout @@ -1,4 +1,6 @@ -data family Sing (a :: k) -- Defined at T8674.hs:4:1 +type Sing :: forall k. k -> * +data family Sing a + -- Defined at T8674.hs:4:1 data instance Sing Bool = SBool -- Defined at T8674.hs:6:15 data instance forall k (a :: [k]). Sing a = SNil -- Defined at T8674.hs:5:15 diff --git a/testsuite/tests/ghci/scripts/T9181.stdout b/testsuite/tests/ghci/scripts/T9181.stdout index a30879c316..388681ed63 100644 --- a/testsuite/tests/ghci/scripts/T9181.stdout +++ b/testsuite/tests/ghci/scripts/T9181.stdout @@ -1,9 +1,10 @@ -type family GHC.TypeLits.AppendSymbol (a :: GHC.Types.Symbol) - (b :: GHC.Types.Symbol) - :: GHC.Types.Symbol -type family GHC.TypeLits.CmpSymbol (a :: GHC.Types.Symbol) - (b :: GHC.Types.Symbol) - :: Ordering +type GHC.TypeLits.AppendSymbol :: GHC.Types.Symbol + -> GHC.Types.Symbol -> GHC.Types.Symbol +type family GHC.TypeLits.AppendSymbol a b +type GHC.TypeLits.CmpSymbol :: GHC.Types.Symbol + -> GHC.Types.Symbol -> Ordering +type family GHC.TypeLits.CmpSymbol a b +type GHC.TypeLits.ErrorMessage :: * data GHC.TypeLits.ErrorMessage = GHC.TypeLits.Text GHC.Types.Symbol | forall t. GHC.TypeLits.ShowType t @@ -13,15 +14,18 @@ data GHC.TypeLits.ErrorMessage | GHC.TypeLits.ErrorMessage GHC.TypeLits.:$$: GHC.TypeLits.ErrorMessage -class GHC.TypeLits.KnownSymbol (n :: GHC.Types.Symbol) where +type GHC.TypeLits.KnownSymbol :: GHC.Types.Symbol -> Constraint +class GHC.TypeLits.KnownSymbol n where GHC.TypeLits.symbolSing :: GHC.TypeLits.SSymbol n {-# MINIMAL symbolSing #-} +type GHC.TypeLits.SomeSymbol :: * data GHC.TypeLits.SomeSymbol = forall (n :: GHC.Types.Symbol). GHC.TypeLits.KnownSymbol n => GHC.TypeLits.SomeSymbol (Data.Proxy.Proxy n) -type family GHC.TypeLits.TypeError (a :: GHC.TypeLits.ErrorMessage) - :: b where +type GHC.TypeLits.TypeError :: forall b. + GHC.TypeLits.ErrorMessage -> b +type family GHC.TypeLits.TypeError a where GHC.TypeLits.natVal :: GHC.TypeNats.KnownNat n => proxy n -> Integer GHC.TypeLits.natVal' :: @@ -36,42 +40,48 @@ GHC.TypeLits.symbolVal :: GHC.TypeLits.KnownSymbol n => proxy n -> String GHC.TypeLits.symbolVal' :: GHC.TypeLits.KnownSymbol n => GHC.Prim.Proxy# n -> String -type family (GHC.TypeNats.*) (a :: GHC.Types.Nat) - (b :: GHC.Types.Nat) - :: GHC.Types.Nat -type family (GHC.TypeNats.+) (a :: GHC.Types.Nat) - (b :: GHC.Types.Nat) - :: GHC.Types.Nat -type family (GHC.TypeNats.-) (a :: GHC.Types.Nat) - (b :: GHC.Types.Nat) - :: GHC.Types.Nat -type (GHC.TypeNats.<=) (x :: GHC.Types.Nat) (y :: GHC.Types.Nat) = +type (GHC.TypeNats.*) :: GHC.Types.Nat + -> GHC.Types.Nat -> GHC.Types.Nat +type family (GHC.TypeNats.*) a b +type (GHC.TypeNats.+) :: GHC.Types.Nat + -> GHC.Types.Nat -> GHC.Types.Nat +type family (GHC.TypeNats.+) a b +type (GHC.TypeNats.-) :: GHC.Types.Nat + -> GHC.Types.Nat -> GHC.Types.Nat +type family (GHC.TypeNats.-) a b +type (GHC.TypeNats.<=) :: GHC.Types.Nat + -> GHC.Types.Nat -> Constraint +type (GHC.TypeNats.<=) x y = (x GHC.TypeNats.<=? y) ~ 'True :: Constraint -type family (GHC.TypeNats.<=?) (a :: GHC.Types.Nat) - (b :: GHC.Types.Nat) - :: Bool -type family GHC.TypeNats.CmpNat (a :: GHC.Types.Nat) - (b :: GHC.Types.Nat) - :: Ordering -type family GHC.TypeNats.Div (a :: GHC.Types.Nat) - (b :: GHC.Types.Nat) - :: GHC.Types.Nat -class GHC.TypeNats.KnownNat (n :: GHC.Types.Nat) where +type (GHC.TypeNats.<=?) :: GHC.Types.Nat -> GHC.Types.Nat -> Bool +type family (GHC.TypeNats.<=?) a b +type GHC.TypeNats.CmpNat :: GHC.Types.Nat + -> GHC.Types.Nat -> Ordering +type family GHC.TypeNats.CmpNat a b +type GHC.TypeNats.Div :: GHC.Types.Nat + -> GHC.Types.Nat -> GHC.Types.Nat +type family GHC.TypeNats.Div a b +type GHC.TypeNats.KnownNat :: GHC.Types.Nat -> Constraint +class GHC.TypeNats.KnownNat n where GHC.TypeNats.natSing :: GHC.TypeNats.SNat n {-# MINIMAL natSing #-} -type family GHC.TypeNats.Log2 (a :: GHC.Types.Nat) :: GHC.Types.Nat -type family GHC.TypeNats.Mod (a :: GHC.Types.Nat) - (b :: GHC.Types.Nat) - :: GHC.Types.Nat +type GHC.TypeNats.Log2 :: GHC.Types.Nat -> GHC.Types.Nat +type family GHC.TypeNats.Log2 a +type GHC.TypeNats.Mod :: GHC.Types.Nat + -> GHC.Types.Nat -> GHC.Types.Nat +type family GHC.TypeNats.Mod a b +type GHC.Types.Nat :: * data GHC.Types.Nat +type GHC.TypeNats.SomeNat :: * data GHC.TypeNats.SomeNat = forall (n :: GHC.Types.Nat). GHC.TypeNats.KnownNat n => GHC.TypeNats.SomeNat (Data.Proxy.Proxy n) +type GHC.Types.Symbol :: * data GHC.Types.Symbol -type family (GHC.TypeNats.^) (a :: GHC.Types.Nat) - (b :: GHC.Types.Nat) - :: GHC.Types.Nat +type (GHC.TypeNats.^) :: GHC.Types.Nat + -> GHC.Types.Nat -> GHC.Types.Nat +type family (GHC.TypeNats.^) a b GHC.TypeNats.sameNat :: (GHC.TypeNats.KnownNat a, GHC.TypeNats.KnownNat b) => Data.Proxy.Proxy a diff --git a/testsuite/tests/ghci/scripts/T9881.stdout b/testsuite/tests/ghci/scripts/T9881.stdout index 68acea7c61..57bc6256d3 100644 --- a/testsuite/tests/ghci/scripts/T9881.stdout +++ b/testsuite/tests/ghci/scripts/T9881.stdout @@ -1,3 +1,4 @@ +type Data.ByteString.Lazy.ByteString :: * data Data.ByteString.Lazy.ByteString = Data.ByteString.Lazy.Internal.Empty | Data.ByteString.Lazy.Internal.Chunk {-# UNPACK #-}Data.ByteString.ByteString @@ -16,6 +17,7 @@ instance Show Data.ByteString.Lazy.ByteString instance Read Data.ByteString.Lazy.ByteString -- Defined in ‘Data.ByteString.Lazy.Internal’ +type Data.ByteString.ByteString :: * data Data.ByteString.ByteString = Data.ByteString.Internal.PS {-# UNPACK #-}(GHC.ForeignPtr.ForeignPtr GHC.Word.Word8) diff --git a/testsuite/tests/ghci/scripts/ghci008.stdout b/testsuite/tests/ghci/scripts/ghci008.stdout index abed6d21f3..3f62f3f7f2 100644 --- a/testsuite/tests/ghci/scripts/ghci008.stdout +++ b/testsuite/tests/ghci/scripts/ghci008.stdout @@ -1,19 +1,24 @@ +type Num :: * -> Constraint class Num a where (+) :: a -> a -> a ... -- Defined in ‘GHC.Num’ infixl 6 + +type Num :: * -> Constraint class Num a where (+) :: a -> a -> a ... -- Defined in ‘GHC.Num’ infixl 6 + +type Data.Complex.Complex :: * -> * data Data.Complex.Complex a = !a Data.Complex.:+ !a -- Defined in ‘Data.Complex’ infix 6 Data.Complex.:+ +type Data.Complex.Complex :: * -> * data Data.Complex.Complex a = !a Data.Complex.:+ !a -- Defined in ‘Data.Complex’ infix 6 Data.Complex.:+ +type RealFloat :: * -> Constraint class (RealFrac a, Floating a) => RealFloat a where floatRadix :: a -> Integer floatDigits :: a -> Int diff --git a/testsuite/tests/ghci/scripts/ghci011.stdout b/testsuite/tests/ghci/scripts/ghci011.stdout index 6dd5782d6c..35f4b9fda2 100644 --- a/testsuite/tests/ghci/scripts/ghci011.stdout +++ b/testsuite/tests/ghci/scripts/ghci011.stdout @@ -1,4 +1,6 @@ -data [] a = [] | a : [a] -- Defined in ‘GHC.Types’ +type [] :: * -> * +data [] a = [] | a : [a] + -- Defined in ‘GHC.Types’ instance Applicative [] -- Defined in ‘GHC.Base’ instance Eq a => Eq [a] -- Defined in ‘GHC.Classes’ instance Functor [] -- Defined in ‘GHC.Base’ @@ -11,7 +13,9 @@ instance MonadFail [] -- Defined in ‘Control.Monad.Fail’ instance Read a => Read [a] -- Defined in ‘GHC.Read’ instance Foldable [] -- Defined in ‘Data.Foldable’ instance Traversable [] -- Defined in ‘Data.Traversable’ -data () = () -- Defined in ‘GHC.Tuple’ +type () :: * +data () = () + -- Defined in ‘GHC.Tuple’ instance Eq () -- Defined in ‘GHC.Classes’ instance Monoid () -- Defined in ‘GHC.Base’ instance Ord () -- Defined in ‘GHC.Classes’ @@ -20,7 +24,9 @@ instance Enum () -- Defined in ‘GHC.Enum’ instance Show () -- Defined in ‘GHC.Show’ instance Read () -- Defined in ‘GHC.Read’ instance Bounded () -- Defined in ‘GHC.Enum’ -data (,) a b = (,) a b -- Defined in ‘GHC.Tuple’ +type (,) :: * -> * -> * +data (,) a b = (,) a b + -- Defined in ‘GHC.Tuple’ instance Monoid a => Applicative ((,) a) -- Defined in ‘GHC.Base’ instance (Eq a, Eq b) => Eq (a, b) -- Defined in ‘GHC.Classes’ instance Functor ((,) a) -- Defined in ‘GHC.Base’ diff --git a/testsuite/tests/ghci/scripts/ghci019.stdout b/testsuite/tests/ghci/scripts/ghci019.stdout index d03720d2b5..0a9fefb77b 100644 --- a/testsuite/tests/ghci/scripts/ghci019.stdout +++ b/testsuite/tests/ghci/scripts/ghci019.stdout @@ -1,2 +1,4 @@ -data Foo = Foo -- Defined at ghci019.hs:8:1 +type Foo :: * +data Foo = Foo + -- Defined at ghci019.hs:8:1 instance [safe] Prelude.Eq Foo -- Defined at ghci019.hs:9:10 diff --git a/testsuite/tests/ghci/scripts/ghci020.stdout b/testsuite/tests/ghci/scripts/ghci020.stdout index 4effb90a52..7a949cd465 100644 --- a/testsuite/tests/ghci/scripts/ghci020.stdout +++ b/testsuite/tests/ghci/scripts/ghci020.stdout @@ -1,4 +1,6 @@ -data (->) (a :: TYPE q) (b :: TYPE r) -- Defined in ‘GHC.Prim’ +type (->) :: * -> * -> * +data (->) a b + -- Defined in ‘GHC.Prim’ infixr -1 -> instance Applicative ((->) r) -- Defined in ‘GHC.Base’ instance Functor ((->) r) -- Defined in ‘GHC.Base’ diff --git a/testsuite/tests/ghci/scripts/ghci023.stdout b/testsuite/tests/ghci/scripts/ghci023.stdout index 9403102dd9..70c64c4293 100644 --- a/testsuite/tests/ghci/scripts/ghci023.stdout +++ b/testsuite/tests/ghci/scripts/ghci023.stdout @@ -12,6 +12,7 @@ Data.Maybe.listToMaybe :: [a] -> Maybe a Data.Maybe.mapMaybe :: (a -> Maybe b) -> [a] -> [b] maybe :: b -> (a -> b) -> Maybe a -> b Data.Maybe.maybeToList :: Maybe a -> [a] +type Maybe :: * -> * data Maybe a = Nothing | Just a -- via readFile (True,False) diff --git a/testsuite/tests/ghci/scripts/ghci025.stdout b/testsuite/tests/ghci/scripts/ghci025.stdout index 9c862d340c..3531825a97 100644 --- a/testsuite/tests/ghci/scripts/ghci025.stdout +++ b/testsuite/tests/ghci/scripts/ghci025.stdout @@ -2,8 +2,11 @@ :browse! *T -- defined locally T.length :: T.Integer +type N :: * -> Constraint class N a +type S :: * -> Constraint class S a +type C :: * -> * -> Constraint class C a b ... c1 :: (C a b, N b) => a -> b @@ -11,7 +14,8 @@ c2 :: (C a b, N b, S b) => a -> b c3 :: C a b => a -> b c4 :: C a b => a1 -> b -- imported via Control.Monad -class (GHC.Base.Alternative m, Monad m) => MonadPlus (m :: * -> *) +type MonadPlus :: (* -> *) -> Constraint +class (GHC.Base.Alternative m, Monad m) => MonadPlus m ... mplus :: MonadPlus m => m a -> m a -> m a mzero :: MonadPlus m => m a @@ -20,7 +24,8 @@ mzero :: MonadPlus m => m a (>>=) :: Monad m => m a -> (a -> m b) -> m b return :: Monad m => a -> m a -- imported via Control.Monad, Prelude, T -class GHC.Base.Applicative m => Monad (m :: * -> *) +type Monad :: (* -> *) -> Constraint +class GHC.Base.Applicative m => Monad m ... -- imported via Data.Maybe catMaybes :: [Maybe a] -> [a] @@ -34,23 +39,29 @@ maybe :: b -> (a -> b) -> Maybe a -> b maybeToList :: Maybe a -> [a] -- imported via Data.Maybe, Prelude Just :: a -> Maybe a +type Maybe :: * -> * data Maybe a = ... Nothing :: Maybe a -- imported via Prelude (+) :: GHC.Num.Num a => a -> a -> a (=<<) :: Monad m => (a -> m b) -> m a -> m b +type Eq :: * -> Constraint class Eq a ... -- imported via Prelude, T Prelude.length :: Data.Foldable.Foldable t => t a -> GHC.Types.Int -- imported via T +type T.Integer :: * data T.Integer = ... T.length :: Data.ByteString.Internal.ByteString -> GHC.Types.Int :browse! T -- defined locally T.length :: T.Integer +type N :: * -> Constraint class N a +type S :: * -> Constraint class S a +type C :: * -> * -> Constraint class C a b ... c1 :: (C a b, N b) => a -> b @@ -60,8 +71,11 @@ c4 :: C a b => a1 -> b :browse! T -- with -fprint-explicit-foralls -- defined locally T.length :: T.Integer +type N :: * -> Constraint class N a +type S :: * -> Constraint class S a +type C :: * -> * -> Constraint class C a b ... c1 :: forall a b. (C a b, N b) => a -> b diff --git a/testsuite/tests/ghci/scripts/ghci026.stdout b/testsuite/tests/ghci/scripts/ghci026.stdout index 24049ee655..d8e282a3b2 100644 --- a/testsuite/tests/ghci/scripts/ghci026.stdout +++ b/testsuite/tests/ghci/scripts/ghci026.stdout @@ -7,7 +7,9 @@ listToMaybe :: [a] -> Maybe a mapMaybe :: (a -> Maybe b) -> [a] -> [b] maybe :: b -> (a -> b) -> Maybe a -> b maybeToList :: Maybe a -> [a] +type Maybe :: * -> * data Maybe a = Nothing | Just a +type T :: * data T = A Int | B Float f :: Double -> Double g :: Double -> Double diff --git a/testsuite/tests/ghci/scripts/ghci027.stdout b/testsuite/tests/ghci/scripts/ghci027.stdout index bbe355c17a..e152e7419a 100644 --- a/testsuite/tests/ghci/scripts/ghci027.stdout +++ b/testsuite/tests/ghci/scripts/ghci027.stdout @@ -1,8 +1,10 @@ +type GHC.Base.MonadPlus :: (* -> *) -> Constraint class (GHC.Base.Alternative m, GHC.Base.Monad m) => - GHC.Base.MonadPlus (m :: * -> *) where + GHC.Base.MonadPlus m where ... mplus :: m a -> m a -> m a +type GHC.Base.MonadPlus :: (* -> *) -> Constraint class (GHC.Base.Alternative m, GHC.Base.Monad m) => - GHC.Base.MonadPlus (m :: * -> *) where + GHC.Base.MonadPlus m where ... Control.Monad.mplus :: m a -> m a -> m a diff --git a/testsuite/tests/ghci/scripts/ghci030.stdout b/testsuite/tests/ghci/scripts/ghci030.stdout index 49ce606456..1195afc37d 100644 --- a/testsuite/tests/ghci/scripts/ghci030.stdout +++ b/testsuite/tests/ghci/scripts/ghci030.stdout @@ -1,2 +1,6 @@ -data D = forall a. C (Int -> a) Char -- Defined at ghci030.hs:8:1 -data D = forall a. C (Int -> a) Char -- Defined at ghci030.hs:8:10 +type D :: * +data D = forall a. C (Int -> a) Char + -- Defined at ghci030.hs:8:1 +type D :: * +data D = forall a. C (Int -> a) Char + -- Defined at ghci030.hs:8:10 diff --git a/testsuite/tests/ghci/scripts/ghci031.stdout b/testsuite/tests/ghci/scripts/ghci031.stdout index 796433e1b7..6ed977034c 100644 --- a/testsuite/tests/ghci/scripts/ghci031.stdout +++ b/testsuite/tests/ghci/scripts/ghci031.stdout @@ -1,3 +1,4 @@ type role D nominal +type D :: * -> * data Eq a => D a = C a -- Defined at ghci031.hs:7:1 diff --git a/testsuite/tests/ghci/scripts/ghci033.stdout b/testsuite/tests/ghci/scripts/ghci033.stdout index e4bfebeb39..4deea62397 100644 --- a/testsuite/tests/ghci/scripts/ghci033.stdout +++ b/testsuite/tests/ghci/scripts/ghci033.stdout @@ -1,2 +1,3 @@ +type Foo :: * data Foo = Foo1 Int | Int `InfixCon` Bool -- Defined at ghci033.hs:4:1 diff --git a/testsuite/tests/ghci/scripts/ghci040.stdout b/testsuite/tests/ghci/scripts/ghci040.stdout index d9ebd9c59e..bfd78971a7 100644 --- a/testsuite/tests/ghci/scripts/ghci040.stdout +++ b/testsuite/tests/ghci/scripts/ghci040.stdout @@ -1 +1,3 @@ -data Ghci1.T = A | ... -- Defined at <interactive>:2:10 +type Ghci1.T :: * +data Ghci1.T = A | ... + -- Defined at <interactive>:2:10 diff --git a/testsuite/tests/ghci/scripts/ghci041.stdout b/testsuite/tests/ghci/scripts/ghci041.stdout index 14b8726c76..67a68f00be 100644 --- a/testsuite/tests/ghci/scripts/ghci041.stdout +++ b/testsuite/tests/ghci/scripts/ghci041.stdout @@ -1 +1,3 @@ -data R = A | ... -- Defined at <interactive>:3:10 +type R :: * +data R = A | ... + -- Defined at <interactive>:3:10 diff --git a/testsuite/tests/ghci/scripts/ghci042.stdout b/testsuite/tests/ghci/scripts/ghci042.stdout index 5cb84f632f..d68caeb6b4 100644 --- a/testsuite/tests/ghci/scripts/ghci042.stdout +++ b/testsuite/tests/ghci/scripts/ghci042.stdout @@ -1,6 +1,14 @@ -data T = A {...} -- Defined at <interactive>:2:10 -data T = A {a :: Int} -- Defined at <interactive>:2:13 +type T :: * +data T = A {...} + -- Defined at <interactive>:2:10 +type T :: * +data T = A {a :: Int} + -- Defined at <interactive>:2:13 a :: Integer -- Defined at <interactive>:5:5 3 -data R = B {a :: Int} -- Defined at <interactive>:8:13 -data T = A {Ghci1.a :: Int} -- Defined at <interactive>:2:1 +type R :: * +data R = B {a :: Int} + -- Defined at <interactive>:8:13 +type T :: * +data T = A {Ghci1.a :: Int} + -- Defined at <interactive>:2:1 diff --git a/testsuite/tests/ghci/scripts/ghci051.stdout b/testsuite/tests/ghci/scripts/ghci051.stdout index a3542869a5..9e77b017ba 100644 --- a/testsuite/tests/ghci/scripts/ghci051.stdout +++ b/testsuite/tests/ghci/scripts/ghci051.stdout @@ -1,9 +1,21 @@ -data T = C | D -- Defined at <interactive>:8:1 -type T' = Ghci1.T -- Defined at <interactive>:3:1 -data Ghci1.T = A | ... -- Defined at <interactive>:2:10 -data Ghci4.T = B | ... -- Defined at <interactive>:5:12 -data T = C | ... -- Defined at <interactive>:8:14 -data T = ... | D -- Defined at <interactive>:8:18 +type T :: * +data T = C | D + -- Defined at <interactive>:8:1 +type T' :: * +type T' = Ghci1.T + -- Defined at <interactive>:3:1 +type Ghci1.T :: * +data Ghci1.T = A | ... + -- Defined at <interactive>:2:10 +type Ghci4.T :: * +data Ghci4.T = B | ... + -- Defined at <interactive>:5:12 +type T :: * +data T = C | ... + -- Defined at <interactive>:8:14 +type T :: * +data T = ... | D + -- Defined at <interactive>:8:18 b :: T' -- Defined at <interactive>:4:5 c :: Ghci4.T -- Defined at <interactive>:7:5 d :: T -- Defined at <interactive>:9:5 diff --git a/testsuite/tests/ghci/scripts/ghci059.stdout b/testsuite/tests/ghci/scripts/ghci059.stdout index 2fc93e6de5..e5cdb3d313 100644 --- a/testsuite/tests/ghci/scripts/ghci059.stdout +++ b/testsuite/tests/ghci/scripts/ghci059.stdout @@ -5,6 +5,7 @@ Please see section `The Coercible constraint` of the user's guide for details. -} type role Coercible representational representational -class Coercible a b => Coercible (a :: k) (b :: k) +type Coercible :: forall k. k -> k -> Constraint +class Coercible a b => Coercible a b -- Defined in ‘GHC.Types’ coerce :: Coercible a b => a -> b -- Defined in ‘GHC.Prim’ diff --git a/testsuite/tests/ghci/should_run/T10145.stdout b/testsuite/tests/ghci/should_run/T10145.stdout index 4effb90a52..7a949cd465 100644 --- a/testsuite/tests/ghci/should_run/T10145.stdout +++ b/testsuite/tests/ghci/should_run/T10145.stdout @@ -1,4 +1,6 @@ -data (->) (a :: TYPE q) (b :: TYPE r) -- Defined in ‘GHC.Prim’ +type (->) :: * -> * -> * +data (->) a b + -- Defined in ‘GHC.Prim’ infixr -1 -> instance Applicative ((->) r) -- Defined in ‘GHC.Base’ instance Functor ((->) r) -- Defined in ‘GHC.Base’ diff --git a/testsuite/tests/ghci/should_run/T11825.stdout b/testsuite/tests/ghci/should_run/T11825.stdout index 9ab7b1be0c..6ff7d89cfb 100644 --- a/testsuite/tests/ghci/should_run/T11825.stdout +++ b/testsuite/tests/ghci/should_run/T11825.stdout @@ -1,3 +1,4 @@ +type X :: ★ → ★ → Constraint class X a b | a → b where to ∷ a → b {-# MINIMAL to #-} diff --git a/testsuite/tests/ghci/should_run/T12525.stdout b/testsuite/tests/ghci/should_run/T12525.stdout index 652a5cdd03..a00ffea4e3 100644 --- a/testsuite/tests/ghci/should_run/T12525.stdout +++ b/testsuite/tests/ghci/should_run/T12525.stdout @@ -1,3 +1,4 @@ x :: () = () y :: () = () +type Foo :: * -> Constraint class Foo a diff --git a/testsuite/tests/ghci/should_run/T9914.stdout b/testsuite/tests/ghci/should_run/T9914.stdout index d9407d3877..5187084e71 100644 --- a/testsuite/tests/ghci/should_run/T9914.stdout +++ b/testsuite/tests/ghci/should_run/T9914.stdout @@ -1,5 +1,9 @@ 1 2 2 -data T1 = MkT1 -- Defined at <interactive>:6:1 -data T2 = MkT2 -- Defined at <interactive>:8:2 +type T1 :: * +data T1 = MkT1 + -- Defined at <interactive>:6:1 +type T2 :: * +data T2 = MkT2 + -- Defined at <interactive>:8:2 diff --git a/testsuite/tests/indexed-types/should_fail/ClosedFam3.stderr b/testsuite/tests/indexed-types/should_fail/ClosedFam3.stderr index 28e71792ca..f0a5614560 100644 --- a/testsuite/tests/indexed-types/should_fail/ClosedFam3.stderr +++ b/testsuite/tests/indexed-types/should_fail/ClosedFam3.stderr @@ -2,30 +2,33 @@ 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 :: * - where - Foo Int = Bool - Foo Double = Char - Boot file: type family Foo a :: * - where Foo Int = Bool + Main module: type Foo :: * -> * + type family Foo a where + Foo Int = Bool + Foo Double = Char + Boot file: type Foo :: * -> * + type family Foo a where + Foo Int = Bool 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 :: * - where - Bar Int = Bool - Bar Double = Double - Boot file: type family Bar a :: * - where - Bar Int = Bool - Bar Double = Char + Main module: type Bar :: * -> * + type family Bar a where + Bar Int = Bool + Bar Double = Double + Boot file: type Bar :: * -> * + type family Bar a where + Bar Int = Bool + Bar Double = Char 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 :: * - where Baz Int = Bool - Boot file: type family Baz (a :: k) :: * - where Baz Int = Bool + Main module: type Baz :: * -> * + type family Baz a where + Baz Int = Bool + Boot file: type Baz :: forall k. k -> * + type family Baz a where + Baz Int = Bool The types have different kinds diff --git a/testsuite/tests/indexed-types/should_fail/T9167.stderr b/testsuite/tests/indexed-types/should_fail/T9167.stderr index 1bd21aed5e..2c296793dc 100644 --- a/testsuite/tests/indexed-types/should_fail/T9167.stderr +++ b/testsuite/tests/indexed-types/should_fail/T9167.stderr @@ -1,5 +1,5 @@ -T9167.hs:5:1: - The associated type ‘F’ - mentions none of the type or kind variables of the class ‘C a’ - In the class declaration for ‘C’ +T9167.hs:5:1: error: + • The associated type ‘F b’ + mentions none of the type or kind variables of the class ‘C a’ + • In the class declaration for ‘C’ diff --git a/testsuite/tests/overloadedrecflds/ghci/duplicaterecfldsghci01.stdout b/testsuite/tests/overloadedrecflds/ghci/duplicaterecfldsghci01.stdout index cfed45f6f1..ff758c18bb 100644 --- a/testsuite/tests/overloadedrecflds/ghci/duplicaterecfldsghci01.stdout +++ b/testsuite/tests/overloadedrecflds/ghci/duplicaterecfldsghci01.stdout @@ -1,6 +1,9 @@ True -data S = MkS {Ghci1.foo :: Int} -- Defined at <interactive>:3:16 +type S :: * +data S = MkS {Ghci1.foo :: Int} + -- Defined at <interactive>:3:16 +type T :: * -> * data T a = MkT {Ghci2.foo :: Bool, ...} -- Defined at <interactive>:4:18 diff --git a/testsuite/tests/parser/should_compile/DumpRenamedAst.stderr b/testsuite/tests/parser/should_compile/DumpRenamedAst.stderr index 49ec1d111a..53d4f37acf 100644 --- a/testsuite/tests/parser/should_compile/DumpRenamedAst.stderr +++ b/testsuite/tests/parser/should_compile/DumpRenamedAst.stderr @@ -110,6 +110,7 @@ ({ <no location info> } []))))] [] + [] []) ,(TyClGroup (NoExtField) @@ -229,6 +230,7 @@ {Name: DumpRenamedAst.Peano}))))) (Nothing))))] [] + [] []) ,(TyClGroup (NoExtField) @@ -273,6 +275,7 @@ {Name: GHC.Types.Type}))))))))) (Nothing))))] [] + [] [({ DumpRenamedAst.hs:(18,1)-(19,45) } (DataFamInstD (NoExtField) @@ -502,6 +505,7 @@ ({ <no location info> } []))))] [] + [] []) ,(TyClGroup (NoExtField) @@ -624,6 +628,7 @@ {Name: GHC.Types.Type}))))) (Nothing))))] [] + [] [])] [] [] diff --git a/testsuite/tests/parser/should_compile/T14189.stderr b/testsuite/tests/parser/should_compile/T14189.stderr index 9e6b981bb8..29518e5118 100644 --- a/testsuite/tests/parser/should_compile/T14189.stderr +++ b/testsuite/tests/parser/should_compile/T14189.stderr @@ -91,6 +91,7 @@ ({ <no location info> } []))))] [] + [] [])] [] [] diff --git a/testsuite/tests/polykinds/CuskFam.hs b/testsuite/tests/polykinds/CuskFam.hs new file mode 100644 index 0000000000..c339dbcac0 --- /dev/null +++ b/testsuite/tests/polykinds/CuskFam.hs @@ -0,0 +1,16 @@ +{-# LANGUAGE TypeFamilies, PolyKinds, DataKinds #-} +-- {-# LANGUAGE CUSKs #-} -- enabled by default + +module CuskFam where + +type family F a -- non-injective + +type family X :: F a + -- Used to fail with: + -- + -- • Couldn't match expected kind ‘F a1’ with actual kind ‘F a’ + -- NB: ‘F’ is a non-injective type family + -- The type variable ‘a1’ is ambiguous + -- • In the type family declaration for ‘X’ + -- + -- See Note [Unifying implicit CUSK variables] in TcHsType diff --git a/testsuite/tests/polykinds/all.T b/testsuite/tests/polykinds/all.T index 6345b228e4..74ab266308 100644 --- a/testsuite/tests/polykinds/all.T +++ b/testsuite/tests/polykinds/all.T @@ -214,3 +214,4 @@ test('T16221a', normal, compile_fail, ['']) test('T16342', normal, compile, ['']) test('T16263', normal, compile_fail, ['']) test('T16902', normal, compile_fail, ['']) +test('CuskFam', normal, compile, ['']) diff --git a/testsuite/tests/rename/should_fail/rnfail055.stderr b/testsuite/tests/rename/should_fail/rnfail055.stderr index b9ba174519..ef4b09fd3a 100644 --- a/testsuite/tests/rename/should_fail/rnfail055.stderr +++ b/testsuite/tests/rename/should_fail/rnfail055.stderr @@ -15,31 +15,39 @@ RnFail055.hs-boot:4:1: error: RnFail055.hs-boot:6:1: error: Type constructor ‘S1’ has conflicting definitions in the module and its hs-boot file - Main module: type S1 a b = (a, b) - Boot file: type S1 a b c = (a, b) + Main module: type S1 :: * -> * -> * + type S1 a b = (a, b) + Boot file: type S1 :: * -> * -> * -> * + type S1 a b c = (a, b) The types have different kinds RnFail055.hs-boot:8:1: error: Type constructor ‘S2’ has conflicting definitions in the module and its hs-boot file - Main module: type S2 a b = forall a1. (a1, b) - Boot file: type S2 a b = forall b1. (a, b1) + Main module: type S2 :: * -> * -> * + type S2 a b = forall a1. (a1, b) + Boot file: type S2 :: * -> * -> * + type S2 a b = forall b1. (a, b1) The roles do not match. Roles on abstract types default to ‘representational’ in boot files. RnFail055.hs-boot:12:1: error: Type constructor ‘T1’ has conflicting definitions in the module and its hs-boot file - Main module: data T1 a b = T1 [b] [a] - Boot file: data T1 a b = T1 [a] [b] + Main module: type T1 :: * -> * -> * + data T1 a b = T1 [b] [a] + Boot file: type T1 :: * -> * -> * + data T1 a b = T1 [a] [b] The constructors do not match: The types for ‘T1’ differ RnFail055.hs-boot:14:1: error: Type constructor ‘T2’ has conflicting definitions in the module and its hs-boot file Main module: type role T2 representational nominal + type T2 :: * -> * -> * data Eq b => T2 a b = T2 a Boot file: type role T2 nominal phantom + type T2 :: * -> * -> * data Eq a => T2 a b = T2 a The roles do not match. Roles on abstract types default to ‘representational’ in boot files. @@ -54,16 +62,20 @@ RnFail055.hs-boot:17:12: error: RnFail055.hs-boot:21:1: error: Type constructor ‘T5’ has conflicting definitions in the module and its hs-boot file - Main module: data T5 a = T5 {field5 :: a} - Boot file: data T5 a = T5 a + Main module: type T5 :: * -> * + data T5 a = T5 {field5 :: a} + Boot file: type T5 :: * -> * + data T5 a = T5 a The constructors do not match: The record label lists for ‘T5’ differ RnFail055.hs-boot:23:1: error: Type constructor ‘T6’ has conflicting definitions in the module and its hs-boot file - Main module: data T6 = T6 Int - Boot file: data T6 = T6 !Int + Main module: type T6 :: * + data T6 = T6 Int + Boot file: type T6 :: * + data T6 = T6 !Int The constructors do not match: The strictness annotations for ‘T6’ differ @@ -71,8 +83,10 @@ RnFail055.hs-boot:25:1: error: Type constructor ‘T7’ has conflicting definitions in the module and its hs-boot file Main module: type role T7 phantom + type T7 :: * -> * data T7 a = forall a1. T7 a1 - Boot file: data T7 a = forall b. T7 a + Boot file: type T7 :: * -> * + data T7 a = forall b. T7 a The roles do not match. Roles on abstract types default to ‘representational’ in boot files. The constructors do not match: The types for ‘T7’ differ @@ -83,11 +97,13 @@ RnFail055.hs-boot:27:22: error: RnFail055.hs-boot:28:1: error: Class ‘C2’ has conflicting definitions in the module and its hs-boot file - Main module: class C2 a b where + Main module: type C2 :: * -> * -> Constraint + class C2 a b where m2 :: a -> b m2' :: a -> b {-# MINIMAL m2, m2' #-} - Boot file: class C2 a b where + Boot file: type C2 :: * -> * -> Constraint + class C2 a b where m2 :: a -> b {-# MINIMAL m2 #-} The methods do not match: There are different numbers of methods @@ -96,6 +112,8 @@ RnFail055.hs-boot:28:1: error: RnFail055.hs-boot:29:1: error: Class ‘C3’ has conflicting definitions in the module and its hs-boot file - Main module: class (Eq a, Ord a) => C3 a - Boot file: class (Ord a, Eq a) => C3 a + Main module: type C3 :: * -> Constraint + class (Eq a, Ord a) => C3 a + Boot file: type C3 :: * -> Constraint + class (Ord a, Eq a) => C3 a The class constraints do not match diff --git a/testsuite/tests/roles/should_fail/Roles12.stderr b/testsuite/tests/roles/should_fail/Roles12.stderr index d1872f3350..ec3bff4182 100644 --- a/testsuite/tests/roles/should_fail/Roles12.stderr +++ b/testsuite/tests/roles/should_fail/Roles12.stderr @@ -3,7 +3,9 @@ Roles12.hs:5:1: error: Type constructor ‘T’ has conflicting definitions in the module and its hs-boot file Main module: type role T phantom + type T :: * -> * + data T a + Boot file: type T :: * -> * data T a - Boot file: data T a The roles do not match. Roles on abstract types default to ‘representational’ in boot files. diff --git a/testsuite/tests/roles/should_fail/T9204.stderr b/testsuite/tests/roles/should_fail/T9204.stderr index 998f17c284..0e8cbf4524 100644 --- a/testsuite/tests/roles/should_fail/T9204.stderr +++ b/testsuite/tests/roles/should_fail/T9204.stderr @@ -3,7 +3,9 @@ T9204.hs:6:1: error: Type constructor ‘D’ has conflicting definitions in the module and its hs-boot file Main module: type role D phantom + type D :: * -> * + data D a + Boot file: type D :: * -> * data D a - Boot file: data D a The roles do not match. Roles on abstract types default to ‘representational’ in boot files. diff --git a/testsuite/tests/saks/should_compile/T16721.script b/testsuite/tests/saks/should_compile/T16721.script new file mode 100644 index 0000000000..1e747be98e --- /dev/null +++ b/testsuite/tests/saks/should_compile/T16721.script @@ -0,0 +1,4 @@ +:set -XStandaloneKindSignatures -XNoStarIsType +import Data.Kind (Type) +type T :: (Type -> Type) -> Type; data T a +:info T diff --git a/testsuite/tests/saks/should_compile/T16721.stdout b/testsuite/tests/saks/should_compile/T16721.stdout new file mode 100644 index 0000000000..8dce9caa1a --- /dev/null +++ b/testsuite/tests/saks/should_compile/T16721.stdout @@ -0,0 +1,4 @@ +type role T phantom +type T :: (Type -> Type) -> Type +data T a + -- Defined at <interactive>:3:35 diff --git a/testsuite/tests/saks/should_compile/T16723.hs b/testsuite/tests/saks/should_compile/T16723.hs new file mode 100644 index 0000000000..2ba216a93d --- /dev/null +++ b/testsuite/tests/saks/should_compile/T16723.hs @@ -0,0 +1,10 @@ +{-# LANGUAGE StandaloneKindSignatures #-} +{-# LANGUAGE PolyKinds #-} +{-# LANGUAGE ScopedTypeVariables #-} + +module T16723 where + +import Data.Kind + +type D :: forall a. Type +data D diff --git a/testsuite/tests/saks/should_compile/T16724.hs b/testsuite/tests/saks/should_compile/T16724.hs new file mode 100644 index 0000000000..3ab5d0761a --- /dev/null +++ b/testsuite/tests/saks/should_compile/T16724.hs @@ -0,0 +1,15 @@ +{-# LANGUAGE StandaloneKindSignatures #-} +{-# LANGUAGE PolyKinds #-} +{-# LANGUAGE ScopedTypeVariables #-} +{-# LANGUAGE TypeFamilies #-} + +module T16724 where + +import Data.Kind + +type T1 :: forall k (a :: k). Type +type family T1 + +-- type T2 :: forall {k} (a :: k). Type +type T2 :: forall a. Type +type family T2 diff --git a/testsuite/tests/saks/should_compile/T16724.script b/testsuite/tests/saks/should_compile/T16724.script new file mode 100644 index 0000000000..f5681b86ca --- /dev/null +++ b/testsuite/tests/saks/should_compile/T16724.script @@ -0,0 +1,5 @@ +:set -fprint-explicit-kinds -fprint-explicit-foralls -XNoStarIsType +:load T16724.hs +:info T1 +:info T2 + -- must have the same arity! diff --git a/testsuite/tests/saks/should_compile/T16724.stdout b/testsuite/tests/saks/should_compile/T16724.stdout new file mode 100644 index 0000000000..099371c58d --- /dev/null +++ b/testsuite/tests/saks/should_compile/T16724.stdout @@ -0,0 +1,6 @@ +type T1 :: forall k (a :: k). Type +type family T1 @k @a + -- Defined at T16724.hs:11:1 +type T2 :: forall {k} (a :: k). Type +type family T2 @{k} @a + -- Defined at T16724.hs:15:1 diff --git a/testsuite/tests/saks/should_compile/T16726.hs b/testsuite/tests/saks/should_compile/T16726.hs new file mode 100644 index 0000000000..e1a748d0a0 --- /dev/null +++ b/testsuite/tests/saks/should_compile/T16726.hs @@ -0,0 +1,17 @@ +{-# LANGUAGE StandaloneKindSignatures #-} +{-# LANGUAGE PolyKinds #-} +{-# LANGUAGE ScopedTypeVariables #-} +{-# LANGUAGE TypeFamilies #-} + +module T16726 where + +import Data.Kind + +type D :: forall k. k -> Type +data D :: forall j. j -> Type + +type DF :: forall k. k -> Type +data family DF :: forall j. j -> Type + +type T :: forall k. k -> Type +type family T :: forall j. j -> Type diff --git a/testsuite/tests/saks/should_compile/T16731.hs b/testsuite/tests/saks/should_compile/T16731.hs new file mode 100644 index 0000000000..c2051f678d --- /dev/null +++ b/testsuite/tests/saks/should_compile/T16731.hs @@ -0,0 +1,14 @@ +{-# LANGUAGE StandaloneKindSignatures #-} +{-# LANGUAGE DeriveAnyClass #-} +{-# LANGUAGE MultiParamTypeClasses #-} +{-# LANGUAGE PolyKinds #-} +{-# LANGUAGE ScopedTypeVariables #-} + +module T16731 where + +import Data.Kind + +class C (a :: Type) (b :: Type) + +type T :: forall a. a -> Type +data T (x :: z) deriving (C z) diff --git a/testsuite/tests/saks/should_compile/T16756a.hs b/testsuite/tests/saks/should_compile/T16756a.hs new file mode 100644 index 0000000000..f85c2ecbc9 --- /dev/null +++ b/testsuite/tests/saks/should_compile/T16756a.hs @@ -0,0 +1,12 @@ +{-# LANGUAGE StandaloneKindSignatures #-} +{-# LANGUAGE TypeFamilies #-} + +module T16756a where + +import Data.Kind (Type) + +type T :: Type -> Type +data family T + -- We do /not/ need to write: + -- data family T a + -- See https://gitlab.haskell.org/ghc/ghc/issues/16756#note_203567 diff --git a/testsuite/tests/saks/should_compile/T16758.hs b/testsuite/tests/saks/should_compile/T16758.hs new file mode 100644 index 0000000000..2798156f3c --- /dev/null +++ b/testsuite/tests/saks/should_compile/T16758.hs @@ -0,0 +1,14 @@ +{-# LANGUAGE StandaloneKindSignatures #-} +{-# LANGUAGE ConstrainedClassMethods #-} +{-# LANGUAGE DataKinds #-} +{-# LANGUAGE GADTs #-} +{-# LANGUAGE PolyKinds #-} +{-# LANGUAGE ExplicitForAll #-} + +module T16758 where + +import Data.Kind + +type C :: forall (a :: Type) -> a ~ Int => Constraint +class C a where + f :: C a => a -> Int diff --git a/testsuite/tests/saks/should_compile/T17164.hs b/testsuite/tests/saks/should_compile/T17164.hs new file mode 100644 index 0000000000..0f9d9e440f --- /dev/null +++ b/testsuite/tests/saks/should_compile/T17164.hs @@ -0,0 +1,14 @@ +{-# LANGUAGE StandaloneKindSignatures #-} +{-# LANGUAGE PolyKinds #-} +{-# LANGUAGE ScopedTypeVariables #-} +{-# LANGUAGE TemplateHaskell #-} +{-# LANGUAGE TypeFamilies #-} +{-# OPTIONS_GHC -ddump-splices #-} + +module T17164 where + +import Data.Kind + +$([d| type T :: forall k -> k -> Type + type family T :: forall k -> k -> Type + |]) diff --git a/testsuite/tests/saks/should_compile/T17164.stderr b/testsuite/tests/saks/should_compile/T17164.stderr new file mode 100644 index 0000000000..5b1fdbf0fc --- /dev/null +++ b/testsuite/tests/saks/should_compile/T17164.stderr @@ -0,0 +1,7 @@ +T17164.hs:(12,3)-(14,6): Splicing declarations + [d| type T :: forall k -> k -> Type + + type family T :: forall k -> k -> Type |] + ======> + type T :: forall k -> k -> Type + type family T :: forall k -> k -> Type diff --git a/testsuite/tests/saks/should_compile/all.T b/testsuite/tests/saks/should_compile/all.T new file mode 100644 index 0000000000..73f608c6dd --- /dev/null +++ b/testsuite/tests/saks/should_compile/all.T @@ -0,0 +1,49 @@ +setTestOpts(normalise_version('base','ghc-prim')) + +test('saks001', normal, compile, ['']) +test('saks002', normal, compile, ['']) +test('saks003', normal, compile, ['']) +test('saks004', normal, compile, ['']) +test('saks005', normal, compile, ['']) +test('saks006', normal, compile, ['']) +test('saks007', normal, compile, ['']) +test('saks008', normal, compile, ['']) +test('saks009', normal, compile, ['']) +test('saks010', normal, compile, ['']) +test('saks014', normal, compile, ['']) +test('saks015', normal, compile, ['']) +test('saks016', normal, compile, ['']) +test('saks017', normal, compile, ['']) +test('saks018', normal, compile, ['']) +test('saks019', normal, compile, ['']) +test('saks020', normal, compile, ['']) +test('saks021', normal, compile, ['']) +test('saks023', normal, ghci_script, ['saks023.script']) +test('saks024', normal, compile, ['']) +test('saks025', extra_files(['saks025.hs']), ghci_script, ['saks025.script']) +test('saks026', normal, compile, ['']) +test('saks029', normal, compile, ['']) +test('saks030', normal, compile, ['']) +test('saks031', normal, compile, ['']) +test('saks032', normal, compile, ['']) +test('saks033', normal, compile, ['']) +test('saks034', extra_files(['saks034.hs']), ghci_script, ['saks034.script']) +test('saks035', extra_files(['saks035.hs']), ghci_script, ['saks035.script']) +test('saks036', normal, compile, ['']) +test('T16723', normal, compile, ['']) +test('T16724', extra_files(['T16724.hs']), ghci_script, ['T16724.script']) +test('T16726', normal, compile, ['']) +test('T16731', normal, compile, ['']) +test('T16758', expect_broken(16758), compile, ['']) +test('T16721', normal, ghci_script, ['T16721.script']) +test('T16756a', normal, compile, ['']) + +# We omit 'profasm' because it fails with: +# Cannot load -prof objects when GHC is built with -dynamic +# To fix this, either: +# (1) Use -fexternal-interpreter, or +# (2) Build the program twice: once with -dynamic, and then +# with -prof using -osuf to set a different object file suffix. +test('saks027', omit_ways(['profasm']), compile, ['-v0 -ddump-splices -dsuppress-uniques']) +test('saks028', omit_ways(['profasm']), compile, ['']) +test('T17164', omit_ways(['profasm']), compile, ['-v0 -ddump-splices -dsuppress-uniques']) diff --git a/testsuite/tests/saks/should_compile/saks001.hs b/testsuite/tests/saks/should_compile/saks001.hs new file mode 100644 index 0000000000..425a992adb --- /dev/null +++ b/testsuite/tests/saks/should_compile/saks001.hs @@ -0,0 +1,8 @@ +{-# LANGUAGE StandaloneKindSignatures #-} + +module SAKS_001 where + +import Data.Kind (Type) + +type MonoTagged :: Type -> Type -> Type +data MonoTagged t x = MonoTagged x diff --git a/testsuite/tests/saks/should_compile/saks002.hs b/testsuite/tests/saks/should_compile/saks002.hs new file mode 100644 index 0000000000..3dcf49deda --- /dev/null +++ b/testsuite/tests/saks/should_compile/saks002.hs @@ -0,0 +1,8 @@ +{-# LANGUAGE StandaloneKindSignatures #-} +{-# LANGUAGE TypeFamilies, PolyKinds, ExplicitForAll #-} + +module SAKS_002 where + +type Id :: forall k. k -> k +type family Id x where + Id x = x diff --git a/testsuite/tests/saks/should_compile/saks003.hs b/testsuite/tests/saks/should_compile/saks003.hs new file mode 100644 index 0000000000..778862c918 --- /dev/null +++ b/testsuite/tests/saks/should_compile/saks003.hs @@ -0,0 +1,8 @@ +{-# LANGUAGE StandaloneKindSignatures #-} +{-# LANGUAGE TypeFamilyDependencies, PolyKinds, ExplicitForAll #-} + +module SAKS_003 where + +type InjectiveId :: forall k. k -> k +type family InjectiveId x = r | r -> x where + InjectiveId x = x diff --git a/testsuite/tests/saks/should_compile/saks004.hs b/testsuite/tests/saks/should_compile/saks004.hs new file mode 100644 index 0000000000..1a4cdbafd3 --- /dev/null +++ b/testsuite/tests/saks/should_compile/saks004.hs @@ -0,0 +1,10 @@ +{-# LANGUAGE StandaloneKindSignatures #-} +{-# LANGUAGE MultiParamTypeClasses, PolyKinds, ConstraintKinds #-} + +module SAKS_004 where + +import Data.Kind (Type, Constraint) + +type C :: (k -> Type) -> k -> Constraint +class C a b where + f :: a b diff --git a/testsuite/tests/saks/should_compile/saks005.hs b/testsuite/tests/saks/should_compile/saks005.hs new file mode 100644 index 0000000000..ed85eca41d --- /dev/null +++ b/testsuite/tests/saks/should_compile/saks005.hs @@ -0,0 +1,12 @@ +{-# LANGUAGE StandaloneKindSignatures #-} +{-# LANGUAGE GADTs, PolyKinds, ExplicitForAll #-} + +module SAKS_005 where + +import Data.Kind (Type, Constraint) + +type TypeRep :: forall k. k -> Type +data TypeRep a where + TyInt :: TypeRep Int + TyMaybe :: TypeRep Maybe + TyApp :: TypeRep a -> TypeRep b -> TypeRep (a b) diff --git a/testsuite/tests/saks/should_compile/saks006.hs b/testsuite/tests/saks/should_compile/saks006.hs new file mode 100644 index 0000000000..99e6b3aa5c --- /dev/null +++ b/testsuite/tests/saks/should_compile/saks006.hs @@ -0,0 +1,22 @@ +{-# LANGUAGE StandaloneKindSignatures #-} +{-# LANGUAGE MultiParamTypeClasses, FlexibleContexts #-} +{-# LANGUAGE TypeFamilies, PolyKinds, ConstraintKinds #-} + +module SAKS_006 where + +import Data.Kind (Type, Constraint) + +type C :: (k -> Type) -> k -> Constraint +type T :: k -> Type + +class C a b +data T a + +-- type D :: j -> Constraint -- #16571 +type D :: Type -> Constraint +type D = C T + +-- type DF :: j -> Constraint -- #16571 +type DF :: Type -> Constraint +type family DF where + DF = C T diff --git a/testsuite/tests/saks/should_compile/saks007.hs b/testsuite/tests/saks/should_compile/saks007.hs new file mode 100644 index 0000000000..7f6869576b --- /dev/null +++ b/testsuite/tests/saks/should_compile/saks007.hs @@ -0,0 +1,15 @@ +{-# LANGUAGE StandaloneKindSignatures #-} +{-# LANGUAGE TypeFamilies, GADTs, PolyKinds, DataKinds, ExplicitForAll #-} + +-- See also: saks007_fail.hs +module SAKS_007 where + +import Data.Kind (Type, Constraint) + +type family F a where { F Type = True; F _ = False } +type family G a where { G Type = False; G _ = True } + +type X :: forall k1 k2. (F k1 ~ G k2) => k1 -> k2 -> Type +data X a b where + MkX :: X Integer Maybe -- OK: F Type ~ G (Type -> Type) + -- True ~ True diff --git a/testsuite/tests/saks/should_compile/saks008.hs b/testsuite/tests/saks/should_compile/saks008.hs new file mode 100644 index 0000000000..ce7a8646d0 --- /dev/null +++ b/testsuite/tests/saks/should_compile/saks008.hs @@ -0,0 +1,12 @@ +{-# LANGUAGE StandaloneKindSignatures #-} +{-# LANGUAGE PolyKinds, DataKinds #-} + +module SAKS_008 where + +import Data.Proxy (Proxy) +import Data.Kind (Type) + +-- Test inferred type variables. +-- T :: forall {k} (a :: k). Proxy a -> Type +type T :: Proxy a -> Type +data T x = MkT diff --git a/testsuite/tests/saks/should_compile/saks009.hs b/testsuite/tests/saks/should_compile/saks009.hs new file mode 100644 index 0000000000..f2cccdddfd --- /dev/null +++ b/testsuite/tests/saks/should_compile/saks009.hs @@ -0,0 +1,9 @@ +{-# LANGUAGE StandaloneKindSignatures #-} +{-# LANGUAGE ExplicitForAll, PolyKinds #-} + +module SAKS_009 where + +import Data.Kind (Type) + +type Q :: forall k -> k -> Type +data Q j (a :: j) diff --git a/testsuite/tests/saks/should_compile/saks010.hs b/testsuite/tests/saks/should_compile/saks010.hs new file mode 100644 index 0000000000..20dd2413b0 --- /dev/null +++ b/testsuite/tests/saks/should_compile/saks010.hs @@ -0,0 +1,9 @@ +{-# LANGUAGE StandaloneKindSignatures #-} +{-# LANGUAGE RankNTypes, PolyKinds, DataKinds #-} + +module SAKS_010 where + +import Data.Kind (Type) + +type W :: forall (a :: forall k. k -> Type) -> a Int -> a Maybe -> Type +data W x (y :: x Int) (z :: x Maybe) diff --git a/testsuite/tests/saks/should_compile/saks014.hs b/testsuite/tests/saks/should_compile/saks014.hs new file mode 100644 index 0000000000..6e0f4a56f6 --- /dev/null +++ b/testsuite/tests/saks/should_compile/saks014.hs @@ -0,0 +1,9 @@ +{-# LANGUAGE StandaloneKindSignatures #-} +{-# LANGUAGE PolyKinds #-} + +module SAKS_014 where + +import Data.Kind (Type) + +type T :: (k -> Type) -> (k -> Type) +data T m a = MkT (m a) (T Maybe (m a)) diff --git a/testsuite/tests/saks/should_compile/saks015.hs b/testsuite/tests/saks/should_compile/saks015.hs new file mode 100644 index 0000000000..a8cf7204f1 --- /dev/null +++ b/testsuite/tests/saks/should_compile/saks015.hs @@ -0,0 +1,9 @@ +{-# LANGUAGE StandaloneKindSignatures #-} +{-# LANGUAGE PolyKinds, ExplicitForAll #-} + +module SAKS_015 where + +import Data.Kind (Type) + +type T :: forall k -> k -> Type +data T (k :: Type) (a :: k) diff --git a/testsuite/tests/saks/should_compile/saks016.hs b/testsuite/tests/saks/should_compile/saks016.hs new file mode 100644 index 0000000000..dca8ce7700 --- /dev/null +++ b/testsuite/tests/saks/should_compile/saks016.hs @@ -0,0 +1,9 @@ +{-# LANGUAGE StandaloneKindSignatures #-} +{-# LANGUAGE PolyKinds, RankNTypes #-} + +module SAKS_016 where + +import Data.Kind (Type) + +type T :: forall k. k -> forall j. j -> Type +data T (x :: hk) (y :: hj) diff --git a/testsuite/tests/saks/should_compile/saks017.hs b/testsuite/tests/saks/should_compile/saks017.hs new file mode 100644 index 0000000000..3b69b27d7f --- /dev/null +++ b/testsuite/tests/saks/should_compile/saks017.hs @@ -0,0 +1,16 @@ +{-# LANGUAGE StandaloneKindSignatures #-} +{-# LANGUAGE TypeFamilies, DataKinds, PolyKinds, ExplicitForAll #-} + +module SAKS_017 where + +import Data.Kind (Type) + +type family F a where + F Bool = Type + F (f a) = F a + +type family G a where + G Int = Type + +data family T :: F (Maybe Bool) -> t +data instance T (a :: G Int) = MkT a diff --git a/testsuite/tests/saks/should_compile/saks018.hs b/testsuite/tests/saks/should_compile/saks018.hs new file mode 100644 index 0000000000..a24a19e117 --- /dev/null +++ b/testsuite/tests/saks/should_compile/saks018.hs @@ -0,0 +1,9 @@ +{-# LANGUAGE StandaloneKindSignatures #-} +{-# LANGUAGE PolyKinds, ExplicitForAll #-} + +module SAKS_018 where + +import Data.Kind (Type) + +type T :: forall k -> k -> Type +data T k (x :: hk) diff --git a/testsuite/tests/saks/should_compile/saks019.hs b/testsuite/tests/saks/should_compile/saks019.hs new file mode 100644 index 0000000000..6e97db5c49 --- /dev/null +++ b/testsuite/tests/saks/should_compile/saks019.hs @@ -0,0 +1,11 @@ +{-# LANGUAGE StandaloneKindSignatures #-} +{-# LANGUAGE DataKinds, PolyKinds, ExplicitForAll #-} + +module SAKS_019 where + +import Data.Kind (Type) + +data P (a :: k) + +type T :: forall a. P a -> Type +data T (y :: P (b :: j)) diff --git a/testsuite/tests/saks/should_compile/saks020.hs b/testsuite/tests/saks/should_compile/saks020.hs new file mode 100644 index 0000000000..93cd4b734c --- /dev/null +++ b/testsuite/tests/saks/should_compile/saks020.hs @@ -0,0 +1,9 @@ +{-# LANGUAGE StandaloneKindSignatures #-} +{-# LANGUAGE PolyKinds, RankNTypes #-} + +module SAKS_020 where + +import Data.Kind (Type) + +type T :: forall k. k -> forall j. j -> Type +data T (x :: hk) :: hj -> Type diff --git a/testsuite/tests/saks/should_compile/saks021.hs b/testsuite/tests/saks/should_compile/saks021.hs new file mode 100644 index 0000000000..00bf9f8918 --- /dev/null +++ b/testsuite/tests/saks/should_compile/saks021.hs @@ -0,0 +1,9 @@ +{-# LANGUAGE StandaloneKindSignatures #-} +{-# LANGUAGE PolyKinds, ExplicitForAll #-} + +module SAKS_021 where + +import Data.Kind (Type) + +type T :: forall k -> forall (xx :: k) -> Type +data T k (x :: hk) diff --git a/testsuite/tests/saks/should_compile/saks023.script b/testsuite/tests/saks/should_compile/saks023.script new file mode 100644 index 0000000000..06d85eb38b --- /dev/null +++ b/testsuite/tests/saks/should_compile/saks023.script @@ -0,0 +1,5 @@ +:set -XStandaloneKindSignatures -XExplicitForAll -XPolyKinds -XNoStarIsType +import Data.Kind (Type) +type T :: forall (x :: Type) -> Type; data T a +:kind T + -- must output forall x, not forall a! diff --git a/testsuite/tests/saks/should_compile/saks023.stdout b/testsuite/tests/saks/should_compile/saks023.stdout new file mode 100644 index 0000000000..051268aa78 --- /dev/null +++ b/testsuite/tests/saks/should_compile/saks023.stdout @@ -0,0 +1 @@ +T :: forall x -> Type diff --git a/testsuite/tests/saks/should_compile/saks024.hs b/testsuite/tests/saks/should_compile/saks024.hs new file mode 100644 index 0000000000..b58f49da5d --- /dev/null +++ b/testsuite/tests/saks/should_compile/saks024.hs @@ -0,0 +1,15 @@ +{-# LANGUAGE StandaloneKindSignatures #-} +{-# LANGUAGE PolyKinds, TypeFamilies #-} + +module SAKS_024 where + +import Data.Kind + +data P (a :: k) = MkP + +type C :: i -> Constraint +class C (p :: j) where + type F :: j + +f :: P k -> P (F :: k) +f _ = MkP diff --git a/testsuite/tests/saks/should_compile/saks025.hs b/testsuite/tests/saks/should_compile/saks025.hs new file mode 100644 index 0000000000..dc51abd3f1 --- /dev/null +++ b/testsuite/tests/saks/should_compile/saks025.hs @@ -0,0 +1,12 @@ +{-# LANGUAGE StandaloneKindSignatures #-} +{-# LANGUAGE TypeFamilies, DataKinds, PolyKinds #-} + +module SAKS_025 where + +import Data.Kind + +data P (a :: k) = MkP + +type C :: j -> Constraint +class C a where + type T a b (c :: P p) diff --git a/testsuite/tests/saks/should_compile/saks025.script b/testsuite/tests/saks/should_compile/saks025.script new file mode 100644 index 0000000000..e19353e46d --- /dev/null +++ b/testsuite/tests/saks/should_compile/saks025.script @@ -0,0 +1,3 @@ +:set -XNoStarIsType +:load saks025.hs +:kind T diff --git a/testsuite/tests/saks/should_compile/saks025.stdout b/testsuite/tests/saks/should_compile/saks025.stdout new file mode 100644 index 0000000000..3eb0cd7c30 --- /dev/null +++ b/testsuite/tests/saks/should_compile/saks025.stdout @@ -0,0 +1 @@ +T :: forall k j (p :: k). j -> Type -> P p -> Type diff --git a/testsuite/tests/saks/should_compile/saks026.hs b/testsuite/tests/saks/should_compile/saks026.hs new file mode 100644 index 0000000000..a8a3967a0d --- /dev/null +++ b/testsuite/tests/saks/should_compile/saks026.hs @@ -0,0 +1,15 @@ +{-# LANGUAGE StandaloneKindSignatures #-} +{-# LANGUAGE RankNTypes, DataKinds, PolyKinds, GADTs, TypeFamilies #-} + +module SAKS_026 where + +import Data.Kind + +data HigherRank (f :: forall x. x -> Type) + +data P :: forall k. k -> Type + +type PSyn :: forall k. k -> Type +type PSyn = (P :: forall k. k -> Type) + +type Test = HigherRank PSyn diff --git a/testsuite/tests/saks/should_compile/saks027.hs b/testsuite/tests/saks/should_compile/saks027.hs new file mode 100644 index 0000000000..736def1d68 --- /dev/null +++ b/testsuite/tests/saks/should_compile/saks027.hs @@ -0,0 +1,10 @@ +{-# LANGUAGE StandaloneKindSignatures #-} +{-# LANGUAGE TemplateHaskell #-} + +module SAKS_027 where + +import Data.Kind + +$([d| type U :: Type + data U = MkU + |]) diff --git a/testsuite/tests/saks/should_compile/saks027.stderr b/testsuite/tests/saks/should_compile/saks027.stderr new file mode 100644 index 0000000000..730b1cfde6 --- /dev/null +++ b/testsuite/tests/saks/should_compile/saks027.stderr @@ -0,0 +1,7 @@ +saks027.hs:(8,3)-(10,6): Splicing declarations + [d| type U :: Type + + data U = MkU |] + ======> + type U :: Type + data U = MkU diff --git a/testsuite/tests/saks/should_compile/saks028.hs b/testsuite/tests/saks/should_compile/saks028.hs new file mode 100644 index 0000000000..9d15db593c --- /dev/null +++ b/testsuite/tests/saks/should_compile/saks028.hs @@ -0,0 +1,14 @@ +{-# LANGUAGE StandaloneKindSignatures #-} +{-# LANGUAGE TemplateHaskell #-} + +module SAKS_028 where + +import Data.Kind +import Language.Haskell.TH hiding (Type) + +type Functor' :: (Type -> Type) -> Constraint +class Functor' f + +do sig <- reifyType ('' Functor') + runIO $ putStrLn $ pprint sig + return [] diff --git a/testsuite/tests/saks/should_compile/saks028.stderr b/testsuite/tests/saks/should_compile/saks028.stderr new file mode 100644 index 0000000000..92ed23779c --- /dev/null +++ b/testsuite/tests/saks/should_compile/saks028.stderr @@ -0,0 +1 @@ +(* -> *) -> Constraint diff --git a/testsuite/tests/saks/should_compile/saks029.hs b/testsuite/tests/saks/should_compile/saks029.hs new file mode 100644 index 0000000000..ca2f28bce9 --- /dev/null +++ b/testsuite/tests/saks/should_compile/saks029.hs @@ -0,0 +1,13 @@ +{-# LANGUAGE StandaloneKindSignatures #-} +{-# LANGUAGE PolyKinds, DataKinds, RankNTypes, TypeFamilies #-} + +module SAKS_029 where + +import Data.Kind +import Data.Proxy +import Data.Type.Bool + +type IfK :: forall j m n. forall (e :: Proxy (j :: Bool)) -> m -> n -> If j m n +type family IfK e f g where + IfK (_ :: Proxy True) f _ = f + IfK (_ :: Proxy False) _ g = g diff --git a/testsuite/tests/saks/should_compile/saks030.hs b/testsuite/tests/saks/should_compile/saks030.hs new file mode 100644 index 0000000000..93e414fbed --- /dev/null +++ b/testsuite/tests/saks/should_compile/saks030.hs @@ -0,0 +1,28 @@ +{-# LANGUAGE StandaloneKindSignatures #-} +{-# LANGUAGE PolyKinds, DataKinds, RankNTypes, TypeFamilies, + TypeApplications, TypeOperators, GADTs #-} + +module SAKS_030 where + +import Data.Kind +import Data.Type.Equality + +type T1 :: forall k (a :: k). Bool +type T2 :: k -> Bool + +type family T1 where + T1 @Bool @True = False + T1 @Bool @False = True + +type family T2 a where + T2 True = False + T2 False = True + +type SBool :: Bool -> Type +data SBool b where + STrue :: SBool True + SFalse :: SBool False + +proof_t1_eq_t2 :: SBool b -> T1 @Bool @b :~: T2 b +proof_t1_eq_t2 STrue = Refl +proof_t1_eq_t2 SFalse = Refl diff --git a/testsuite/tests/saks/should_compile/saks031.hs b/testsuite/tests/saks/should_compile/saks031.hs new file mode 100644 index 0000000000..a737d6ddc7 --- /dev/null +++ b/testsuite/tests/saks/should_compile/saks031.hs @@ -0,0 +1,16 @@ +{-# LANGUAGE StandaloneKindSignatures #-} +{-# LANGUAGE UnliftedNewtypes #-} +{-# LANGUAGE PolyKinds, DataKinds, TypeFamilies, MagicHash #-} + +module SAKS_031 where + +import Data.Kind +import GHC.Exts + +type T1 :: Type -> TYPE 'IntRep +data family T1 + +newtype instance T1 a = MkT1 Int# + +type T2 :: TYPE IntRep +newtype T2 = MkT2 Int# diff --git a/testsuite/tests/saks/should_compile/saks032.hs b/testsuite/tests/saks/should_compile/saks032.hs new file mode 100644 index 0000000000..612c66d8fc --- /dev/null +++ b/testsuite/tests/saks/should_compile/saks032.hs @@ -0,0 +1,21 @@ +{-# LANGUAGE StandaloneKindSignatures #-} +{-# LANGUAGE PolyKinds, DataKinds, TypeFamilies, RankNTypes #-} + +module SAKS_032 where + +import Data.Kind +import Data.Proxy + +type Const :: Type -> forall k. k -> Type +data Const a b = Const a + +type F :: Type -> Type -> forall k. k -> Type +type family F a b :: forall k. k -> Type where + F () () = Proxy + F a b = Const (a,b) + +type F1 :: Type -> forall j. j -> forall k1 k2. (k1, k2) -> Type +type family F1 a b + +type F2 :: Type -> forall j. j -> forall k1 k2. (k1, k2) -> Type +type family F2 a b :: forall r2. (r1, r2) -> Type diff --git a/testsuite/tests/saks/should_compile/saks033.hs b/testsuite/tests/saks/should_compile/saks033.hs new file mode 100644 index 0000000000..cd6451dff0 --- /dev/null +++ b/testsuite/tests/saks/should_compile/saks033.hs @@ -0,0 +1,13 @@ +{-# LANGUAGE StandaloneKindSignatures #-} +{-# LANGUAGE PolyKinds, DataKinds, MultiParamTypeClasses, TypeFamilies, TypeApplications #-} + +module SAKS_033 where + +import Data.Kind +import Data.Proxy + +type C :: i -> Constraint +class C (a :: zzz) where + type F (a :: zzz) :: Type + +type T = F @Bool True diff --git a/testsuite/tests/saks/should_compile/saks034.hs b/testsuite/tests/saks/should_compile/saks034.hs new file mode 100644 index 0000000000..1288b665fe --- /dev/null +++ b/testsuite/tests/saks/should_compile/saks034.hs @@ -0,0 +1,11 @@ +{-# LANGUAGE StandaloneKindSignatures #-} +{-# LANGUAGE DataKinds, PolyKinds, TypeFamilies #-} + +module SAKS_034 where + +import Data.Kind + +type C :: j -> Constraint +class C (a :: k) where + -- T :: forall j -> j -> Type + type T k (b :: k) :: Type diff --git a/testsuite/tests/saks/should_compile/saks034.script b/testsuite/tests/saks/should_compile/saks034.script new file mode 100644 index 0000000000..23dc6dfae8 --- /dev/null +++ b/testsuite/tests/saks/should_compile/saks034.script @@ -0,0 +1,4 @@ +:set -XNoStarIsType +:load saks034.hs +:kind C +:kind T diff --git a/testsuite/tests/saks/should_compile/saks034.stdout b/testsuite/tests/saks/should_compile/saks034.stdout new file mode 100644 index 0000000000..9877dc5d39 --- /dev/null +++ b/testsuite/tests/saks/should_compile/saks034.stdout @@ -0,0 +1,2 @@ +C :: j -> Constraint +T :: forall j -> j -> Type diff --git a/testsuite/tests/saks/should_compile/saks035.hs b/testsuite/tests/saks/should_compile/saks035.hs new file mode 100644 index 0000000000..e4b5fe7d66 --- /dev/null +++ b/testsuite/tests/saks/should_compile/saks035.hs @@ -0,0 +1,12 @@ +{-# LANGUAGE StandaloneKindSignatures #-} +{-# LANGUAGE DataKinds, PolyKinds, TypeFamilies #-} + +module SAKS_035 where + +import Data.Proxy +import Data.Kind + +type C :: Proxy i -> Constraint +class C (a :: Proxy z) where + -- F :: k -> Type + type F z diff --git a/testsuite/tests/saks/should_compile/saks035.script b/testsuite/tests/saks/should_compile/saks035.script new file mode 100644 index 0000000000..c51128f0da --- /dev/null +++ b/testsuite/tests/saks/should_compile/saks035.script @@ -0,0 +1,4 @@ +:set -XNoStarIsType +:load saks035.hs +:kind C +:kind F diff --git a/testsuite/tests/saks/should_compile/saks035.stdout b/testsuite/tests/saks/should_compile/saks035.stdout new file mode 100644 index 0000000000..52193a3ff4 --- /dev/null +++ b/testsuite/tests/saks/should_compile/saks035.stdout @@ -0,0 +1,2 @@ +C :: forall k (i :: k). Proxy i -> Constraint +F :: k -> Type diff --git a/testsuite/tests/saks/should_compile/saks036.hs b/testsuite/tests/saks/should_compile/saks036.hs new file mode 100644 index 0000000000..76d3acd340 --- /dev/null +++ b/testsuite/tests/saks/should_compile/saks036.hs @@ -0,0 +1,12 @@ +{-# LANGUAGE StandaloneKindSignatures #-} +{-# LANGUAGE TypeFamilies, PolyKinds, RankNTypes, DataKinds #-} + +module SAKS_036 where + +import Data.Kind + +type C :: forall (k :: Type). k -> Constraint +class C (a :: (j :: Star)) where + type F j + +type family Star where Star = Type diff --git a/testsuite/tests/saks/should_fail/T16722.hs b/testsuite/tests/saks/should_fail/T16722.hs new file mode 100644 index 0000000000..fdc8b8de21 --- /dev/null +++ b/testsuite/tests/saks/should_fail/T16722.hs @@ -0,0 +1,9 @@ +{-# LANGUAGE StandaloneKindSignatures #-} +{-# LANGUAGE NoPolyKinds #-} + +module T16722 where + +import Data.Kind + +type D :: k -> Type +data D a diff --git a/testsuite/tests/saks/should_fail/T16722.stderr b/testsuite/tests/saks/should_fail/T16722.stderr new file mode 100644 index 0000000000..0b50bb868d --- /dev/null +++ b/testsuite/tests/saks/should_fail/T16722.stderr @@ -0,0 +1,5 @@ + +T16722.hs:8:11: error: + Unexpected kind variable ‘k’ + Perhaps you intended to use PolyKinds + In the standalone kind signature for D diff --git a/testsuite/tests/saks/should_fail/T16725.hs b/testsuite/tests/saks/should_fail/T16725.hs new file mode 100644 index 0000000000..904cabe083 --- /dev/null +++ b/testsuite/tests/saks/should_fail/T16725.hs @@ -0,0 +1,8 @@ +{-# LANGUAGE StandaloneKindSignatures #-} +{-# LANGUAGE TemplateHaskell #-} + +module T16725 where + +import Data.Kind (Type) + +type W :: Type diff --git a/testsuite/tests/saks/should_fail/T16725.stderr b/testsuite/tests/saks/should_fail/T16725.stderr new file mode 100644 index 0000000000..4fed187f73 --- /dev/null +++ b/testsuite/tests/saks/should_fail/T16725.stderr @@ -0,0 +1,3 @@ + +T16725.hs:8:6: error: + The standalone kind signature for ‘W’ lacks an accompanying binding diff --git a/testsuite/tests/saks/should_fail/T16727a.hs b/testsuite/tests/saks/should_fail/T16727a.hs new file mode 100644 index 0000000000..c258a4cc81 --- /dev/null +++ b/testsuite/tests/saks/should_fail/T16727a.hs @@ -0,0 +1,9 @@ +{-# LANGUAGE StandaloneKindSignatures #-} + +module T16727a where + +type T1 :: T2 +data T1 + +type T2 :: T1 +data T2 diff --git a/testsuite/tests/saks/should_fail/T16727a.stderr b/testsuite/tests/saks/should_fail/T16727a.stderr new file mode 100644 index 0000000000..9d0f3e11d7 --- /dev/null +++ b/testsuite/tests/saks/should_fail/T16727a.stderr @@ -0,0 +1,5 @@ + +T16727a.hs:8:12: error: + • Type constructor ‘T1’ cannot be used here + (it is defined and used in the same recursive group) + • In a standalone kind signature for ‘T2’: T1 diff --git a/testsuite/tests/saks/should_fail/T16727b.hs b/testsuite/tests/saks/should_fail/T16727b.hs new file mode 100644 index 0000000000..eb8fa62c50 --- /dev/null +++ b/testsuite/tests/saks/should_fail/T16727b.hs @@ -0,0 +1,6 @@ +{-# LANGUAGE StandaloneKindSignatures #-} + +module T16727b where + +type T :: T +data T diff --git a/testsuite/tests/saks/should_fail/T16727b.stderr b/testsuite/tests/saks/should_fail/T16727b.stderr new file mode 100644 index 0000000000..0a50ffe2e4 --- /dev/null +++ b/testsuite/tests/saks/should_fail/T16727b.stderr @@ -0,0 +1,5 @@ + +T16727b.hs:5:11: error: + • Type constructor ‘T’ cannot be used here + (it is defined and used in the same recursive group) + • In a standalone kind signature for ‘T’: T diff --git a/testsuite/tests/saks/should_fail/T16756b.hs b/testsuite/tests/saks/should_fail/T16756b.hs new file mode 100644 index 0000000000..8b71a67dad --- /dev/null +++ b/testsuite/tests/saks/should_fail/T16756b.hs @@ -0,0 +1,11 @@ +{-# LANGUAGE StandaloneKindSignatures #-} + +module T16756b where + +import Data.Kind (Type) + +type T :: Type -> Type +data T + -- We must write: + -- data T a + -- See https://gitlab.haskell.org/ghc/ghc/issues/16756#note_203567 diff --git a/testsuite/tests/saks/should_fail/T16756b.stderr b/testsuite/tests/saks/should_fail/T16756b.stderr new file mode 100644 index 0000000000..d8324628d2 --- /dev/null +++ b/testsuite/tests/saks/should_fail/T16756b.stderr @@ -0,0 +1,4 @@ + +T16756b.hs:8:1: error: + • Expected a type, but found something with kind ‘* -> *’ + • In the data type declaration for ‘T’ diff --git a/testsuite/tests/saks/should_fail/T16826.hs b/testsuite/tests/saks/should_fail/T16826.hs new file mode 100644 index 0000000000..60f305edef --- /dev/null +++ b/testsuite/tests/saks/should_fail/T16826.hs @@ -0,0 +1,14 @@ +{-# LANGUAGE StandaloneKindSignatures #-} +{-# LANGUAGE ConstraintKinds #-} +{-# LANGUAGE DataKinds #-} +{-# LANGUAGE TypeFamilies #-} + +module T16826 where + +import Data.Kind + +type family Id (x :: Type) :: Type where + Id x = x + +type C :: Type -> Id Constraint +class C a diff --git a/testsuite/tests/saks/should_fail/T16826.stderr b/testsuite/tests/saks/should_fail/T16826.stderr new file mode 100644 index 0000000000..c2272806c9 --- /dev/null +++ b/testsuite/tests/saks/should_fail/T16826.stderr @@ -0,0 +1,5 @@ + +T16826.hs:14:1: error: + • Kind signature on a class must end with Constraint + unobscured by type families + • In the class declaration for ‘C’ diff --git a/testsuite/tests/saks/should_fail/all.T b/testsuite/tests/saks/should_fail/all.T new file mode 100644 index 0000000000..82ae24181c --- /dev/null +++ b/testsuite/tests/saks/should_fail/all.T @@ -0,0 +1,32 @@ +test('saks007_fail', normal, compile_fail, ['']) +test('saks_fail001', normal, compile_fail, ['']) +test('saks_fail002', normal, compile_fail, ['']) +test('saks_fail003', normal, compile_fail, ['']) +test('saks_fail004', normal, compile_fail, ['']) +test('saks_fail005', normal, compile_fail, ['']) +test('saks_fail006', normal, compile_fail, ['']) +test('saks_fail007', normal, compile_fail, ['']) +test('saks_fail008', normal, compile_fail, ['']) +test('saks_fail009', normal, compile_fail, ['']) +test('saks_fail010', normal, compile_fail, ['']) +test('saks_fail011', normal, compile_fail, ['']) +test('saks_fail012', normal, compile_fail, ['']) +test('saks_fail013', normal, compile_fail, ['']) +test('saks_fail014', normal, compile_fail, ['']) +test('saks_fail015', normal, compile_fail, ['']) +test('saks_fail016', normal, compile_fail, ['']) +test('saks_fail017', normal, compile_fail, ['']) +test('saks_fail018', normal, compile_fail, ['']) +test('saks_fail019', normal, compile_fail, ['']) +test('saks_fail020', normal, compile_fail, ['']) +test('saks_fail021', normal, compile_fail, ['']) +test('saks_fail022', normal, compile_fail, ['']) +test('saks_fail023', normal, compile_fail, ['']) +test('saks_fail024', normal, compile_fail, ['']) +test('saks_fail025', normal, compile_fail, ['']) +test('T16722', normal, compile_fail, ['']) +test('T16727a', normal, compile_fail, ['']) +test('T16727b', normal, compile_fail, ['']) +test('T16725', normal, compile_fail, ['']) +test('T16826', normal, compile_fail, ['']) +test('T16756b', normal, compile_fail, ['']) diff --git a/testsuite/tests/saks/should_fail/saks007_fail.hs b/testsuite/tests/saks/should_fail/saks007_fail.hs new file mode 100644 index 0000000000..701ffcc17f --- /dev/null +++ b/testsuite/tests/saks/should_fail/saks007_fail.hs @@ -0,0 +1,16 @@ +{-# LANGUAGE StandaloneKindSignatures #-} +{-# LANGUAGE TypeFamilies, GADTs, PolyKinds, DataKinds, ExplicitForAll #-} + +-- See also: saks007.hs +module SAKS_007_fail where + +import GHC.TypeLits (Nat) +import Data.Kind (Type, Constraint) + +type family F a where { F Type = True; F _ = False } +type family G a where { G Type = False; G _ = True } + +type X :: forall k1 k2. (F k1 ~ G k2) => k1 -> k2 -> Type +data X a b where + MkX :: X Integer String -- FAIL: F Type ~ G Type + -- True ~ False diff --git a/testsuite/tests/saks/should_fail/saks007_fail.stderr b/testsuite/tests/saks/should_fail/saks007_fail.stderr new file mode 100644 index 0000000000..ab15984030 --- /dev/null +++ b/testsuite/tests/saks/should_fail/saks007_fail.stderr @@ -0,0 +1,8 @@ + +saks007_fail.hs:15:10: error: + • Couldn't match kind ‘'True’ with ‘'False’ + Expected kind: G * + Actual kind: F * + • In the type ‘X Integer String’ + In the definition of data constructor ‘MkX’ + In the data declaration for ‘X’ diff --git a/testsuite/tests/saks/should_fail/saks_fail001.hs b/testsuite/tests/saks/should_fail/saks_fail001.hs new file mode 100644 index 0000000000..c71f7a4a68 --- /dev/null +++ b/testsuite/tests/saks/should_fail/saks_fail001.hs @@ -0,0 +1,8 @@ +-- No -XStandaloneKindSignatures! + +module SAKS_Fail001 where + +import Data.Kind (Type) + +type T :: Type +data T diff --git a/testsuite/tests/saks/should_fail/saks_fail001.stderr b/testsuite/tests/saks/should_fail/saks_fail001.stderr new file mode 100644 index 0000000000..81ab28278d --- /dev/null +++ b/testsuite/tests/saks/should_fail/saks_fail001.stderr @@ -0,0 +1,4 @@ + +saks_fail001.hs:7:1: error: + Illegal standalone kind signature + Did you mean to enable StandaloneKindSignatures? diff --git a/testsuite/tests/saks/should_fail/saks_fail002.hs b/testsuite/tests/saks/should_fail/saks_fail002.hs new file mode 100644 index 0000000000..8f37e99ead --- /dev/null +++ b/testsuite/tests/saks/should_fail/saks_fail002.hs @@ -0,0 +1,11 @@ +{-# LANGUAGE StandaloneKindSignatures #-} + +module SAKS_Fail002 where + +import Data.Kind (Type) + +data D + +type D :: Type +type D :: Type +type D :: Type diff --git a/testsuite/tests/saks/should_fail/saks_fail002.stderr b/testsuite/tests/saks/should_fail/saks_fail002.stderr new file mode 100644 index 0000000000..bac0492f3a --- /dev/null +++ b/testsuite/tests/saks/should_fail/saks_fail002.stderr @@ -0,0 +1,6 @@ + +saks_fail002.hs:9:1: error: + Duplicate standalone kind signatures for ‘D’: + type D :: Type -- written at saks_fail002.hs:9:1-14 + type D :: Type -- written at saks_fail002.hs:10:1-14 + type D :: Type -- written at saks_fail002.hs:11:1-14 diff --git a/testsuite/tests/saks/should_fail/saks_fail003.hs b/testsuite/tests/saks/should_fail/saks_fail003.hs new file mode 100644 index 0000000000..a1bf05e005 --- /dev/null +++ b/testsuite/tests/saks/should_fail/saks_fail003.hs @@ -0,0 +1,7 @@ +{-# LANGUAGE StandaloneKindSignatures #-} +{-# LANGUAGE PolyKinds #-} + +module SAKS_Fail003 where + +type T :: _ +data T = MkT diff --git a/testsuite/tests/saks/should_fail/saks_fail003.stderr b/testsuite/tests/saks/should_fail/saks_fail003.stderr new file mode 100644 index 0000000000..f8f7f7af0d --- /dev/null +++ b/testsuite/tests/saks/should_fail/saks_fail003.stderr @@ -0,0 +1,4 @@ + +saks_fail003.hs:6:11: error: + Wildcard ‘_’ not allowed + in the standalone kind signature for T diff --git a/testsuite/tests/saks/should_fail/saks_fail004.hs b/testsuite/tests/saks/should_fail/saks_fail004.hs new file mode 100644 index 0000000000..d5d6b1558a --- /dev/null +++ b/testsuite/tests/saks/should_fail/saks_fail004.hs @@ -0,0 +1,10 @@ +{-# LANGUAGE StandaloneKindSignatures #-} +{-# LANGUAGE PolyKinds, DataKinds #-} + +module SAKS_Fail004 where + +import Data.Kind (Type) + +-- See also: T16263 +type Q :: Eq a => Type +data Q diff --git a/testsuite/tests/saks/should_fail/saks_fail004.stderr b/testsuite/tests/saks/should_fail/saks_fail004.stderr new file mode 100644 index 0000000000..15ec978340 --- /dev/null +++ b/testsuite/tests/saks/should_fail/saks_fail004.stderr @@ -0,0 +1,4 @@ + +saks_fail004.hs:9:11: error: + • Illegal constraint in a kind: forall a. Eq a => * + • In a standalone kind signature for ‘Q’: Eq a => Type diff --git a/testsuite/tests/saks/should_fail/saks_fail005.hs b/testsuite/tests/saks/should_fail/saks_fail005.hs new file mode 100644 index 0000000000..e930920a0a --- /dev/null +++ b/testsuite/tests/saks/should_fail/saks_fail005.hs @@ -0,0 +1,14 @@ +{-# LANGUAGE StandaloneKindSignatures #-} +{-# LANGUAGE ScopedTypeVariables #-} +{-# LANGUAGE GADTs, PolyKinds #-} + +module SAKS_Fail005 where + +import Data.Kind (Type) +import Data.Proxy (Proxy) + +-- GADT constructors do not run under bindTyClTyVars, +-- and thus have no access to scoped type variables. +type G :: forall k. k -> Type +data G a where + MkG :: forall a. Proxy (a :: k) -> G a diff --git a/testsuite/tests/saks/should_fail/saks_fail005.stderr b/testsuite/tests/saks/should_fail/saks_fail005.stderr new file mode 100644 index 0000000000..c0230a9fef --- /dev/null +++ b/testsuite/tests/saks/should_fail/saks_fail005.stderr @@ -0,0 +1,2 @@ + +saks_fail005.hs:14:32: error: Not in scope: type variable ‘k’ diff --git a/testsuite/tests/saks/should_fail/saks_fail006.hs b/testsuite/tests/saks/should_fail/saks_fail006.hs new file mode 100644 index 0000000000..fc9bc51cf3 --- /dev/null +++ b/testsuite/tests/saks/should_fail/saks_fail006.hs @@ -0,0 +1,14 @@ +{-# LANGUAGE StandaloneKindSignatures #-} +{-# LANGUAGE ScopedTypeVariables #-} +{-# LANGUAGE TypeApplications, PolyKinds #-} + +module SAKS_Fail006 where + +import Data.Kind (Type) + +-- Type family equations do not run under bindTyClTyVars, +-- and thus have no access to scoped type variables. +type F :: forall k. k -> k +type family F a where + F (Maybe a) = F @k a + F x = x diff --git a/testsuite/tests/saks/should_fail/saks_fail006.stderr b/testsuite/tests/saks/should_fail/saks_fail006.stderr new file mode 100644 index 0000000000..fb7cbe18a7 --- /dev/null +++ b/testsuite/tests/saks/should_fail/saks_fail006.stderr @@ -0,0 +1,2 @@ + +saks_fail006.hs:13:20: error: Not in scope: type variable ‘k’ diff --git a/testsuite/tests/saks/should_fail/saks_fail007.hs b/testsuite/tests/saks/should_fail/saks_fail007.hs new file mode 100644 index 0000000000..0baeda837b --- /dev/null +++ b/testsuite/tests/saks/should_fail/saks_fail007.hs @@ -0,0 +1,8 @@ +{-# LANGUAGE StandaloneKindSignatures #-} + +module SAKS_Fail007 where + +import Data.Kind (Type) + +type May a :: Type +data May a = Nay | Yay a diff --git a/testsuite/tests/saks/should_fail/saks_fail007.stderr b/testsuite/tests/saks/should_fail/saks_fail007.stderr new file mode 100644 index 0000000000..bc2764b1e7 --- /dev/null +++ b/testsuite/tests/saks/should_fail/saks_fail007.stderr @@ -0,0 +1,2 @@ + +saks_fail007.hs:7:12: error: parse error on input ‘::’ diff --git a/testsuite/tests/saks/should_fail/saks_fail008.hs b/testsuite/tests/saks/should_fail/saks_fail008.hs new file mode 100644 index 0000000000..4083e4bfcb --- /dev/null +++ b/testsuite/tests/saks/should_fail/saks_fail008.hs @@ -0,0 +1,9 @@ +{-# LANGUAGE StandaloneKindSignatures #-} +{-# LANGUAGE KindSignatures #-} + +module SAKS_Fail008 where + +import Data.Kind (Type) + +type T :: Type -> (Type -> Type) -> Type +data T a (b :: Type -> Type) x1 (x2 :: Type -> Type) diff --git a/testsuite/tests/saks/should_fail/saks_fail008.stderr b/testsuite/tests/saks/should_fail/saks_fail008.stderr new file mode 100644 index 0000000000..4679afb564 --- /dev/null +++ b/testsuite/tests/saks/should_fail/saks_fail008.stderr @@ -0,0 +1,5 @@ + +saks_fail008.hs:9:1: error: + • Not a function kind: * + but extra binders found: x1 (x2 :: Type -> Type) + • In the data type declaration for ‘T’ diff --git a/testsuite/tests/saks/should_fail/saks_fail009.hs b/testsuite/tests/saks/should_fail/saks_fail009.hs new file mode 100644 index 0000000000..317c0e7644 --- /dev/null +++ b/testsuite/tests/saks/should_fail/saks_fail009.hs @@ -0,0 +1,9 @@ +{-# LANGUAGE StandaloneKindSignatures #-} +{-# LANGUAGE PolyKinds, ExplicitForAll #-} + +module SAKS_Fail009 where + +import Data.Kind (Type) + +type T :: forall k -> k -> Type +data T (k :: Type -> Type) (a :: k) diff --git a/testsuite/tests/saks/should_fail/saks_fail009.stderr b/testsuite/tests/saks/should_fail/saks_fail009.stderr new file mode 100644 index 0000000000..8ce43f6d5d --- /dev/null +++ b/testsuite/tests/saks/should_fail/saks_fail009.stderr @@ -0,0 +1,4 @@ + +saks_fail009.hs:9:1: error: + • Expected kind ‘* -> *’, but ‘k’ has kind ‘*’ + • In the data type declaration for ‘T’ diff --git a/testsuite/tests/saks/should_fail/saks_fail010.hs b/testsuite/tests/saks/should_fail/saks_fail010.hs new file mode 100644 index 0000000000..a427515a82 --- /dev/null +++ b/testsuite/tests/saks/should_fail/saks_fail010.hs @@ -0,0 +1,8 @@ +{-# LANGUAGE StandaloneKindSignatures #-} + +module SAKS_Fail010 where + +import Data.Kind (Type) + +type T :: Type -> Type +data T = MkT Int diff --git a/testsuite/tests/saks/should_fail/saks_fail010.stderr b/testsuite/tests/saks/should_fail/saks_fail010.stderr new file mode 100644 index 0000000000..b270ff2e67 --- /dev/null +++ b/testsuite/tests/saks/should_fail/saks_fail010.stderr @@ -0,0 +1,4 @@ + +saks_fail010.hs:8:1: error: + • Expected a type, but found something with kind ‘* -> *’ + • In the data type declaration for ‘T’ diff --git a/testsuite/tests/saks/should_fail/saks_fail011.hs b/testsuite/tests/saks/should_fail/saks_fail011.hs new file mode 100644 index 0000000000..b5c6a11026 --- /dev/null +++ b/testsuite/tests/saks/should_fail/saks_fail011.hs @@ -0,0 +1,10 @@ +{-# LANGUAGE StandaloneKindSignatures #-} +{-# LANGUAGE GADTs #-} + +module SAKS_Fail011 where + +import Data.Kind (Type) + +type G :: Type -> Type +data G where + MkG :: a -> G a diff --git a/testsuite/tests/saks/should_fail/saks_fail011.stderr b/testsuite/tests/saks/should_fail/saks_fail011.stderr new file mode 100644 index 0000000000..ff23c7b1a3 --- /dev/null +++ b/testsuite/tests/saks/should_fail/saks_fail011.stderr @@ -0,0 +1,4 @@ + +saks_fail011.hs:9:1: error: + • Expected a type, but found something with kind ‘* -> *’ + • In the data type declaration for ‘G’ diff --git a/testsuite/tests/saks/should_fail/saks_fail012.hs b/testsuite/tests/saks/should_fail/saks_fail012.hs new file mode 100644 index 0000000000..892eb8c418 --- /dev/null +++ b/testsuite/tests/saks/should_fail/saks_fail012.hs @@ -0,0 +1,8 @@ +{-# LANGUAGE StandaloneKindSignatures #-} + +module SAKS_Fail012 where + +import Data.Kind (Type, Constraint) + +type C :: Type -> Type -> Constraint +class C a where diff --git a/testsuite/tests/saks/should_fail/saks_fail012.stderr b/testsuite/tests/saks/should_fail/saks_fail012.stderr new file mode 100644 index 0000000000..d43a0ac028 --- /dev/null +++ b/testsuite/tests/saks/should_fail/saks_fail012.stderr @@ -0,0 +1,5 @@ + +saks_fail012.hs:8:1: error: + • Couldn't match expected kind ‘Constraint’ + with actual kind ‘* -> Constraint’ + • In the class declaration for ‘C’ diff --git a/testsuite/tests/saks/should_fail/saks_fail013.hs b/testsuite/tests/saks/should_fail/saks_fail013.hs new file mode 100644 index 0000000000..111b521b8a --- /dev/null +++ b/testsuite/tests/saks/should_fail/saks_fail013.hs @@ -0,0 +1,10 @@ +{-# LANGUAGE StandaloneKindSignatures #-} +{-# LANGUAGE ScopedTypeVariables #-} +{-# LANGUAGE PolyKinds #-} + +module SAKS_Fail013 where + +import Data.Kind (Type) + +type T :: forall (k :: Type) -> Type +data T j = MkT (j -> k) diff --git a/testsuite/tests/saks/should_fail/saks_fail013.stderr b/testsuite/tests/saks/should_fail/saks_fail013.stderr new file mode 100644 index 0000000000..4e041ba756 --- /dev/null +++ b/testsuite/tests/saks/should_fail/saks_fail013.stderr @@ -0,0 +1,2 @@ + +saks_fail013.hs:10:22: error: Not in scope: type variable ‘k’ diff --git a/testsuite/tests/saks/should_fail/saks_fail014.hs b/testsuite/tests/saks/should_fail/saks_fail014.hs new file mode 100644 index 0000000000..e68f448f73 --- /dev/null +++ b/testsuite/tests/saks/should_fail/saks_fail014.hs @@ -0,0 +1,11 @@ +{-# LANGUAGE StandaloneKindSignatures #-} +{-# LANGUAGE TypeFamilies, PolyKinds, ExplicitForAll #-} + +module SAKS_Fail014 where + +import Data.Kind (Type) + +type T :: forall k. k +type family T :: forall j. j where + T = Maybe + T = Integer diff --git a/testsuite/tests/saks/should_fail/saks_fail014.stderr b/testsuite/tests/saks/should_fail/saks_fail014.stderr new file mode 100644 index 0000000000..68733410ee --- /dev/null +++ b/testsuite/tests/saks/should_fail/saks_fail014.stderr @@ -0,0 +1,11 @@ + +saks_fail014.hs:10:7: error: + • Expecting one more argument to ‘Maybe’ + Expected kind ‘forall k. k’, but ‘Maybe’ has kind ‘* -> *’ + • In the type ‘Maybe’ + In the type family declaration for ‘T’ + +saks_fail014.hs:11:7: error: + • Expected kind ‘forall k. k’, but ‘Integer’ has kind ‘*’ + • In the type ‘Integer’ + In the type family declaration for ‘T’ diff --git a/testsuite/tests/saks/should_fail/saks_fail015.hs b/testsuite/tests/saks/should_fail/saks_fail015.hs new file mode 100644 index 0000000000..78ee15e314 --- /dev/null +++ b/testsuite/tests/saks/should_fail/saks_fail015.hs @@ -0,0 +1,11 @@ +{-# LANGUAGE StandaloneKindSignatures #-} +{-# LANGUAGE ScopedTypeVariables #-} +{-# LANGUAGE PolyKinds #-} + +module SAKS_Fail015 where + +import Data.Kind (Type) +import Data.Proxy (Proxy) + +type T :: forall k. k -> Type +data T a = MkT (Proxy (a :: k)) -- 'k' is not brought into scope by ScopedTypeVariables diff --git a/testsuite/tests/saks/should_fail/saks_fail015.stderr b/testsuite/tests/saks/should_fail/saks_fail015.stderr new file mode 100644 index 0000000000..d85b1a4c22 --- /dev/null +++ b/testsuite/tests/saks/should_fail/saks_fail015.stderr @@ -0,0 +1,2 @@ + +saks_fail015.hs:11:29: error: Not in scope: type variable ‘k’ diff --git a/testsuite/tests/saks/should_fail/saks_fail016.hs b/testsuite/tests/saks/should_fail/saks_fail016.hs new file mode 100644 index 0000000000..f2966876ba --- /dev/null +++ b/testsuite/tests/saks/should_fail/saks_fail016.hs @@ -0,0 +1,13 @@ +{-# LANGUAGE StandaloneKindSignatures #-} +{-# LANGUAGE ScopedTypeVariables #-} +{-# LANGUAGE PolyKinds, ConstraintKinds, ExplicitForAll #-} + +module SAKS_Fail016 where + +import Data.Kind (Constraint) + +data T (a :: k) + +type C :: forall k. k -> Constraint +class C a where + getC :: forall. T (a :: k) -- 'k' is not brought into scope by ScopedTypeVariables diff --git a/testsuite/tests/saks/should_fail/saks_fail016.stderr b/testsuite/tests/saks/should_fail/saks_fail016.stderr new file mode 100644 index 0000000000..8f501674ea --- /dev/null +++ b/testsuite/tests/saks/should_fail/saks_fail016.stderr @@ -0,0 +1,2 @@ + +saks_fail016.hs:13:27: error: Not in scope: type variable ‘k’ diff --git a/testsuite/tests/saks/should_fail/saks_fail017.hs b/testsuite/tests/saks/should_fail/saks_fail017.hs new file mode 100644 index 0000000000..b13f27c7f9 --- /dev/null +++ b/testsuite/tests/saks/should_fail/saks_fail017.hs @@ -0,0 +1,12 @@ +{-# LANGUAGE StandaloneKindSignatures #-} +{-# LANGUAGE ScopedTypeVariables #-} +{-# LANGUAGE PolyKinds, TypeApplications #-} + +module SAKS_Fail017 where + +import Data.Kind (Type) + +data T (a :: k) + +type S :: forall k. k -> Type +type S = T @k -- 'k' is not brought into scope by ScopedTypeVariables diff --git a/testsuite/tests/saks/should_fail/saks_fail017.stderr b/testsuite/tests/saks/should_fail/saks_fail017.stderr new file mode 100644 index 0000000000..b43ff35632 --- /dev/null +++ b/testsuite/tests/saks/should_fail/saks_fail017.stderr @@ -0,0 +1,2 @@ + +saks_fail017.hs:12:13: error: Not in scope: type variable ‘k’ diff --git a/testsuite/tests/saks/should_fail/saks_fail018.hs b/testsuite/tests/saks/should_fail/saks_fail018.hs new file mode 100644 index 0000000000..4febbe2530 --- /dev/null +++ b/testsuite/tests/saks/should_fail/saks_fail018.hs @@ -0,0 +1,13 @@ +{-# LANGUAGE StandaloneKindSignatures #-} +{-# LANGUAGE ScopedTypeVariables #-} +{-# LANGUAGE PolyKinds, ExplicitForAll #-} + +module SAKS_Fail018 where + +import Data.Kind (Type) + +data P w + +-- j = k, x = a +type T :: forall k. forall (a :: k) -> Type +data T (x :: j) = MkT (P k) (P j) (P x) -- 'k' is not brought into scope by ScopedTypeVariables diff --git a/testsuite/tests/saks/should_fail/saks_fail018.stderr b/testsuite/tests/saks/should_fail/saks_fail018.stderr new file mode 100644 index 0000000000..38b7c59662 --- /dev/null +++ b/testsuite/tests/saks/should_fail/saks_fail018.stderr @@ -0,0 +1,2 @@ + +saks_fail018.hs:13:26: error: Not in scope: type variable ‘k’ diff --git a/testsuite/tests/saks/should_fail/saks_fail019.hs b/testsuite/tests/saks/should_fail/saks_fail019.hs new file mode 100644 index 0000000000..51cdd54ca2 --- /dev/null +++ b/testsuite/tests/saks/should_fail/saks_fail019.hs @@ -0,0 +1,11 @@ +{-# LANGUAGE StandaloneKindSignatures #-} +{-# LANGUAGE PolyKinds, ExplicitForAll #-} + +module SAKS_Fail019 where + +import Data.Kind (Type) + +type T :: Type -> Type -> Type +data T a :: a -> Type + -- Should not panic with: + -- GHC internal error: ‘a’ is not in scope during type checking, but it passed the renamer diff --git a/testsuite/tests/saks/should_fail/saks_fail019.stderr b/testsuite/tests/saks/should_fail/saks_fail019.stderr new file mode 100644 index 0000000000..5bdb26a933 --- /dev/null +++ b/testsuite/tests/saks/should_fail/saks_fail019.stderr @@ -0,0 +1,6 @@ + +saks_fail019.hs:9:1: error: + • Couldn't match kind ‘a’ with ‘*’ + Expected kind: a -> * + Actual kind: * -> * + • In the data type declaration for ‘T’ diff --git a/testsuite/tests/saks/should_fail/saks_fail020.hs b/testsuite/tests/saks/should_fail/saks_fail020.hs new file mode 100644 index 0000000000..69812aea8b --- /dev/null +++ b/testsuite/tests/saks/should_fail/saks_fail020.hs @@ -0,0 +1,11 @@ +{-# LANGUAGE StandaloneKindSignatures #-} +{-# LANGUAGE RankNTypes, PolyKinds, DataKinds, TypeFamilies #-} + +module SAKS_Fail020 where + +import Data.Kind +import Data.Proxy + +type Foo2 :: () -> forall (k :: Type) -> Proxy (a :: k) +type family Foo2 d k where {} + diff --git a/testsuite/tests/saks/should_fail/saks_fail020.stderr b/testsuite/tests/saks/should_fail/saks_fail020.stderr new file mode 100644 index 0000000000..7f4f33f631 --- /dev/null +++ b/testsuite/tests/saks/should_fail/saks_fail020.stderr @@ -0,0 +1,6 @@ + +saks_fail020.hs:9:49: error: + • Expected kind ‘k’, but ‘a’ has kind ‘k0’ + • In the first argument of ‘Proxy’, namely ‘(a :: k)’ + In a standalone kind signature for ‘Foo2’: + () -> forall (k :: Type) -> Proxy (a :: k) diff --git a/testsuite/tests/saks/should_fail/saks_fail021.hs b/testsuite/tests/saks/should_fail/saks_fail021.hs new file mode 100644 index 0000000000..a702ea0a6a --- /dev/null +++ b/testsuite/tests/saks/should_fail/saks_fail021.hs @@ -0,0 +1,11 @@ +{-# LANGUAGE StandaloneKindSignatures #-} +{-# LANGUAGE RankNTypes, PolyKinds, DataKinds, TypeFamilies #-} + +module SAKS_Fail021 where + +import Data.Kind +import Data.Proxy + +type C :: Type -> Constraint +class C (a :: k) where + type F k diff --git a/testsuite/tests/saks/should_fail/saks_fail021.stderr b/testsuite/tests/saks/should_fail/saks_fail021.stderr new file mode 100644 index 0000000000..6128aff165 --- /dev/null +++ b/testsuite/tests/saks/should_fail/saks_fail021.stderr @@ -0,0 +1,4 @@ + +saks_fail021.hs:10:1: error: + • Expected kind ‘k’, but ‘a’ has kind ‘*’ + • In the class declaration for ‘C’ diff --git a/testsuite/tests/saks/should_fail/saks_fail022.hs b/testsuite/tests/saks/should_fail/saks_fail022.hs new file mode 100644 index 0000000000..47638f84b5 --- /dev/null +++ b/testsuite/tests/saks/should_fail/saks_fail022.hs @@ -0,0 +1,11 @@ +{-# LANGUAGE StandaloneKindSignatures #-} +{-# LANGUAGE RankNTypes, PolyKinds, DataKinds, TypeFamilies #-} + +module SAKS_Fail022 where + +import Data.Kind +import Data.Proxy + +type C :: (x,y) -> Constraint +class C (a :: k) where + type F k diff --git a/testsuite/tests/saks/should_fail/saks_fail022.stderr b/testsuite/tests/saks/should_fail/saks_fail022.stderr new file mode 100644 index 0000000000..e0cc222344 --- /dev/null +++ b/testsuite/tests/saks/should_fail/saks_fail022.stderr @@ -0,0 +1,4 @@ + +saks_fail022.hs:10:1: error: + • Expected kind ‘k’, but ‘a’ has kind ‘(x, y)’ + • In the class declaration for ‘C’ diff --git a/testsuite/tests/saks/should_fail/saks_fail023.hs b/testsuite/tests/saks/should_fail/saks_fail023.hs new file mode 100644 index 0000000000..371f7ac925 --- /dev/null +++ b/testsuite/tests/saks/should_fail/saks_fail023.hs @@ -0,0 +1,11 @@ +{-# LANGUAGE StandaloneKindSignatures #-} +{-# LANGUAGE RankNTypes, PolyKinds, DataKinds, TypeFamilies #-} + +module SAKS_Fail023 where + +import Data.Kind +import Data.Proxy + +type C :: Type -> Constraint +class C (a :: k) where + type F :: k -> k diff --git a/testsuite/tests/saks/should_fail/saks_fail023.stderr b/testsuite/tests/saks/should_fail/saks_fail023.stderr new file mode 100644 index 0000000000..3af24c7abb --- /dev/null +++ b/testsuite/tests/saks/should_fail/saks_fail023.stderr @@ -0,0 +1,4 @@ + +saks_fail023.hs:10:1: error: + • Expected kind ‘k’, but ‘a’ has kind ‘*’ + • In the class declaration for ‘C’ diff --git a/testsuite/tests/saks/should_fail/saks_fail024.hs b/testsuite/tests/saks/should_fail/saks_fail024.hs new file mode 100644 index 0000000000..714b19c4b6 --- /dev/null +++ b/testsuite/tests/saks/should_fail/saks_fail024.hs @@ -0,0 +1,7 @@ +{-# LANGUAGE StandaloneKindSignatures #-} + +module SAKS_Fail024 where + +import Data.Kind (Type) + +type Data.Kind.Type :: Type diff --git a/testsuite/tests/saks/should_fail/saks_fail024.stderr b/testsuite/tests/saks/should_fail/saks_fail024.stderr new file mode 100644 index 0000000000..0266358356 --- /dev/null +++ b/testsuite/tests/saks/should_fail/saks_fail024.stderr @@ -0,0 +1,3 @@ + +saks_fail024.hs:7:6: error: + Expected an unqualified type constructor: Data.Kind.Type diff --git a/testsuite/tests/saks/should_fail/saks_fail025.hs b/testsuite/tests/saks/should_fail/saks_fail025.hs new file mode 100644 index 0000000000..01c0af016a --- /dev/null +++ b/testsuite/tests/saks/should_fail/saks_fail025.hs @@ -0,0 +1,11 @@ +{-# LANGUAGE StandaloneKindSignatures #-} + +module SAKS_Fail024 where + +import Data.Kind (Type) + +type A, B, C :: Type + +data A +data B +data C diff --git a/testsuite/tests/saks/should_fail/saks_fail025.stderr b/testsuite/tests/saks/should_fail/saks_fail025.stderr new file mode 100644 index 0000000000..52e1527d3b --- /dev/null +++ b/testsuite/tests/saks/should_fail/saks_fail025.stderr @@ -0,0 +1,5 @@ + +saks_fail025.hs:7:6: error: + Standalone kind signatures do not support multiple names at the moment: + A, B, C + See https://gitlab.haskell.org/ghc/ghc/issues/16754 for details. diff --git a/testsuite/tests/typecheck/should_fail/T12035.stderr b/testsuite/tests/typecheck/should_fail/T12035.stderr index c6113ea207..375b94c95a 100644 --- a/testsuite/tests/typecheck/should_fail/T12035.stderr +++ b/testsuite/tests/typecheck/should_fail/T12035.stderr @@ -2,5 +2,7 @@ T12035.hs-boot:2:1: error: Type constructor ‘T’ has conflicting definitions in the module and its hs-boot file - Main module: type T = Bool - Boot file: data T + Main module: type T :: * + type T = Bool + Boot file: type T :: * + data T diff --git a/testsuite/tests/typecheck/should_fail/T12035j.stderr b/testsuite/tests/typecheck/should_fail/T12035j.stderr index c6113ea207..375b94c95a 100644 --- a/testsuite/tests/typecheck/should_fail/T12035j.stderr +++ b/testsuite/tests/typecheck/should_fail/T12035j.stderr @@ -2,5 +2,7 @@ T12035.hs-boot:2:1: error: Type constructor ‘T’ has conflicting definitions in the module and its hs-boot file - Main module: type T = Bool - Boot file: data T + Main module: type T :: * + type T = Bool + Boot file: type T :: * + data T diff --git a/testsuite/tests/typecheck/should_fail/T12042.stderr b/testsuite/tests/typecheck/should_fail/T12042.stderr index 3266a1fe11..ae3cf33ea7 100644 --- a/testsuite/tests/typecheck/should_fail/T12042.stderr +++ b/testsuite/tests/typecheck/should_fail/T12042.stderr @@ -5,5 +5,7 @@ T12042.hs-boot:2:1: error: Type constructor ‘S’ has conflicting definitions in the module and its hs-boot file - Main module: type S = R - Boot file: data S + Main module: type S :: * + type S = R + Boot file: type S :: * + data S diff --git a/testsuite/tests/typecheck/should_fail/T3468.stderr b/testsuite/tests/typecheck/should_fail/T3468.stderr index 0a0fec223b..c8aa7622f8 100644 --- a/testsuite/tests/typecheck/should_fail/T3468.stderr +++ b/testsuite/tests/typecheck/should_fail/T3468.stderr @@ -3,6 +3,8 @@ T3468.hs-boot:3:1: error: Type constructor ‘Tool’ has conflicting definitions in the module and its hs-boot file Main module: type role Tool phantom + type Tool :: * -> * data Tool d = forall a r. F a - Boot file: data Tool + Boot file: type Tool :: * + data Tool The types have different kinds diff --git a/testsuite/tests/typecheck/should_fail/T9201.stderr b/testsuite/tests/typecheck/should_fail/T9201.stderr index 28f2f1d391..5e8f0173c5 100644 --- a/testsuite/tests/typecheck/should_fail/T9201.stderr +++ b/testsuite/tests/typecheck/should_fail/T9201.stderr @@ -3,5 +3,4 @@ T9201.hs:6:17: error: • Expected kind ‘x’, but ‘a’ has kind ‘y’ • In the first argument of ‘f’, namely ‘a’ In the second argument of ‘d’, namely ‘(f a)’ - In the type signature: - ret :: d a (f a) + In the type signature: ret :: d a (f a) diff --git a/testsuite/tests/typecheck/should_fail/UnliftedNewtypesFamilyKindFail1.stderr b/testsuite/tests/typecheck/should_fail/UnliftedNewtypesFamilyKindFail1.stderr index 13c9836c43..c868a1321e 100644 --- a/testsuite/tests/typecheck/should_fail/UnliftedNewtypesFamilyKindFail1.stderr +++ b/testsuite/tests/typecheck/should_fail/UnliftedNewtypesFamilyKindFail1.stderr @@ -1,4 +1,5 @@ -UnliftedNewtypesFamilyKindFail1.hs:11:31: - Expected a type, but ‘5’ has kind ‘GHC.Types.Nat’ - In the kind ‘5’ + +UnliftedNewtypesFamilyKindFail1.hs:11:31: error: + • Expected a type, but ‘5’ has kind ‘GHC.Types.Nat’ + • In the kind ‘5’ In the data family declaration for ‘DF’ diff --git a/testsuite/tests/typecheck/should_fail/tcfail210.stderr b/testsuite/tests/typecheck/should_fail/tcfail210.stderr index 9df9b7ef8f..819a9524fb 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail210.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail210.stderr @@ -1,3 +1,3 @@ -tcfail210.hs:4:31: +tcfail210.hs:4:31: error: Not in scope: type constructor or class ‘Constraint’ |