Header menu logo TDesu.FSharp

TDesu.FSharp

Practical F# utility library. Extends FSharp.Core with the functions you keep rewriting.

Getting Started

dotnet add package TDesu.FSharp
open TDesu.FSharp
open TDesu.FSharp.Builders

// Operators
raise ^ exn "something went wrong"
%httpClient.SendAsync(req)

// String helpers
"hello world" |> String.contains "world"
"hello" |> String.toOption  // Some "hello"

// Option/Result combinators
Some 42 |> Option.toResult "missing"
Ok 42 |> Result.tee (printfn "got %d")

// Task combinators
Task.zip (getUser()) (getOrders())

// Computation expressions
let result = taskResult {
    let! user = fetchUser id
    let! orders = fetchOrders user.Id
    return orders.Length
}

Namespaces

Namespace

Description

TDesu.FSharp

Core operators, String, Option, Result, Guard, UnixTime, Validation, Clock, StateMachine, NumericParsing

TDesu.FSharp.Builders

Computation expressions: result {}, option {}, taskResult {}

TDesu.FSharp.Tasks

Task/TaskResult combinators, TaskGroup, parallelThrottle, fireAndForget

TDesu.FSharp.Collections

Dictionary, ResizeArray, Seq, List, Stack extensions

TDesu.FSharp.Concurrency

AtomicInt/Int64, BoundedDict, BoundedQueue, Signal, PeriodicTimer, ChannelWorker, SlidingWindowLimiter

TDesu.FSharp.Resilience

Retry, CircuitBreaker, Timeout, Memoize, Saga

TDesu.FSharp.IO

Env, File, Directory, Disposable, TemporaryFileStream

TDesu.FSharp.Buffers

Bytes (xor, concat, constantTimeEquals), ArrayPool

TDesu.FSharp.Hashing

ContentHash (SHA256/SHA1/MD5), Hash.combine, CollectionComparer

TDesu.FSharp.ActivePatterns

Parse.Int/Double/Guid/Bool, String patterns

TDesu.FSharp.Types

NonEmptyString, ApiResponse

Design Principles

Links

License

Unlicense -- public domain

val raise: exn: System.Exception -> 'T
type exn = System.Exception
module String from Microsoft.FSharp.Core
union case Option.Some: Value: 'T -> Option<'T>
module Option from Microsoft.FSharp.Core
union case Result.Ok: ResultValue: 'T -> Result<'T,'TError>
Multiple items
module Result from Microsoft.FSharp.Core

--------------------
[<Struct>] type Result<'T,'TError> = | Ok of ResultValue: 'T | Error of ErrorValue: 'TError
val printfn: format: Printf.TextWriterFormat<'T> -> 'T
val result: obj
val id: x: 'T -> 'T

Type something to start searching.