streaming-bytestring icon indicating copy to clipboard operation
streaming-bytestring copied to clipboard

Does 'lines' work on Windows?

Open UnkindPartition opened this issue 9 years ago • 3 comments
trafficstars

I was reading the code of lines in connection to #3 and noticed that it only cares about \ns.

I call lines on the result of getContents, which requires binary mode. That in turn means that the automatic newline conversion won't be happening.

So, if I'm reading this right, the code will not work correctly on Windows, will it?

UnkindPartition avatar Sep 22 '16 14:09 UnkindPartition

FYI, I started working on this in my fork (as you can see above).

I'll let you know once I finish.

UnkindPartition avatar Sep 24 '16 11:09 UnkindPartition

Sorry, I'm just getting to these. I was trying in these modules to replicate Data.ByteString.Lazy(.Char8) as much as possible. In bytestring, no account is taken of line endings other than \n it seems. http://hackage.haskell.org/package/bytestring-0.10.6.0/docs/src/Data.ByteString.Lazy.Char8.html#lines

michaelt avatar Sep 24 '16 22:09 michaelt

Yes, I also noticed that. But I don't think we should regard that as a standard; see e.g. this stackoverflow discussion.

Another question is whether unlines should be changed, too... While the conversion in lines hardly has any downsides, it's much trickier with unlines.

UnkindPartition avatar Sep 25 '16 06:09 UnkindPartition