Ticket #1375 (closed bug: fixed)

Opened 6 years ago

Last modified 5 years ago

ByteString’s “lines” eats empty lines

Reported by: guest Owned by: dons@…
Priority: high Milestone: 6.8.1
Component: libraries/base Version: 6.6.1
Keywords: Cc: dons@…
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Difficulty: Unknown
Test Case: bytestring006 Blocked By:
Blocking: Related Tickets:

Description

I’d expect this to be true for ByteStrings? map B.unpack . B.lines . B.pack == Prelude.lines But it seems that B.lines will merge several consecutive newlines. B.split '\n' works as it should, though.

Thanks, Joachim

Change History

Changed 6 years ago by mail@…

Just addding my e-Mail-Adress

Changed 6 years ago by igloo

  • cc dons@… added
  • priority changed from normal to high
  • milestone set to 6.8

In particular, it's Lazy.Char8 that has the problem. Here's the (libraries/base) HEAD:

Prelude> lines "a\n\nb\n\nc"
["a","","b","","c"]
Prelude> :m - Prelude
> :m + Data.ByteString.Char8
Data.ByteString.Char8> Prelude.map unpack (lines (pack "a\n\nb\n\nc"))
["a","","b","","c"]
Data.ByteString.Char8> :m - Data.ByteString.Char8
> :m + Data.ByteString.Lazy.Char8
Data.ByteString.Lazy.Char8> Prelude.map unpack (lines (pack "a\n\nb\n\nc"))
["a","b","c"]

I haven't looked at the development branch of fps/bytestring.

Changed 6 years ago by guest

  • cc dons@… added; dons@… removed

Changed 6 years ago by jpbernardy

  • cc dons@… added; dons@… removed

Changed 6 years ago by igloo

  • owner set to dons@…

Presumably this will be fixed in the new bytestring package?

Changed 6 years ago by duncan

Yes it will be fixed in the new bytestring package.

Changed 6 years ago by guest

  • cc changed from dons@cse.unsw.edu.au Bulat.Ziganshin@gmail.com jeanphilippe.bernardy@gmail.com to dons@cse.unsw.edu.au Bulat.Ziganshin@gmail.com jeanphilippe.bernardy@gmail.com

Changed 6 years ago by igloo

  • status changed from new to closed
  • testcase set to bytestring006
  • resolution set to fixed

Fixed by Duncan:

Mon Aug 27 16:23:45 BST 2007  Duncan Coutts <duncan@haskell.org>
  * Fix Lazy.lines "foo\n\nbar"

and now tested by bytestring006.

Changed 6 years ago by igloo

  • milestone changed from 6.8 branch to 6.8.1

Changed 5 years ago by simonmar

  • architecture changed from Unknown to Unknown/Multiple

Changed 5 years ago by simonmar

  • os changed from Unknown to Unknown/Multiple
Note: See TracTickets for help on using tickets.