Reputation: 2312
As far as I can tell, I am using F# 4.5.
However, VS2017 does not like the following code
let someAsyncIntOption = async{
return Some 1
}
let someAsyncString = async{
match! someAsyncIntOption with
|Some 1 -> return "Some one"
|_ -> return "None"
}
match! is not recognized as valid syntax.
What do I need to do to make this work?
Upvotes: 1
Views: 107
Reputation: 61
According to...
https://blogs.msdn.microsoft.com/dotnet/2018/07/26/announcing-f-4-5-preview/
If you haven't already...
First, install:
If you create a .NET desktop F# project in Visual Studio (from the F# desktop development component), then you will need to update your FSharp.Core package to 4.5.2 with the NuGet UI.
Once you have installed the necessary bits, you can start developing F# 4.5 code with Visual Studio, Visual Studio for Mac, or Visual Studio Code with Ionide.
When .NET Core SDK 2.1.400 and Visual Studio 2017 version 15.8 are released, the referenced FSharp.Core will be 4.5.2 for all new projects and you will not need to perform this second step.
It may be that you need to be targeting .NET Core for this to work and only after updating your FSharp.Core package to 4.5.2.
I haven't tried any of this, but hope that helps.
Upvotes: 1
Reputation: 36738
F# 4.5 was released in VS 2017 v15.8 preview 5. It's not enough to target the F# 4.5 runtime; you also have to have the F# 4.5 compiler in order for that syntax to be accepted. And the F# 4.5 compiler comes with VS 15.8 preview 5; if you're running a Visual Studio version older than 15.8 preview 5, then you have an older F# compiler that doesn't know about the match!
syntax.
Upvotes: 2