Would it be a good or bad idea to make dropWhile try to fuse?

Joachim Breitner mail at joachim-breitner.de
Sat Jul 26 08:34:28 UTC 2014


Am Freitag, den 25.07.2014, 00:35 -0400 schrieb David Feuer:
> This is generally awful, because it could copy a large portion of the
> list with no benefit. However, if it fuses, it will sometimes give
> good results. For example, compiling
> f m n = foldr (+) 0 $ dropWhile (<m) $ map (+1) [1..n]
> yields Core that does not produce a intermediate list. Does anyone
> have any thoughts about whether this one is worth pursuing?

in general, I’d be doubtful about this. 

I guess it shouldn’t happen unless it fuses on both sides (as then there
is no sharing, is it?) which is probably not easily expressible with


Joachim Breitner
  e-Mail: mail at joachim-breitner.de
  Homepage: http://www.joachim-breitner.de
  Jabber-ID: nomeata at joachim-breitner.de

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part
URL: <http://www.haskell.org/pipermail/libraries/attachments/20140726/f2bfd80e/attachment.sig>

More information about the Libraries mailing list