Commit e782e882 authored by Ben Gamari's avatar Ben Gamari Committed by Ben Gamari
Browse files

Add test for Data.Typeable.typeOf

Test Plan: Validate

Reviewers: goldfire, austin

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D1770

GHC Trac Issues: #11120
parent ac3cf68c
{-# LANGUAGE DataKinds #-}
import Data.Typeable
import GHC.Types
-- Test that Typeable works for various wired-in types.
-- See, for instance, #11120.
main :: IO ()
main = do
print $ typeOf "hello world"
print $ typeOf '4'
print $ typeOf (42 :: Int)
print $ typeOf (42 :: Word)
print $ typeOf (3.1415 :: Double)
print $ typeOf (return () :: IO ())
print $ typeOf ('a', 1::Int, "hello")
print $ typeOf (typeOf "hi")
print $ typeOf True
print $ typeOf EQ
print $ typeOf (id :: Int -> Int)
print $ typeOf (Proxy :: Proxy (Eq Int))
print $ typeOf (Proxy :: Proxy (Int, Int))
print $ typeOf (Proxy :: Proxy "hello world")
print $ typeOf (Proxy :: Proxy 1)
print $ typeOf (Proxy :: Proxy [1,2,3])
print $ typeOf (Proxy :: Proxy 'EQ)
print $ typeOf (Proxy :: Proxy TYPE)
print $ typeOf (Proxy :: Proxy (TYPE 'Lifted))
print $ typeOf (Proxy :: Proxy *)
print $ typeOf (Proxy :: Proxy )
print $ typeOf (Proxy :: Proxy 'Lifted)
print $ typeOf (Proxy :: Proxy (~~))
[Char]
Char
Int
Word
Double
IO ()
(Char,Int,[Char])
TypeRep
Bool
Ordering
Int -> Int
Proxy Constraint (Eq Int)
Proxy Constraint (Int,Int)
Proxy Symbol "hello world"
Proxy Nat 1
Proxy [Nat] (': Nat 1 (': Nat 2 (': Nat 3 '[])))
Proxy Ordering 'EQ
Proxy (Levity -> Constraint) TYPE
Proxy Constraint Constraint
Proxy Constraint Constraint
Proxy Constraint Constraint
Proxy Levity 'Lifted
Proxy (Constraint -> Constraint -> Constraint) ~~
...@@ -113,3 +113,4 @@ test('T9858d', normal, compile_and_run, ['']) ...@@ -113,3 +113,4 @@ test('T9858d', normal, compile_and_run, [''])
test('T10284', exit_code(1), compile_and_run, ['']) test('T10284', exit_code(1), compile_and_run, [''])
test('T11049', exit_code(1), compile_and_run, ['']) test('T11049', exit_code(1), compile_and_run, [''])
test('T11230', normal, compile_and_run, ['']) test('T11230', normal, compile_and_run, [''])
test('TypeOf', normal, compile_and_run, [''])
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment