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 |
|---|---|
|
Core operators, String, Option, Result, Guard, UnixTime, Validation, Clock, StateMachine, NumericParsing |
|
Computation expressions: |
|
Task/TaskResult combinators, TaskGroup, parallelThrottle, fireAndForget |
|
Dictionary, ResizeArray, Seq, List, Stack extensions |
|
AtomicInt/Int64, BoundedDict, BoundedQueue, Signal, PeriodicTimer, ChannelWorker, SlidingWindowLimiter |
|
Retry, CircuitBreaker, Timeout, Memoize, Saga |
|
Env, File, Directory, Disposable, TemporaryFileStream |
|
Bytes (xor, concat, constantTimeEquals), ArrayPool |
|
ContentHash (SHA256/SHA1/MD5), Hash.combine, CollectionComparer |
|
Parse.Int/Double/Guid/Bool, String patterns |
|
NonEmptyString, ApiResponse |
Design Principles
- Idiomatic F# -- follows FSharp.Core naming conventions
- Inline everything -- zero-cost abstractions via
[<InlineIfLambda>] - No dependencies -- only FSharp.Core
- Fable compatible -- sources included in nupkg
- XML docs -- works with IDE tooltips and fsdocs
Links
License
Unlicense -- public domain
module Result from Microsoft.FSharp.Core
--------------------
[<Struct>] type Result<'T,'TError> = | Ok of ResultValue: 'T | Error of ErrorValue: 'TError
TDesu.FSharp