@@ -3,11 +3,16 @@ module SourceSyntax.Module where
4import Data.Data
4import Data.Data
5import Data.List (intercalate)
5import Data.List (intercalate)
6−import qualified SourceSyntax.Declaration as Decl
6+import qualified Data.Map as Map
8+import SourceSyntax.Expression
9+import SourceSyntax.Declaration
10+import SourceSyntax.Type
7import System.FilePath (joinPath)
11import System.FilePath (joinPath)
12+import qualified Type.Type as T
9data Module tipe var =
14data Module tipe var =
10− Module [String] Exports Imports [Decl.Declaration tipe var]
15+ Module [String] Exports Imports [Declaration tipe var]
11 deriving (Show)
16 deriving (Show)
13type Exports = [String]
18type Exports = [String]
@@ -16,8 +21,15 @@ type Imports = [(String, ImportMethod)]
16data ImportMethod = As String | Importing [String] | Hiding [String]
21data ImportMethod = As String | Importing [String] | Hiding [String]
17 deriving (Eq, Ord, Show, Data, Typeable)
22 deriving (Eq, Ord, Show, Data, Typeable)
19−name :: Module a b -> String
24+data MetadataModule t v = MetadataModule {
20−name (Module names _ _ _) = intercalate "." names
25+ names :: [String],
22−path :: Module a b -> FilePath
26+ path :: FilePath,
23−path (Module names _ _ _) = joinPath names
27+ exports :: [String],
28+ imports :: [(String, ImportMethod)],
30+ types :: Map.Map String T.Variable,
31+ fixities :: [(Assoc, Int, String)],
32+ aliases :: [(String, [String], Type)],
33+ foreignImports :: [(String, LExpr t v, String, Type)],
34+ foreignExports :: [(String, String, Type)]