runTLS' for when the caller is also using ExceptT

This commit is contained in:
Stephen Paul Weber 2021-02-13 21:18:46 -05:00
parent 955b054ff4
commit ceac3318da

View file

@ -23,6 +23,7 @@ module Network.Protocol.TLS.GNU
, fromExceptT , fromExceptT
, runTLS , runTLS
, runTLS'
, runClient , runClient
, getSession , getSession
, handshake , handshake
@ -98,7 +99,10 @@ fromExceptT :: E.ExceptT Error UIO a -> TLS a
fromExceptT = E.mapExceptT lift fromExceptT = E.mapExceptT lift
runTLS :: (Unexceptional m) => Session -> TLS a -> m (Either Error a) runTLS :: (Unexceptional m) => Session -> TLS a -> m (Either Error a)
runTLS s tls = UIO.lift $ R.runReaderT (E.runExceptT tls) s runTLS s = E.runExceptT . runTLS' s
runTLS' :: (Unexceptional m) => Session -> TLS a -> E.ExceptT Error m a
runTLS' s = E.mapExceptT (UIO.lift . flip R.runReaderT s)
runClient :: Transport -> TLS a -> IO (Either Error a) runClient :: Transport -> TLS a -> IO (Either Error a)
runClient transport tls = do runClient transport tls = do