Skip to content
This repository has been archived by the owner on Nov 23, 2017. It is now read-only.

Monad syntax bug #160

Open
raimohanska opened this issue Dec 2, 2012 · 3 comments
Open

Monad syntax bug #160

raimohanska opened this issue Dec 2, 2012 · 3 comments
Labels

Comments

@raimohanska
Copy link
Collaborator

As in https://gist.github.com/4150252#comments

This works:

let main = do ioMonad
  _ <- putStrLn "a"
  putStrLn "b"

This does not:

let main = do ioMonad
  putStrLn "a"
  putStrLn "b"
raimohanska added a commit to raimohanska/roy that referenced this issue Dec 2, 2012
@raimohanska
Copy link
Collaborator Author

So I made a fix, but I gotta admit I don't understand the compiler thorougly enough to be totally convinced it works under all circumstances. I added a new testcase (callbackmonad.roy) an existing test case to also include a line where there's just a side effect and no assignment.

@raimohanska
Copy link
Collaborator Author

Works in Turtle Roy: http://turtle-roy.herokuapp.com/?turtle=2FTJWA37ZP

@joneshf
Copy link
Collaborator

joneshf commented Aug 5, 2013

Hmm, There still seems to be a bug about this as of 0.2.2. It seems to still have to bind something in order for it to compile.

So something like:

let main = do someMonad
  someFunc 37

Gives this traceback:

/usr/lib/node_modules/roy/src/compile.js:152
    var result = n.accept({
                   ^
TypeError: Cannot call method 'accept' of undefined
    at compileNodeWithEnvToJsAST (/usr/lib/node_modules/roy/src/compile.js:152:20)
    at compileNode (/usr/lib/node_modules/roy/src/compile.js:150:16)
    at Object.n.accept.visitBind (/usr/lib/node_modules/roy/src/compile.js:317:27)
    at accept (/usr/lib/node_modules/roy/src/nodes.js:146:26)
    at compileNodeWithEnvToJsAST (/usr/lib/node_modules/roy/src/compile.js:152:20)
    at compileNode (/usr/lib/node_modules/roy/src/compile.js:150:16)
    at Object.n.accept.visitDo (/usr/lib/node_modules/roy/src/compile.js:388:27)
    at accept (/usr/lib/node_modules/roy/src/nodes.js:156:26)
    at compileNodeWithEnvToJsAST (/usr/lib/node_modules/roy/src/compile.js:152:20)
    at compileNode (/usr/lib/node_modules/roy/src/compile.js:150:16)

@rtfeldman rtfeldman reopened this Aug 7, 2013
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants