shithub: MicroHs

Download patch

ref: 75d02b70e8a79cb517ee159c2a1ffc3fc0ec6542
parent: b9f0554fb00ffee57f8ff08e932b015341ffac04
author: Lennart Augustsson <lennart@augustsson.net>
date: Mon Mar 25 15:07:22 EDT 2024

Package

--- /dev/null
+++ b/src/MicroHs/Package.hs
@@ -1,0 +1,31 @@
+module MicroHs.Package(
+  PackageName, PackageVersion,
+  Package(..),
+  ) where
+import MicroHs.Desugar(LDef)
+import MicroHs.TypeCheck(TModule)
+
+--
+-- Packages are organized as follows.
+-- The environment variable $PKGDIR determines the location,
+-- with the default $HOME/.mcabal/packages
+-- The file $PKGDIR/toc.txt the the table of contents.
+-- Each line is the name of a package followed by the exported modules.
+-- For each package 'foo' there is a serialized package
+-- in $PKGDIR/foo.pkg
+-- On startup the table of contents is read.
+-- From this we get a map from module names to package file names.
+-- On first use of a package module, we load the corresponding package file.
+-- There is also a map from package names to loaded packages.
+-- 
+
+
+type PackageName = String
+type PackageVersion = String
+
+data Package = Package {
+  pkgName      :: PackageName,                     -- package name
+  pkgVersion   :: PackageVersion,                  -- package version
+  pkgExported  :: [TModule [LDef]]                 -- exported modules
+  pkgOther     :: [TModule [LDef]]                 -- non-exported modules
+  pkgDepends   :: [(PackageName, PackageVersion)]  -- used packages
--