[GHC] #15521: Provide a strict version of sum

GHC ghc-devs at haskell.org
Wed Aug 15 19:33:11 UTC 2018


#15521: Provide a strict version of sum
-------------------------------------+-------------------------------------
        Reporter:  dnadales          |                Owner:  (none)
            Type:  feature request   |               Status:  new
        Priority:  normal            |            Milestone:  8.6.1
       Component:  Prelude           |              Version:  8.4.3
      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:                    |
-------------------------------------+-------------------------------------

Comment (by svenpanne):

 Be careful, you're mixing things up here, because there are actually 3
 different `sum`s:

 * In `Prelude`: This must behave like the definition on p. 121 from the
 report mentioned above.
 * In `Data.List`: The report doesn't state anything regarding strictness,
 but following the principle of least surprise, this should better behave
 like `Prelude.sum`. Note that GHC 7.10 (i.e. `base` 4.8) generalized the
 signature a bit.
 * In `Data.Foldable`: Basically the same holds here as for the previous
 item.

 Note that I'm not saying that the current strictness behavior of `sum` is
 a brilliant idea, but it's basically far too late to change this. Doing
 such a change would definitely wreak havoc in the package ecosystem,
 because it is not even reflected by a change in the signature.

-- 
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/15521#comment:5>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list