On Sun, Jun 5, 2011 at 11:00 AM, Yitzchak Gale <gale@sefer.org> wrote:
If behind the scenes the concat is copying directly from slices of the original
input, then no, in principle we're not saving much then.
I thought there were *two* copies going on.
If you're using the specialised functions like attoparsec's takeWhile, then all they do is return a view into the underlying array. No copying occurs until the concat itself. Now that I think of it: in principle, you could write a specialised concat that would check the pointer/offset/length combinations of its arguments and, if they all abutted perfectly, would just return a new view into that same array, sans copying. (You'd have to hide it behind unsafePerformIO, of course.)