Fsharp: Difference between revisions
Appearance
imported>Samuela No edit summary |
m →Usage: improve highlighting (though i had to create 2 separate adjacent code blocks for different language highlighting. maybe that's bad?) |
||
| (6 intermediate revisions by 4 users not shown) | |||
| Line 1: | Line 1: | ||
[https://fsharp.org/ F#] (F-Sharp) is a .NET language. | |||
= Usage = | = Usage = | ||
F# is packaged in the <code>dotnet-sdk</code> family of packages (<code>dotnet- | 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: | ||
< | |||
$ nix-shell -p dotnet- | <syntaxhighlight lang=console> | ||
$ 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 | 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. | ||
For help type #help;; | For help type #help;; | ||
</syntaxhighlight> | |||
<syntaxhighlight lang=fsharp> | |||
> printfn "Hello world from F#!";; | > printfn "Hello world from F#!";; | ||
Hello world from F#! | Hello world from F#! | ||
val it : unit = () | val it : unit = () | ||
</ | </syntaxhighlight> | ||
To create a project use | |||
<syntaxhighlight lang=console> | |||
$ dotnet new console --language F# | |||
$ dotnet run | |||
</syntaxhighlight> | |||
like so! | like so! | ||
== See also == | |||
* [[DotNET]] | |||
[[Category:Languages]] | |||
Latest revision as of 07:32, 16 July 2026
F# (F-Sharp) is a .NET language.
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!