Open jfmengels opened 4 months ago
Sounds good! Though I would want compilation to still error for these.
It can be done for labelled arguments but I don't think it could be done for annotations as it would be ambiguous or prevent us from adding defaults in future.
Though I would want compilation to still error for these.
Absolutely.
I don't think it could be done for annotations as it would be ambiguous or prevent us from adding defaults in future.
It it's ambiguous, indeed it should not be done. I don't think this will prevent from adding defaults or other syntaxes in the future. At that point, the formatter should stop doing this transformation, as it will become ambiguous or unhelpful.
I don't think this should be considered as a breaking change in any way, since it doesn't impact the formatting of correct Gleam modules, so in my understanding it should be entirely fine to remove this when needed.
I'm learning Gleam, and sometimes it's hard to remember to use
=
or:
in some cases, especially for record expressions.A nice thing that
elm-format
does for Elm files, is to transform=
to:
(and the reverse) where appropriate. This is a time-saver and very nice for beginners. For instance, I have several times taught Elm to beginners, and when they would use the incorrect symbol, then save, the symbol would be fixed without them even noticing (or seeing an error message).I don't know in how many places this kind of change could be applied, I think it could at least be done reliably in record expressions, maybe as well in type annotations.