summaryrefslogtreecommitdiff
path: root/testsuite/tests/ghci/should_run/ghcirun003.hs
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/tests/ghci/should_run/ghcirun003.hs')
-rw-r--r--testsuite/tests/ghci/should_run/ghcirun003.hs50
1 files changed, 50 insertions, 0 deletions
diff --git a/testsuite/tests/ghci/should_run/ghcirun003.hs b/testsuite/tests/ghci/should_run/ghcirun003.hs
new file mode 100644
index 0000000000..1087188305
--- /dev/null
+++ b/testsuite/tests/ghci/should_run/ghcirun003.hs
@@ -0,0 +1,50 @@
+
+module Main (main) where
+
+main :: IO ()
+main = print ok
+
+ok :: Bool
+ok = map foo [10..72] == map bar [10..72]
+
+foo :: Int -> [Int]
+foo 12 = [12, 13, 14, 15, 16, 17]
+foo 14 = [14, 15, 16, 17, 18, 19]
+foo 16 = [16, 17, 18, 19, 20, 21]
+foo 18 = [18, 19, 20, 21, 22, 23]
+foo n | n == 20 = [20, 30, 40, 50, 60, 70, 80]
+foo 22 = [22, 23, 24, 25, 26, 27]
+foo 24 = [24, 25, 26, 27, 28, 29]
+foo 26 = [26, 27, 28, 29, 30, 31]
+foo 28 = [28, 29, 30, 31, 32, 33]
+foo n | n == 30 = [30, 40, 50, 60, 70, 80, 90]
+foo 32 = [32, 33, 34, 35, 36, 37]
+foo 34 = [34, 35, 36, 37, 38, 39]
+foo 36 = [36, 37, 38, 39, 40, 41]
+foo 38 = [38, 39, 40, 41, 42, 43]
+foo n | n == 40 = [40, 50, 60, 70, 80, 90, 100]
+foo 42 = [42, 43, 44, 45, 46, 47]
+foo 44 = [44, 45, 46, 47, 48, 49]
+foo 46 = [46, 47, 48, 49, 50, 51]
+foo 48 = [48, 49, 50, 51, 52, 53]
+foo n | n == 50 = [50, 60, 70, 80, 90, 100, 110]
+foo 52 = [52, 53, 54, 55, 56, 57]
+foo 54 = [54, 55, 56, 57, 58, 59]
+foo 56 = [56, 57, 58, 59, 60, 61]
+foo 58 = [58, 59, 60, 61, 62, 63]
+foo n | n == 60 = [60, 70, 80, 90, 100, 110, 120]
+foo 62 = [62, 63, 64, 65, 66, 67]
+foo 64 = [64, 65, 66, 67, 68, 69]
+foo 66 = [66, 67, 68, 69, 70, 71]
+foo 68 = [68, 69, 70, 71, 72, 73]
+foo n | n == 70 = [70, 80, 90, 100, 110, 120, 130]
+foo _ = []
+
+bar :: Int -> [Int]
+bar n
+ | odd n = []
+ | n < 12 = []
+ | n > 70 = []
+ | n `mod` 10 == 0 = take 7 $ iterate (+ 10) n
+ | otherwise = take 6 $ iterate (+ 1) n
+