diff options
Diffstat (limited to 'testsuite/tests/lib/base')
-rw-r--r-- | testsuite/tests/lib/base/T19691.hs | 33 | ||||
-rw-r--r-- | testsuite/tests/lib/base/all.T | 1 |
2 files changed, 34 insertions, 0 deletions
diff --git a/testsuite/tests/lib/base/T19691.hs b/testsuite/tests/lib/base/T19691.hs new file mode 100644 index 0000000000..0525b8b499 --- /dev/null +++ b/testsuite/tests/lib/base/T19691.hs @@ -0,0 +1,33 @@ +{-# Language DerivingStrategies #-} +{-# Language TypeApplications #-} +{-# Language GADTs #-} +{-# Language StandaloneKindSignatures #-} +{-# Language TypeFamilies #-} + +import Data.Kind +import Type.Reflection + +type Dict :: Constraint -> Type +data Dict cls where + Dict :: cls => Dict cls + +deriving stock + instance Show (Dict cls) + +type WitnessList :: forall k. k -> Type +data WitnessList as where + WitnessList :: Typeable a => WitnessList (f a) + +deriving stock + instance Show (WitnessList as) + +toDict :: TypeRep a -> Dict (Typeable a) +toDict TypeRep = Dict + +witness :: TypeRep as -> Maybe (WitnessList as) +witness (App _ TypeRep) = Just WitnessList + +main :: IO () +main = do + print (toDict (TypeRep @[Int])) + print (witness (TypeRep @[Int])) diff --git a/testsuite/tests/lib/base/all.T b/testsuite/tests/lib/base/all.T index 6bf890c148..170bfe4d85 100644 --- a/testsuite/tests/lib/base/all.T +++ b/testsuite/tests/lib/base/all.T @@ -3,3 +3,4 @@ test('T16586', normal, compile_and_run, ['-O2']) # Event-manager not supported on Windows test('T16916', when(opsys('mingw32'), skip), compile_and_run, ['-O2 -threaded -with-rtsopts="-I0" -rtsopts']) test('T17310', normal, compile, ['']) +test('T19691', normal, compile, [''])
\ No newline at end of file |