Remove the type-checking knot.
[ghc.git] / testsuite / tests / polykinds / T7973.hs
1 {-# LANGUAGE DataKinds, PolyKinds, KindSignatures #-}
2 {-# LANGUAGE ExistentialQuantification, UndecidableInstances, TypeFamilies #-}
3
4 module Test where
5
6 -- Kind-level proxies.
7 data {-kind-} K (a :: *) = KP
8
9 -- A type with 1 kind-polymorphic type argument.
10 data T (n :: k)
11
12 -- A type with 1 kind argument.
13 data F (kp :: K k)
14
15 -- A class with 1 kind argument.
16 class (kp ~ KP) => C (kp :: K k) where
17 f :: T (a :: k) -> F kp
18
19 -- A type with 1 kind argument.
20 -- Contains an existentially quantified type-variable of this kind.
21 data SomeT (kp :: K k) = forall (n :: k). Mk (T n)
22
23 -- Show `SomeT` by converting it to `F`, using `C`.
24 instance (C kp, Show (F kp)) => Show (SomeT kp) where
25 show (Mk x) = show (f x)