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

Better monad example #14

piranha opened this issue Nov 28, 2011 · 2 comments


Copy link

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

This comment has been minimized.

Copy link

commented Nov 28, 2011



This comment has been minimized.

Copy link

commented Nov 29, 2011

Very, very cool. 👍

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