Skip to content
This repository has been archived by the owner. It is now read-only.

Better monad example #14

Closed
piranha opened this issue Nov 28, 2011 · 2 comments

Comments

@piranha
Copy link
Collaborator

commented Nov 28, 2011

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
)
@paulmillr

This comment has been minimized.

Copy link
Contributor

commented Nov 28, 2011

👍

@puffnfresh

This comment has been minimized.

Copy link
Owner

commented Nov 29, 2011

Very, very cool. 👍

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
3 participants
You can’t perform that action at this time.