Reputation: 31315
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.
Upvotes: 5
Views: 2731
Reputation: 13876
You can use encodeUtf8Builder function and the corresponding function for lazy text.
Upvotes: 5