Effective Haskell: Chapter 12 - missing some code on p.438 (B9 - PDF version)

@RebeccaSkinner

Chapter 12 starts with the code for the File Archive builder from the bottom of p.438 to p.440.

If the intention was to provide the complete version built during Chapter 11, the definition of the Encode typeclass is missing.

We can find it on p.418-419, which is

class Encode a where
  encode :: a -> ByteString
  encode = BS.drop 4 .encodeWithSize
  
  encodeWithSize :: a -> ByteString
  encodeWithSize a = 
    let s = encode a
        l = fromIntegral $ BS.length s
    in word32ToByteString l <> s
    
  {-# MINIMAL encode | encodeWithSize #-}