Repository F# setup
open System
open System.IO
open System.Threading
open System.Threading.Tasks
open Axial
open Axial.Console
open Axial.FileSystem
open Axial.Hosting
open Axial.Hosting.Browser
open Axial.Hosting.Node
open Axial.State
open Axial.Telemetry
open Axial.Telemetry.JavaScriptSupplying Platform Services
A root Flow starts with live clock/random/GUID implementations and an Information+ stderr log sink. No platform
bundle is required in 'env. Keep authority such as configuration, HTTP, files and process execution in
an application record; override runtime values around the flow itself.
Show page setup
open System
open Axial
open Axial
let shouldEqual expected actual =
if actual <> expected then failwithf "Expected %A but got %A" expected actuallet startup : Flow<unit, Never, int> =
flow {
let! now = Clock.now
do! Log.info ("Starting port 8080 in " + string now.Year)
return 8080
}
startup: Flow<unit,Never,int>Axial.Flow`3unitThe 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.
intAn abbreviation for the CLI type . Basic Types
flow: FlowBuilderThe universal flow { } computation expression.
now: DateTimeOffsetAxial.ClockHelpers for the clock service.
now: Flow<'env,'error,DateTimeOffset>Reads the current UTC timestamp from an explicit clock service.
Axial.LogHelpers for the logging service.
info: string -> Flow<'env,'error,unit>Writes an informational message to the installed log sink.
(+): ^T1 -> ^T2 -> ^T3Overloaded addition operator The first parameter. The second parameter. The result of the operation. 2 + 2 // Evaluates to 4 "Hello " + "World" // Evaluates to "Hello World"
string: 'T -> stringConverts the argument to a string using ToString. For standard integer and floating point values and any type that implements IFormattable, ToString conversion uses CultureInfo.InvariantCulture. The input value. The converted string. string 'A' // evaluates to "A" string 0xff // evaluates to "255" string -10 // evaluates to "-10"
Year: intGets the year component of the date represented by the current object. The year component of the current object, expressed as an integer value between 0 and 9999.
Requires & types
Requires: open Axial (packages: Axial)val startup: Flow<unit,Never,int>A port decoded from an environment variable with a Reified schema is shown in the configuration guide; this page stays on the runtime values themselves.
let log = Log.memory ()
startup
|> Flow.withClock (Clock.fromValue (DateTimeOffset(2026, 1, 1, 0, 0, 0, TimeSpan.Zero)))
|> Flow.withRandom (Random.seeded 42)
|> Flow.withGuid (Guid.fromValue System.Guid.Empty)
|> Flow.withLogSink log
|> Flow.run ()
|> shouldEqual (Exit.Success 8080)
log.Entries |> Seq.map _.Message |> Seq.toList |> shouldEqual ["Starting port 8080 in 2026"]
log: TestLogAxial.LogHelpers for the logging service.
memory: unit -> TestLogstartup: Flow<unit,Never,int>(|>): 'T1 -> ('T1 -> 'U) -> 'UApply a function to a value, the value being on the left, the function on the right The argument. The function. The function result. let doubleIt x = x * 2 3 |> doubleIt // Evaluates to 6
Axial.FlowwithClock: IClock -> Flow<'env,'error,'value> -> Flow<'env,'error,'value>Overrides the clock within this flow and its descendants.
Axial.ClockHelpers for the clock service.
fromValue: DateTimeOffset -> ManualClockCreates a manual clock starting at the supplied instant. Sleeps require explicit advancement.
``.ctor``: int * int * int * int * int * int * TimeSpan -> unitInitializes a new instance of the structure using the specified year, month, day, hour, minute, second, and offset. The year (1 through 9999). The month (1 through 12). The day (1 through the number of days in ). The hours (0 through 23). The minutes (0 through 59). The seconds (0 through 59). The time's offset from Coordinated Universal Time (UTC). does not represent whole minutes. is less than one or greater than 9999. -or- is less than one or greater than 12. -or- is less than one or greater than the number of days in . -or- is less than zero or greater than 23. -or- is less than 0 or greater than 59. -or- is less than 0 or greater than 59. -or- is less than -14 hours or greater than 14 hours. -or- The property is earlier than or later than .
System.TimeSpanRepresents a time interval.
Zero: TimeSpanRepresents the zero value. This field is read-only.
withRandom: IRandom -> Flow<'env,'error,'value> -> Flow<'env,'error,'value>Overrides random values within this flow and its descendants.
Axial.RandomHelpers for the random-number service.
seeded: int -> IRandomCreates a reproducible generator, independent for each test run.
withGuid: IGuid -> Flow<'env,'error,'value> -> Flow<'env,'error,'value>Overrides GUID generation within this flow and its descendants.
Axial.GuidHelpers for the GUID service.
fromValue: Guid -> IGuidCreates a deterministic GUID service that always returns the supplied value.
SystemEmpty: GuidA read-only instance of the structure whose value is all zeros.
System.GuidRepresents a globally unique identifier (GUID).
withLogSink: ILogSink -> Flow<'env,'error,'value> -> Flow<'env,'error,'value>Replaces the log destination within this flow and its descendants.
run: 'env -> Flow<'env,'error,'value> -> Exit<'value,'error>Runs the workflow and blocks until the final exit is available. The environment used by the workflow. The workflow to run. The final workflow exit. let exit = workflow |> Flow.run environment
shouldEqual: 'a -> 'a -> unitAxial.Exit`2Represents the final outcome of a workflow execution. The type of the success value. The type of the domain-specific failure value.
SuccessThe workflow completed successfully.
Entries: Collections.Generic.IReadOnlyList<LogEntry>The recorded entries, in the order they were written.
Microsoft.FSharp.Collections.SeqModuleContains operations for working with values of type .
map: ('T -> 'U) -> 'T seq -> 'U seqBuilds a new collection whose elements are the results of applying the given function to each of the elements of the collection. The given function will be applied as elements are demanded using the MoveNext method on enumerators retrieved from the object. The returned sequence may be passed between threads safely. However, individual IEnumerator values generated from the returned sequence should not be accessed concurrently. Sequence construction is O(1). Enumeration is O(n), where n is the length of the sequence. A function to transform items from the input sequence. The input sequence. The result sequence. Thrown when the input sequence is null. let inputs = ["a"; "bbb"; "cc"] inputs |> Seq.map (fun x -> x.Length) Evaluates to a sequence yielding the same results as seq { 1; 3; 2 }
_arg1: LogEntryMessage: stringtoList: 'T seq -> 'T listBuilds a list from the given collection. The input sequence. The result list. Thrown when the input sequence is null. let inputs = seq { 1; 2; 5 } inputs |> Seq.toList Evaluates to [ 1; 2; 5 ]. This is an O(n) operation, where n is the length of the sequence.
Requires & types
Requires: open Axial; open System (packages: Axial)val log: TestLogOverrides apply to a subtree and its forks; the outer values are restored afterwards. Flow.mapLogSink decorates
an installed sink instead of replacing it. Flow.withTelemetry installs annotation and typed-attribute callbacks;
Activity and JavaScript OpenTelemetry adapters compose through them rather than replacing them.
Host logging defaults
| Host | Installed destination |
|---|---|
| Generic Host | Microsoft logging, category Axial |
| ASP.NET Core flowEndpoint | RequestServices' Microsoft logging factory, category Axial.Endpoint |
| GenHTTP | Runtime default unless EndpointOptions.LogSink is supplied |
| Node | NodeLogging.sink LogLevel.Information, through console.error on stderr |
| Browser | BrowserLogging.sink LogLevel.Information, mapped to console.debug/info/warn/error |
HostedAppOptions.LogSink and ASP.NET EndpointOptions.LogSink accept an optional factory callback from
ILoggerFactory to ILogSink. GenHTTP, Node and Browser options accept an optional sink directly. None leaves
the runtime default in force; a supplied LogSink.none silences logs. An inner Flow.withLogSink always wins.
Microsoft logging scopes include annotations and named FiberLocals; empty entries add no empty scope.
FiberLogging.observe remains opt-in and separate from message logging.
The default flowEndpoint functions retain their existing argument order. Use flowEndpointWithOptions for an
explicit endpoint policy. Node offers startWithOptions / runWithOptions; Browser offers mountWithOptions /
startWithSignalOptions. See .NET hosting, Node and application lifecycle.
Tests and authority
Flow.runTest env creates a fresh deterministic TestPlatform. Flow.runTestWith platform env exposes its
manual clock, recording log, random and GUID implementations. Neither advances time automatically: fork a timed
flow, await its sleeper-registration signal, call TestClock.advance, then join. advanceAll stops at the latest
deadline registered at entry rather than following a repeating timer forever.
These runners are .NET-only. Fable uses the same ManualClock and scoped overrides; after advancing, await the
released promise/fiber before a dependent advance.
A container should resolve application authority once and construct the environment. It is not a runtime-service registry. See providing the environment and service details. Cryptographic randomness belongs in explicit capability code using System.Security.Cryptography, not the runtime random generator.

