mirror of
https://github.com/github/semantic.git
synced 2024-12-26 00:12:29 +03:00
Trace out the module table for easy debug/dev of import resolution
This commit is contained in:
parent
0d29d38c50
commit
edc00cff27
@ -15,7 +15,10 @@ data ModuleInfo = ModuleInfo { modulePath :: FilePath, moduleRoot :: FilePath }
|
||||
deriving (Eq, Ord, Show)
|
||||
|
||||
data Module term = Module { moduleInfo :: ModuleInfo, moduleBody :: term }
|
||||
deriving (Eq, Foldable, Functor, Ord, Show, Traversable)
|
||||
deriving (Eq, Foldable, Functor, Ord, Traversable)
|
||||
|
||||
instance Show (Module term) where
|
||||
showsPrec _ Module{..} = shows moduleInfo
|
||||
|
||||
|
||||
-- | Construct a 'Module' for a 'Blob' and @term@, relative to some root 'FilePath'.
|
||||
|
@ -40,7 +40,7 @@ insert k v = ModuleTable . Map.insert k v . unModuleTable
|
||||
|
||||
-- | Construct a 'ModuleTable' from a list of 'Module's.
|
||||
fromModules :: [Module term] -> ModuleTable [Module term]
|
||||
fromModules = ModuleTable . Map.fromListWith (<>) . map toEntry
|
||||
fromModules modules = let x = ModuleTable (Map.fromListWith (<>) (map toEntry modules)) in traceShow x x
|
||||
where toEntry m = (modulePath (moduleInfo m), [m])
|
||||
|
||||
toPairs :: ModuleTable a -> [(ModulePath, a)]
|
||||
|
Loading…
Reference in New Issue
Block a user