Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
implement monadic syntax sugar #1326
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
research on semantics of