
Hi all, The following function gives me an "Ambiguous type variable `a' in the constraint: `Read a' arising from a use of `res'" error: test :: Read a => String -> Maybe [(a,String)] test s = if null res then Nothing else Just $ fst $ head res where res = reads s The reason as 'jmcarthur' so patiently explained on IRC is that 'res' is used twice and the type constraint 'a' is different for each use, hence the ambiguity. I get that. But I have a further question why should 'null ...' care about the type of its list argument? Isn't it polymorphic? So it shouldn't make a difference that the 'a' inside res is ambiguous because we know for sure that it always returns a list of some kind. Thanks, -deech