fsil 1.1.16

There is a newer version of this package available.
See the version list below for details.
dotnet add package fsil --version 1.1.16
                    
NuGet\Install-Package fsil -Version 1.1.16
                    
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="fsil" Version="1.1.16" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="fsil" Version="1.1.16" />
                    
Directory.Packages.props
<PackageReference Include="fsil" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add fsil --version 1.1.16
                    
#r "nuget: fsil, 1.1.16"
                    
#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.
#:package fsil@1.1.16
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=fsil&version=1.1.16
                    
Install as a Cake Addin
#tool nuget:?package=fsil&version=1.1.16
                    
Install as a Cake Tool

fsil: F# inline library

<a href="https://www.nuget.org/packages/fsil"><img alt="Nuget" src="https://img.shields.io/nuget/v/fsil"></a>

Features:

  • a small generic utils library like FSharpPlus
  • all functions are inline and trimmable, won't bloat your binary size: you pay for only what you use
  • Fable compatible
  • zero cost: does not create junk variables or implicit allocations
  • uses [<AutoOpen>] so all functions are in the global namespace

Example:

alternate text is missing from this package README image

Benchmark comparisons to FSharpPlus

alternate text is missing from this package README image

I love F# for high performance programming and this makes high-level generic F# a little more feasible without punishing the user performance-wise. The functions in this library compile down to exactly the same form as the (optimal) resolved implementation so iter f x to the compiler is identical to e.g., ValueOption.iter f x or Array.iter f x.

Currently this library contains a fairly small set of functions:

iter, iteri, iter_range, map, mapi, is_some, is_none, is_ok, some, none, try_item, value, len, enum, enumv, default_, default_inst, default_with, zero, one, print, forall, exists, fold, foldi.

there are also some functions for spans with separate function definitions due to their limitations:

span_forall, span_exists, span_iter...

You can also define your own implementations as static members. here is an example for iter and map on a Tree, for documentation just look at the source code itself.

type Tree<'T> =
    | Leaf of 'T
    | Node of 'T * Tree<'T> * Tree<'T>

    static member Map(self: Tree<'T>, fn: 'T -> 'U) : Tree<'U> =
        match self with
        | Leaf x -> Leaf(fn x)
        | Node(v, l, r) ->
            let new_l = Tree.Map(l, fn)
            let new_r = Tree.Map(r, fn)
            Node(fn v, new_l, new_r)

    static member Iterate(self: Tree<'T>, fn: 'T -> unit) : unit =
        match self with
        | Leaf x -> fn x
        | Node(v, l, r) ->
            Tree.Iterate(l, fn)
            fn v
            Tree.Iterate(r, fn)

let tree1 = Leaf 1
let iter = tree1 |> iter (fun v -> print v)
let mapped: Tree<int> = tree1 |> map (fun v -> v + 1)
// these implementations are generated from Iterate and Map
// so you get them "for free"
let iteri = tree1 |> iteri (fun idx v -> print v)
let mapped2: Tree<int> = tree1 |> mapi (fun idx v -> idx + v + 1)
let sum = tree1 |> fold 0 (fun acc v -> acc + 1 )
let sum2 = tree1 |> foldi 0 (fun idx acc v -> acc + 1 )

Most important remember to have (f#)un! 😃

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  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.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.0.13 336 9/23/2025
2.0.11 149 9/23/2025
2.0.10 153 9/23/2025
2.0.9 146 9/23/2025
2.0.5 189 6/21/2025
2.0.4 242 6/16/2025
2.0.2 350 5/15/2025
1.1.17 323 5/13/2025
1.1.16 171 5/10/2025
1.1.15 169 5/10/2025
1.1.14 170 5/10/2025
1.1.13 275 4/21/2025
1.1.12 268 4/21/2025
1.1.11 269 4/21/2025
1.1.6 268 4/10/2025
1.1.4 267 4/10/2025
1.1.3 271 4/10/2025
1.1.2 264 4/9/2025
1.0.19 265 4/3/2025
Loading failed