In this recipe, we will look at alternative representations of string. The string is a list of Char and is not an efficient implementation. The text and bytestring packages are the most popular packages for alternative and efficient string implementations. While text implements unicode characters, bytestring is good for binary data. In this recipe, we will work with these data types and convert them into each other, and also explore a GHC extension for strings.
Working with text and bytestring
How to do it...
- Create a new project working-with-text-and-bytestring with the simple Stack template:
stack new working-with-text-and-bytestring simple
- Add dependency on the text and bytestring libraries in the build-depends...