Embrace -XTypeInType, add -XStarIsType
[ghc.git] / testsuite / tests / pmcheck / complete_sigs / T14253.hs
1 {-# LANGUAGE GADTs #-}
2 {-# LANGUAGE PatternSynonyms #-}
3 {-# LANGUAGE TypeOperators #-}
4 {-# LANGUAGE RankNTypes #-}
5 {-# LANGUAGE PolyKinds #-}
6
7 module T14253 where
8
9 import GHC.Exts
10 import Data.Kind
11
12 data TypeRep (a :: k) where
13 Con :: TypeRep (a :: k)
14 TrFun :: forall (r1 :: RuntimeRep) (r2 :: RuntimeRep)
15 (a :: TYPE r1) (b :: TYPE r2).
16 TypeRep a
17 -> TypeRep b
18 -> TypeRep (a -> b)
19
20 pattern Fun :: forall k (fun :: k). ()
21 => forall (r1 :: RuntimeRep) (r2 :: RuntimeRep)
22 (arg :: TYPE r1) (res :: TYPE r2).
23 (k ~ Type, fun ~~ (arg -> res))
24 => TypeRep arg
25 -> TypeRep res
26 -> TypeRep fun
27 pattern Fun arg res <- TrFun arg res
28
29 data Dynamic where
30 Dynamic :: forall a. TypeRep a -> a -> Dynamic
31
32 -- Adding this results in failure
33 {-# COMPLETE Con #-}
34
35 dynApply :: Dynamic -> Dynamic -> Maybe Dynamic
36 -- Changing TrFun to Fun also results in failure
37 dynApply (Dynamic (Fun ta tr) f) (Dynamic ta' x) = undefined
38 dynApply _ _ = Nothing
39