Skip to content
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

bs and bs.obj ppx apply deeply #2584

Open
bobzhang opened this issue Jun 1, 2020 · 1 comment
Open

bs and bs.obj ppx apply deeply #2584

bobzhang opened this issue Jun 1, 2020 · 1 comment

Comments

@bobzhang
Copy link
Contributor

bobzhang commented Jun 1, 2020

When using [@bs] to uncurry a function it is applied deeply. Probably it's better to apply it only on the most shallow level:

[@bs] uncurriedFun({
  normalFun(1)
});

In this case the output of the ppx is that normalFun is also called uncurried.

A similar thing happens with [@bs.obj]. All fields (even if it's part of the field expression) are converted to objects.

example:

[%bs.obj]
{
  test: {actually_a_record: 1}
}

cc @jfrolich
moved from rescript-lang/rescript#4306

@bobzhang
Copy link
Contributor Author

bobzhang commented Jun 1, 2020

note the bs attribute looks good to me.

let u =(.f0,f1)=>
f0(. {
  f1(1)
});

The inferred type is

let u: (. (. 'a) => 'b, int => 'a) => 'b;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant