1
1
mirror of https://github.com/github/semantic.git synced 2024-12-20 21:31:48 +03:00

Use resumeLoadError to tighten up graphingLoadErrors.

This commit is contained in:
Rob Rix 2018-05-09 12:27:35 -04:00
parent 16df80a66a
commit db2c0e737e

View File

@ -1,4 +1,4 @@
{-# LANGUAGE GADTs, GeneralizedNewtypeDeriving, ScopedTypeVariables, TypeFamilies, TypeOperators, UndecidableInstances #-} {-# LANGUAGE GADTs, GeneralizedNewtypeDeriving, TypeFamilies, TypeOperators, UndecidableInstances #-}
module Analysis.Abstract.Graph module Analysis.Abstract.Graph
( Graph(..) ( Graph(..)
, Vertex(..) , Vertex(..)
@ -84,16 +84,13 @@ graphingTerms recur term@(In _ syntax) = do
recur term recur term
-- | Add vertices to the graph for 'LoadError's. -- | Add vertices to the graph for 'LoadError's.
graphingLoadErrors :: forall location term value effects a graphingLoadErrors :: Members '[ Reader ModuleInfo
. Members '[ Reader ModuleInfo
, Resumable (LoadError location value) , Resumable (LoadError location value)
, State Graph , State Graph
] effects ] effects
=> SubtermAlgebra (Base term) term (Evaluator location term value effects a) => SubtermAlgebra (Base term) term (Evaluator location term value effects a)
-> SubtermAlgebra (Base term) term (Evaluator location term value effects a) -> SubtermAlgebra (Base term) term (Evaluator location term value effects a)
graphingLoadErrors recur term = resume @(LoadError location value) graphingLoadErrors recur term = recur term `resumeLoadError` (\ (ModuleNotFound name) -> moduleInclusion (Module (BC.pack name)) *> moduleNotFound name)
(recur term)
(\ err@(ModuleNotFound name) -> moduleInclusion (Module (BC.pack name)) *> throwResumable err)
-- | Add vertices to the graph for evaluated modules and the packages containing them. -- | Add vertices to the graph for evaluated modules and the packages containing them.
graphingModules :: Members '[ Reader ModuleInfo graphingModules :: Members '[ Reader ModuleInfo