on master help sign in
Replace '-' with '_' in LHS of Node requires

Currently, the following ``` module Main %lib Node "node-pty" main : JS_IO () main = pure () ``` produces the invalid javascript `var node-pty = require("node-pty");`. This is a quick fix that matches the way we handle other invalid characters.

commit74d29c0d7cca6866fa94acc1e39a31d8be17683b authorNaman Bharadwaj <namanbharadwaj@users.noreply.github.com> dateTue 2 Jan 2018, 18:19 (9 years ago) parentd23221b
1 file changed+1
src/IRTS/JavaScript/Codegen.hs+1
src/IRTS/JavaScript/Codegen.hs+1
@@ -89,6 +89,7 @@ includeLibs =
8989 repl '\\' = '_'
9090 repl '/' = '_'
9191 repl '.' = '_'
92+ repl '-' = '_'
9293 repl c = c
9394 in
9495 concatMap (\lib -> "var " ++ (repl <$> lib) ++ " = require(\"" ++ lib ++"\");\n")