You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
openSystem.CollectionsletfindCustomer(id:int)=()lettest(f:int ->'a)(id:int)(principle:IEnumerable)= Some (fun()-> f id)letpartialTest= test findCustomer
Expected behavior
It should compile and give a proper signature.
Actual behavior
It does not compile.
Value restriction. The value 'partialTest' has been inferred to have generic type
val partialTest : (int -> '_a -> (unit -> unit) option) when '_a :> IEnumerable
Either make the arguments to 'partialTest' explicit or, if you do not intend for it to be generic, add a type annotation. (using built-in F# compiler)
Known workarounds
Make partialTest generic, let partialTest<'a> = ...
Related information
This compiles at the module level:
letfindCustomer(id:int)=()lettest(f:int ->'a)(id:int)(principle:string)= Some (fun()-> f id)letpartialTest= test findCustomer
The text was updated successfully, but these errors were encountered:
It could be intended design, but I'm sure users would expect this to work since the one using string does. Therefore, I'm deeming this as a bug until said otherwise.
I guess my head is exploding, I'm not sure why a sealed type in this case would cause a value restriction. But this would explain when using a record or DU worked.
Code doesn't compile.
Repro steps
Expected behavior
It should compile and give a proper signature.
Actual behavior
It does not compile.
Known workarounds
Make
partialTest
generic,let partialTest<'a> = ...
Related information
This compiles at the module level:
The text was updated successfully, but these errors were encountered: