FSharp.Literals 2.2.15

dotnet add package FSharp.Literals --version 2.2.15
NuGet\Install-Package FSharp.Literals -Version 2.2.15
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="FSharp.Literals" Version="2.2.15" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add FSharp.Literals --version 2.2.15
#r "nuget: FSharp.Literals, 2.2.15"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install FSharp.Literals as a Cake Addin
#addin nuget:?package=FSharp.Literals&version=2.2.15

// Install FSharp.Literals as a Cake Tool
#tool nuget:?package=FSharp.Literals&version=2.2.15

FSharp.Literals

The package includes several features for literals:

  • To print values and types in F# source code style.

  • To get default value from type info.

Getting it over NuGet

Install-Package FSharp.Literals

The main usage

The basic usage is Literal.stringify<'t> (obj:'t):

open FSharp.Literals
Literal.stringify ([1], [true])

result is F# source code, it can be pasted directly into F# files.

[1], [true]

This code uses .NET and F# reflection to walk the structure of values so as to build a formatted representation of the value. You format structural types such as lists and tuples using the syntax of F# source code. Unrecognized values are formatted by calling the F# sprintf "%A" method for these values.

The overloads function as same output as Literal.stringify is:

open FSharp.Literals
Literal.stringifyDynamic typeof<int list * bool list> ([1], [true])

The basic usage is Literal.printTypeDynamic (ty:Type):

open FSharp.Literals

let ty = typeof<(string*int)*(float*bool)>
let y = Literal.printTypeDynamic ty
Should.equal y "(string*int)*(float*bool)"

You can also use shortcut methods same as this method:

let y = Literal.printType<(string*int)*(float*bool)>
Should.equal y "(string*int)*(float*bool)"

to print F# types using the syntax of F# source code. In order to please the C#-programmers, it's all this list<int> style instead of int list. You can also re-implement TypePrinter interfaces to custom printed result in your styles.

Note: Should.equal in library FSharp.xUnit.

default value

You often need to know the default values for a certain type. You can use function Literal.defaultValueDynamic:

let x = typeof<char>
let y = Literal.defaultValueDynamic x :?> char
should.equal y '\u0000'

You can also use shortcut methods same as this method:

let y = Literal.defaultValue<char>
should.equal y '\u0000'

It can resolve any type of default value, the system defines common composite types, even if the system is not defined types that you need, you can supplement the composite types that you need, the library provides a recursive framework.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (5)

Showing the top 5 NuGet packages that depend on FSharp.Literals:

Package Downloads
FSharpCompiler.Lex

Lex are tools for generating lexical analyzer.

FSharpCompiler.Yacc

Yacc utility for.NET platform. Yacc are tools for generating parsers.

FSharpCompiler.Json

FSharpCompiler.Json is a JSON serializer for F#.

FSharp.ObjectCatalogViews

Print the SQL database as an F# record types.

FSharp.JLinq

`FSharp.JLinq` is a library to enhance JToken located in `Newtonsoft.Json.Linq`.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.2.15 277 10/18/2023
2.2.14 160 9/23/2023
2.2.13 140 9/17/2023
2.2.12 346 7/21/2023
2.2.11 3,510 10/19/2022
2.2.10 410 10/19/2022
2.2.9 15,596 3/8/2022
2.2.8 6,174 1/2/2022
2.2.7 438 12/31/2021
2.2.6 750 12/28/2021
2.2.5 2,751 10/28/2021
2.2.4 470 10/26/2021
2.2.3 4,087 7/18/2021
2.2.2 403 7/18/2021
2.2.1 1,253 6/15/2021
2.2.0 802 4/10/2021
2.1.4 3,506 3/10/2021
2.1.3 339 3/9/2021
2.1.2 362 3/7/2021
2.1.1 501 3/4/2021
2.1.0 351 3/3/2021
2.0.10 633 2/26/2021
2.0.9 1,091 2/20/2021
2.0.8 316 2/16/2021
2.0.7 490 2/13/2021
2.0.6 558 2/11/2021
2.0.5 2,017 1/4/2021
2.0.4 457 12/26/2020
2.0.3 397 11/27/2020
2.0.2 687 9/26/2020
2.0.1 469 8/19/2020
2.0.0 418 8/17/2020
1.0.0 571 6/14/2020

update nuget