To fix the error all you have to do as @Joker_vD pointed out is to replace your ++
with :
To understand the difference between the two you should look at the type signature:
(:) :: a -> [a] -> [a]
(++) :: [a] -> [a] -> [a]
As you could see, :
takes an element and a list and returns a list back. ++
on the other hand takes two lists.
You should look at Data.Set
and Data.List
packages if you want to do set intersections / diff more efficiently.
Note that after fixing the error, the program's output will not match what you wanted. You should investigate why that's happening and should be an easy fix.