[GHC] #9848: List.all does not fuse

GHC ghc-devs at haskell.org
Sun Aug 2 03:41:54 UTC 2015


#9848: List.all does not fuse
-------------------------------------+-------------------------------------
        Reporter:  klapaucius        |                   Owner:  ekmett
            Type:  bug               |                  Status:  new
        Priority:  normal            |               Milestone:
       Component:  Core Libraries    |                 Version:  7.9
      Resolution:                    |                Keywords:
Operating System:  Unknown/Multiple  |            Architecture:
 Type of failure:  Runtime           |  Unknown/Multiple
  performance bug                    |               Test Case:
      Blocked By:                    |                Blocking:
 Related Tickets:                    |  Differential Revisions:
-------------------------------------+-------------------------------------

Comment (by akio):

 It looks like the problem is in how `foldMap` for lists is defined.

 Now `all` is defined in terms of `foldMap`, and `foldMap` is defined in
 terms of `foldr`. However, the unfolding for `foldMap` for lists contains
 a recursive function, rather than a reference to `foldr`. This means any
 list function defined in terms of `foldMap` has no chance of fusion.

 Adding an INLINE pragma to the default definition for `foldMap` seems to
 fix the issue.

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


More information about the ghc-tickets mailing list