Fix build in GHC 7.4.
This commit is contained in:
parent
34a2e4129a
commit
f0f4eef863
2 changed files with 6 additions and 3 deletions
|
@ -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)
|
||||||
|
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue