on b1dd157 help sign in
47 lines 1.4 kB history raw
1{-# LANGUAGE DeriveDataTypeable #-}
2module SourceSyntax.Module where
4import Data.Data
5import Data.Binary
6import Data.List (intercalate)
7import qualified Data.Map as Map
8import Control.Applicative ((<$>), (<*>))
10import SourceSyntax.Expression
11import SourceSyntax.Declaration
12import SourceSyntax.Type
13import System.FilePath (joinPath)
14import qualified Type.Type as Type
16data Module tipe var =
17 Module [String] Exports Imports [Declaration tipe var]
18 deriving (Show)
20type Exports = [String]
22type Imports = [(String, ImportMethod)]
23data ImportMethod = As String | Importing [String] | Hiding [String]
24 deriving (Eq, Ord, Show, Data, Typeable)
26data MetadataModule t v = MetadataModule {
27 names :: [String],
28 path :: FilePath,
29 exports :: [String],
30 imports :: [(String, ImportMethod)],
31 program :: LExpr t v,
32 types :: Map.Map String Type.Variable,
33 fixities :: [(Assoc, Int, String)],
34 aliases :: [(String, [String], Type)],
35 datatypes :: [ (String, [String], [(String,[Type])]) ],
36 foreignImports :: [(String, LExpr t v, String, Type)],
37 foreignExports :: [(String, String, Type)]
40data ModuleInterface = ModuleInterface {
41 iTypes :: Map.Map String Type,
42 iAdts :: Map.Map String (Int, [String])
43} deriving Show
45instance Binary ModuleInterface where
46 put modul = put (iTypes modul) >> put (iAdts modul)
47 get = ModuleInterface <$> get <*> get