[GHC] #10830: maximumBy has a space leak

GHC ghc-devs at haskell.org
Tue Sep 22 13:43:10 UTC 2015


#10830: maximumBy has a space leak
-------------------------------------+-------------------------------------
        Reporter:  NeilMitchell      |                   Owner:
            Type:  bug               |                  Status:  new
        Priority:  normal            |               Milestone:  7.10.3
       Component:  libraries/base    |                 Version:  7.10.2
      Resolution:                    |                Keywords:
Operating System:  Windows           |            Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |               Test Case:
      Blocked By:                    |                Blocking:
 Related Tickets:                    |  Differential Revisions:  Phab:D1205
-------------------------------------+-------------------------------------

Comment (by NeilMitchell):

 It's pretty rare that you are using `maximumBy` with a custom function and
 the result type is {{{Int}}} or {{{Integer}}} - typically you'd just use
 {{{minimum}}} or {{{maximum}}} directly - so I don't think special cases
 are likely to be of any benefit. I think using {{{foldl1}}} is the only
 way to reduce the space leak, which is what happened in base-4.7 for
 Data.List. The Foldable variants have always been foldr1, but maybe that's
 a bug in Foldable? It's certainly a BBP regression.

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


More information about the ghc-tickets mailing list