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

return broken #155

Open
puffnfresh opened this issue Nov 26, 2012 · 1 comment
Open

return broken #155

puffnfresh opened this issue Nov 26, 2012 · 1 comment
Labels

Comments

@puffnfresh
Copy link
Owner

Following example does not work because return is not parsed correctly:

let ioMonad = {
        return: \x -> (\() -> x)
        bind: \action f -> (\() -> 
                             let value = action ()
                             let action2 = f value
                             action2 ()
                           )
      }

let putStrLn line () = console.log line

let main = do ioMonad
    text <- return "hello"
    putStrLn text

main ()
@raimohanska
Copy link
Collaborator

Btw, there's another trick in the example: the putStrLn implementation assumes that Roy functions are curried and partially applicable which apparently is not the case. Hence, my working version has also this change:

let putStrLn line = (\() -> console.log line)

In this same experiment I tried to introduce

let const x = (\() -> x)

But that doesn't compile; const seems like a reserved word. Don't know if that's intentional... (If I name it "always" instead, it compiles)

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

2 participants