I may have been away from F# for too long, but I would have expected this to compile:
module Calc
let foo values = List.sum values
Instead, I get a compilation error:
FS0071 Type constraint mismatch when applying the default type 'obj' for a type inference variable. The type 'obj' does not support the operator '+' Consider adding further type constraints
This also happens for List.average, so at first I thought it had something to do with generic constraints like requires member ( + ) and member get_Zero, but that can't be the whole story, since let foo values = List.max values compiles (List.max also has a generic constraint, albeit a simpler one - it only requires comparison).
What am I doing wrong?
This is a .NET 5.0 project. Compilation fails both in Visual Studio and with dotnet build.