New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

implement monadic syntax sugar #1326

Open
bobzhang opened this Issue Mar 7, 2017 · 0 comments

Comments

Projects
None yet
1 participant
@bobzhang
Member

bobzhang commented Mar 7, 2017

see discussions in #1214

after some research, below is the syntax I think will be great and extensible in the future

let [@bs] v0  = promise0 in  (* default to Promise.bind *)
let [@bs] v1 = promise1 in 
let [@bs Option] v2 = optionl2 in  (* now default to Option.bind *)
let [@bs ] v3 = optional3 in 
let [@bs Promise] v4 = promise4 in (* back to promise *)
let [@bs error] v5 = error_handling in  (* here bind to Promise.catch *)
...  

We chose attributes instead of extension (like janestreet let%bind) because attributes allow payload for more customization later

todo:

research on semantics of let .. and

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment