<div class="gmail_quote">On Sun, Jun 5, 2011 at 11:00 AM, Yitzchak Gale <span dir="ltr">&lt;<a href="mailto:gale@sefer.org">gale@sefer.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im">If behind the scenes the concat is copying directly from slices of the original</div>
input, then no, in principle we&#39;re not saving much then.<br>
I thought there were *two* copies going on.<br></blockquote><div><br></div><div>If you&#39;re using the specialised functions like attoparsec&#39;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&#39;d have to hide it behind unsafePerformIO, of course.)</div>
</div>