~singpolyma/gsasl-haskell

05fb47635c238395642fcce82f419a719aee694e — Michael Alan Dorman 9 years ago 26ff5b4
Add Applicative instances for ghc >= 7.10
1 files changed, 9 insertions(+), 1 deletions(-)

M lib/Network/Protocol/SASL/GNU.hs
M lib/Network/Protocol/SASL/GNU.hs => lib/Network/Protocol/SASL/GNU.hs +9 -1
@@ 78,7 78,7 @@ module Network.Protocol.SASL.GNU

import           Prelude hiding (catch)
import qualified Control.Exception as E
import           Control.Monad (when, unless)
import           Control.Monad (ap, when, unless)
import           Control.Monad.IO.Class (MonadIO, liftIO)
import qualified Control.Monad.Trans.Reader as R
import qualified Data.ByteString as B


@@ 142,6 142,10 @@ newtype SASL a = SASL { unSASL :: R.ReaderT Context IO a }
instance Functor SASL where
	fmap f = SASL . fmap f . unSASL

instance Applicative SASL where
        pure = SASL . pure
        (<*>) = ap

instance Monad SASL where
	return = SASL . return
	(>>=) sasl f = SASL $ unSASL sasl >>= unSASL . f


@@ 249,6 253,10 @@ newtype Session a = Session { unSession :: R.ReaderT SessionCtx IO a }
instance Functor Session where
	fmap f = Session . fmap f . unSession

instance Applicative Session where
        pure = Session . pure
        (<*>) = ap

instance Monad Session where
	return = Session . return
	(>>=) m f = Session $ unSession m >>= unSession . f