fsil 2.0.13
dotnet add package fsil --version 2.0.13
NuGet\Install-Package fsil -Version 2.0.13
<PackageReference Include="fsil" Version="2.0.13" />
<PackageVersion Include="fsil" Version="2.0.13" />
<PackageReference Include="fsil" />
paket add fsil --version 2.0.13
#r "nuget: fsil, 2.0.13"
#:package fsil@2.0.13
#addin nuget:?package=fsil&version=2.0.13
#tool nuget:?package=fsil&version=2.0.13
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:
Benchmark comparisons to FSharpPlus
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_len, 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.
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)
static member IterateWhile(self: Tree<'T>, cond: byref<bool>, fn: 'T -> unit) : unit =
if cond then
match self with
| Leaf x -> fn x
| Node(v, l, r) ->
Tree.IterateWhile(l, &cond, fn)
if cond then fn v
if cond then Tree.IterateWhile(r, &cond, 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/IterateWhile/Map
// so you get them all "for free"
let map_indexed = tree1 |> mapi (fun idx v -> $"elem {idx}:{v}")
let sum: int = tree1 |> fold 0 (fun acc v -> acc + v)
let exists2: bool = tree1 |> exists (fun v -> v = 2)
let all_larger_than_5: bool = tree1 |> forall (fun v -> v > 5)
let find_5: voption<int> = tree1 |> try_find (fun v -> v = 5)
or you can extend these definitions to your own general functions
// flattening a list is just binding to id
// this function now works on any collection you can bind
let inline flatten list = list |> bind id
let flatarray = flatten [|[|1;2;3|];[|4;5;6|]|] // [|1;2;3;4;5;6|]
let flatlist = flatten [[1;2;3];[4;5;6]] // [1;2;3;4;5;6]
let flatoption = flatten (Some(Some 1)) // Some 1
More
The Alloy library extends fsil, adding additional operations, with the same implications.
Most important remember to have (f#)un! 😃
| Product | Versions 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 is compatible. 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. |
-
net10.0
- FSharp.Core (>= 10.0.100-preview7.25451.107)
-
net8.0
- FSharp.Core (>= 9.0.303)
-
net9.0
- FSharp.Core (>= 9.0.303)
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 | 277 | 9/23/2025 |
| 2.0.11 | 144 | 9/23/2025 |
| 2.0.10 | 147 | 9/23/2025 |
| 2.0.9 | 141 | 9/23/2025 |
| 2.0.5 | 183 | 6/21/2025 |
| 2.0.4 | 234 | 6/16/2025 |
| 2.0.2 | 342 | 5/15/2025 |
| 1.1.17 | 317 | 5/13/2025 |
| 1.1.16 | 163 | 5/10/2025 |
| 1.1.15 | 163 | 5/10/2025 |
| 1.1.14 | 162 | 5/10/2025 |
| 1.1.13 | 266 | 4/21/2025 |
| 1.1.12 | 262 | 4/21/2025 |
| 1.1.11 | 264 | 4/21/2025 |
| 1.1.6 | 261 | 4/10/2025 |
| 1.1.4 | 261 | 4/10/2025 |
| 1.1.3 | 264 | 4/10/2025 |
| 1.1.2 | 257 | 4/9/2025 |
| 1.0.19 | 259 | 4/3/2025 |