📖 About F#
F# is a functional-first programming language that makes it easy to write correct and maintainable code. It excels at domain modeling, data transformation pipelines, and type-safe business logic.
🎯 Best For
- Domain modeling with algebraic data types
- Data transformation pipelines
- Type-safe business logic
- Financial and scientific computing
- Concurrent and asynchronous programming
🔧 Key Features
- Result<'T, 'Error> pattern for error handling
- Pipe operator |> for function composition
- Pattern matching for control flow
- Immutability by default
- Type inference
- Async workflows for asynchronous programming
🛠️ Development Tools
Build
dotnet build
Test
dotnet test
Coverage
dotnet test /p:CollectCoverage=true
Run
dotnet run
📄 Package Contents (7 files)
AGENTS_RULES.md
Complete AI agent rules (universal)
- FSHARP-specific best practices
- TDD workflow (Red-Green-Refactor)
- DDD principles and patterns
- Git workflow and commit format
- Code quality principles
.cursorrules
Quick reference for Cursor IDE
- Essential rules summary
- Links to full documentation
- Optimized for quick loading
.gitignore
Git exclusions
- FSHARP-specific patterns
- Build artifacts
- IDE configuration files
- Dependency directories
AGENTS.md
Quick reference guide
- Common patterns
- Best practices summary
- Quick troubleshooting
README.md
Project template with examples
- Setup instructions
- Sample code and structure
- Testing examples
- Build and run commands
CODE_QUALITY_PRINCIPLES.md
Quality principles and best practices
- Avoid default values (fail-fast)
- Consistency across code paths
- Extract reusable functions
- FSHARP-specific examples
CONTRIBUTING.md
Contribution guidelines
- TDD workflow (Red-Green-Refactor)
- Git commit format
- Code review process
- Testing requirements (90% coverage)
💻 Code Examples
Result Pattern
type Result<'T, 'Error> =
| Ok of 'T
| Error of 'Error
let divide x y =
if y = 0 then Error "Division by zero"
else Ok (x / y)
Railway-Oriented Programming
let validateUser user =
user
|> validateEmail
|> Result.bind validateAge
|> Result.bind validatePassword
|> Result.map createUser
Pipe Operator
[1; 2; 3; 4; 5] |> List.map (fun x -> x * 2) |> List.filter (fun x -> x > 5) |> List.sum