Re: [GHC] #3474: Add a strict variant of iterate to Data.List

#3474: Add a strict variant of iterate to Data.List -------------------------------------+------------------------------------- Reporter: mux | Owner: (none) Type: proposal | Status: new Priority: normal | Milestone: 8.2.2 Component: libraries/base | Version: 6.10.4 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by winter): * status: closed => new * resolution: wontfix => * milestone: Not GHC => 8.2.2 Comment: Today a friend asked me the exactly problem, i.e. why `iterate (+1) 1 !! 100000000` cost 8G ram. This is surprising because most people are expecting GC should chase the list and the whole computation should run in O(1) space. But as soon as i checked the definition of `iterate`, i realize it's no possible to run in O(1) space, we're simply not forcing the `f (f ... (f x))` chain at all. So i came to this ticket. Adding `iterate'` may not be enough: we have to add document to notify people to watch out! -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/3474#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC