Haskell get error when list parameter has more than one element
<p>I just got into Haskell, and I'm trying to make a function that given a list of numbers will return a list of all the negative numbers in it.
So I did this</p>

<pre><code>negative:: [Int] -&gt; [Int]

negative [x] = [z | z &lt;- [x], x &lt; 0]
</code></pre>

<p>When I try it with only one element in the list it works as it should</p>

<p>negative [-1] returns [-1]</p>

<p>negative [1] returns []</p>

<p>However when I add more numbers like for example
negative [0,-1] I get the following error:</p>

<p>Program error: pattern match failure: negative [Num_fromInt instNum_v30 0,Num_fromInt instNum_v30 -1]</p>

<p>I tried typing the numbers with spaces and without spaces between but the result is the same. I'm guessing there's something wrong with my code, but since I'm still getting used to Haskell I'm having a hard time finding it. Any help will be appreciated.</p>