title: How to use Haskell ceiling function
body: <pre><code>test_1 :: Int -&gt; Int
  test_1 y = 5 * 10 ^ (ceiling ( logBase 10 y  ) )  + 100
  </code></pre>
  
  <p>Here is the error message: </p>
  
  <pre><code>parse.hs:23:22: error:
      • No instance for (RealFrac Int) arising from a use of ‘ceiling’
      • In the second argument of ‘(^)’, namely
          ‘(ceiling (logBase 10 y))’
        In the second argument of ‘(*)’, namely
          ‘10 ^ (ceiling (logBase 10 y))’
        In the first argument of ‘(+)’, namely
          ‘5 * 10 ^ (ceiling (logBase 10 y))’
  
  parse.hs:23:32: error:
      • No instance for (Floating Int) arising from a use of ‘logBase’
      • In the first argument of ‘ceiling’, namely ‘(logBase 10 y)’
        In the second argument of ‘(^)’, namely ‘(ceiling (logBase 10 y))’
        In the second argument of ‘(*)’, namely
          ‘10 ^ (ceiling (logBase 10 y))’
  Failed, modules loaded: none.
  </code></pre>
  
  <p>But if I try this function by simply using a real number:</p>
  
  <pre><code>test = 5 * 10 ^ (ceiling ( logBase 10 1000 ) )  + 100
  </code></pre>
  
  <p>It works fine.</p>