jcollard / elm-mode

Elm mode for emacs
GNU General Public License v3.0
373 stars 67 forks source link

type annotations for Elm 0.19 #152

Closed johbra closed 3 years ago

johbra commented 5 years ago

If I type C-c C-a I get a message like Wrote /var/folders/r8/mm42spk12vbg3j856x5hr5qr0000gn/T/elm-comp-in-59859mMk.elm But no type annotations are added to the .elm buffer

purcell commented 5 years ago

Yes, the Elm guys completely changed the json error output of the Elm compiler, and elm-mode has not been updated to support both the old format and the new format. elm-compile-add-annotations is the function to be fixed for this.

purcell commented 5 years ago

Ah, in fact the issue here is that the new elm make does not support the --warn flag, and this is what elm-mode was using previously in order to have elm make print out the missing annotation so it could be inserted. Without support for that, there's no obvious alternative route to providing this functionality.

purcell commented 5 years ago

I'll confess to being quite frustrated by all the breakage introduced by Elm 0.19, and I don't currently have much faith that it will be addressed upstream.

johbra commented 5 years ago

It's a pity, I regret your frustration. But for me, a programming language without an effective Emacs mode isn't worth to be used further.

purcell commented 5 years ago

It's a pity, I regret your frustration. But for me, a programming language without an effective Emacs mode isn't worth to be used further.

It's a chicken and egg thing for me: my motivation to work on Emacs modes like this is related to my trust in the language. :-)

johbra commented 5 years ago

It's a chicken and egg thing for me: my motivation to work on Emacs modes like this is related to my trust in the language. :-)

Indeed, that's a problem. I am teaching functional programming (using Racket, Clojure/Clojurescript) and I am trying to figure out, if Elm could be an alternative. But especially for beginners you need a good support by editors or IDEs.

purcell commented 5 years ago

You might also consider using a basic subset of Haskell or Purescript. The Emacs support is extremely good for both these days, particularly Purescript. For the latter, you can install the language tools using only npm, and the Emacs purescript-mode + psc-ide + psci packages. The resulting experience is extremely nice.

johbra commented 5 years ago

Thanks for the hints, but for now I'll not give up using Elm

purcell commented 5 years ago

Yep, definitely not trying to talk you out of it. :-)

theothornhill commented 3 years ago

Is this still relevant?

purcell commented 3 years ago

I suspect (but have not checked) that elm-make hasn't grown a --warn flag, so I think there's no route for fixing this. Does LSP support inserting type signatures?

theothornhill commented 3 years ago

Yeah, elm-language-server can infer and insert types now:

image

After insert:

image

purcell commented 3 years ago

Great, then fixing this will be out of scope for elm-mode, given current lack of core tool support.