- Use PascalCase for module names and type names.
- Use camelCase for function names, method names, and variable names.
- Use uppercase abbreviations for acronyms in names (e.g., HTTP, XML).
- Use 4 spaces for indentation (no tabs).
- Limit line length to 100 characters.
- Break long lines with appropriate indentation.
- Put opening braces on the same line as the declaration.
- Use
///
for XML documentation comments. - Use
//
for single-line comments. - Use
(* ... *)
for multi-line comments.
- Use pattern matching instead of
if-then-else
chains whenever possible. - Define discriminated union cases in uppercase.
- Use indentation to make the pattern matching code readable.
- Prefer immutability whenever possible.
- Use
let
bindings for immutable values. - Avoid using mutable variables.
- Use the
|>
operator for function composition. - Prefer function composition over nested function calls.
- Use the
Result<'T, 'TError>
type for error handling. - Use
Option<'T>
for optional values. - Avoid throwing exceptions for normal control flow.
- Use
async
andawait
for asynchronous programming. - Use
Task<'T>
for asynchronous computations. - Use
Async<'T>
for asynchronous workflows.
- Avoid unnecessary type annotations.
- Use meaningful names for variables and functions.
- Write concise and readable code.
- Follow functional programming principles.
- Use whitespace to improve code readability.