title: Memory usage of constructors in haskell
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/3254758/memory-footprint-of-haskell-data-types">Memory footprint of Haskell data types</a>  </p>
  </blockquote>
  
  
  
  <p>When solving combinatorial problems, I will often represent the solution as a bit string, eg. 1010100010110111000110... You get the picture.</p>
  
  <p>I figured that when I use <code>[Int]</code> for the bit string, <code>Int</code> always spends the same amount of memory, no matter how big the number actually is (because <code>Int</code> it's bounded, in contrast to <code>Integer</code>), as the computer only remembers the bit representation, and <code>String</code>'s would take even more space as far as I know.</p>
  
  <p>My idea was then to use the data type</p>
  
  <pre><code>data Bits = Empty | Zero Bits | One Bits deriving (Eq,Ord,Show)
  </code></pre>
  
  <p>But how much memory do the constructors <code>Empty</code>, <code>Zero</code> and <code>One</code> use compared to <code>Int</code>'s?</p>