acceptAndHandle :: Socket Inet6 Stream TCP -> IO ()
acceptAndHandle s = bracket
  ( accept s )
  ( \(p, addr)-> do
    close p
    putStrLn $ "Closed connection to " ++ show addr
  )
  ( \(p, addr)-> do
    putStrLn $ "Accepted connection from " ++ show addr
    sendAll p "Hello world!" msgNoSignal
  )
acceptAndHandle :: Socket Inet6 Stream TCP -> IO ()
acceptAndHandle s = bracket
  ( accept s )
  ( \(p, addr)-> do
    close p
    putStrLn $ "Closed connection to " ++ show addr
  )
  ( \(p, addr)-> do
    putStrLn $ "Accepted connection from " ++ show addr
    sendAll p "Hello world!" msgNoSignal
  )
acceptAndHandle s = bracket
  ( accept s )
  ( \(p, addr)-> do
    close p
    putStrLn $ "Closed connection to " ++ show addr
  )
  ( \(p, addr)-> do
    putStrLn $ "Accepted connection from " ++ show addr
    sendAll p "Hello world!" msgNoSignal
  )