@@ -5,6 +5,7 @@
5{-# LANGUAGE KindSignatures #-}
5{-# LANGUAGE KindSignatures #-}
6{-# LANGUAGE MultiParamTypeClasses #-}
6{-# LANGUAGE MultiParamTypeClasses #-}
7{-# LANGUAGE RecordWildCards #-}
7{-# LANGUAGE RecordWildCards #-}
8+{-# LANGUAGE TemplateHaskell #-}
8{-# LANGUAGE TypeFamilies #-}
9{-# LANGUAGE TypeFamilies #-}
9{-# LANGUAGE UndecidableInstances #-}
10{-# LANGUAGE UndecidableInstances #-}
@@ -26,7 +27,7 @@ module Control.Monad.Trans.PagerDuty
29− , runAWST
30+ , runPDT
31 -- * Environment
32 -- * Environment
@@ -44,6 +45,7 @@ module Control.Monad.Trans.PagerDuty
46import Control.Applicative
47import Control.Applicative
47import Control.Monad.Base
49import Control.Monad.Base
48import Control.Monad.Catch
50import Control.Monad.Catch
49import Control.Monad.Except
51import Control.Monad.Except
@@ -65,6 +67,8 @@ data Env (s :: Security) = Env
65-- , _envLogging ::
67-- , _envLogging ::
68-- | A convenient alias for 'PDT' 'IO'.
72-- | A convenient alias for 'PDT' 'IO'.
69type PD s = PDT s IO
73type PD s = PDT s IO
@@ -90,17 +94,17 @@ instance MonadBase b m => MonadBase b (PDT s m) where
90 {-# INLINE liftBase #-}
94 {-# INLINE liftBase #-}
92instance MonadTransControl (PDT s) where
96instance MonadTransControl (PDT s) where
93− newtype StT (PDT s) a = StTAWS
97+ newtype StT (PDT s) a = StTPD
94− { unStTAWS :: StT (ExceptT Error) (StT (ReaderT (Env s)) a)
98+ { unStTPD :: StT (ExceptT Error) (StT (ReaderT (Env s)) a)
97 liftWith f = PDT $
101 liftWith f = PDT $
98 liftWith $ \g ->
102 liftWith $ \g ->
99 liftWith $ \h ->
103 liftWith $ \h ->
100− f (liftM StTAWS . h . g . unPDT)
104+ f (liftM StTPD . h . g . unPDT)
101 {-# INLINE liftWith #-}
105 {-# INLINE liftWith #-}
103− restoreT = PDT . restoreT . restoreT . liftM unStTAWS
107+ restoreT = PDT . restoreT . restoreT . liftM unStTPD
104 {-# INLINE restoreT #-}
108 {-# INLINE restoreT #-}
106instance MonadBaseControl b m => MonadBaseControl b (PDT s m) where
110instance MonadBaseControl b m => MonadBaseControl b (PDT s m) where