~singpolyma/haskell-gnutls

f0f4eef86327c262e5d1d6966deb818a9f766c45 — John Millikin 11 years ago 34a2e41
Fix build in GHC 7.4.
2 files changed, 6 insertions(+), 3 deletions(-)

M Network/Protocol/TLS/GNU.hs
M Network/Protocol/TLS/GNU/ErrorT.hs
M Network/Protocol/TLS/GNU.hs => Network/Protocol/TLS/GNU.hs +2 -1
@@ 42,6 42,7 @@ module Network.Protocol.TLS.GNU
import Control.Monad (when, foldM, foldM_)
import Control.Monad.Trans (MonadIO, liftIO)
import qualified Control.Monad.Error as E
import           Control.Monad.Error (ErrorType)
import qualified Control.Monad.Reader as R
import qualified Control.Concurrent.MVar as M
import qualified Data.ByteString as B


@@ 91,7 92,7 @@ instance MonadIO TLS where
	liftIO = TLS . liftIO

instance E.MonadError TLS where
	type E.ErrorType TLS = Error
	type ErrorType TLS = Error
	throwError = TLS . E.throwError
	catchError m h = TLS $ E.catchError (unTLS m) (unTLS . h)


M Network/Protocol/TLS/GNU/ErrorT.hs => Network/Protocol/TLS/GNU/ErrorT.hs +4 -2
@@ 23,7 23,9 @@ import Control.Monad (liftM)
import Control.Monad.Trans (MonadIO, liftIO)
import Control.Monad.Trans.Class (MonadTrans, lift)
import qualified Control.Monad.Error as E
import           Control.Monad.Error (ErrorType)
import qualified Control.Monad.Reader as R
import           Control.Monad.Reader (EnvType)

-- A custom version of ErrorT, without the 'Error' class restriction.



@@ 41,7 43,7 @@ instance Monad m => Monad (ErrorT e m) where
			Right r -> runErrorT $ k r

instance Monad m => E.MonadError (ErrorT e m) where
	type E.ErrorType (ErrorT e m) = e
	type ErrorType (ErrorT e m) = e
	throwError = ErrorT . return . Left
	catchError m h = ErrorT $ do
		x <- runErrorT m


@@ 53,7 55,7 @@ instance MonadTrans (ErrorT e) where
	lift = ErrorT . liftM Right

instance R.MonadReader m => R.MonadReader (ErrorT e m) where
	type R.EnvType (ErrorT e m) = R.EnvType m
	type EnvType (ErrorT e m) = EnvType m
	ask = lift R.ask
	local = mapErrorT . R.local