mirror of
https://github.com/github/semantic.git
synced 2024-11-28 01:47:01 +03:00
Generalize scopeGraph over the term type.
This commit is contained in:
parent
3bafa9a8b3
commit
c7bee13fd4
@ -15,7 +15,6 @@ import Control.Effect.Fresh
|
|||||||
import Control.Effect.Reader
|
import Control.Effect.Reader
|
||||||
import Control.Effect.State
|
import Control.Effect.State
|
||||||
import Control.Monad ((>=>))
|
import Control.Monad ((>=>))
|
||||||
import qualified Data.Core as Core
|
|
||||||
import Data.File
|
import Data.File
|
||||||
import Data.Foldable (fold)
|
import Data.Foldable (fold)
|
||||||
import Data.Function (fix)
|
import Data.Function (fix)
|
||||||
@ -26,7 +25,6 @@ import Data.Name
|
|||||||
import Data.Proxy
|
import Data.Proxy
|
||||||
import qualified Data.Set as Set
|
import qualified Data.Set as Set
|
||||||
import Data.Text (Text)
|
import Data.Text (Text)
|
||||||
import Data.Term
|
|
||||||
import Prelude hiding (fail)
|
import Prelude hiding (fail)
|
||||||
|
|
||||||
data Entry = Entry
|
data Entry = Entry
|
||||||
@ -41,8 +39,17 @@ newtype ScopeGraph = ScopeGraph { unScopeGraph :: Map.Map Entry (Set.Set Entry)
|
|||||||
instance Semigroup ScopeGraph where
|
instance Semigroup ScopeGraph where
|
||||||
ScopeGraph a <> ScopeGraph b = ScopeGraph (Map.unionWith (<>) a b)
|
ScopeGraph a <> ScopeGraph b = ScopeGraph (Map.unionWith (<>) a b)
|
||||||
|
|
||||||
scopeGraph :: [File (Term (Core.Ann :+: Core.Core) User)] -> (Heap User ScopeGraph, [File (Either (Loc, String) ScopeGraph)])
|
|
||||||
scopeGraph
|
scopeGraph
|
||||||
|
:: Ord term
|
||||||
|
=> (forall sig m
|
||||||
|
. (Carrier sig m, Member (Reader Loc) sig, MonadFail m)
|
||||||
|
=> Analysis term User ScopeGraph m
|
||||||
|
-> (term -> m ScopeGraph)
|
||||||
|
-> (term -> m ScopeGraph)
|
||||||
|
)
|
||||||
|
-> [File term]
|
||||||
|
-> (Heap User ScopeGraph, [File (Either (Loc, String) ScopeGraph)])
|
||||||
|
scopeGraph eval
|
||||||
= run
|
= run
|
||||||
. runFresh
|
. runFresh
|
||||||
. runHeap
|
. runHeap
|
||||||
|
Loading…
Reference in New Issue
Block a user