Your type signature should be
vowels :: [Char] -> [Char]
vowels str = [ x | x <- str, x `elem` ['A','E','I','U','Y','O']]
or
vowels :: String -> String
In your code, (Char a) => ...
indicates that the type a
should be an instance of the typeclass Char
. However, Char
is a data type, not a type class which is why you get the error. Since you don't need any classes to implement this function you can just remove the constraint.