ku-fpg / sunroof-compiler

Monadic Javascript Compiler
BSD 3-Clause "New" or "Revised" License
73 stars 6 forks source link

sunroofCompileJSB does not need a binding name? #38

Open jbracker opened 11 years ago

jbracker commented 11 years ago

Right now sunroofCompileJSB has the following signature:

sunroofCompileJSB :: CompilerOpts -> String -> JS B () -> IO String

Beside the internal implementation, why does it take a name to privde a binding? JS B () never has a interesting result. So shouldn't the signature be:

sunroofCompileJSB :: CompilerOpts -> JS B () -> IO String

Possible implementation:

sunroofCompileJSB :: CompilerOpts -> JS B () -> IO String
sunroofCompileJSB opts f = do
  (stmts,_) <- compileJS opts 0 (single . JS_Return) $ do
    k <- continuation (\ () -> f)
    goto k () :: JS A ()
  return $ showStmt $ ExprStmt $ scopeForEffect stmts
jbracker commented 11 years ago

Did we settle on something for this?

andygill commented 11 years ago

No - not yet.