FSharp.Literals
2.2.5
See the version list below for details.
dotnet add package FSharp.Literals --version 2.2.5
NuGet\Install-Package FSharp.Literals -Version 2.2.5
<PackageReference Include="FSharp.Literals" Version="2.2.5" />
paket add FSharp.Literals --version 2.2.5
#r "nuget: FSharp.Literals, 2.2.5"
// Install FSharp.Literals as a Cake Addin #addin nuget:?package=FSharp.Literals&version=2.2.5 // Install FSharp.Literals as a Cake Tool #tool nuget:?package=FSharp.Literals&version=2.2.5
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
print value
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])
print type
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 libraryFSharp.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 | Versions 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. |
-
.NETStandard 2.0
- FSharp.Core (>= 6.0.0)
- FSharp.Idioms (>= 1.1.14)
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 | 337 | 10/18/2023 |
2.2.14 | 207 | 9/23/2023 |
2.2.13 | 188 | 9/17/2023 |
2.2.12 | 451 | 7/21/2023 |
2.2.11 | 3,830 | 10/19/2022 |
2.2.10 | 431 | 10/19/2022 |
2.2.9 | 16,227 | 3/8/2022 |
2.2.8 | 6,429 | 1/2/2022 |
2.2.7 | 488 | 12/31/2021 |
2.2.6 | 833 | 12/28/2021 |
2.2.5 | 3,004 | 10/28/2021 |
2.2.4 | 508 | 10/26/2021 |
2.2.3 | 4,379 | 7/18/2021 |
2.2.2 | 428 | 7/18/2021 |
2.2.1 | 1,361 | 6/15/2021 |
2.2.0 | 861 | 4/10/2021 |
2.1.4 | 3,822 | 3/10/2021 |
2.1.3 | 368 | 3/9/2021 |
2.1.2 | 391 | 3/7/2021 |
2.1.1 | 539 | 3/4/2021 |
2.1.0 | 380 | 3/3/2021 |
2.0.10 | 677 | 2/26/2021 |
2.0.9 | 1,184 | 2/20/2021 |
2.0.8 | 342 | 2/16/2021 |
2.0.7 | 529 | 2/13/2021 |
2.0.6 | 594 | 2/11/2021 |
2.0.5 | 2,167 | 1/4/2021 |
2.0.4 | 481 | 12/26/2020 |
2.0.3 | 429 | 11/27/2020 |
2.0.2 | 724 | 9/26/2020 |
2.0.1 | 492 | 8/19/2020 |
2.0.0 | 445 | 8/17/2020 |
1.0.0 | 598 | 6/14/2020 |
refac filter / map to choose.