[GHC] #15521: Provide a strict version of sum
GHC
ghc-devs at haskell.org
Wed Aug 15 17:35:21 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 ulysses4ever):
Replying to [comment:1 f-a]:
> Is there any occourrence when using a lazy `sum` is more appropriate
than using its stricter version?
One might go with a usual non-termination argument: if you have divergent
computation inside your list AND you don't actually use the result of
`sum`, then you get a different behaviour. Similar argument applies for
“expensive” computation inside the list.
Also, Haskell Report (the Haskell standard) says that `sum` should behave
lazily (AFAIK). So, changing the behavior of `sum` seems a bit of extreme
to me. I'd rather argue for adding `sum' / product'` to `Prelude`.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/15521#comment:2>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list