creating a function that takes a list of Ints and returns the list with any odd numbers squared
<p>I want to write a function very similar to filter using the odd function that takes a list and returns that list with any odd numbers squared.</p>

<p>ex</p>

<pre><code>gchi&gt; sqrodd [1,2,3,4,5]
[1,2,9,4,25]
</code></pre>

<p>what I have and believe is close is</p>

<pre><code>sqrodd :: (a-&gt;Bool) -&gt; [a] -&gt; [a]
sqrodd odd []     = []
sqrodd odd (x:xs) = if odd x
                    then (x*x) :sqrodd odd xs
                    else x : sqrodd odd xs
</code></pre>

<p>but I get errors with the function definition saying "couldn't match expected type <code>a -&gt; Bool</code> with actual type <code>[a]</code>"</p>