File tree Expand file tree Collapse file tree 1 file changed +12
-4
lines changed
Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change 1- -- The result of this example doesn't change whether with or without Strict.
21{-
32 stack exec ghc -- -O0 -rtsopts -with-rtsopts=-K1k ./stackoverflow.hs
43 stack exec ghc -- -O0 -rtsopts -with-rtsopts=-K1k -XStrict ./stackoverflow.hs
4+ stack exec ghc -- -O1 -rtsopts -with-rtsopts=-K1k ./stackoverflow.hs
5+ stack exec ghc -- -O1 -rtsopts -with-rtsopts=-K1k -XStrict ./stackoverflow.hs
56-}
67
78import Control.Exception
9+ import Data.List
810
911main :: IO ()
1012main = do
11- let size = 50000
12- evaluate $ foldr (\ x z -> x : z) [] [1 .. size]
13- putStrLn " DONE: foldr"
13+ let size = 5000
14+ putStrLn " BEGIN"
15+
16+ evaluate $ foldr (:) [] [1 .. size]
17+ putStrLn " DONE: foldr 1"
18+
1419 evaluate $ foldl (\ z x -> x : z) [] [1 .. size]
1520 putStrLn " DONE: foldl"
21+
22+ evaluate $ foldr (\ x z -> x : z) [] [1 .. size]
23+ putStrLn " DONE: foldr 2"
You can’t perform that action at this time.
0 commit comments