
You might also look at Data.Rope from the rope library, which provides an
O(1) append for strict bytestring chunks, and the ability to decode UTF-8
chars from the result.
http://hackage.haskell.org/packages/archive/rope/0.6.1/doc/html/Data-Rope.ht...
I'd also be happy to work with you if the current API falls short of your
needs.
-Edward Kmett
On Thu, Jun 3, 2010 at 10:03 AM, Kevin Jardine
(I've done a basic Google search on this with no results. Apologies if this has been asked before.)
I am coding a web application in which the content is a Unicode string built up over multiple functions and maintained in a State structure.
I gather that the String module is inefficient and that Data.Text would be a better choice.
Is it more efficient to build up a list of Text objects over time and combine them together with a single Data.Text.concat for the final output or to run Data.Text.append for each new string so that I am maintaining a single Text object rather than a list?
As Data.Text.append requires copying both strings each time, my gut feeling is that concat would be much more efficient, but Haskell has surprised me before, so I wanted to check.
Kevin
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe