import System.Time( getClockTime ) add_up 0 acc = acc add_up n acc = add_up (n - 1) (acc + n) time = getClockTime >>= print >> return "" main = do time print (add_up 10000000 0) time print (add_up 5000000 0) time print (add_up 10000000 0) time return () {- c:\ghc\ghc-6.4\code>ghc 493959.hs c:\ghc\ghc-6.4\code>main Thu Sep 22 17:57:10 GMT Daylight Time 2005 Heap exhausted; Current maximum heap size is 268435456 bytes (256 Mb); use `+RTS -M' to increase it. c:\ghc\ghc-6.4\code>main Thu Sep 22 17:58:10 GMT Daylight Time 2005 50000005000000 Thu Sep 22 17:58:13 GMT Daylight Time 2005 12500002500000 Thu Sep 22 17:58:15 GMT Daylight Time 2005 50000005000000 Thu Sep 22 17:58:15 GMT Daylight Time 2005 -}