summaryrefslogtreecommitdiff
path: root/testsuite/tests/indexed-types/should_compile/ATLoop.hs
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/tests/indexed-types/should_compile/ATLoop.hs')
-rw-r--r--testsuite/tests/indexed-types/should_compile/ATLoop.hs22
1 files changed, 22 insertions, 0 deletions
diff --git a/testsuite/tests/indexed-types/should_compile/ATLoop.hs b/testsuite/tests/indexed-types/should_compile/ATLoop.hs
new file mode 100644
index 0000000000..19f9e5b8a2
--- /dev/null
+++ b/testsuite/tests/indexed-types/should_compile/ATLoop.hs
@@ -0,0 +1,22 @@
+{-# OPTIONS_GHC -O2 #-}
+
+-- Reading the interface file caused a black hole
+-- in earlier versions of GHC
+
+-- Also, foo should compile to very tight code with -O2
+-- (The O2 was nothing to do with the black hole though.)
+
+module ShouldCompile where
+
+import ATLoop_help
+
+foo :: FooT Int -> Int -> Int
+foo t n = t `seq` bar n
+ where
+ bar 0 = 0
+ bar n | even n = bar (n `div` 2)
+ bar n = bar (n - int t)
+
+
+
+