-
Notifications
You must be signed in to change notification settings - Fork 430
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
Syntax proposal: F# like syntax for monads "let!" #1353
Comments
Would this be similar to https://github.com/janestreet/ppx_let ? If so, you can use this ppx with your projects already. If the goal is the async/awaiy equivalent, there's some really good work to make https://github.com/ocsigen/lwt work well with reason and bucklescript, which should help some. |
I'll elaborate further. In principle my proposal is to integrate something similar to
In addition the F# syntax described here consider other useful cases like Here's another example comparing it to OCaml:
Same code with Reason (F# like syntax)
|
What does Reason use for its equivalent(s) to |
@hcarty If I understood correctly, what you mean is that |
@modlfo I just mean that the |
@hcarty Thanks for the clarification. I was not aware that |
I proposed a generic monadic syntax based on ppx_let semantics in #1321 (comment) |
Binding ops solve this problem today |
One thing that I miss from F# when working in OCaml is the possibility of writing monadic bindings (that are readable) without the need of a ppx preprocessor like ppx_let.
I think that the F# syntax could fit nicely with the current syntax of Reason. Here are more details https://docs.microsoft.com/en-gb/dotnet/fsharp/language-reference/computation-expressions
For example:
which already looks pretty much like Reason:
If you are not familiar with the F# syntax, the
let!
is replaced by thebind
function defined in the moduleasync
.The text was updated successfully, but these errors were encountered: