summaryrefslogtreecommitdiff
path: root/tests/examples/ghc86/TH_repPrim2.hs
blob: 8ab2c84fb3008a970f7ad0aa8a19783ecfb5ea53 (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
29
30
31
32
33
34
{-# LANGUAGE MagicHash, UnboxedTuples #-}
{-# LANGUAGE TemplateHaskell #-}
-- test the representation of unboxed literals

module Main where

import GHC.Exts
import GHC.Float
import Language.Haskell.TH
import Text.PrettyPrint
import System.IO

main :: IO ()
main = do putStrLn $ show $ $( do e <- [| 20# |]
                                  runIO $ putStrLn $ show e
                                  runIO $ putStrLn $ pprint e
                                  runIO $ hFlush stdout
                                  [| I# $( return e) |] )
          putStrLn $ show $ $( do e <- [| 32## |]
                                  runIO $ putStrLn $ show e
                                  runIO $ putStrLn $ pprint e
                                  runIO $ hFlush stdout
                                  [| W# $(return e) |] )
          putStrLn $ show $ $( do e <- [| 12.3# |]
                                  runIO $ putStrLn $ show e
                                  runIO $ putStrLn $ pprint e
                                  runIO $ hFlush stdout
                                  [| F# $(return e) |] )
          putStrLn $ show $ $( do e <- [| 24.6## |]
                                  runIO $ putStrLn $ show e
                                  runIO $ putStrLn $ pprint e
                                  runIO $ hFlush stdout
                                  [| D# $(return e) |] )