Actually, mad as a hatter came considerably before Lewis Carroll. Madness was a symptom of mercury poisoning; the mercury was used in the manufacture of felt, from which the hats were made.