There's a difference between melanin and melatonin as well. Melanin is a pigment produced in the skin which blocks sunlight. Melatonin is the pineal hormone, and it regulates sleep-wake cycles.
Melanin is crucial if you live in a sunny, tropical climate and wear few clothes. Too much solar radiation is dangerous. But if you're a 500,000 year old human living in a cold temperate region dark skin (melanin) can be a liability. It can lead to a dangerous vitamin-D deficiency.