Extracting Heterogenous Values from the Archive

In the last chapter, you built a library named FilePack that will allow you to combine files with various types of data into a single archive. Throughout that chapter, you learned about using existential types to deal with heterogeneous collections of data. Although you were able to build a library with a nice API for creating archives, there was one glaring problem: after creating a file pack you had no way of unpacking the data.

In this chapter, we’ll work on the other half of the file packing program: decoding a file pack that can contain many different types of data. Just like when we were encoding data, we’ll want to support arbitrary data types that can be defined by the user, and we’ll want ...

Get Effective 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.