title: Haskell Int size
body: <p>What's the size of Int (bounded integer) in Haskell, or should I say in GHC?</p>
  
  <p>As practice I wrote a short program to get the number of bits set in an Int</p>
  
  <pre><code>import Data.Bits
  
  getBits :: Int -&gt; Int
  getBits x
      | x == 0 = 0
      | otherwise = 1 + (getBits y)
      where y = x .&amp;. (x - 1)
  
  
  main = do
      putStrLn "type a integer"
      num &lt;- getLine
      let n = read num :: Int
      putStrLn $ "result is: " ++ show (getBits n)
  </code></pre>
  
  <p>If I input number -1, the result is 64, which indicates the size of an Int is 64 bit. Why is that the case? Why it's not 32 bit as in C/C++?</p>