PolicyModule
PackageAxial
Constructors and combinators for environment-aware workflow requirements.
Summary
| Name | Signature | Synopsis |
|---|---|---|
| lift | lift operation mapError environment input | Lifts a pure result-returning function and maps its error into the workflow error type. |
| withError | withError operation error | Lifts a pure result-returning function and replaces any error with a fixed workflow error. |
| context | context operation mapError environment input | Lifts an environment-aware result-returning function and maps its error into the workflow error type. |
| pass | pass environment input | A policy that returns the input unchanged. |
| compose | compose first second environment input | Composes two policies left to right. |
| optional | optional enabled policy environment input | Runs a policy only when the environment predicate is true; otherwise returns the input unchanged. |
Lifts a pure result-returning function and maps its error into the workflow error type.
Parameters
| Name | Type | Description |
|---|---|---|
| operation | 'input -> Result<'output, 'innerError> | |
| mapError | 'innerError -> 'error | |
| environment | 'env | |
| input | 'input |
Returns
Result<'output, 'error>
Lifts a pure result-returning function and replaces any error with a fixed workflow error.
Parameters
| Name | Type | Description |
|---|---|---|
| operation | 'input -> Result<'output, 'innerError> | |
| error | 'error |
Returns
Policy<'env, 'error, 'input, 'output>
Lifts an environment-aware result-returning function and maps its error into the workflow error type.
Parameters
| Name | Type | Description |
|---|---|---|
| operation | 'env -> 'input -> Result<'output, 'innerError> | |
| mapError | 'innerError -> 'error | |
| environment | 'env | |
| input | 'input |
Returns
Result<'output, 'error>
A policy that returns the input unchanged.
Parameters
| Name | Type | Description |
|---|---|---|
| environment | 'env | |
| input | 'input |
Returns
Result<'input, 'error>
Composes two policies left to right.
Parameters
| Name | Type | Description |
|---|---|---|
| first | Policy<'env, 'error, 'input, 'middle> | |
| second | Policy<'env, 'error, 'middle, 'output> | |
| environment | 'env | |
| input | 'input |
Returns
Result<'output, 'error>

