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

Compiler strips away parentheses affecting precedence in output code #569

Closed
bodil opened this issue Aug 22, 2014 · 0 comments
Closed

Compiler strips away parentheses affecting precedence in output code #569

bodil opened this issue Aug 22, 2014 · 0 comments

Comments

@bodil
Copy link

bodil commented Aug 22, 2014

Given the following function:

bug :: Number -> Number -> Number
bug a b = 0 - (a - b)

The compiler strips away the parentheses, yielding JS code like this:

return 0 - a - b;

I was expecting this:

return 0 - (a - b);

The former returns an unexpected result:

bug 0 (-2)
-- returns 2 ((0 - 0) - -2), not -2 (0 - (0 - -2)) as one would expect
@paf31 paf31 added bug labels Aug 22, 2014
@paf31 paf31 added this to the 0.6.0 milestone Aug 22, 2014
@paf31 paf31 added easy and removed easy labels Aug 22, 2014
@paf31 paf31 closed this as completed in db4fd45 Aug 25, 2014
paf31 added a commit that referenced this issue Aug 25, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants