Haskell "Couldn't match expected type ‘a’ with actual type ‘[a0]’"
<p>Im doing a project in Haskell where I am trying to create a function which takes two list inputs and then returns a union of the list but without any duplicates. </p>

<p>The problem is that I keep getting the error message:</p>

<pre><code>Couldn't match expected type ‘a’ with actual type ‘[t0]’
      ‘a’ is a rigid type variable bound by
          the type signature for newList :: [a] -&gt; [a] -&gt; [a]
</code></pre>

<p>Here is my code:</p>

<pre><code>allList :: (Eq a) =&gt; [a] -&gt; [a] -&gt; [a]
allList [] [] = []
allList x y = (x ++ y)

checkDup [] = []
checkDup (z:zs)
    | z `elem` zs = checkDup zs
    | otherwise = z : checkDup zs

newList :: (Eq a) =&gt; [a] -&gt; [a] -&gt; [a]
newList [] [] = []
newList x y = [checkDup z | z &lt;- allList x y]
</code></pre>

<p>The first <code>allList</code> function creates a list of the two list, the <code>checkDup</code> creates a new list without any duplicates and the <code>newList</code> uses list comprehension to pass the combined list to the <code>checkDup</code>. </p>

<p>Anyone know where I am going wrong?</p>