Type of empty list
Jump to navigation
Jump to search
Question
Why is
([]::[Int]) == ([]::[Char])
a type error and not just True
(because both lists are empty) or False
(because the types mismatch)?
Related question: Why is
map :: (a -> b) -> [a] -> [b]
map f (x:xs) = f x : map f xs
map f xs@[] = xs
a type error and the case definition
map f [] = []
is not?