Browse Source

replace isJust / fromJust with pattern matching

master
Philipp Balzarek 13 years ago
parent
commit
5950c1e313
  1. 14
      source/Network/Xmpp/Concurrent.hs

14
source/Network/Xmpp/Concurrent.hs

@ -143,13 +143,13 @@ session :: HostName -- ^ Host to connect to
-- JID resource (or Nothing to let -- JID resource (or Nothing to let
-- the server decide) -- the server decide)
-> IO (Either XmppFailure (Session, Maybe AuthFailure)) -> IO (Either XmppFailure (Session, Maybe AuthFailure))
session hostname realm port tls sasl = runErrorT $ do session hostname realm port mbTls mbSasl = runErrorT $ do
con <- ErrorT $ openStream hostname port realm def con <- ErrorT $ openStream hostname port realm def
if isJust tls case mbTls of
then ErrorT $ startTls (fromJust tls) con Nothing -> return ()
else return () Just tls -> ErrorT $ startTls tls con
aut <- if isJust sasl aut <- case mbSasl of
then ErrorT $ auth (fst $ fromJust sasl) (snd $ fromJust sasl) con Nothing -> return Nothing
else return Nothing Just (handlers, resource) -> ErrorT $ auth handlers resource con
ses <- ErrorT $ newSession con ses <- ErrorT $ newSession con
return (ses, aut) return (ses, aut)

Loading…
Cancel
Save