Update Trac ticket URLs to point to GitLab
[ghc.git] / testsuite / tests / perf / should_run / T149_A.hs
1 module Main (main) where
2
3 -- See #149
4
5 -- Currently (with GHC 7.0) the CSE works, just,
6 -- but it's delicate.
7
8
9 import System.CPUTime
10
11 main :: IO ()
12 main = print $ playerMostOccur1 [1..m]
13
14 m :: Int
15 m = 22
16
17 playerMostOccur1 :: [Int] -> Int
18 playerMostOccur1 [a] = a
19 playerMostOccur1 (x:xs)
20 | numOccur x (x:xs) > numOccur (playerMostOccur1 xs) xs = x
21 | otherwise = playerMostOccur1 xs
22
23 numOccur :: Int -> [Int] -> Int
24 numOccur i is = length is
25