pufuwozu/roy — Issue #14: Better monad example
Author: piranha
Created: 2011-11-28 14:47:48+00:00
State: open

Maybe it's worth it to have something better as an example for monad, to show why would you want them in JS. Something like this maybe:

```
type Request = {url: String, payload: String}

let ajaxRequest = {
return: fn x = x
bind: fn (x : Request) f =
$.ajax x.url x.payload f
}

let v = (do ajaxRequest
bind value = {url: '/url/', payload: 'stuff'}
console.log value
return value
)
```