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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.