summaryrefslogtreecommitdiff
path: root/testsuite/tests/deSugar/should_compile/ds040.hs
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/tests/deSugar/should_compile/ds040.hs')
-rw-r--r--testsuite/tests/deSugar/should_compile/ds040.hs18
1 files changed, 18 insertions, 0 deletions
diff --git a/testsuite/tests/deSugar/should_compile/ds040.hs b/testsuite/tests/deSugar/should_compile/ds040.hs
new file mode 100644
index 0000000000..c99f5fab63
--- /dev/null
+++ b/testsuite/tests/deSugar/should_compile/ds040.hs
@@ -0,0 +1,18 @@
+
+{-# LANGUAGE NPlusKPatterns #-}
+
+module ShouldCompile where
+
+-- !!! Another bug in overloaded n+k patts
+--
+
+main = print ((4::Int) ^^^^ (6::Int))
+
+(^^^^) :: (Num a, Integral b) => a -> b -> a
+x ^^^^ 0 = 1
+x ^^^^ (n+1) = f x n x
+ where f _ 0 y = y
+ f x n y = g x n where
+ g x n | even n = g (x*x) (n `quot` 2)
+ | otherwise = f x (n-1) (x*y)
+_ ^^^^ _ = error "(^^^^){Prelude}: negative exponent"