-
Notifications
You must be signed in to change notification settings - Fork 6.1k
Description
Following the instructions laid out in the Dugnad session on YouTube, here is my first attempt at highlighting an example of this error:
let Sum x y = x + y
let RegisterFunction1 (fn:'A->'B) = ()
let Test1 = RegisterFunction1 Sum
let RegisterFunction2 (fn:'A->int) = ()
let Test2 = RegisterFunction2 Sum
RegisterFunction1 works and RegisterFunction2 has a FS0001 error. As best as I can make it, RegisterFunction1 maps 'A to int and 'B to int->int which is why it compiles. RegisterFunction2 also maps 'A to int but then errors when it sees that what's left (int->int) does not match the int return value.
It should be said that the explanation provided on this page, "This message can be issued in many different circumstances, etc." along with the remedies prescribed steer one in the right direction, however I am still unsure whether it is possible to create a RegisterFunction which mandates the return type!
Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
- ID: 035a85bf-dd16-24bd-c1dc-9f072db94093
- Version Independent ID: fda0a436-bc69-2650-1370-074ab0d51e97
- Content: Compiler error FS0001 - F#
- Content Source: docs/fsharp/language-reference/compiler-messages/fs0001.md
- Product: dotnet-fsharp
- GitHub Login: @cartermp
- Microsoft Alias: dotnetcontent