Lesson 25. Working with binary data

After reading lesson 25, you’ll be able to

  • Use the ByteString type to efficiently work with binary data
  • Treat ByteStrings as regular ASCII strings by using ByteString.Char8
  • Glitch JPEG images by using Haskell
  • Work with binary Unicode data

In this lesson, you’ll learn about working with binary file data by using Haskell’s ByteString type. ByteString allows you to treat raw binary data as though it were a regular string. To demonstrate the use of ByteString, you’ll focus on a fun project requiring you to manipulate binary file data. You’ll create a simple command-line tool that will allow you to create glitch art, like that in figure 25.1.

Figure 25.1. A scene from Michael Betancourt’s glitch art video ...

Get Get Programming with Haskell now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.