Fsharp: Difference between revisions

From NixOS Wiki
imported>Milahu
No edit summary
imported>Aerphanas
update package name, and add how to create project
Line 1: Line 1:
= Usage =
= Usage =
F# is packaged in the <code>dotnet-sdk</code> family of packages (<code>dotnet-sdk_2</code>, <code>dotnet-sdk_3</code>, and <code>dotnet-sdk_5</code> as of 5/17/2021).
F# is packaged in the <code>dotnet-sdk</code> family of packages (<code>dotnet-sdk_3</code>, <code>dotnet-sdk_5</code>, and <code>dotnet-sdk_7</code> as of Dec 20, 2022).


You can pop into a REPL:
You can pop into a REPL:
<pre>
<pre>
$ nix-shell -p dotnet-sdk_5
$ nix-shell -p dotnet-sdk
warning: unknown setting 'experimental-features'
warning: unknown setting 'experimental-features'


[nix-shell:~]$ dotnet fsi
[nix-shell:~]$ dotnet fsi


Microsoft (R) F# Interactive version 11.3.2.0 for F# 5.0
Microsoft (R) F# Interactive version 12.0.5.0 for F# 6.0
Copyright (c) Microsoft Corporation. All Rights Reserved.
Copyright (c) Microsoft Corporation. All Rights Reserved.


Line 18: Line 18:
val it : unit = ()
val it : unit = ()
</pre>
</pre>
To create a project use
<pre>
dotnet new console --language F#
dotnet run
</pre>
like so!
like so!



Revision as of 08:34, 20 December 2022

Usage

F# is packaged in the dotnet-sdk family of packages (dotnet-sdk_3, dotnet-sdk_5, and dotnet-sdk_7 as of Dec 20, 2022).

You can pop into a REPL:

$ nix-shell -p dotnet-sdk
warning: unknown setting 'experimental-features'

[nix-shell:~]$ dotnet fsi

Microsoft (R) F# Interactive version 12.0.5.0 for F# 6.0
Copyright (c) Microsoft Corporation. All Rights Reserved.

For help type #help;;

> printfn "Hello world from F#!";;
Hello world from F#!
val it : unit = ()

To create a project use

dotnet new console --language F#
dotnet run

like so!

See also