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

GHC ghc-devs at haskell.org
Thu Aug 16 10:05:32 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 sjakobi):

 Adding a strict `sum'` function would fit well with the planned addition
 of `foldMap'` to `Foldable`: Phab:D4924

 I don't think it's necessary to add `sum'` as `Foldable` method though:
 Just adding it as function to `Data.Foldable` should be good enough.

 An alternative implementation would be

 {{{
 sum' = getSum #. foldMap' Sum
 }}}

 but I don't currently see any advantages to this version.

 Furthermore, if we add `sum'`, we should also add `product'` for
 consistency.

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


More information about the ghc-tickets mailing list