Embrace -XTypeInType, add -XStarIsType
[ghc.git] / testsuite / tests / indexed-types / should_fail / T14369.hs
1 {-# LANGUAGE AllowAmbiguousTypes #-}
2 {-# LANGUAGE GADTs #-}
3 {-# LANGUAGE RankNTypes #-}
4 {-# LANGUAGE ScopedTypeVariables #-}
5 {-# LANGUAGE TypeApplications #-}
6 {-# LANGUAGE TypeFamilyDependencies #-}
7 {-# LANGUAGE DataKinds, PolyKinds #-}
8 {-# LANGUAGE TypeOperators #-}
9 module T14369 where
10
11 data family Sing (a :: k)
12
13 data instance Sing (z :: Maybe a) where
14 SNothing :: Sing Nothing
15 SJust :: Sing x -> Sing (Just x)
16
17 class SingKind k where
18 type Demote k = r | r -> k
19 fromSing :: Sing (a :: k) -> Demote k
20
21 instance SingKind a => SingKind (Maybe a) where
22 type Demote (Maybe a) = Maybe (Demote a)
23 fromSing SNothing = Nothing
24 fromSing (SJust x) = Just (fromSing x)
25
26 f :: forall (x :: forall a. Maybe a) a. SingKind a => Sing x -> Maybe (Demote a)
27 f = fromSing