In inetd and systemd type systems, it is possible for the system to bind a socket and launch the application with the socket already existing, for example to provide socket based service starting. I would like to take advantage of this functionality in one of my Haskell daemons.
The daemon currently calls, socket, bindSocket, listen to create a Socket object that I can later call accept on. To change this to an inetd type system I would need to use standard input as a Socket, but all I can find so far is stdin :: Handle, or fdToHandle :: CInt -> Handle - neither are quite what I need.
I can't seem to find anything that has type Handle -> Socket, nor anything that is like stdin :: Socket. The nearest I can find is mkSocket which is very low-level, and most other languages (ie, Ruby) provide a call to turn a file descriptor into a socket without having to specify various other parameters.