That still leaks according to my tests. It crashes after a few seconds when running a dummy implementation with +RTS -M1g
. This is the dummy:
data Conn = Conn
{-# NOINLINE awaitConn #-}
awaitConn :: IO Conn
awaitConn = pure Conn
{-# NOINLINE handle #-}
handle :: Conn -> IO ()
handle Conn = pure ()
Edit: Ah, just saw your edit.