Improve error reporting: Function accidentally partially applied
- Dominant language
- F#
- Stars
- 4.3k
- Forks
- 876
- Avg merge
- 4d 11h
- Merged PRs (30d)
- 131
Description
## What
Oftentimes, you may add a curried argument to a function after the fact, or called a curried function and simply forgot the last argument. All callsites will break (correct) but the error is generally not what you would expect. Look at the following example: -
``` fsharp
let foo a b = a + b
let c = foo 10
let d = c + 10
```
The error returned is `error FS0001: The type 'int' does not match the type 'int -> int'`
## Why
New developers to F# may be unfamiliar with the concept of pervasive type inference and / or of passing functions as values and / or of partially applied functions. The error message does not make entirely clear _why_ this error is occurring.
## How
This makes sense, but again, to a new developer, it's completely confusing. A preferred error may be something like: -
`The value 'c' is a partially applied function with signature 'int -> int' and is not compatible with 10. Did you forget to provide all the partial arguments when creating 'c'?`
If it is not easily possible from the AST to understand that this is a partially applied function (entirely possible), it should still be possible to make a clearer message saying you are trying to do something across a function and a simple value.
Contributor guide
Assessment
This issue has not been assessed yet.