mirror of
https://github.com/github/semantic.git
synced 2024-12-20 13:21:59 +03:00
Rename the LoadError constructor to ModuleNotFound.
This commit is contained in:
parent
ccd7424af7
commit
a12383f6e1
@ -93,7 +93,7 @@ graphingLoadErrors :: forall location term value effects a
|
||||
-> SubtermAlgebra (Base term) term (Evaluator location term value effects a)
|
||||
graphingLoadErrors recur term = resume @(LoadError location value)
|
||||
(recur term)
|
||||
(\ err@(LoadError name) -> moduleInclusion (Module (BC.pack name)) *> throwResumable err)
|
||||
(\ err@(ModuleNotFound name) -> moduleInclusion (Module (BC.pack name)) *> throwResumable err)
|
||||
|
||||
-- | Add vertices to the graph for evaluated modules and the packages containing them.
|
||||
graphingModules :: Members '[ Reader ModuleInfo
|
||||
|
@ -125,17 +125,17 @@ instance Applicative m => Monoid (Merging m location value) where
|
||||
|
||||
-- | An error thrown when loading a module from the list of provided modules. Indicates we weren't able to find a module with the given name.
|
||||
data LoadError location value resume where
|
||||
LoadError :: ModulePath -> LoadError location value (Maybe (Environment location value, value))
|
||||
ModuleNotFound :: ModulePath -> LoadError location value (Maybe (Environment location value, value))
|
||||
|
||||
deriving instance Eq (LoadError location value resume)
|
||||
deriving instance Show (LoadError location value resume)
|
||||
instance Show1 (LoadError location value) where
|
||||
liftShowsPrec _ _ = showsPrec
|
||||
instance Eq1 (LoadError location value) where
|
||||
liftEq _ (LoadError a) (LoadError b) = a == b
|
||||
liftEq _ (ModuleNotFound a) (ModuleNotFound b) = a == b
|
||||
|
||||
moduleNotFound :: Member (Resumable (LoadError location value)) effects => ModulePath -> Evaluator location term value effects (Maybe (Environment location value, value))
|
||||
moduleNotFound = throwResumable . LoadError
|
||||
moduleNotFound = throwResumable . ModuleNotFound
|
||||
|
||||
runLoadError :: Evaluator location term value (Resumable (LoadError location value) ': effects) a -> Evaluator location term value effects (Either (SomeExc (LoadError location value)) a)
|
||||
runLoadError = raiseHandler runError
|
||||
|
@ -91,7 +91,7 @@ resumingResolutionError = runResolutionErrorWith (\ err -> traceE ("ResolutionEr
|
||||
GoImportError pathToResolve -> pure [pathToResolve])
|
||||
|
||||
resumingLoadError :: Member Trace effects => Evaluator location term value (Resumable (LoadError location value) ': effects) a -> Evaluator location term value effects a
|
||||
resumingLoadError = runLoadErrorWith (\ (LoadError path) -> traceE ("LoadError: " <> path) $> Nothing)
|
||||
resumingLoadError = runLoadErrorWith (\ (ModuleNotFound path) -> traceE ("LoadError: " <> path) $> Nothing)
|
||||
|
||||
resumingEvalError :: (AbstractHole value, Member Trace effects, Show value) => Evaluator location term value (Resumable (EvalError value) ': effects) a -> Evaluator location term value effects a
|
||||
resumingEvalError = runEvalErrorWith (\ err -> traceE ("EvalError" <> show err) *> case err of
|
||||
|
Loading…
Reference in New Issue
Block a user