Migrate F# Conventions
Use single-argument function syntax
- Prefer function-call style for single-argument methods and functions.
- Write
upper.Contains "NOT NULL",str.StartsWith "CREATE", andDefault <| Value "". - Avoid parenthesized single-argument calls such as
upper.Contains("NOT NULL").
Use module-per-file declarations
- Prefer top-level module declarations for single-module files.
- Write
module migrate.Dbat file top. - Avoid
namespace ...with nestedmodule Db =for single-module files.
Use taskResult for Task<Result<_, _>> workflows
- Prefer
taskResultfor functions returningTask<Result<'a, 'e>>. - Use
let!directly forResult<'a, 'e>andTask<Result<'a, 'e>>values so errors short-circuit through the computation expression. - Use
do!directly for plainTask<unit>values insidetaskResult. - Add explicit type annotations on
let!bindings when F# cannot disambiguateTask<'a>fromTask<Result<'a, 'e>>builder overloads. - Avoid manually matching on
Resultinsidetask { ... }whentaskResult { ... }can express the same control flow.
Format with Fantomas
- Run Fantomas on changed F# code before committing.
- Format all project F# files with
cd src && fantomas .. - Format a specific file with
fantomas src/MigLib/Db.fs.