A Purely Functional Approach to Packet Processing