[GHC] #14785: accumArray is too lazy

GHC ghc-devs at haskell.org
Fri Feb 9 18:59:00 UTC 2018


#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


More information about the ghc-tickets mailing list