Skip to content

Instantly share code, notes, and snippets.

Last active August 20, 2020 13:05
Show Gist options
  • Save davidspiess/0e86b835526d0e01a03f9c6380424272 to your computer and use it in GitHub Desktop.
Save davidspiess/0e86b835526d0e01a03f9c6380424272 to your computer and use it in GitHub Desktop.
Learning F#

Day 1 - Exploring dotnet core

  • dotnet has built in templates for creating new projects.
  • I can install new templates e.g for the Giraffe webserver.
  • Giraffe builts upon Kestrel, which is the built in dotnet core websever.
  • dotnet watch run builds the project on file change.
  • To use dotnet watch i had to install it as DotNetCliToolReference package in my .fsproj file.
  • dotnet add uses NuGet behind the scenes to install dependencies.
  • NuGet has currently no command to add packages as DotNetClitToolReference.
  • I had to add the package manually in the ItemGroup of my .fsproj file.
  • dotnet restore executes the changes i manually made.
  • To update dotnet core on Windows i had to download the installer and uninstall the old version from the programm settings. Better use Chocolatey to keep it updated.
  • To update dotnet core on MacOS i had to download the installer. Before installing a newer version run dotnet --info to find all paths, which have to be deleted manualy.

Day 2 - Tooling troubles

  • Ionide Plugin for VS Code requires Mono to run on MacOS.
  • In plugin settings i can use dotnet core instead of Mono for displaying autocompletion hints, still a bit buggy.
  • Mono is some kind of cross-platform open source alternative to dotnet core.
  • Nuget installs dependencies under ~/.nuget. This makes it especially hard to import DLLs in .fsx scripts as Mono has trouble resolving the home path.
  • Nuget includes the version number in the folder path of the package. This could cause .fsx imports to break after updates.
  • Paket is another package manager who solves the pain points above, by placing packages directly in the solution. Works similar to npm. No pitfalls with transitive packages too.
  • Ionide comes with a CLI called Forge, which is similar to the dotnet core templates. Cross-platform, comes bundled with Paket already. Not sure which benefits i get from it.
  • Paket is also available on Homebrew.

Day 3 - Get Programming With F#

  • Create a new F# program with dotnet new console --language F# --name MyFirstFSharpApp.
  • To enable debugging in VS Code i have to install VSCode C# plugin (Omnisharp).
  • To pass debug arguments to a console application i have to add them in launch.json as args.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment