blob: 9a3167047f98e43513a721c4150ff41658cc2adf (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
{-# LANGUAGE DataKinds, TypeOperators, TypeFamilies #-}
{-# LANGUAGE UndecidableInstances, ScopedTypeVariables, FlexibleContexts #-}
module T11990b where
import GHC.TypeLits
import Data.Proxy
type family PartialTF t :: Symbol where
PartialTF Int = "Int"
PartialTF Bool = "Bool"
PartialTF a = TypeError (Text "Unexpected type @ PartialTF: "
:<>: ShowType a)
type family NestedPartialTF (tsym :: Symbol) :: Symbol where
NestedPartialTF "Int" = "int"
NestedPartialTF "Bool" = "bool"
NestedPartialTF a =
TypeError (Text "Unexpected type @ NestedPartialTF: " :<>: ShowType a)
testPartialTF :: forall a.(KnownSymbol (PartialTF a)) => a -> String
testPartialTF t = symbolVal (Proxy :: Proxy (PartialTF a))
testNesPartialTF ::
forall a.(KnownSymbol (NestedPartialTF (PartialTF a))) => a -> String
testNesPartialTF t = symbolVal (Proxy :: Proxy (NestedPartialTF (PartialTF a)))
t2 = testNesPartialTF 'a'
|