title: error: Ambiguous type variable ‘t0’ arising from a use of ‘func’ prevents the constraint ‘(Show t0)’ from being solved
body: <p>I am studying about Haskell. And i am trying to make a while loop that everytime it runs it makes the value 'a' 2 times smaller with flooring after that.</p>
  
  <p>this works fine:</p>
  
  <pre><code>func a = 
      if a &gt; 0 then 
        func (a/2)
      else 
        print (a)
  </code></pre>
  
  <p>Now adding floor function to it.</p>
  
  <pre><code>func a = 
      if a &gt; 0 then 
          func (floor (a/2))
      else 
          print (a)
  </code></pre>
  
  <p>now running it</p>
  
  <pre><code>func 5
  </code></pre>
  
  <p>And there is an error:</p>
  
  <pre><code>Ambiguous type variable ‘t0’ arising from a use of ‘func’
        prevents the constraint ‘(Show t0)’ from being solved.
        Probable fix: use a type annotation to specify what ‘t0’ should be.
        These potential instances exist:
          instance Show Ordering -- Defined in ‘GHC.Show’
          instance Show Integer -- Defined in ‘GHC.Show’
          instance Show a =&gt; Show (Maybe a) -- Defined in ‘GHC.Show’
          ...plus 22 others
          ...plus 12 instances involving out-of-scope types
          (use -fprint-potential-instances to see them all)
      • In the expression: func 1
        In an equation for ‘it’: it = func 1
  </code></pre>
  
  <p>The two questions i have is: </p>
  
  <p>question 1:Why is this error occuring?</p>
  
  <p>question 2:And how can i fix it?</p>
  
  <p>I am using "repl.it" haskell. I'll appreciate every helps :)!</p>