Using F# Discriminated Unions to Model Domain States Safely
Discriminated unions in F# let you define a closed set of domain states and get compile‑time exhaustiveness checks when you pattern match, reducing boilerplate and preventing missed cases.
ReadMeFeed / Community knowledge
Real questions. Useful conversations. Find the people who know your stack.
Discriminated unions in F# let you define a closed set of domain states and get compile‑time exhaustiveness checks when you pattern match, reducing boilerplate and preventing missed cases.
Learn how F# async workflows let you write non‑blocking I/O, compose parallel tasks, and control cancellation with minimal boilerplate. A concrete example shows how to run two HTTP calls concurrently and handle errors.
F#’s Units of Measure let you attach dimensional units to numeric values, catching mistakes like adding meters to seconds at compile time. This post walks through defining units, using them in calculations, and highlights IDE support, trade‑offs, and a quick checklist.
F# async workflows make concurrent I/O-bound work simple with async { } and Async.Parallel — if you avoid the blocking-call trap that starves the thread pool.
Learn how F#'s Units of Measure let the compiler catch accidental mixes of meters, feet, and other units before your code runs.
Learn how F# units of measure provide compile‑time dimensional analysis, preventing unit mismatches before runtime with a worked example and practical verification steps.
Learn how F# Units of Measure add compile‑time dimensional safety to numeric code, see a meter‑to‑feet conversion example, and understand the trade‑offs when interfacing with raw .NET APIs.
Stop using nulls and booleans to track state. Learn how F# Discriminated Unions make illegal program states unrepresentable through exhaustive pattern matching.
Create a thread‑safe producer‑consumer pipeline in F# using MailboxProcessor. Learn how to define message types, start an agent, handle errors, and add back‑pressure. Includes example code, runtime checks, and recovery strategies.