The easiest way to get started is to copy one of the templates that are from the FsLab templates repository. The templates work with Xamarin Studio, Visual Studio and other F# editors.
The templates use Paket for dependency management. When you use the templates, you'll need to run Paket to get the dependencies. This happens automatically when you build the project, but you can also do it by hand.
In the basic template, run
For example, when using mono on Mac, run:
In the journal template you can use build scripts
The following will process all journals and open them in a web browser:
This downloads the packages and creates
paket.lock file with the version information.
Once the packages are downloaded, you can open the
Tutorial.fsx script and edit it.
The tempalates are designed to be used from F# Interactive. Select a couple of lines
of code and use "Alt+Enter" (in Visual Studio), "Ctrl+Enter" (in Xamarin Studio) or
other command to send the code to F# Interactive.
The basic FsLab template is a minimal sample containing a tutorial and Paket references as described above. The template works with Xamarin Studio, Visual Studio or via command line.
The FsLab Journal template contains everything as described above, but also adds the ability to generate HTML and LaTeX reports from your literate scripts.
The template comes with build scripts
build.cmd that can be used
build rungenerates HTML outputs, opens them in a browser and automatically updates them when the source files change
build latexgenerates LaTeX output
build pdfgenerates LaTeX and also invokes
It is equally easy to install FsLab using NuGet or using Paket. We recommend using Paket. This is a bit more work at the beginning, but it will save you time when updating to new versions later!
FsLab is available on NuGet as
FsLab.Runner package can be used to re-implement the functionality of the
FsLab Journal template.
To use it directly, create a new project (F# Tutorial is a good start in Visual Studio and Xamarin Studio). Then add refernece to the FsLab NuGet package and wait until all components are downloaded.
Finally add a new script file, say
Tutorial.fsx and load
FsLab.fsx using the
following command (the version will differ, so you'll have to check the created
packages directory; when the project is in a sub-folder you'll also need
When referencing FsLab using Paket, you'll need to download the latest version of
Paket and create a file called
paket.dependencies with the following contents:
1: 2: 3:
This specifies that Paket should install the
FsLab package for you. Then
run the following command (drop
mono on Windows):
The typical usage is to put
paket.exe into a sub-folder called
.paket, but this
is completely up to you. Paket will drop the version numbers from folder names, so
you can reference FsLab as follows in your scripts:
paket.lock file with the information about installed versions.
Paket makes it easy to update to the latest version of FsLab. Just run