@@ -53,7 +53,6 @@ instance Monad RouteResult where
53
53
newtype RouteResultT m a = RouteResultT { runRouteResultT :: m (RouteResult a ) }
54
54
deriving (Functor )
55
55
56
- -- As we write these instances, we get instances for `DelayedIO` with GND.
57
56
instance MonadTrans RouteResultT where
58
57
lift = RouteResultT . liftM Route
59
58
@@ -89,8 +88,6 @@ instance MonadTransControl RouteResultT where
89
88
instance MonadThrow m => MonadThrow (RouteResultT m ) where
90
89
throwM = lift . throwM
91
90
92
- -- instance MonadCatch m => MonadCatch (RouteResultT m) where
93
- -- instance MonadError ServantErr (RouteResultT m) where
94
91
95
92
toApplication :: RoutingApplication -> Application
96
93
toApplication ra request respond = ra request routingRespond
@@ -189,8 +186,8 @@ newtype DelayedIO a = DelayedIO { runDelayedIO' :: ReaderT Request (ResourceT (R
189
186
, MonadResource
190
187
)
191
188
192
- returnRouteResult :: RouteResult a -> DelayedIO a
193
- returnRouteResult x = DelayedIO $ lift . lift $ RouteResultT . return $ x
189
+ liftRouteResult :: RouteResult a -> DelayedIO a
190
+ liftRouteResult x = DelayedIO $ lift . lift $ RouteResultT . return $ x
194
191
195
192
instance MonadBaseControl IO DelayedIO where
196
193
type StM DelayedIO a = StM (ReaderT Request (ResourceT (RouteResultT IO ))) a
@@ -209,11 +206,11 @@ emptyDelayed result =
209
206
210
207
-- | Fail with the option to recover.
211
208
delayedFail :: ServantErr -> DelayedIO a
212
- delayedFail err = returnRouteResult $ Fail err
209
+ delayedFail err = liftRouteResult $ Fail err
213
210
214
211
-- | Fail fatally, i.e., without any option to recover.
215
212
delayedFailFatal :: ServantErr -> DelayedIO a
216
- delayedFailFatal err = returnRouteResult $ FailFatal err
213
+ delayedFailFatal err = liftRouteResult $ FailFatal err
217
214
218
215
-- | Gain access to the incoming request.
219
216
withRequest :: (Request -> DelayedIO a ) -> DelayedIO a
@@ -311,7 +308,7 @@ runDelayed Delayed{..} env req =
311
308
a <- authD
312
309
b <- bodyD
313
310
r <- ask
314
- returnRouteResult (serverD c a b r)
311
+ liftRouteResult (serverD c a b r)
315
312
)
316
313
req
317
314
0 commit comments