3 ms·
I'm pretty sure that the precedence is the same as in the usual convention of arithmetics. You can ask for it in GHCi (the REPL): > :i (-) > [...] infixl6 >
by Dewie 13y ago
I'm pretty sure that the precedence is the same as in the usual convention of arithmetics.
You can ask for it in GHCi (the REPL):
> :i (-)
> [...] infixl6
> :i ( * )
> [...] infixl7
So ( * ) has precedence over (-). The expression is then:
(b * b) - (4 * a * c)
Personally, I don't know if infix syntax is truly overall more readable than purely prefix/postfix syntax, or other such uniform representations. It might be for arithmetic, because it is so ingrained, but the precedence order was never hammered into me to such a degree that I learned it automatically by heart; I used to defensively make more parenthesise than I really needed to, just in case.