If you want to create a function to check if the list contains one given value, you need to make some changes.
First, you need to provide the expected value for comparison. You are currently trying to compare with Char 'a', but you cannot compare Char with an unknown type a . Secondly, this type must be an instance of the Eq , so you can do the comparison.
You can map the template to a single list, and then add a sentence to compare the item with the one you expect, for example.
isSingletonOf :: Eq a => a -> [a] -> Bool isSingletonOf v [s] | v == s = True isSingletonOf _ _ = False
Then you can create a function to compare [Char] :
f :: [Char] -> Bool f = isSingletonOf 'a'
source share