summaryrefslogtreecommitdiff
path: root/test.hs
diff options
context:
space:
mode:
Diffstat (limited to 'test.hs')
-rw-r--r--test.hs21
1 files changed, 21 insertions, 0 deletions
diff --git a/test.hs b/test.hs
new file mode 100644
index 0000000000..0aa6d51f51
--- /dev/null
+++ b/test.hs
@@ -0,0 +1,21 @@
+{-# LANGUAGE MagicHash #-}
+
+module Lib (g) where
+
+import GHC.Exts
+import Data.Int
+
+{-# RULES
+ "blah" forall x . case f x of (I# a, _) -> e = case sf x of a -> e
+#-}
+
+f :: Int -> (Int, Int)
+f x = (sum [0..x], sum [1..2*x])
+{-# NOINLINE f #-}
+
+sf :: Int -> Int#
+sf x = case sum [0..x] of I# a -> a
+{-# NOINLINE sf #-}
+
+g :: Int
+g = case f 42 of (a, _) -> a + 1