summaryrefslogtreecommitdiff
path: root/testsuite/tests/simplCore/should_compile/T9441b.hs
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/tests/simplCore/should_compile/T9441b.hs')
-rw-r--r--testsuite/tests/simplCore/should_compile/T9441b.hs15
1 files changed, 15 insertions, 0 deletions
diff --git a/testsuite/tests/simplCore/should_compile/T9441b.hs b/testsuite/tests/simplCore/should_compile/T9441b.hs
new file mode 100644
index 0000000000..464c96e63f
--- /dev/null
+++ b/testsuite/tests/simplCore/should_compile/T9441b.hs
@@ -0,0 +1,15 @@
+module T9441b where
+
+f1 :: Integer -> Integer
+f1 n
+ | n <= 1 = 1
+ | otherwise = go n 1
+ where
+ go 0 r = r
+ go m r = go (m - 1) (r * m)
+
+f2 :: Integer -> Integer
+f2 n = go n 1
+ where
+ go 0 s = s
+ go p s = go (p - 1) (s * p)