I'm writing some code that is rendering an HTML page (via servant
, if that's relevant), and for various complicated reasons, I have to construct the HTML by "combining" two segments.
- One segment is fetched from an internal HTTP API which returns a
Data.ByteString.Lazy
- The other segment is rendered using the
ede
library, which generates aData.Text.Lazy
What options do I have if I have to combine these two segments efficiently? The two segments can be reasonably large (few 100 kbs each). This servant
server is going to see quite some traffic, so any inefficiency (like copying 100s of kbs of memory for every req/res, will quickly add up).