Evolution behind allergies



I've done some searches for the science/evolution behind allergies and
haven't come up with much so thought someone here might lend a hand.
I'm interested in how/why humans developed allergies. Particularly
nut allergies or life threatening allergies. This might tie deeper
into immunology, so maybe our resident Dr.Dr. (not Kleinman) can shed
some light? Just some points to sources could help.

/lurk

.