Skip to content
This repository has been archived by the owner on Nov 23, 2017. It is now read-only.

add ajax monad as an example #38

Closed
wants to merge 2 commits into from
Closed

add ajax monad as an example #38

wants to merge 2 commits into from

Conversation

piranha
Copy link
Collaborator

@piranha piranha commented Dec 3, 2011

Refs GH-14. Do you think it's better to keep tracing monad as well or should I remove it from examples?

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

let ajaxRequest = {
return: fn x = x
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lambda syntax has been changed in #32. So:

return: \x -> x

@paulmillr
Copy link
Contributor

👍

@puffnfresh
Copy link
Owner

I really like the example but $ isn't defined on the Roy website. It doesn't seem like you're using jQuery's $.ajax.

Where should it be coming from?

@piranha
Copy link
Collaborator Author

piranha commented Dec 4, 2011

Hm, I thought about exactly jQuery's $.ajax. Why doesn't it look like this? Of course, to be able to run it, it would be nice to point to some real url, but it still needs jQuery for this.

@puffnfresh
Copy link
Owner

As far as I can tell, there's only jQuery.ajax( url [, settings] ) or jQuery.ajax( settings ).

That probably leaves us with a couple of options:

bind: fn (x : Request) f =
  $.ajax x.url {dataL x.payload, complete: f}

Or:

bind: fn (x : Request) f =
  ($.ajax x.url).complete f

@piranha
Copy link
Collaborator Author

piranha commented Dec 4, 2011

Indeed I was wrong. I thought about $.get x.url x.payload f. :\ Sorry.

@puffnfresh
Copy link
Owner

Awesome, I can fix that up locally.

@puffnfresh
Copy link
Owner

Merged and pushed to http://roy.brianmckenna.org/

@puffnfresh puffnfresh closed this Dec 4, 2011
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants