gleam-lang/gleam
View on GitHubFormatter: Replace = symbols by : symbols where syntactically correct
Open
#2,979 opened on Apr 12, 2024
help wanted
Description
I'm learning Gleam, and sometimes it's hard to remember to use = or : in some cases, especially for record expressions.
pub fn new(name: String) {
Thing(
name = name, // should have `:`
)
}
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.