
24 May
2009
24 May
'09
3:35 p.m.
When you use filter in this case, it's checking for users that are the same as ("Joao Claudino", "1240", 2). There aren't any in the list, so filter returns []. You can't use head on [], because there's no first element. Other notes about your code: - if x then True else False is the same as just x. - The otherwise case for userRegistration can never be reached. I would write it more like this: checkUser user userList = elem user userList userRegistration user list | checkUser user list = list | otherwise = user:list