@@ -179,7 +179,7 @@ build flags rootFile = do
179179 files <- if make flags then getSortedDependencies noPrelude rootFile else return [rootFile]
180180 let ifaces = if noPrelude then Map.empty else Prelude.interfaces
181181 (moduleName, interfaces) <- buildFiles flags (length files) ifaces "" files
182− js <- foldM appendToOutput "" files
182+ js <- foldM appendToOutput BS.empty files
183183
184184 (extension, code) <- case only_js flags of
185185 True -> do
@@ -187,22 +187,23 @@ build flags rootFile = do
187187 return ("js", genJs js)
188188 False -> do
189189 putStr "Generating HTML ... "
190− runtime <- getRuntime flags
191− return ("html", genHtml $ createHtml runtime (takeBaseName rootFile) (sources js) moduleName "")
190+ rtsPath <- getRuntime flags
191+ return ("html", BS.pack . genHtml $
192+ createHtml rtsPath (takeBaseName rootFile) (sources js) moduleName "")
192193
193194 let targetFile = buildPath flags rootFile extension
194195 createDirectoryIfMissing True (takeDirectory targetFile)
195− writeFile targetFile code
196+ BS.writeFile targetFile code
196197 putStrLn "Done"
197198
198199 where
199− appendToOutput :: String -> FilePath -> IO String
200+ appendToOutput :: BS.ByteString -> FilePath -> IO BS.ByteString
200201 appendToOutput js filePath =
201− do src <- readFile (elmo flags filePath)
202− return (src ++ js)
202+ do src <- BS.readFile (elmo flags filePath)
203+ return (BS.append src js)
203204
204205 genHtml = if minify flags then Normal.renderHtml else Pretty.renderHtml
205− genJs = if minify flags then BS.unpack . JS.minify . BS.pack else id
206+ genJs = if minify flags then JS.minify else id
206207 sources js = map Link (scripts flags) ++
207208 [ Source (if minify flags then Minified else Readable) js ]
208209