Fix impredicativity (again)
[ghc.git] / testsuite / tests / typecheck / should_fail / T11990a.hs
1 {-# LANGUAGE DataKinds, TypeOperators, TypeFamilies #-}
2 {-# LANGUAGE UndecidableInstances, ScopedTypeVariables, FlexibleContexts #-}
3
4 module T11990a where
5
6 import GHC.TypeLits
7 import Data.Proxy
8
9 type family PartialTF t :: Symbol where
10 PartialTF Int = "Int"
11 PartialTF Bool = "Bool"
12 PartialTF a = TypeError (Text "Unexpected type @ PartialTF: "
13 :<>: ShowType a)
14
15 testPartialTF :: forall a.(KnownSymbol (PartialTF a)) => a -> String
16 testPartialTF t = symbolVal (Proxy :: Proxy (PartialTF a))
17
18 t1 = testPartialTF 'a'
19
20 {- Above code rightly fails with the following error:
21 • Unexpected type: Char
22 • In the expression: testPartialTF 'a'
23 In an equation for ‘t1’: t1 = testPartialTF 'a'
24 -}