printparam "port" $ port args
printparam "vhost" $ vHost args
printparam "connection_name" $ connectionName args
- printparam "connect timeout" $ (show (connect_timeout args)) ++ "s"
+ printparam "connect timeout" $ [show (connect_timeout args), "s"]
globalCertificateStore <- getSystemCertificateStore
let myTLS =
N.TLSSettings
where
flexprint :: a -> IO ()
flexprint = (hPutStrLn stderr) . show
+ empty :: a -> Bool
+ empty _ = False
printparam :: String -> a -> IO ()
- printparam label x = do
- mapM_ (hPutStr stderr) [" --- ", label, ": "]
- flexprint x
- hFlush stderr
+ printparam label x =
+ if empty x
+ then return ()
+ else do
+ mapM_ (hPutStr stderr) [" --- ", label, ": "]
+ flexprint x
+ hFlush stderr
instance (Flexprint a) => Flexprint (Maybe a) where
+ empty = isNothing
printparam _ Nothing = return ()
printparam x (Just y) = printparam x y
instance Flexprint String where
flexprint = hPutStrLn stderr
+ empty = null
instance Flexprint [String] where
flexprint = flexprint . unwords
+ empty = null
instance Flexprint T.Text where
flexprint = flexprint . T.unpack
+ empty = T.null
instance Flexprint BL.ByteString where
flexprint x = hPutStrLn stderr "" >> BL.hPut stderr x >> hPutStrLn stderr ""
+ empty = BL.null
instance Flexprint Bool