The blaze-builder
package provides a .Char.Utf8
module which includes fromText
and fromLazyText
for efficiently converting a value from the text package into a blaze-builder
Builder
value. With the new Builder API in bytestring
, however, no such function exists (since bytestring
does not depend on text
). We could unpack the Text
values and use stringUtf8
, but that's almost certain to be much slower.
Another option would be to use blaze-builder
, which is now actually just a wrapper around bytestring
's Builder
type, but I'm wondering if there's a more idiomatic way of approaching this.
You can use encodeUtf8Builder function and the corresponding function for lazy text.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With