Skip to content

Commit

Permalink
Check if main exists / get elm-repl working
Browse files Browse the repository at this point in the history
  • Loading branch information
evancz committed Oct 8, 2016
1 parent 01abf34 commit 1a55483
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Pipeline/Generate.hs
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ exportProgram
-> String
exportProgram debugMode interfaces canonicalName@(Module.Canonical _ moduleName) =
let
makeProgram =
program =
Module.qualifiedVar canonicalName "main"

object =
Expand All @@ -211,7 +211,8 @@ exportProgram debugMode interfaces canonicalName@(Module.Canonical _ moduleName)
if debugMode then createDebugMetadata interfaces canonicalName else "undefined"
in
setup moduleName
++ makeProgram ++ "(" ++ object ++ ", '" ++ name ++ "', " ++ debugArg ++ ");"
++ "if (typeof " ++ program ++ " !== 'undefined') {\n "
++ program ++ "(" ++ object ++ ", '" ++ name ++ "', " ++ debugArg ++ ");\n}"


createDebugMetadata :: Map.Map Module.Canonical Module.Interface -> Module.Canonical -> String
Expand Down

0 comments on commit 1a55483

Please sign in to comment.