git.iko.soy/typeable/pagerduty
on develop help sign in
Correcting naming
76aff7eBrendan Hay
src/Control/Monad/Trans/PagerDuty.hs+9−5
@@ -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 #-}
10
11
@@ -26,7 +27,7 @@ module Control.Monad.Trans.PagerDuty
26 , PD
27 , PD
27
28
28 -- * Run
29 -- * Run
29− , runAWST
30+ , runPDT
30
31
31 -- * Environment
32 -- * Environment
32 , Env
33 , Env
@@ -44,6 +45,7 @@ module Control.Monad.Trans.PagerDuty
44 ) where
45 ) where
45
46
46import Control.Applicative
47import Control.Applicative
48+import Control.Lens
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 ::
66 }
68 }
67
69
70+makeLenses ''Env
71+
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
70
74
@@ -90,17 +94,17 @@ instance MonadBase b m => MonadBase b (PDT s m) where
90 {-# INLINE liftBase #-}
94 {-# INLINE liftBase #-}
91
95
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)
95 }
99 }
96
100
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 #-}
102
106
103− restoreT = PDT . restoreT . restoreT . liftM unStTAWS
107+ restoreT = PDT . restoreT . restoreT . liftM unStTPD
104 {-# INLINE restoreT #-}
108 {-# INLINE restoreT #-}
105
109
106instance MonadBaseControl b m => MonadBaseControl b (PDT s m) where
110instance MonadBaseControl b m => MonadBaseControl b (PDT s m) where