@@ -70,21 +70,21 @@ type Interface = String
7070buildFile :: Flags -> Int -> Int -> FilePath -> IO Interface
7171buildFile flags moduleNum numModules filePath =
7272 do compiled <- alreadyCompiled
73− if compiled then getInterface else compile
73+ if compiled then readFile elmo else compile
7474
7575 where
7676 file :: String -> FilePath
7777 file ext = output_directory flags </> replaceExtension filePath ext
7878
79− interface :: FilePath
80− interface = file "elmi"
79+ elmo :: FilePath
80+ elmo = file "elmo"
8181
8282 alreadyCompiled :: IO Bool
8383 alreadyCompiled = do
84− exists <- doesFileExist interface
84+ exists <- doesFileExist elmo
8585 if not exists then return False
8686 else do tsrc <- getModificationTime filePath
87− tint <- getModificationTime interface
87+ tint <- getModificationTime elmo
8888 return (tsrc < tint)
8989
9090 number :: String
@@ -97,19 +97,16 @@ buildFile flags moduleNum numModules filePath =
9797 compile = do
9898 putStrLn (number ++ " Compiling " ++ name)
9999 source <- readFile filePath
100− (inter,obj) <-
100+ (interface,obj) <-
101101 if takeExtension filePath == ".js" then return ("",source) else
102102 case buildFromSource (no_prelude flags) source of
103103 Left err -> putStrLn err >> exitFailure
104− Right modul -> return (show modul, jsModule modul)
104+ Right modul -> do exs <- exportInfo modul
105+ return (exs, jsModule modul)
105106 createDirectoryIfMissing True (output_directory flags)
106− writeFile interface inter
107− writeFile (file "elmo") obj
108− return inter
107+ writeFile elmo obj
108+ return obj
109109
110− getInterface :: IO Interface
111− getInterface = do
112− readFile interface
113110
114111getRuntime :: Flags -> IO FilePath
115112getRuntime flags =
@@ -153,3 +150,9 @@ buildFiles flags numModules interfaces (filePath:rest) = do
153150 let moduleName = intercalate "." (splitDirectories (dropExtensions filePath))
154151 interfaces' = Map.insert moduleName interface interfaces
155152 buildFiles flags numModules interfaces' rest
153+
154+
155+exportInfo :: Module -> IO String
156+exportInfo (Module names ims exs stmts) =
157+ do print exs
158+ return (show exs)