title: How to convert a Integer to a ByteString in Haskell
body: <p>We'd like to serialize data in a specific binary format. We use <code>Data.ByteString</code>s internally.</p>
  
  <p>So, the question is: How to convert the different data types we use to a <code>ByteString</code>. For <code>String</code> we have no problem, we can use <code>encodeLazyByteString UTF8 "string"</code>. But we'd also like to convert <code>Integer</code>s to <code>ByteString</code>s (big-endian).</p>
  
  <p>Does anyone know how to do that and/or has any good tips using Haskell and binary formats?</p>
  
  <p>Thanks!</p>