From c6dd2883d2896fb2f6752a917bebf210b208f3eb Mon Sep 17 00:00:00 2001 From: Tony Hannan Date: Tue, 22 Feb 2011 10:48:14 -0500 Subject: [PATCH] Fix typo in conditional compilation --- Database/MongoDB/Connection.hs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Database/MongoDB/Connection.hs b/Database/MongoDB/Connection.hs index 2b6c45e..fb89563 100644 --- a/Database/MongoDB/Connection.hs +++ b/Database/MongoDB/Connection.hs @@ -67,15 +67,18 @@ host hostname = Host hostname defaultPort showHostPort :: Host -> String -- ^ Display host as \"host:port\" -showHostPort (Host hostname port) = hostname ++ ":" ++ (case port of - Service s -> s - PortNumber p -> show p +-- TODO: Distinguish Service and UnixSocket port +showHostPort (Host hostname port) = hostname ++ ":" ++ portname where + portname = case port of + Service s -> s + PortNumber p -> show p #if !defined(mingw32_HOST_OS) && !defined(cygwin32_HOST_OS) && !defined(_WIN32) - UnixSocket s -> s) + UnixSocket s -> s #endif readHostPortM :: (Monad m) => String -> m Host -- ^ Read string \"hostname:port\" as @Host hosthame port@ or \"hostname\" as @host hostname@ (default port). Fail if string does not match either syntax. +-- TODO: handle Service and UnixSocket port readHostPortM = either (fail . show) return . parse parser "readHostPort" where hostname = many1 (letter <|> digit <|> char '-' <|> char '.') parser = do