on master help sign in
Fix how compiler errors are displayed in generated HTML
f625a9cevancz
compiler/Gen/CompileToJS.hs+3−1
@@ -18,8 +18,10 @@ import Rename (deprime)
18import Types.Types ( Type(RecordT) )
18import Types.Types ( Type(RecordT) )
19
19
20showErr :: String -> String
20showErr :: String -> String
21−showErr err = "Elm.Graphics.text(Elm.Text.monospace(" ++ msg ++ "))"
21+showErr err = globalAssign "Elm.Main" (jsFunc "elm" body)
22 where msg = show . concatMap (++"<br>") . lines $ err
22 where msg = show . concatMap (++"<br>") . lines $ err
23+ body = "var T = Elm.Graphics.Text(elm);\n\
24+ \return { main : T.text(T.monospace(" ++ msg ++ ")) };"
23
25
24indent = concatMap f
26indent = concatMap f
25 where f '\n' = "\n "
27 where f '\n' = "\n "