Proposal: Add {to, from}Strict conversion functions between strict and lazy ByteStrings

wren ng thornton wren at
Sun Oct 30 00:53:38 CEST 2011

On 10/29/11 8:23 AM, Gábor Lehel wrote:
>> Maybe this is bikeshedding and I'm not sure I like it but we could
>> also rename these functions to:
>> toStrict ->  fromLazy
>> fromStrict ->  toLazy
>> Because we nowhere mention the word 'strict' in the bytestring API but
>> we do mention to word 'lazy'.
> In that case, I think they should be in the non-Lazy module?
> ByteString.Lazy.fromLazy/toLazy sound a bit odd... (at a first
> impression, you'd think they were identity functions).

I don't think that sounds too strange. We're defining a new thing (lazy 
ByteStrings) which is a special version of something else more 
"primitive", so we're also defining how to convert the primitive things 
into our special things.

In any case, +1 to adding these functions to the package. I don't know 
how many times I've written them by hand this way...

Live well,

More information about the Libraries mailing list