Header menu logo TDesu.FSharp

TDesu.FSharp Namespace

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

Type/Module Description

Boolean

Builders

Byref

Named, in-place mutation helpers for byref values. Every function takes the byref first, so they read the same way at the call site as the built-in <- assignment they replace.

Byte

Char

DateTime

DateTimeOffset

Decimal

Double

Enum

Parsing and bitwise flag helpers for enums, generic over any enum type via .

EnumShape<'enum>

Structural shape for a flags-style enum: a struct Enum whose underlying type supports the bitwise |||, ^^^ and &&& operators. In practice this is every .NET enum type, since the F# compiler resolves those three operators for any enum intrinsically — this abbreviation exists purely so Enum's functions don't each repeat the same three-line constraint clause.

FakeClock

Fake clock for testing. Allows manual time control. Not thread-safe.

Guard

Guard module — validate-and-throw in one call.

Guid

IClock

Abstraction over system clock for testable time-dependent code. let clock = SystemClock.Instance let now = clock.UtcNow // In tests: let fake = FakeClock(DateTimeOffset(2024, 1, 1, 0, 0, 0, TimeSpan.Zero)) fake.Advance(TimeSpan.FromHours 1.)

Int16

Int32

Int64

Numeric

Generic numeric helpers: clamping, linear interpolation, and inclusive-range checks. Built on F#'s built-in arithmetic/comparison constraints, so they work for float, decimal, custom numeric types — anything with the required operators — not just int.

Operators

Option

Regex

Result

SByte

Single

StateMachine

Helpers for building state machines as plain F# match expressions. Define transitions as let apply state event = match state, event with ... and use goto/stay/fail to build results.

String

String utility functions — functional wrappers over String methods.

SystemClock

Default clock implementation using the real system clock.

TimeSpan

UInt16

UInt32

UInt64

UnixTime

Fast cached Unix timestamp — avoids repeated syscalls. Updated lazily, accurate to ~15ms (system timer resolution).

Validation

Combinators for Validation.

Validation<'TValue, 'TError>

Applicative validation: collects ALL errors instead of short-circuiting. Use and! in the validation { } CE to run validators in parallel and collect errors.

ValidationBuilder

Computation expression builder for Validation workflows. Use let! for monadic (short-circuit) and and! for applicative (collect errors).

ValidationCE

Computation expression instance for Validation workflows: validation { ... }.

ValueOption

Version

Type something to start searching.