Repository F# setup
open System
open System.IO
open System.Threading
open System.Threading.Tasks
open Axial
open Axial.Layers
open Axial.Console
open Axial.FileSystem
open Axial.Hosting
open Axial.Hosting.Browser
open Axial.Hosting.Node
open Axial.HttpClient
open Axial.PlatformService
open Axial.Process
open Axial.State
open Axial.Telemetry
open Axial.Telemetry.JavaScriptReading the Type
The full Flow type has three parameters:
Flow<'env, 'error, 'value>| Parameter | Meaning |
|---|---|
'env |
Dependencies supplied when the workflow runs |
'error |
Expected failures the caller can handle |
'value |
The value produced on success |
For example:
let loadUser (id: UserId) : Flow<AppEnv, LoadUserError, User> = ...Short aliases are abbreviations for the same three-parameter type. Each one fixes the channels it leaves out:
| Alias | Expands to | Meaning |
|---|---|---|
Flow<'value> |
Flow<unit, Never, 'value> |
No environment and no typed failure |
Flow<'error, 'value> |
Flow<unit, 'error, 'value> |
Typed failure, no environment |
EnvFlow<'env, 'value> |
Flow<'env, Never, 'value> |
Environment, no typed failure |
ExnFlow<'value> |
Flow<unit, exn, 'value> |
Recoverable exceptions as typed failures |
ExnEnvFlow<'env, 'value> |
Flow<'env, exn, 'value> |
Environment and recoverable exceptions |
unit in the environment channel means the workflow reads nothing. Never is an error type with no values, so a
Flow<'value> or EnvFlow<'env, 'value> cannot fail with an expected error. Writing the alias and writing the
expansion produce the same type, so the two forms are interchangeable in a signature:
open Axial
Axiallet render : Flow<string> = Flow.succeed "ok"
let renderExpanded : Flow<unit, Never, string> = render
render: Flow<string>FlowA flow that requires no environment and cannot fail with a typed error.
stringAn abbreviation for the CLI type . Basic Types
Axial.Flowsucceed: 'value -> Flow<'env,'error,'value>Alias for ok that reads well in some call sites. The value to wrap in a successful flow. A flow that always succeeds with the provided value. let result = Flow.succeed 42 |> Flow.run () // result = Success 42
renderExpanded: Flow<unit,Never,string>Axial.Flow`3Represents a cold workflow that reads an environment, returns a typed result, and is executed explicitly through one of its execution members such as ToTask, ToAsync, or RunSynchronously. The type of the environment dependency. The type of the failure value. The type of the success value.
unitThe type 'unit', which has only one value "()". This value is special and always uses the representation 'null'. Basic Types
Axial.NeverRepresents an error channel that cannot occur.
Go Further
- Flow API reference maps the construction, environment, composition, execution, resource, and concurrency functions.
- Troubleshooting Types explains the compiler errors produced when environment or error channels do not line up.

