[GHC] #9339: last is not a good consumer
GHC
ghc-devs at haskell.org
Mon Jul 21 16:11:49 UTC 2014
#9339: last is not a good consumer
-------------------------------------+-------------------------------------
Reporter: dfeuer | Owner:
Type: bug | Status: new
Priority: normal | Milestone:
Component: | Version: 7.8.3
libraries/base | Keywords:
Resolution: | Operating System: Unknown/Multiple
Differential Revisions: | Type of failure: Runtime
Architecture: | performance bug
Unknown/Multiple | Test Case:
Difficulty: Unknown | Blocking:
Blocked By: |
Related Tickets: |
-------------------------------------+-------------------------------------
Comment (by dfeuer):
Replying to [comment:3 nomeata]:
> > That looks wonderful. Is it certain to be changed to a foldl' in
cases where it doesn't fuse?
>
> Hopefully not. `foldl'` would force the accumulator, which we do *not*
want here (otherwise the `undefined` would be forced, or `last [undefined,
1]` would not work).
Yes, you're right. I got mixed up a bit.
> I didn’t do further testing with that idea, it just crossed my mind. It
maybe the that this implementation is only good when fusing works – would
you mind trying to find out?
I don't have anything beyond 7.8.3, and on 7.8.3 your code doesn't fuse.
Could you maybe try it?
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9339#comment:4>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list