FreeMonadModule
PackageFCQRS.Model
A free monad: a program is a description made of instructions, and an interpreter that the
application supplies decides what each instruction does. The same program can run against a
database in production and against fixed answers in a test.
Summary
| Name | Signature | Synopsis |
|---|---|---|
| free | free | Builds a `Free` program. |
| freeResult | freeResult | Builds a `Free` program that gives a `Result`: a `let!` on an `Error` ends it. |
| liftFree | liftFree m | A program that cannot fail as one that gives a `Result`, so `freeResult` can `let!` it. |
| liftResult | liftResult r | A `Result` as a program that performs nothing. |
Builds a `Free` program.
A block's code up to its first instruction runs when the block is built, not when the program
runs, so a program value shares what that code created between runs: a `let mutable` or a `for`
loop's position. Build a program that keeps such state in a function, such as
`let order id = free { ... }`, and call it for each run.
Returns
FreeBuilder
Builds a `Free` program that gives a `Result`: a `let!` on an `Error` ends it.
A block's code up to its first instruction runs when the block is built, not when the program
runs, so a program value shares what that code created between runs: a `let mutable` or a `for`
loop's position. Build a program that keeps such state in a function, such as
`let order id = free { ... }`, and call it for each run.
Returns
FreeResultBuilder
A program that cannot fail as one that gives a `Result`, so `freeResult` can `let!` it.
Parameters
| Name | Type | Description |
|---|---|---|
| m | Free<'I, 'T> |
Returns
Free<'I, Result<'T, 'E>>