title: How to output minimal binary using Data.Binary and Data.ByteString.Lazy?
body: <p>Minimal test code (bs.hs):</p>
  
  <pre><code>import qualified Data.Binary as B
  import qualified Data.ByteString.Lazy.Char8 as BSLC
  
  main = do
      BSLC.putStr $ B.encode $ Pad $ BSLC.pack "xxx"
  
  data Pad = Pad BSLC.ByteString
  instance B.Binary Pad where
      put (Pad p) = do
          B.put p
      get = do
          p &lt;- B.get
          return $ Pad p
  </code></pre>
  
  <p>And I get:</p>
  
  <pre><code>% runghc bs.hs | od -c
  0000000   \0  \0  \0  \0  \0  \0  \0 003   x   x   x                    
  0000013
  % ghc --version
  The Glorious Glasgow Haskell Compilation System, version 7.10.2
  </code></pre>
  
  <p>I expect to get "xxx".  I have no idea how the first 8 bytes (7 x \0 + 1 x 003) come from.</p>