Tweaks and typos in manual, note refs, comments
[ghc.git] / testsuite / tests / typecheck / should_fail / T11990b.hs
1 {-# LANGUAGE DataKinds, TypeOperators, TypeFamilies #-}
2 {-# LANGUAGE UndecidableInstances, ScopedTypeVariables, FlexibleContexts #-}
3
4 module T11990b 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 type family NestedPartialTF (tsym :: Symbol) :: Symbol where
16 NestedPartialTF "Int" = "int"
17 NestedPartialTF "Bool" = "bool"
18 NestedPartialTF a =
19 TypeError (Text "Unexpected type @ NestedPartialTF: " :<>: ShowType a)
20
21 testPartialTF :: forall a.(KnownSymbol (PartialTF a)) => a -> String
22 testPartialTF t = symbolVal (Proxy :: Proxy (PartialTF a))
23
24 testNesPartialTF ::
25 forall a.(KnownSymbol (NestedPartialTF (PartialTF a))) => a -> String
26 testNesPartialTF t = symbolVal (Proxy :: Proxy (NestedPartialTF (PartialTF a)))
27
28 t2 = testNesPartialTF 'a'