Proposal: Add NFData instances for strict and lazy ByteStrings

Bas van Dijk v.dijk.bas at gmail.com
Fri Nov 4 11:36:49 CET 2011


On 26 October 2011 21:34, Bas van Dijk <v.dijk.bas at gmail.com> wrote:
> While I was hunting for a space leak in the new hackage-server (still
> haven't found it) I noticed strict and lazy ByteStrings don't have
> NFData instances. I propose to add them because it enables users to
> force ByteStrings in the principled way (using deepseq) so they don't
> need to use tricks like: B.length b `seq` ...
>
> instance NFData Strict.ByteString
>
> instance NFData Lazy.ByteString where
>    rnf Empty       = ()
>    rnf (Chunk _ b) = rnf b
>
> Note that the containers dependency of deepseq was recently dropped so
> depending on that package is not a big issue anymore.
>
> Discussion deadline: 2 weeks from now (9 November)
>
> Bas
>

Because of the upcoming ghc-7.4 release I went ahead and created a
ticket. Although the discussion period is not officially over there
was overwhelming support and not a single objection was made.

http://hackage.haskell.org/trac/ghc/ticket/5601

I just realized that bytestring is not maintained by
libraries at haskell.org but by Don and Duncan. Are you guys ok with this
change?

Cheers,

Bas



More information about the Libraries mailing list