[GHC] #14785: accumArray is too lazy
#14785: accumArray is too lazy -------------------------------------+------------------------------------- Reporter: dfeuer | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: 8.6.1 Component: Core | Version: 8.2.2 Libraries | Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: Other Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- According to the documentation, {{{#!hs -- If the accumulating function is strict, then 'accumArray' is strict in -- the values, as well as the indices, in the association list. Thus, -- unlike ordinary arrays built with 'array', accumulated arrays should -- not in general be recursive. }}} I believe that strictness is desirable, because it prevents thunks from accumulating when we use the passed function. But the strictness isn't actually there! We never force the result of the function. I believe we should fix the code (and documentation) to maintain the invariant that all elements in the result of `accumArray` are in WHNF. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14785> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#14785: accumArray is too lazy -------------------------------------+------------------------------------- Reporter: dfeuer | Owner: (none) Type: bug | Status: patch Priority: normal | Milestone: 8.6.1 Component: Core Libraries | Version: 8.2.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Other | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D4403 Wiki Page: | -------------------------------------+------------------------------------- Changes (by dfeuer): * status: new => patch * differential: => Phab:D4403 Comment: I have emailed the [https://mail.haskell.org/pipermail/libraries/2018-February/028509.html libraries list] and the CLC. In the mean time, I've uploaded a differential. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14785#comment:1> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#14785: accumArray is too lazy -------------------------------------+------------------------------------- Reporter: dfeuer | Owner: (none) Type: bug | Status: patch Priority: normal | Milestone: 8.6.1 Component: Core Libraries | Version: 8.2.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Other | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D4403 Wiki Page: | -------------------------------------+------------------------------------- Comment (by Ben Gamari <ben@…>): In [changeset:"08345bd0e8d237ec3929aaee7613c4f76e07e131/ghc" 08345bd/ghc]: {{{ #!CommitTicketReference repository="ghc" revision="08345bd0e8d237ec3929aaee7613c4f76e07e131" Make accumArray and accum stricter `accumArray` was lazier than documented. `accum` did not have documented strictness. The extra laziness allowed thunks to build up in the array. Force the results of applying the accumulating function to resolve. Reviewers: hvr, bgamari Reviewed By: bgamari Subscribers: alpmestan, rwbarton, thomie, carter GHC Trac Issues: #14785 Differential Revision: https://phabricator.haskell.org/D4403 }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14785#comment:2> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#14785: accumArray is too lazy -------------------------------------+------------------------------------- Reporter: dfeuer | Owner: (none) Type: bug | Status: closed Priority: normal | Milestone: 8.6.1 Component: Core Libraries | Version: 8.2.2 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Other | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D4403 Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * status: patch => closed * resolution: => fixed -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14785#comment:3> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
participants (1)
-
GHC