@@ -117,7 +117,10 @@ tacticCmd _ _ _ =
117
117
pure $ Left $ mkErr InvalidRequest " Bad URI"
118
118
119
119
120
- timingOut :: Int -> (Either ResponseError a ) -> MaybeT IO (Either ResponseError a )
120
+ timingOut
121
+ :: Int -- ^ Time in microseconds
122
+ -> Either ResponseError a -- ^ Computation to run
123
+ -> MaybeT IO (Either ResponseError a )
121
124
timingOut t m = do
122
125
x <- lift $ timeout t $ evaluate m
123
126
pure $ joinNote (mkErr InvalidRequest " timed out" ) x
@@ -203,8 +206,8 @@ mergeFunBindMatches make_decl span (fb@FunBind {fun_matches = mg@MG {mg_alts = L
203
206
mergeFunBindMatches _ _ _ = Left " mergeFunBindMatches: called on something that isnt a funbind"
204
207
205
208
206
- noteT :: String -> TransformT (Either String ) a
207
- noteT = lift . Left
209
+ throwError :: String -> TransformT (Either String ) a
210
+ throwError = lift . Left
208
211
209
212
210
213
------------------------------------------------------------------------------
@@ -218,7 +221,7 @@ graftDecl
218
221
graftDecl span
219
222
make_decl
220
223
(L src (ValD ext fb))
221
- = either noteT (pure . Just . pure . L src . ValD ext) $
224
+ = either throwError (pure . Just . pure . L src . ValD ext) $
222
225
mergeFunBindMatches make_decl span fb
223
226
-- TODO(sandy): add another case for default methods in class definitions
224
227
graftDecl span
@@ -229,7 +232,7 @@ graftDecl span
229
232
for (bagToList binds) $ \ b@ (L bsrc bind) -> do
230
233
case bind of
231
234
fb@ FunBind {}
232
- | span `isSubspanOf` bsrc -> either noteT (pure . L bsrc) $ mergeFunBindMatches make_decl span fb
235
+ | span `isSubspanOf` bsrc -> either throwError (pure . L bsrc) $ mergeFunBindMatches make_decl span fb
233
236
_ -> pure b
234
237
235
238
pure $ Just $ pure $ L src $ InstD ext $ cid
@@ -240,7 +243,7 @@ graftDecl span
240
243
graftDecl span _ x = do
241
244
traceMX " biggest" $ unsafeRender $ locateBiggest @ (Match GhcPs (LHsExpr GhcPs )) span x
242
245
traceMX " first" $ unsafeRender $ locateFirst @ (Match GhcPs (LHsExpr GhcPs )) x
243
- noteT " graftDecl: don't know about this AST form"
246
+ throwError " graftDecl: don't know about this AST form"
244
247
245
248
246
249
fromMaybeT :: Functor m => a -> MaybeT m a -> m a
0 commit comments