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.JavaScriptClock, random numbers and GUIDs come from the runtime, not the application environment. The runtime starts with
live implementations; a scoped override applies to its flow and forked descendants, then restores the outer value.
Application authority such as files, HTTP, process execution and configuration stays explicit in 'env.
open System
open Axial
open Axial
let isExpired (expiry: DateTimeOffset) : Flow<'env, Never, bool> =
Clock.now |> Flow.map (fun now -> now >= expiry)
SystemAxialisExpired: DateTimeOffset -> Flow<'env,Never,bool>expiry: DateTimeOffsetSystem.DateTimeOffsetRepresents a point in time, typically expressed as a date and time of day, relative to Coordinated Universal Time (UTC).
Axial.Flow`3envAxial.NeverRepresents an error channel that cannot occur.
boolAn abbreviation for the CLI type . Basic Types
Axial.ClockHelpers for the clock service.
now: Flow<'env,'error,DateTimeOffset>Reads the current UTC timestamp from an explicit clock service.
(|>): '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.Flowmap: ('value -> 'next) -> Flow<'env,'error,'value> -> Flow<'env,'error,'next>Transforms the successful value of a flow. If the source fails, the is not executed. The original failure cause is preserved, including typed failures, interruption, and defects. Use map for pure value transformations after an effect has succeeded. A function of type 'value -> 'next to transform the successful value. The source flow of type to transform. A new with the transformed success value of type 'next. let flow = Flow.succeed 1 |> Flow.map (fun x -> x + 1)
now: DateTimeOffset(>=): 'T -> 'T -> boolStructural greater-than-or-equal The first parameter. The second parameter. The result of the comparison. 5 >= 1 // Evaluates to true 5 >= 5 // Evaluates to true [1; 5] >= [1; 6] // Evaluates to false
Requires & types
Requires: open Axial; open System (packages: Axial)val isExpired: DateTimeOffset -> Flow<'env,Never,bool>| Runtime value | Reader | Scoped override |
|---|---|---|
IClock |
Clock.now, Clock.elapsed, timed Flow operations |
Flow.withClock |
IRandom |
Random.next, nextInt, nextDouble, bytes |
Flow.withRandom |
IGuid |
Guid.newGuid |
Flow.withGuid |
IClock, IRandom, IGuid and the platform modules are defined in Axial. Their reader modules keep the
Axial namespace for 0.12, but the implementation ships in the Axial package. The
Axial package is deleted; environment, argument and file configuration live in
Axial.Configuration. There is no general runtime service registry. An environment remains an ordinary application record, and Flow.envWith selects its fields.
Observation slots
Log.info and the other logging helpers write to the current ILogSink. The default writes Information and above
to stderr, leaving stdout available for application output. Flow.withLogSink replaces the sink for a subtree;
Flow.mapLogSink decorates the sink already in force. Flow.withTelemetry similarly installs the two write-only
ITelemetry callbacks for annotations and typed attributes. These slots inherit through forks too.
Deterministic runs
> open System;;
> open Axial;;
> open Axial;;
> (Clock.now : Flow<unit, Never, DateTimeOffset>) |> Flow.map _.Year |> Flow.runTest ();;
> (Random.nextInt 1 10 : Flow<unit, Never, int>) |> Flow.withRandom (Random.fromValue 7) |> Flow.runTest ();;val it: Exit<int,Never> = Success 1970
val it: Exit<int,Never> = Success 7SystemAxialAxial.ClockHelpers for the clock service.
now: Flow<'env,'error,DateTimeOffset>Reads the current UTC timestamp from an explicit clock service.
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.
System.DateTimeOffsetRepresents a point in time, typically expressed as a date and time of day, relative to Coordinated Universal Time (UTC).
(|>): '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.Flowmap: ('value -> 'next) -> Flow<'env,'error,'value> -> Flow<'env,'error,'next>Transforms the successful value of a flow. If the source fails, the is not executed. The original failure cause is preserved, including typed failures, interruption, and defects. Use map for pure value transformations after an effect has succeeded. A function of type 'value -> 'next to transform the successful value. The source flow of type to transform. A new with the transformed success value of type 'next. let flow = Flow.succeed 1 |> Flow.map (fun x -> x + 1)
_arg1: DateTimeOffsetYear: 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.
Axial.TestPlatformExtensions.FlowrunTest: 'env -> Flow<'env,'error,'value> -> Exit<'value,'error>A fresh platform for each run: Unix epoch, seeded random, sequential GUIDs, and a recording sink.
Axial.RandomHelpers for the random-number service.
nextInt: int -> int -> Flow<'env,'error,int>Reads a random integer from an explicit random-number service.
intAn abbreviation for the CLI type . Basic Types
withRandom: IRandom -> Flow<'env,'error,'value> -> Flow<'env,'error,'value>Overrides random values within this flow and its descendants.
fromValue: int -> IRandomCreates a deterministic random generator that always returns the supplied value. NextDouble returns the value as a float and NextBytes truncates it to a byte; use Random.fromFixed when a test needs distinct integer, double, and byte values.
Flow.runTest env creates a fresh TestPlatform: an epoch ManualClock, seeded random, sequential GUIDs and a
recording log. Flow.runTestWith platform env exposes those fakes for assertions. Neither runner advances time
automatically. Timed tests fork, await a registration signal, explicitly advance, then join; see clock.
The test runners are .NET APIs; Fable supports ManualClock and the same scoped per-service overrides.
Culture and time zone
Culture and TimeZone are plain sealed values, not runtime-context fields. Read a machine default as an explicit
effect with Culture.system or TimeZone.local, keep the value in the application model, and pass it to pure
functions. Flow.runTest supplies the invariant culture and UTC. Culture.setProcessDefault sets the .NET process
culture once at startup; it is a no-op on Fable.
Format.number, Format.currency, Format.date and Format.time take the culture first. TimeZone.toLocal zone instant converts a UTC instant to the zone's wall clock for presentation. On .NET formatting uses CultureInfo; on
Fable it uses Intl. Both use the instant's wall clock, not the machine's local time.
The targets agree on the common tested output but not on every format. Known differences:
Format.numberuses the .NET"N2"pattern andIntl.NumberFormatwith two fractional digits. They agree for de-DE and en-US in the tests; other .NET number patterns are not exposed.Format.currencyon .NET uses the culture's currency symbol and pattern. On Fable it derives a currency from the culture's region and falls back to USD for unmapped regions. The invariant culture therefore renders¤1,234.50on .NET and$1,234.50on Fable.Format.dateandFormat.timeuse the .NET short date/time patterns ("d"and"t") withCultureInfo, while Fable builds numericIntl.DateTimeFormatfields. Zero padding and separators can differ: de-DE date is01.06.2025on .NET and commonly1.6.2025on Fable. en-US time can differ in the non-breaking space beforePM.- The invariant culture uses en-US as the Fable
Intlbaseline becauseIntlhas no invariant locale. Use an explicit culture for presentation and do not compare invariantFormat.currency/date/time strings across targets.
Configuration is different: environment variables, arguments, and files read external state. See the
Configuration set for ConfigSource, Config.load, Config.watch, and Config.processArg.
Cryptographic randomness belongs inside an explicit capability using System.Security.Cryptography, not the runtime's
ordinary random generator.
In this section
- Clock: timestamps, durations and explicit manual stepping.
- Logging: level gates, metadata, sink composition and host adapters.
- Randomness and GUIDs: fixed, seeded and scripted values.
- Configuration set: layered external configuration and secrets.

