parseHostAndPort :: URI -> Either ServiceResponseExcept (String, PortNumber)
parseHostAndPort target = do
  uri <- maybeToEither (ConnectExcept $ "Could not parse URI "++target) $ parseURI target
  host <- maybeToEither (ConnectExcept $ "Could not parse hostname from "++target) $ uriRegName uri
  port <- maybeToEither (ConnectExcept $ "Could not parse port from "++target) $ uriPort uri
  return (host, fromIntegral port)
parseHostAndPort :: URI -> Either ServiceResponseExcept (String, PortNumber)
parseHostAndPort target = do
  uri <- maybeToEither (ConnectExcept $ "Could not parse URI "++target) $ parseURI target
  host <- maybeToEither (ConnectExcept $ "Could not parse hostname from "++target) $ uriRegName uri
  port <- maybeToEither (ConnectExcept $ "Could not parse port from "++target) $ uriPort uri
  return (host, fromIntegral port)
parseHostAndPort target = do
  uri <- maybeToEither (ConnectExcept $ "Could not parse URI "++target) $ parseURI target
  host <- maybeToEither (ConnectExcept $ "Could not parse hostname from "++target) $ uriRegName uri
  port <- maybeToEither (ConnectExcept $ "Could not parse port from "++target) $ uriPort uri
  return (host, fromIntegral port)