Something like this: https://github.com/yesodweb/wai/compare/master...dpwiz:wai:serve-connection It is better to pass SockAddr instead of Socket (although it's not used here directly, but probably some dependencies use it).