The Book of Prayers (Kitab Al-Salat)
Muslim :: Book 4 : Hadith 2061
Abu Huraira reported Allah's Messenger as saying: Hasten at a funeral, for if (the dead person) is good, you would (soon) bring him close to the good. And if it is otherwise, it is an evil of which you are ridding yourselves.