Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: syntax highlight currying #74

Closed
boxed opened this issue Sep 15, 2017 · 7 comments

Comments

@boxed
Copy link

@boxed boxed commented Sep 15, 2017

Something that bites me in Elm a lot is currying. I accidentally don't supply enough arguments and I get a type error (often HUGE) somewhere far from the mistake.

If you could have syntax highlighting for when functions don't have all their parameters that would be great!

@klazuka

This comment has been minimized.

Copy link
Contributor

@klazuka klazuka commented Sep 15, 2017

I don't see how this is a problem with currying specifically? Providing the wrong number of arguments can also happen when trying to use a function "normally". And as far as I remember, every time I've made this mistake, the Elm compiler has given a good error saying "maybe you are missing an argument".

If the compiler is reporting the type error far away from the problem, and you can reduce it down to a simple example, then maybe you can add it to the compiler's error message catalog so that it can be fixed for all Elm users, regardless of development environment.

@boxed

This comment has been minimized.

Copy link
Author

@boxed boxed commented Sep 16, 2017

@klazuka

This comment has been minimized.

Copy link
Contributor

@klazuka klazuka commented Sep 16, 2017

Implicit currying and partial application is a core feature of the ML family of languages. It does take some getting used to when coming from other languages.

Would running elm-make as an external annotator make this easier for you? Maybe part of the pain is that (currently) compile errors are reported in a separate window instead of as red underlines on the source code in the editor.

@boxed

This comment has been minimized.

Copy link
Author

@boxed boxed commented Sep 18, 2017

Nope, this wouldn't solve the problem. In fact there are two quite distinct problems:

  1. Errors that are annoying and hard to handle. I just got one now for example:
unction `program` is expecting the argument to be:

    { ..., view : Model -> Html Msg }

But it is:

    { ...
    , view :
          (
          Msg
          -> { currentText : String
          , inputId : String
          , items : List Item
          , listControl : ListControl.Model String
          , showListControl : Bool
          }
          )
          -> Model
          -> Html
                 { currentText : String
                 , inputId : String
                 , items : List Item
                 , listControl : ListControl.Model String
                 , showListControl : Bool
                 }
    }

Hint: Problem in the `view` field. It looks like a function needs 1 more
argument.

It's pretty bad. It just tells you there's a mistake on a function somewhere inside view. And if your view calls other view functions that don't have proper type annotations the problem can be in any of those too. I don't think this actually can be fixed by the error message being improved.

  1. Yes, it takes some getting used to to use currying, but I think I'm fairly used to it since I do type those without thinking much quite a bit. So I don't think it's that. I just want to see if I did what I wanted to do. Just having a way to syntax highlight when an expression ends up as curried would be great.
@shamansir

This comment has been minimized.

Copy link

@shamansir shamansir commented Sep 30, 2017

I think there is a number of cases where I, as a developer, intentionally not specify all the arguments when I call the function — currying helps to postpone things for later calls and manage the program flow in an easy and elegant ways. So, in these cases, there is totally no error for me in having an insufficient number of arguments, so why should it be marked as such?

@boxed

This comment has been minimized.

Copy link
Author

@boxed boxed commented Sep 30, 2017

@durkiewicz

This comment has been minimized.

Copy link
Owner

@durkiewicz durkiewicz commented Sep 24, 2018

Thank you in your interest in the plugin. I'm sorry to say that this repository is no longer maintained due to lack of resources. If you need an Elm language support in IntelliJ - please consider using this plugin instead.

@durkiewicz durkiewicz closed this Sep 24, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.