good fusion (was Re: inits)

Malcolm Wallace Malcolm.Wallace at cs.york.ac.uk
Mon Apr 10 06:57:17 EDT 2006


"Josef Svenningsson" <josef.svenningsson at gmail.com> wrote:

> On 4/10/06, Simon Marlow <simonmarhaskell at gmail.com> wrote:
> > I propose to replace inits in Data.List with this one.
> >
> Fair enough. But how does it play with list fusion?

I don't know the answer to your question, but it does prompt another one
of my own.

> I know that both
> (:) and zipWith are good producers but how does it work when they are
> composed like this? And how does it compare with the strict version
> which is just a call to zipWith (and must therefore be a good producer
> I assume).

Are the larger sizes of zipWith (zipWith3, zipWith4, ...) also good
producers?  I have some evidence from a recent application I have been
writing that they may not be.  At least, reading the -ddump-simpl
output, it does not seem clear-cut that a pipeline e.g.
    (concat . f . map g . zipWith3 h as bs) cs
is turned into a simple loop, although perhaps I am not reading it
right.  Is there any received wisdom on what should be expected here?

Regards,
    Malcolm


More information about the Libraries mailing list