[GHC] #9132: takeWhile&C. still not fusible

GHC ghc-devs at haskell.org
Sun Jun 8 08:33:50 UTC 2014


#9132: takeWhile&C. still not fusible
-------------------------------------+-------------------------------------
        Reporter:  Blaisorblade      |            Owner:  skeuchel
            Type:  bug               |           Status:  new
        Priority:  normal            |        Milestone:
       Component:  libraries/base    |          Version:  7.8.2
      Resolution:                    |         Keywords:  fusion
Operating System:  Unknown/Multiple  |     Architecture:  Unknown/Multiple
 Type of failure:  Runtime           |       Difficulty:  Moderate (less
  performance bug                    |  than a day)
       Test Case:                    |       Blocked By:
        Blocking:                    |  Related Tickets:
-------------------------------------+-------------------------------------

Comment (by Blaisorblade):

 @nomeata: while @skeuchel is the owner, I'm the OP. Thanks for explaining
 me why fusing `dropWhile` is important.

 Was your comment addressed at the branch I posted, or is there some other
 work from skeuchel? (I saw the [private communication] and didn't get it
 either).

 In case it is relevant, it seems to me harder to fuse dropWhile.

 Writing dropWhile as a fold is harder (technically, because it is not a
 catamorphism but a paramorphism). When the predicate fails, you want to
 return the rest of the list without processing it, but the original list
 is not available:

 dropWhileF p c n x xs = if p x then xs else <REST LIST, including x and xs
 before processing>

 I see that can be accomplished using, in essence, the reader monad: make
 the fold produce a function taking the list as extra argument. However, I
 understand that's often not a good idea, or even a non-starter, for
 performance. So, what's the way forward?

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


More information about the ghc-tickets mailing list