Opened 4 years ago

Closed 4 years ago

#5601 closed feature request (fixed)

Proposal: Add NFData instances for strict and lazy ByteStrings

Reported by: basvandijk Owned by:
Priority: normal Milestone:
Component: libraries (other) Version: 7.2.1
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: Differential Revisions:

Description

I noticed strict and lazy ByteStrings don't have NFData instances. I proposed 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.

We had 8 +1s and no objections.

Attachments (2)

Change History (4)

comment:1 Changed 4 years ago by basvandijk

Keep in mind that because of the added instances the major version has to be bumped from 0.9.2.0 to 0.10.

comment:2 Changed 4 years ago by duncan

  • Resolution set to fixed
  • Status changed from new to closed

Applied.

Note: See TracTickets for help on using tickets.