Skip to content

Commit 67badc8

Browse files
committed
Rename noteT to throwError; minor haddock
1 parent 6161373 commit 67badc8

File tree

1 file changed

+9
-6
lines changed
  • plugins/hls-tactics-plugin/src/Ide/Plugin

1 file changed

+9
-6
lines changed

plugins/hls-tactics-plugin/src/Ide/Plugin/Tactic.hs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,10 @@ tacticCmd _ _ _ =
117117
pure $ Left $ mkErr InvalidRequest "Bad URI"
118118

119119

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)
121124
timingOut t m = do
122125
x <- lift $ timeout t $ evaluate m
123126
pure $ joinNote (mkErr InvalidRequest "timed out") x
@@ -203,8 +206,8 @@ mergeFunBindMatches make_decl span (fb@FunBind {fun_matches = mg@MG {mg_alts = L
203206
mergeFunBindMatches _ _ _ = Left "mergeFunBindMatches: called on something that isnt a funbind"
204207

205208

206-
noteT :: String -> TransformT (Either String) a
207-
noteT = lift . Left
209+
throwError :: String -> TransformT (Either String) a
210+
throwError = lift . Left
208211

209212

210213
------------------------------------------------------------------------------
@@ -218,7 +221,7 @@ graftDecl
218221
graftDecl span
219222
make_decl
220223
(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) $
222225
mergeFunBindMatches make_decl span fb
223226
-- TODO(sandy): add another case for default methods in class definitions
224227
graftDecl span
@@ -229,7 +232,7 @@ graftDecl span
229232
for (bagToList binds) $ \b@(L bsrc bind) -> do
230233
case bind of
231234
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
233236
_ -> pure b
234237

235238
pure $ Just $ pure $ L src $ InstD ext $ cid
@@ -240,7 +243,7 @@ graftDecl span
240243
graftDecl span _ x = do
241244
traceMX "biggest" $ unsafeRender $ locateBiggest @(Match GhcPs (LHsExpr GhcPs)) span x
242245
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"
244247

245248

246249
fromMaybeT :: Functor m => a -> MaybeT m a -> m a

0 commit comments

Comments
 (0)