Safe Haskell | None |
---|---|
Language | Haskell2010 |
Extensions |
|
This module provides a template for creating implementations
of MonadSmtp
over some abstract connection type.
Operations on a connection can throw IO- and network-based errors,
and we don't handle those in any particular way
ourselves. However, we throw SmtpError
s if server responses
are unparseable or unexpected.
Synopsis
- module Network.Mail.Assumpta.Connection
- newtype SmtpT conn m a = SmtpT {}
- liftSmtpT :: Monad m => m a -> SmtpT conn m a
- mapSmtpT :: (m1 (Either SmtpError a1) -> m2 (Either SmtpError a2)) -> SmtpT conn m1 a1 -> SmtpT conn m2 a2
- class Monad m => MonadSmtp m
- runSmtpEither :: conn -> SmtpT conn m a -> m (Either SmtpError a)
- runSmtp :: MonadError SmtpError m => conn -> SmtpT conn m b -> m b
- withSmtpConnection :: (Cstrt c m, MonadMask m, Connection c, MonadSmtp m) => Params c -> (c -> m b) -> m b
- rethrow :: MonadError e m => ExceptT e m b -> m b
Abstract connections
SMTP operations
newtype SmtpT conn m a Source #
Monad transformer that adds the ability to send SMTP commands and receive server replies over some abstract communications channel, 'conn'.
Instances
mapSmtpT :: (m1 (Either SmtpError a1) -> m2 (Either SmtpError a2)) -> SmtpT conn m1 a1 -> SmtpT conn m2 a2 Source #
Lifted mapExceptT
.
class Monad m => MonadSmtp m Source #
Monad for sending SMTP commands and checking for expected responses.
Instances
run SmptT actions
runSmtp :: MonadError SmtpError m => conn -> SmtpT conn m b -> m b Source #
runSmtp c a
runSmtpEither
generalized to MonadError
, so
a caller can
use Maybe
or or MonadError
instances as they choose.
withSmtpConnection :: (Cstrt c m, MonadMask m, Connection c, MonadSmtp m) => Params c -> (c -> m b) -> m b Source #
withConnection
, specialized to only run
MonadSmtp
actions.
Utility functions
rethrow :: MonadError e m => ExceptT e m b -> m b Source #
convert an ExceptT into a MonadError