title: How to print a Fractional x without decimal point if and only if x is Integral?
body: <p>In Haskell how to print a Fractional x without decimal point if and only if x is Integral? Please improve my code below:</p>
  
  <pre><code>printFrac :: (Show a, RealFrac a) =&gt; a -&gt; IO ()
  printFrac x = if x==fromIntegral (round x) then print (round x) else print x
  </code></pre>