on master help sign in
Add field to MetadataModule for datatypes
commite852ae25e3a37c11e6a54033688f6488a631c67d authorEvan Czaplicki <info@elm-lang.org> dateWed 17 Jul 2013, 19:24 (13 years ago) parentfceb46d
2 files changed+10−8
compiler/Initialize.hs+1 compiler/SourceSyntax/Module.hs+9−8
compiler/Initialize.hs+1
@@ -38,6 +38,7 @@ buildFromSource noPrelude src =
3838 imports = ims,
3939 defs = fst . SD.flattenLets [] . SD.sortDefs . dummyLet $ TcDecl.toExpr decls,
4040 types = Map.empty,
41+ datatypes = [ (name, vars, ctors) | Datatype name vars ctors <- decls ],
4142 fixities = [ (assoc,level,op) | Fixity assoc level op <- decls ],
4243 aliases = [ (name,tvs,tipe) | TypeAlias name tvs tipe <- decls ],
4344 foreignImports = [ (evt,v,name,typ) | ImportEvent evt v name typ <- decls ],
compiler/SourceSyntax/Module.hs+9−8
@@ -22,14 +22,15 @@ data ImportMethod = As String | Importing [String] | Hiding [String]
2222 deriving (Eq, Ord, Show, Data, Typeable)
2323
2424data MetadataModule t v = MetadataModule {
25− names :: [String],
26− path :: FilePath,
27− exports :: [String],
28− imports :: [(String, ImportMethod)],
29− defs :: [Def t v],
30− types :: Map.Map String T.Variable,
31− fixities :: [(Assoc, Int, String)],
32− aliases :: [(String, [String], Type)],
25+ names :: [String],
26+ path :: FilePath,
27+ exports :: [String],
28+ imports :: [(String, ImportMethod)],
29+ defs :: [Def t v],
30+ types :: Map.Map String T.Variable,
31+ fixities :: [(Assoc, Int, String)],
32+ aliases :: [(String, [String], Type)],
33+ datatypes :: [ (String, [String], [(String,[Type])]) ],
3334 foreignImports :: [(String, LExpr t v, String, Type)],
3435 foreignExports :: [(String, String, Type)]
3536}