
Hi, Am Montag, den 17.02.2014, 10:22 +0000 schrieb Simon Marlow:
This worries me a bit. If foldl isn't inlined, I get a less efficient version, so it has to be inlined everywhere. So -O0 code gets worse, and binary sizes for -O1+ get bigger - foldl, sum, and product are now INLINE.
What I'm arguing is that we should have more flexibility to *not* inline things (INLINABLE is much better than INLINE), and when not inlining things we should be calling an efficient version of the function. This is why map is not defined in terms of foldr, for instance.
so you are arguing that we should do what is done for map, i.e. have the old definition for foldl, make foldl k z0 xs = foldr (\v fn z -> fn (k z v)) id xs z0 a RULE [~0] and have another RULE [0] that does foldr (\v fn z -> fn (k z v)) id xs z0 = foldl k z0 xs Is that right? Greetings, Joachim -- Joachim “nomeata” Breitner mail@joachim-breitner.de • http://www.joachim-breitner.de/ Jabber: nomeata@joachim-breitner.de • GPG-Key: 0x4743206C Debian Developer: nomeata@debian.org