Fix build in GHC 7.4.

This commit is contained in:
John Millikin 2012-02-23 18:27:26 -08:00
parent 34a2e4129a
commit f0f4eef863
No known key found for this signature in database
GPG key ID: 59A38F85F9C7C59E
2 changed files with 6 additions and 3 deletions

View file

@ -42,6 +42,7 @@ module Network.Protocol.TLS.GNU
import Control.Monad (when, foldM, foldM_) import Control.Monad (when, foldM, foldM_)
import Control.Monad.Trans (MonadIO, liftIO) import Control.Monad.Trans (MonadIO, liftIO)
import qualified Control.Monad.Error as E import qualified Control.Monad.Error as E
import Control.Monad.Error (ErrorType)
import qualified Control.Monad.Reader as R import qualified Control.Monad.Reader as R
import qualified Control.Concurrent.MVar as M import qualified Control.Concurrent.MVar as M
import qualified Data.ByteString as B import qualified Data.ByteString as B
@ -91,7 +92,7 @@ instance MonadIO TLS where
liftIO = TLS . liftIO liftIO = TLS . liftIO
instance E.MonadError TLS where instance E.MonadError TLS where
type E.ErrorType TLS = Error type ErrorType TLS = Error
throwError = TLS . E.throwError throwError = TLS . E.throwError
catchError m h = TLS $ E.catchError (unTLS m) (unTLS . h) catchError m h = TLS $ E.catchError (unTLS m) (unTLS . h)

View file

@ -23,7 +23,9 @@ import Control.Monad (liftM)
import Control.Monad.Trans (MonadIO, liftIO) import Control.Monad.Trans (MonadIO, liftIO)
import Control.Monad.Trans.Class (MonadTrans, lift) import Control.Monad.Trans.Class (MonadTrans, lift)
import qualified Control.Monad.Error as E import qualified Control.Monad.Error as E
import Control.Monad.Error (ErrorType)
import qualified Control.Monad.Reader as R import qualified Control.Monad.Reader as R
import Control.Monad.Reader (EnvType)
-- A custom version of ErrorT, without the 'Error' class restriction. -- 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 Right r -> runErrorT $ k r
instance Monad m => E.MonadError (ErrorT e m) where 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 throwError = ErrorT . return . Left
catchError m h = ErrorT $ do catchError m h = ErrorT $ do
x <- runErrorT m x <- runErrorT m
@ -53,7 +55,7 @@ instance MonadTrans (ErrorT e) where
lift = ErrorT . liftM Right lift = ErrorT . liftM Right
instance R.MonadReader m => R.MonadReader (ErrorT e m) where 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 ask = lift R.ask
local = mapErrorT . R.local local = mapErrorT . R.local