BindModule
PackageAxial
Creates error-adaptation markers for
let!, do!, and return! in flow { }.Assigns an error to a missing or unit-error source at a
flow { } bind site.Parameters
| Name | Type | Description |
|---|---|---|
| failure | 'error | The error to use if the source fails. |
| source | ^source | The source to adapt. |
Returns
BindError<'env, 'error, 'value>
Verification Examples
flow {
let! user = maybeUser |> Bind.error InvalidUser
do! Result.requireTrue () isValid |> Bind.error InvalidInput
}Maps an existing source error at a
flow { } bind site.Parameters
| Name | Type | Description |
|---|---|---|
| mapper | 'error1 -> 'error2 | The error mapping function. |
| source | ^source | The source to adapt. |
Returns
BindError<'env, 'error2, 'value>
Verification Examples
flow {
do! authorize user |> Bind.mapError Unauthorized
}
