Hey so I was learning Haskell in class and I was given the problem of removing all instances of something from a list. This is my go at it but I run into this error that I'm not sure I follow.
--delete element from list
removeElement :: [a] -> [a]
removeElement x [] = []
removeElement x aList =
if (head aList) == x
then removeElement x (tail aList)
else aList
The error I receive is this:
Couldn't match expected type `[[a]] -> [[a]]'
with actual type `[a]'
Relevant bindings include
removeElement :: [a] -> [a] (bound at hwmk3.hs:8:1)
The equation(s) for `removeElement' have two arguments,
but its type `[a] -> [a]' has only one
I'm guessing that the syntax is wrong but I'm not sure how to fix it. Thanks for your help.