Commit a0c0c8dc authored by Ian Lynagh's avatar Ian Lynagh
Browse files

Add Word# literals to some tests

parent 0e1b2012
{-# OPTIONS_GHC -fglasgow-exts #-}
import GHC.Exts
data T = C Int# Float# Double# Char# Int Float Double
test = C 1# 1.2# 1.23## 'x'# 1 1.2 1.23
data T = C Int# Word# Float# Double# Char# Int Float Double
test = C 1# 32## 1.2# 1.23## 'x'# 1 1.2 1.23
()
test = C 1 1.2 1.23 'x' 1 1.2 1.23
test = C 1 32 1.2 1.23 'x' 1 1.2 1.23
......@@ -9,8 +9,8 @@ import GHC.Exts
main = do
case curried 9.0## 't'# of
(# i#, u@(), d1#, c1#, f#, d2#, c2# #)
-> print ( I# i#, u, D# d1#, C# c1#, F# f#, D# d2#, C# c2# )
(# i#, u@(), d1#, c1#, f#, w#, d2#, c2# #)
-> print ( I# i#, u, D# d1#, C# c1#, F# f#, W# w#, D# d2#, C# c2# )
print $ map_ ((#,#) True) ['a','b','c']
-- try NOINLINE to make sure the currying isn't eliminated
......@@ -18,8 +18,8 @@ main = do
-- for variety of testing
{-# NOINLINE curried #-}
curried :: Double# -> Char# ->
(# Int#, (), Double#, Char#, Float#, Double#, Char# #)
curried = (#,,,,,,#) 3# () 4.0## 'f'# 5.0#
(# Int#, (), Double#, Char#, Float#, Word#, Double#, Char# #)
curried = (#,,,,,,,#) 3# () 4.0## 'f'# 5.0# 32##
map_ :: (a -> (# b, c #)) -> [a] -> [(b,c)]
map_ f [] = []
......
(3,(),4.0,'f',5.0,9.0,'t')
(3,(),4.0,'f',5.0,32,9.0,'t')
[(True,'a'),(True,'b'),(True,'c')]
......@@ -3,7 +3,7 @@
module Main where
import GHC.Base
import GHC.Exts
import GHC.Float
import Language.Haskell.TH
import Text.PrettyPrint
......@@ -15,6 +15,11 @@ main = do putStrLn $ show $ $( do e <- [| I# 20# |]
runIO $ putStrLn $ pprint e
runIO $ hFlush stdout
return e )
putStrLn $ show $ $( do e <- [| W# 32## |]
runIO $ putStrLn $ show e
runIO $ putStrLn $ pprint e
runIO $ hFlush stdout
return e )
putStrLn $ show $ $( do e <- [| F# 12.3# |]
runIO $ putStrLn $ show e
runIO $ putStrLn $ pprint e
......
AppE (ConE GHC.Base.I#) (LitE (IntPrimL 20))
GHC.Base.I# 20#
AppE (ConE GHC.Word.W#) (LitE (WordPrimL 32))
GHC.Word.W# 32##
AppE (ConE GHC.Float.F#) (LitE (FloatPrimL (123%10)))
GHC.Float.F# 12.3#
AppE (ConE GHC.Float.D#) (LitE (DoublePrimL (123%5)))
......
......@@ -4,7 +4,7 @@
module Main
where
import GHC.Base
import GHC.Exts
import GHC.Float
import Language.Haskell.TH
import Text.PrettyPrint
......@@ -13,6 +13,8 @@ import System.IO
main :: IO ()
main = do putStrLn $ show $ $( do e <- [| I# 20# |]
return e )
putStrLn $ show $ $( do e <- [| W# 32## |]
return e )
putStrLn $ show $ $( do e <- [| F# 12.3# |]
return e )
putStrLn $ show $ $( do e <- [| D# 24.6## |]
......
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