Embrace -XTypeInType, add -XStarIsType
[ghc.git] / testsuite / tests / typecheck / should_run / TypeOf.hs
1 {-# LANGUAGE DataKinds, UnicodeSyntax #-}
2
3 import Data.Typeable
4 import GHC.Types
5
6 -- Test that Typeable works for various wired-in types.
7 -- See, for instance, #11120.
8
9 main :: IO ()
10 main = do
11 print $ typeOf "hello world"
12 print $ typeOf '4'
13 print $ typeOf (42 :: Int)
14 print $ typeOf (42 :: Word)
15 print $ typeOf (3.1415 :: Double)
16 print $ typeOf (return () :: IO ())
17 print $ typeOf ('a', 1::Int, "hello")
18 print $ typeOf (typeOf "hi")
19 print $ typeOf True
20 print $ typeOf EQ
21 print $ typeOf (id :: Int -> Int)
22
23 print $ typeOf (Proxy :: Proxy (Eq Int))
24 print $ typeOf (Proxy :: Proxy (Int, Int))
25 print $ typeOf (Proxy :: Proxy "hello world")
26 print $ typeOf (Proxy :: Proxy 1)
27 print $ typeOf (Proxy :: Proxy [1,2,3])
28 print $ typeOf (Proxy :: Proxy 'EQ)
29 print $ typeOf (Proxy :: Proxy TYPE)
30 print $ typeOf (Proxy :: Proxy (TYPE 'LiftedRep))
31 print $ typeOf (Proxy :: Proxy *)
32 print $ typeOf (Proxy :: Proxy ★)
33 print $ typeOf (Proxy :: Proxy 'LiftedRep)
34 print $ typeOf (Proxy :: Proxy '(1, "hello"))
35 print $ typeOf (Proxy :: Proxy (~~))