`return` broken
Opened this issue · 1 comments
puffnfresh commented
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 commented
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)