title: How can I determine size of a type in Haskell?
body: <p>Assume I created a type as follows:</p>
  
  <pre><code>data RequestAck = 
           RequestAck { ackOK :: Word32, ackMsgCode :: Word32 } 
  </code></pre>
  
  <p>I can see that it is 2 * 4 bytes big and make that a constant somewhere.</p>
  
  <p>The only problems is that once I add a field to the type, I'd have to remember to update my constant.</p>
  
  <p>Is there a function out there that will provide me with the size of a given type e.g., <code>t -&gt; Int</code>?</p>
  
  <p>The function that comes close to what I want is </p>
  
  <p><code>gsize :: Data a =&gt; a -&gt; Int</code> </p>
  
  <p>inside the Data.Generics.Schemes module, but I don't want to have to make my type an instance of <code>Data</code>.</p>
  
  <p>Is there a more generic solution out there?</p>
  
  <p>To be sure, I'm looking for a function that operates on the static type, e.g., I don't want to pass an instance, but the type itself.</p>