Is this really necessary?  Seems like you could just explicitly match P in the function clause?