Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

OverloadedStrings for chars [duplicate]

The hackage documentation for ByteString contains this example:

split :: Word8 -> ByteString -> [ByteString]
split '\n' "a\nb\nd\ne" == ["a","b","d","e"]

It's as if '\n' is converted to a Word8, but LANGUAGE OverloadedStrings seems only to work on strings, not chars. What extension to I need to include for the example code to work?

like image 748
Clinton Avatar asked Dec 22 '14 08:12

Clinton


1 Answers

bytestring supports a cheap and cheerful Latin1 view of the bytes. You can import Data.ByteString.Char8 to get that view.

like image 58
Don Stewart Avatar answered Nov 04 '22 20:11

Don Stewart