Skip to content

Instantly share code, notes, and snippets.

@raimohanska
Created November 26, 2012 17:15
Show Gist options
  • Save raimohanska/4149447 to your computer and use it in GitHub Desktop.
Save raimohanska/4149447 to your computer and use it in GitHub Desktop.
IO Monad in Roy
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 <- (\() -> "hello")
putStrLn text
main ()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment