diff --git a/src/Data/Abstract/Package.hs b/src/Data/Abstract/Package.hs index 1e4de3489..0777d8023 100644 --- a/src/Data/Abstract/Package.hs +++ b/src/Data/Abstract/Package.hs @@ -6,9 +6,14 @@ import Data.Abstract.ModuleTable as ModuleTable type PackageName = Name +data PackageInfo = PackageInfo + { packageName :: Maybe PackageName + , packageVersion :: Maybe Version + } + deriving (Eq, Ord, Show) + data Package term = Package - { packageName :: Maybe PackageName - , packageVersion :: Maybe Version + { packageInfo :: PackageInfo , packageModules :: ModuleTable [Module term] , packageEntryPoints :: ModuleTable (Maybe Name) } @@ -19,6 +24,6 @@ newtype Version = Version { versionString :: String } fromModules :: [Module term] -> Package term -fromModules [] = Package Nothing Nothing mempty mempty -fromModules (m:ms) = Package Nothing Nothing (ModuleTable.fromModules (m:ms)) entryPoints +fromModules [] = Package (PackageInfo Nothing Nothing) mempty mempty +fromModules (m:ms) = Package (PackageInfo Nothing Nothing) (ModuleTable.fromModules (m:ms)) entryPoints where entryPoints = ModuleTable.singleton (moduleName (moduleInfo m)) Nothing diff --git a/src/Semantic/Util.hs b/src/Semantic/Util.hs index ff32a6d47..07f704949 100644 --- a/src/Semantic/Util.hs +++ b/src/Semantic/Util.hs @@ -181,7 +181,7 @@ parseFiles parser paths = traverse (parseFile parser (Just (dropFileName (head p parsePackage :: PackageName -> Parser term -> [FilePath] -> IO (Package term) parsePackage name parser files = setName . Package.fromModules <$> parseFiles parser files - where setName p = p { Package.packageName = Just name } + where setName p = p { packageInfo = PackageInfo (Just name) Nothing } -- Read a file from the filesystem into a Blob.