draptik

mostly tech stuff

F# Linux: Mixed Feelings

I have been trying to learn F# with .NET Core and Linux for some time. My experience so far are mixed. Let me explain what I mean by “mixed”:

First off all: It is great that we can use .NET with Linux in the first place! And dotnet as CLI-first tool is amazing (not only for linux desktop users, but also for docker, ci)! I can’t emphasis this enough!

BUT:

  • The templates generated by dotnet new are never up-to-date for F#. One always has to spend 30min cleaning up and updating.
  • IDE integration (Ionide) also takes weeks until everything works flawlessly after a new dotnet core release (VSCode, Rider).

Example: Currently (2018-11-29) I have to patch dotnet new xunit -lang f# -o somefolder:

1
2
3
4
5
6
7
$ dotnet new xunit -lang f# -o somefolder
The template "xUnit Test Project" was created successfully.

Processing post-creation actions...
Running 'dotnet restore' on somefolder/somefolder.fsproj...
...
Restore succeeded.
1
2
3
4
`$ dotnet test
Build started, please wait...
/home/patrick/.nuget/packages/microsoft.net.test.sdk/15.9.0/build/netcoreapp1.0/Microsoft.Net.Test.Sdk.targets(104,5): warning : A 'Program.fs' file can be automatically generated for F# .NET Core test projects. To fix this warning, either delete the file from the project, or set the <GenerateProgramFile> property to 'false'. [/home/patrick/tmp/somefolder/somefolder.fsproj]
...

Why? Learning F#, this really irritates me! Am I doing something wrong? Is it idiomatic to see these kinds of warnings?

Fix:

1
2
3
cd somefolder
rm Program.fs
sed -i '/Program/d' somefolder.fsproj

Simple, isn’t it? F#-Team: Talk to the template team.

Electron apps such as VSCode behave unusually with Arch Linux, so I won’t comment on that. And Rider is really slow catching up to new .NET Core versions on Linux… (linux: 2nd class citizen).

All in all, F# with .NET Core and Linux: keeps being interesting ;–)

Setup (2018-11-29):

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
$ dotnet --info
.NET Core SDK (reflecting any global.json):
 Version:   2.1.500
 Commit:    b68b931422

Runtime Environment:
 OS Name:     arch
 OS Version:
 OS Platform: Linux
 RID:         arch-x64
 Base Path:   /opt/dotnet/sdk/2.1.500/

Host (useful for support):
  Version: 2.1.6
  Commit:  3f4f8eebd8

.NET Core SDKs installed:
  2.1.3 [/opt/dotnet/sdk]
  2.1.500 [/opt/dotnet/sdk]

.NET Core runtimes installed:
  Microsoft.NETCore.App 2.1.6 [/opt/dotnet/shared/Microsoft.NETCore.App]

To install additional .NET Core runtimes or SDKs:
  https://aka.ms/dotnet-download

Yes, this is just a rant.

I am still a big fan of F#, .NET Core, and Linux. And the combination of the three. I’ll keep trying to understand them, because I think they are a good combination.

Any pointers to better usage are more than welcome!

Comments