nw-fp-fsharp

Solid

F# language-specific patterns, Railway-Oriented Programming, and Computation Expressions

AI & Automation 526 stars 55 forks Updated 1 weeks ago MIT

Install

View on GitHub

Quality Score: 95/100

Stars 20%
91
Recency 20%
90
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# FP in F# -- Functional Software Crafter Skill Cross-references: [fp-principles](../nw-fp-principles/SKILL.md) | [fp-domain-modeling](../nw-fp-domain-modeling/SKILL.md) | [pbt-dotnet](../nw-pbt-dotnet/SKILL.md) ## When to Choose F# - Best for: domain modeling on .NET | DDD | railway-oriented programming | pipeline-first design | finance - Not ideal for: teams needing higher-kinded types | non-.NET platforms | large existing C# codebases resistant to change ## [STARTER] Quick Setup ```bash dotnet new console -lang F# -o OrderService && cd OrderService dotnet new xunit -lang F# -o OrderService.Tests dotnet add OrderService.Tests reference OrderService dotnet add OrderService.Tests package FsCheck.Xunit dotnet test ``` **File order matters**: F# compiles files top-to-bottom as listed in `.fsproj`. Types must be defined before use. ## [STARTER] Type System for Domain Modeling ### Choice Types (Discriminated Unions) ```fsharp type PaymentMethod = | CreditCard of cardNumber: string * expiryDate: string | BankTransfer of accountNumber: string | Cash ``` ### Record Types and Domain Wrappers ```fsharp type Customer = { CustomerId: CustomerId CustomerName: CustomerName CustomerEmail: EmailAddress } type OrderId = OrderId of int type EmailAddress = EmailAddress of string ``` Records have structural equality by default. Single-case DUs have small runtime cost (unlike Haskell's zero-cost newtype). ### [STARTER] Validated Construction (Smart Construct...

Details

Author
nWave-ai
Repository
nWave-ai/nWave
Created
3 months ago
Last Updated
1 weeks ago
Language
Python
License
MIT

Similar Skills

Semantically similar based on skill content — not just same category