The instance of Show for [a] is implemented using showList. The instance of Show for Char provides a special implementation of showList that uses double quotes and escapes non-ASCII-printable characters.
As a result, if someone applies show to a [Char] value, the implementation of showList will be chosen, and it will correctly render the string using quotes.
At least sometimes, then, we can avoid the need for the OverlappingInstances extension with a little bit of lateral thinking."
GHC Code
class Show a where
showsPrec :: Int -> a -> ShowS
show :: a -> String
showList :: [a] -> ShowS
*Main> show [1,2,3]
"[1,2,3]"
*Main> show ['a','b','c']
"\"abc\""
*Main>
It's the same problem now transfered to showList which will be declared differently for a list of int's or a list of chars, but still it outputs them differently as can be seen from the above code. How it is able to differentiate without throwing up the overlap error?
-A