@RebeccaSkinner
In Effective Haskell Chapter 11 (~ p 410 in ePub), when creating the Encode and Decode instances for String, pack and unpack are used, but given all the imports, ghci couldn’t resolve them so I needed to use the qualified names, BC.pack and BC.unpack.
Serializing FileMode (approx p. 413 in ePub) doesn’t work on Macs since CMode wraps a Word16, not Word32. I was baffled because the documentation on Hackage said CMode wraps a Word32, not realizing that the Hackage docs were probably generated on a Linux box. I ended up writing the encoding/decoding for Word16 so GHC could pick the right one.
When defining Encode to have encode and encodeWithSize (approx p 415 in ePub), the MINIMAL pragma is missing the # at the opening ( {-
instead of {-#
)
I assume there was some refactoring going on because the FileData type was defined with record fields: fileName, fileSize, filePermissions, and fileData, but the Encode instance uses packedFileName, packedFileSize, packedFilePermissions, and packedFileData.
The file pack example is a fun one for getting at these different data encodings.