Implements Priority Queues intended to be used with the STM module.
Returns an empty PQueue with the specified number of priority levels.
Recursively tries to read each priority level until it finds something.
If it can't find any events it returns Nothing. Call using
Writes the given something to the given PQueue at the specified
priority level. It does some checking to make sure we have a valid
priority level. Call using
atomically $ writeThing pqueue priority thing.