Fold integer-simple.git into ghc.git (re #8545)
[ghc.git] / testsuite / tests / perf / should_run / T7436.hs
1 {-# LANGUAGE DeriveFunctor, DeriveFoldable #-}
2 module Main where
3
4 import Prelude hiding (foldr)
5 import Data.Foldable
6
7 data List a = Nil | Cons a (List a)
8 deriving (Functor, Foldable)
9
10 mkList :: Int -> List Int
11 mkList 0 = Nil
12 mkList n = Cons n (mkList (n-1))
13
14 main :: IO ()
15 main = print $ foldr (\x y -> y) "end" (mkList n)
16 where n = 40000
17 -- Increase this to increase the difference between good and bad
18 -- Eg 6000 takes a lot longer
19 -- The biggest difference is not allocation or bytes used,
20 -- but execution time!
21
22