title: Int type conversion
body: <p>1) How do you convert from one <code>Int</code> type to a <code>Num</code> type?</p>
  
  <p>Similar questions have been asked before and the answer has been (as is on the Haskell wiki) is to use <code>fromIntegral</code>. <code>fromIntegral</code> returns a <code>Num</code> type so I have to cast this to my desired format.</p>
  
  <p>I need to take a <code>Word16</code> and convert it to a <code>Int64</code> so I am doing the following</p>
  
  <pre><code>let valueLength = (fromIntegral(tagLength) :: Int64)
  </code></pre>
  
  <p>where <code>tagLength</code> has type <code>Word16</code></p>
  
  <p>Is this approach correct?</p>
  
  <p>2) How do you handle type conversion safely?</p>
  
  <p>Coming from a Java background where there is for Integers I believe <code>Short</code>,<code>Int</code> and <code>Long</code>
  I can use a <code>short</code> as an <code>int</code> but not the other way around. In Haskell though if I write</p>
  
  <pre><code>256 :: Word8
  </code></pre>
  
  <p>in <code>ghci</code> it returns 0.</p>