Error message "This function takes too many arguments..." can be improved
- Dominant language
- F#
- Stars
- 4.3k
- Forks
- 876
- Avg merge
- 4d 8h
- Merged PRs (30d)
- 133
Description
When a function is used as an argument where a value type is expected, FS0002 is thrown. It seems to make more sense to use a type error in such case, as raising FS0002 is rather confusing.

### Repro steps
Consider this, or any similar snippet where an argument of a non-function type is expected:
```f#
let x = Seq.init (fun x -> Result.Ok x)
```
### Expected behavior
It should raise something similar to:
> error FS0001: This expression was expected to have type 'int' but here has type ''a -> Result<'a>'
Or if FS0002 is _by design_, perhaps it can be improved if the compiler can detect the case where it is in fact a type error and give a more descriptive error detailing what would otherwise be shown with FS0001.
### Actual behavior
Instead it raises:
> error FS0002: This function takes too many arguments, or is used in a context where a function is not expected
This is confusing as it is besides the point (even though the last part says "used in a context where a function is not expected", this is hard to grok, even more so since many programmers are puzzled by the concept of 'context').
### Known workarounds
N/A
### Related information
Any current F# version, including latest.
As an aside, type inference in the screenshot shows that `x` is of type `((int -> obj) -> seq)`, I have no clue why it thinks that, it is clearly confused...
Contributor guide
Assessment
This issue has not been assessed yet.