Reject nested predicates in impredicativity checking
[ghc.git] / testsuite / tests / polykinds / T9569.hs
1 {-# OPTIONS_GHC -fno-warn-redundant-constraints #-}
2 {-# LANGUAGE RankNTypes, ConstraintKinds, KindSignatures, DataKinds, TypeFamilies #-}
3 module T9569 where
4
5 import GHC.Exts
6
7 data Proxy (c :: Constraint)
8
9 class Deferrable (c :: Constraint) where
10 defer :: Proxy c -> (c => a) -> a
11
12 deferPair :: (Deferrable c1, Deferrable c2) =>
13 Proxy (c1,c2) -> ((c1,c2) => a) -> a
14 deferPair _ _ = undefined
15
16 instance (Deferrable c1, Deferrable c2) => Deferrable (c1,c2) where
17 -- defer p f = deferPair p f -- Succeeds
18 defer = deferPair -- Fails
19
20 {-
21 [G] Deferrable c1, Deferrable c2
22
23 [W] Proxy (c1,c2) -> ((c1,c2) => a) -> a ~ Proxy (c1x,c2x) -> ((c1x,c2x) => ax) -> ax
24 [w] Deferrable c1x
25 [w] Deferrable c2x
26 -}