summaryrefslogtreecommitdiff
path: root/testsuite/tests/perf/should_run/T876.hs
blob: 398859f86da814971a1e3e0925196445fdbe1db9 (plain)
1
2
3
4
5
6
7
8
9
10
11
-- This test allocates a lot more if length is
-- not a good consumer

module Main where
import System.Environment (getArgs)

foo :: Int -> Int
foo n = sum [ length [i..n] | i <- [1..n] ]

main = do { [arg] <- getArgs
          ; print (foo (read arg)) }