Improve error message for: "The type 'int' does not support the operator 'DivideByInt'"
See original GitHub issueThis was originally opened on CodePlex by latkin
Today this happened to me:
Microsoft (R) F# Interactive version 12.0.20809.1
Copyright (c) Microsoft Corporation. All Rights Reserved.
For help type #help;;
> [|2;4;6;8|] |> Seq.average;;
> [|2;4;6;8|] |> Seq.average;;
---------------^^^^^^^^^^^
stdin(1,16): error FS0001: The type 'int' does not support the operator 'DivideByInt'
I was surprised to discover that int does not support DivideByInt. Since many times I have successfully divided ints by other ints.
I think we should either:
- Make all numeric types that are divisible by int support DivideByInt or
- improve the error message so that it’s not quite so head scratching.
comments dsyme wrote Jun 3, 2014 at 6:02 AM +1 for a better error message
Issue Analytics
- State:
- Created 9 years ago
- Comments:9 (7 by maintainers)
Top Results From Across the Web
Improve error message for: "The type 'int' does not support ...
I was surprised to discover that int does not support DivideByInt. Since many times I have successfully divided ints by other ints.
Read more >The type 'int' does not support the operator '=='
F# uses single = for equality operator: let t = seq { 1..10 } |> Seq.takeWhile (fun e -> e % 2 =...
Read more >Troubleshooting F# | F# for fun and profit
After that, I will describe each of the common error messages in detail, and give ... The type 'int' does not support any...
Read more >Choosing between collection functions · F# for Fun and Profit
Many of these functions are not yet documented on MSDN so I'm going to link ... The type 'int' does not support the...
Read more >F# Math (IV.) - Writing generic numeric code
As we can see, the type needs to provide DivideByInt method (which takes integer as the second parameter) and a multiplication operator. The ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thankfully, .NET has been integrated nicely and can substitute here …
let average = [2;4;6;8] |> System.Linq.Enumerable.Average
@zpbappi , I’m going to close this the current error message and behaviour is at least explainable. Even if averaging a collection of ints seems like something the average API should actually be able to accomplish.
Kevin