title: Haskell decrement function
body: <p>I am trying to learn Haskell, this is my very first approach at functional programming. I'm having some trouble creating a function that takes a number as input and prints that number one by one recursively, until 0.</p>
  
  <pre><code>printDescending n = if n &gt; 0
                          then printDescending n - 1 return n
                          else return n - 1
  </code></pre>
  
  <p>I want to be able to do <code>printDescending 20</code> and have it output 20, 19, 18...2, 1, 0. But I'm getting this error:</p>
  
  <pre><code>&gt;     • Non type-variable argument
  &gt;         in the constraint: Num ((a -&gt; m a) -&gt; a1 -&gt; m1 a1)
  &gt;       (Use FlexibleContexts to permit this)
  &gt;     • When checking the inferred type
  &gt;         printDescending :: forall (m :: * -&gt; *) a (m1 :: * -&gt; *) a1.
  &gt;                            (Ord a1, Num ((a -&gt; m a) -&gt; a1 -&gt; m1 a1), Num (m1 a1), Num a1,
  &gt;                             Monad m1, Monad m) =&gt;
  &gt;                            a1 -&gt; m1 a1 Failed, modules loaded: none.
  </code></pre>
  
  <p>I think it may be my syntax. Anyone have some insight?</p>