Stream: beginners

Topic: Operator desugaring table questions


view this post on Zulip Kilian Vounckx (Jun 17 2023 at 14:39):

I have two questions about the operator desugaring table in the tutorial.

view this post on Zulip Anton (Jun 17 2023 at 14:54):

It shows bit shift operators which aren't in the language. Are they planned, or were they at one point and is the table out of date

I think they were planned but I'm not sure if they still are, I'll update the table.

It shows that !f x y desugars to Bool.not (f x y), and -f x y desugars to Num.neg (f x y), but at the moment they desugar to Bool.not f x y and Num.neg f x y respectively. Which one is incorrect?

I think the brackets are just for clarity for the reader, the order of application is the same for the compiler (I think).

view this post on Zulip Kilian Vounckx (Jun 17 2023 at 14:56):

Anton said:

I think the brackets are just for clarity for the reader, the order of application is the same for the compiler (I think).

I don't think it is the same. At the moment, the compiler does (Bool.not f) x y, not Bool.not (f x y). If f is a function, it will be a compiler error. I don't know which of the two is best, but the table is not doing the same as the compiler if I am correct

view this post on Zulip Anton (Jun 17 2023 at 15:09):

You are correct, elm also does it like our current implementation, so I'm just going to remove the !f x y and -f x y from the table

view this post on Zulip Brendan Hansknecht (Jun 17 2023 at 15:18):

Yeah i think the example needs parens and is just a mistake


Last updated: Jul 06 2025 at 12:14 UTC