title: convert double to GLfloat in Haskell
body: <p>I want to convert a Double to a GLfloat.
  I want to use it for comparations.</p>
  
  <pre><code>xM &lt;- newIORef 0.0
  zM &lt;- newIORef 0.0
  mobs &lt;- newIORef []
  mapM_ (\x -&gt; colision x xM) mobs
  </code></pre>
  
  <p>mobs is fulled with a method.</p>
  
  <pre><code>colision mob xC = do
    xcama &lt;- get xC
    --zcama &lt;- get zC
    let menor = mob!!0
    let mayor = mob!!7
    --if xm&gt;= xmin &amp;&amp; xm &lt;= xmax &amp;&amp; zm &gt;= zmin &amp;&amp; zm &lt;= zmax  then renderText (1, (-1.4)) $ "Dead"
    --else renderText (1, (-1.4)) $ "Warning..."
    renderText (1, (-1.4)) $ "Warning..."
  </code></pre>
  
  <p>When I try to compile it show me this error:</p>
  
  <p>"Couldn't match type 'Foreign.C.Types.CDouble' with 'Foreign.C.Types.CFloat'
  Expected type :GLfloat</p>
  
  <p>Actual type: GLdouble</p>
  
  <p>-----Solution:------</p>
  
  <p>I use this code:</p>
  
  <pre><code>import GHC.Float
    d2f = realToFrac :: GLdouble -&gt; GLfloat
  </code></pre>