Browse Source

replace isJust / fromJust with case

master
Philipp Balzarek 13 years ago
parent
commit
c3222acc2a
  1. 12
      source/Network/Xmpp/Session.hs

12
source/Network/Xmpp/Session.hs

@ -43,12 +43,12 @@ session :: HostName -- ^ Host to connect to
-> IO (Either XmppFailure (Session, Maybe AuthFailure)) -> IO (Either XmppFailure (Session, Maybe AuthFailure))
session hostname realm port tls sasl = runErrorT $ do session hostname realm port tls sasl = runErrorT $ do
con <- ErrorT $ connect hostname port realm con <- ErrorT $ connect hostname port realm
if isJust tls case tls of
then ErrorT $ startTls (fromJust tls) con Just tls' -> ErrorT $ startTls tls' con
else return () Nothing -> return ()
aut <- if isJust sasl aut <- case sasl of
then ErrorT $ auth (fst $ fromJust sasl) (snd $ fromJust sasl) con Just sasl' -> ErrorT $ auth (fst sasl) (snd sasl) con
else return Nothing Nothing -> return Nothing
ses <- ErrorT $ newSession con ses <- ErrorT $ newSession con
return (ses, aut) return (ses, aut)

Loading…
Cancel
Save