Functorize the TCP/IP stack