summaryrefslogtreecommitdiff
path: root/testsuite/tests/parser/should_run/readRun004.hs
diff options
context:
space:
mode:
authorDavid Terei <davidterei@gmail.com>2011-07-20 11:09:03 -0700
committerDavid Terei <davidterei@gmail.com>2011-07-20 11:26:35 -0700
commit16514f272fb42af6e9c7674a9bd6c9dce369231f (patch)
treee4f332b45fe65e2a7a2451be5674f887b42bf199 /testsuite/tests/parser/should_run/readRun004.hs
parentebd422aed41048476aa61dd4c520d43becd78682 (diff)
downloadhaskell-16514f272fb42af6e9c7674a9bd6c9dce369231f.tar.gz
Move tests from tests/ghc-regress/* to just tests/*
Diffstat (limited to 'testsuite/tests/parser/should_run/readRun004.hs')
-rw-r--r--testsuite/tests/parser/should_run/readRun004.hs28
1 files changed, 28 insertions, 0 deletions
diff --git a/testsuite/tests/parser/should_run/readRun004.hs b/testsuite/tests/parser/should_run/readRun004.hs
new file mode 100644
index 0000000000..5e6545adb1
--- /dev/null
+++ b/testsuite/tests/parser/should_run/readRun004.hs
@@ -0,0 +1,28 @@
+{-# LANGUAGE UnboxedTuples, MagicHash #-}
+
+-- should_run to make sure linking succeeds
+-- (curried unboxed tuples with both boxed
+-- and unboxed components).
+-- See Trac #1509; also Note [Primop wrappers] in Id.lhs
+
+import GHC.Exts
+
+main = do
+ case curried 9.0## 't'# of
+ (# 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
+-- too soon, but also test the other one without NOINLINE
+-- for variety of testing
+{-# NOINLINE curried #-}
+curried :: Double# -> Char# ->
+ (# Int#, (), Double#, Char#, Float#, Word#, Double#, Char# #)
+curried = (#,,,,,,,#) 3# () 4.0## 'f'# 5.0# 32##
+
+map_ :: (a -> (# b, c #)) -> [a] -> [(b,c)]
+map_ f [] = []
+map_ f (a:as) = case f a of
+ (# b, c #) -> (b, c) : map_ f as
+