How to convert text to byte builder?

The blaze-builder package introduces the .Char.Utf8 module, which includes fromText and fromLazyText to efficiently convert a value from a text package to a blaze-builder Builder value. However, with the new Builder API in bytestring such a function does not exist (since bytestring does not depend on text ). We could unpack the text values ​​and use stringUtf8 , but that would almost certainly be much slower.

Another option is to use blaze-builder , which is now actually a wrapper like bytestring Builder , but I'm wondering if there is a more idiomatic way to get closer to this.

+5
source share
1 answer

You can use encodeUtf8Builder and the corresponding function for lazy text .

+3
source

All Articles