[GHC] #13280: Consider deriving more Foldable methods

GHC ghc-devs at haskell.org
Wed Mar 22 05:35:06 UTC 2017


#13280: Consider deriving more Foldable methods
-------------------------------------+-------------------------------------
        Reporter:  dfeuer            |                Owner:  dfeuer
            Type:  task              |               Status:  new
        Priority:  normal            |            Milestone:  8.2.1
       Component:  Compiler          |              Version:  8.0.1
      Resolution:                    |             Keywords:  deriving-perf
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  Runtime           |  Unknown/Multiple
  performance bug                    |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by dfeuer):

 Note about `length`, so I don't forget:

 For the nested case,

 {{{#!hs
 Con ... f (g a) ...
 }}}

 the way to make sure we never do worse than the default `length`
 definition (assuming the recursively called `length` is good) is to use

 {{{#!hs
 length (Con ... fga ...) = ... + foldl' (\acc x -> acc + length x) 0 fga +
 ...
 }}}

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


More information about the ghc-tickets mailing list