OverloadedStrings for chars

434 Views Asked by At

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?

1

There are 1 best solutions below

0
On

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