Functional Koans - F#
Inspired by EdgeCase's fantastic Ruby koans, the goal of the F# koans is to teach you F# through testing.
When you first run the koans, you'll be presented with a runtime error and a stack trace indicating where the error occurred. Your goal is to make the error go away. As you fix each error, you should learn something about the F# language and functional programming in general.
Your journey towards F# enlightenment starts in the AboutAsserts.fs file. These koans will be very simple, so don't overthink them! As you progress through more koans, more and more F# syntax will be introduced which will allow you to solve more complicated problems and use more advanced techniques.
Running with GitHub Codespaces
GitHub Codespaces is a free platform to run F# Koans completely in your browser, no install or setup required! Just go to https://github.com/ChrisMarinos/FSharpKoans/codespaces and click "New CodeSpace"
Running with Docker
To launch in watch mode using docker run the following command;
The F# Koans needs .Net 5.0 to be built and run. Make sure that you have installed it before building the project. This is the current release of .NET Core that many modern F# and .NET applications use.
Running the Koans from the command line (.Net Core)
To build the Koans, run
dotnet buildcommand in the project root.
To run the Koans, run
dotnet run -p FSharpKoans/FSharpKoans.fsprojin the root directory or
Running the Koans in Visual Studio Code
- Open the project directory in Visual Studio Code with Ionide-fsharp plugin installed and press F5 to build and launch the Koans (some time is needed to build the project before launch).
Running the Koans from a Devcontainer
Install the Remote - Containers extension in Visual Studio Code.
Open the directory inside a Devcontainer.
Open a terminal and start using the Koans.
You can also use dotnet-watch to have your changes reloaded automatically.
To do so, navigate into
FSharpKoans directory and run
dotnet watch run. Now, after you change the project code, it will be automatically reloaded and tests rerun.