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.JavaScriptProviding the Environment
Build the environment at startup and in each test. Prefer these approaches in order.
1. Construct it
Build the record and pass it to Flow.run:
Show page setup
// Setup for the checked examples on this page.
open System
open Axial
open Axial
/// Fails the docs test when an example's result differs from the value shown.
let shouldEqual expected actual =
if actual <> expected then failwithf "Expected %A but got %A" expected actualtype IUserStore =
abstract Count: unit -> int
type AppEnv = { Users: IUserStore }
let summary : Flow<AppEnv, Never, string> =
flow {
let! users = Flow.envWith _.Users
let! now = Clock.now
let today = now.ToString "yyyy-MM-dd"
return $"{users.Count()} users on {today}"
}
FsLiveDocsGeneratedPage21_2D306DEB1823.IUserStoreCount: IUserStore -> unit -> intunitThe type 'unit', which has only one value "()". This value is special and always uses the representation 'null'. Basic Types
intAn abbreviation for the CLI type . Basic Types
FsLiveDocsGeneratedPage21_2D306DEB1823.AppEnvUsers: IUserStoresummary: Flow<AppEnv,Never,string>Axial.Flow`3Axial.NeverRepresents an error channel that cannot occur.
stringAn abbreviation for the CLI type . Basic Types
flow: FlowBuilderThe universal flow { } computation expression.
users: IUserStoreAxial.FlowenvWith: ('env -> 'value) -> Flow<'env,'error,'value>Projects one value from the current environment. This is the primary way to access app dependencies, configuration, or request metadata stored in env. The projection runs only when the flow is executed, so constructing the flow is still pure and side-effect free. Prefer small projections over passing a large environment deeper into reusable helpers. A function that extracts a value from the environment. A containing the projected value. let region () = Flow.envWith (fun (environment: {| Region: string |}) -> environment.Region)
_arg1: AppEnvnow: DateTimeOffsetAxial.ClockHelpers for the clock service.
now: Flow<'env,'error,DateTimeOffset>Reads the current UTC timestamp from an explicit clock service.
today: stringToString: string -> stringConverts the value of the current object to its equivalent string representation using the specified format. A format string. A string representation of the value of the current object, as specified by . The length of is one, and it is not one of the standard format specifier characters defined for . -or- does not contain a valid custom format pattern. The date and time is outside the range of dates supported by the calendar used by the current culture.
Requires & types
Requires: open Axial (packages: Axial)val summary: Flow<AppEnv,Never,string>Production builds the record from the live services; SqlUserStore is a placeholder for your own store implementation, not a type Axial ships. For example: { Users = SqlUserStore(connectionString) }. A test builds it from fixed ones:
let fixedEnv =
{ Users = { new IUserStore with member _.Count() = 3 } }
summary |> Flow.withClock (Clock.fromValue (DateTimeOffset(2026, 1, 1, 0, 0, 0, TimeSpan.Zero))) |> Flow.run fixedEnv |> shouldEqual (Exit.Success "3 users on 2026-01-01")
fixedEnv: AppEnvUsers: IUserStoreFsLiveDocsGeneratedPage21_2D306DEB1823.IUserStore_: IUserStoreCount: unit -> intsummary: Flow<AppEnv,Never,string>(|>): '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.
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.
Requires & types
Requires: open Axial; open System (packages: Axial)val fixedEnv: AppEnvThe record literal shows where each service comes from.
Clock, random and GUID values are runtime services, not authority in this record. Install test values with
Flow.withClock, Flow.withRandom and Flow.withGuid. Log and telemetry destinations use Flow.withLogSink
and Flow.withTelemetry. These scoped overrides inherit through forks and restore the outer values on exit.
Configuration reads still require an explicit IHasConfig dependency; see
Tutorial: Composing Built-in Services.
2. Take it from a host container
.NET hosts already have an IServiceProvider. Use it to build the environment, then leave it behind.
Resolving inside the workflow is the escape hatch, not the default shape:
type IOrderQueue =
abstract Flush: unit -> int
let flushOrdersFromProvider : Flow<IServiceProvider, unit, int> =
flow {
let! orders = ServiceProvider.get<IOrderQueue, _, _> ()
return orders.Flush()
}
FsLiveDocsGeneratedPage21_2D306DEB1823.IOrderQueueFlush: IOrderQueue -> unit -> intunitThe type 'unit', which has only one value "()". This value is special and always uses the representation 'null'. Basic Types
intAn abbreviation for the CLI type . Basic Types
flushOrdersFromProvider: Flow<IServiceProvider,unit,int>Axial.Flow`3System.IServiceProviderDefines a mechanism for retrieving a service object; that is, an object that provides custom support to other objects.
flow: FlowBuilderThe universal flow { } computation expression.
orders: IOrderQueueAxial.ServiceProviderReads services from an environment. This is the host boundary. Use it in glue and adapters where dynamic container lookup is the intended behaviour; application workflows should declare what they need instead. Missing registrations are configuration defects and fail through Cause.Die rather than the typed error channel. Build the environment with a layer when a missing registration should be a typed startup error.
get: unit -> Flow<'env,'error,'service>Resolves a service from the IServiceProvider in the environment. The service type being requested. The environment type. The workflow error type. A flow that succeeds with the requested service instance. let orders = ServiceProvider.get<IOrderRepository, _, _> ()
Flush: unit -> intRequires & types
Requires: open Axial; open System (packages: Axial)val flushOrdersFromProvider: Flow<IServiceProvider,unit,int>A host's container supplies the IServiceProvider. The examples use a small stand-in:
let provider (services: (Type * obj) list) =
{ new IServiceProvider with
member _.GetService serviceType =
services |> List.tryFind (fst >> (=) serviceType) |> Option.map snd |> Option.defaultValue null }
provider: (Type * obj) list -> IServiceProviderservices: (Type * obj) listSystem.TypeRepresents type declarations: class types, interface types, array types, value types, enumeration types, type parameters, generic type definitions, and open or closed constructed generic types.
objAn abbreviation for the CLI type . Basic Types
listThe type of immutable singly-linked lists. See the module for further operations related to lists. Use the constructors [] and :: (infix) to create values of this type, or the notation [1; 2; 3]. Use the values in the List module to manipulate values of this type, or pattern match against the values directly. See also F# Language Guide - Lists.
System.IServiceProviderDefines a mechanism for retrieving a service object; that is, an object that provides custom support to other objects.
_: IServiceProviderGetService: Type -> objGets the service object of the specified type. An object that specifies the type of service object to get. A service object of type . -or- if there is no service object of type .
serviceType: Type(|>): '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
Microsoft.FSharp.Collections.ListModuleContains operations for working with values of type . Operations for collections such as lists, arrays, sets, maps and sequences. See also F# Collection Types in the F# Language Guide.
tryFind: ('T -> bool) -> 'T list -> 'T optionReturns the first element for which the given function returns True. Return None if no such element exists. The function to test the input elements. The input list. The first element for which the predicate returns true, or None if every element evaluates to false. Try to find the first even number: let inputs = [1; 2; 3] inputs |> List.tryFind (fun elm -> elm % 2 = 0) Evaluates to Some 2 Try to find the first even number: let inputs = [1; 5; 3] inputs |> List.tryFind (fun elm -> elm % 2 = 0) Evaluates to None This is an O(n) operation in the worst case, where n is the length of the list.
fst: 'T1 * 'T2 -> 'T1Return the first element of a tuple, fst (a,b) = a. The input tuple. The first value. fst ("first", 2) // Evaluates to "first"
(>>): ('T1 -> 'T2) -> ('T2 -> 'T3) -> 'T1 -> 'T3Compose two functions, the function on the left being applied first The first function to apply. The second function to apply. The composition of the input functions. let addOne x = x + 1 let doubleIt x = x * 2 let addThenDouble = addOne >> doubleIt addThenDouble 3 // Evaluates to 8
(=): 'T -> 'T -> boolStructural equality The first parameter. The second parameter. The result of the comparison. 5 = 5 // Evaluates to true 5 = 6 // Evaluates to false [1; 2] = [1; 2] // Evaluates to true (1, 5) = (1, 6) // Evaluates to false
Microsoft.FSharp.Core.OptionModuleContains operations for working with options. Options
map: ('T -> 'U) -> 'T option -> 'U optionmap f inp evaluates to match inp with None -> None | Some x -> Some (f x). A function to apply to the option value. The input option. An option of the input value after applying the mapping function, or None if the input is None. None |> Option.map (fun x -> x * 2) // evaluates to None Some 42 |> Option.map (fun x -> x * 2) // evaluates to Some 84
snd: 'T1 * 'T2 -> 'T2Return the second element of a tuple, snd (a,b) = b. The input tuple. The second value. snd ("first", 2) // Evaluates to 2
defaultValue: 'T -> 'T option -> 'TGets the value of the option if the option is Some, otherwise returns the specified default value. The specified default value. The input option. The option if the option is Some, else the default value. Identical to the built-in operator, except with the arguments swapped. (99, None) ||> Option.defaultValue // evaluates to 99 (99, Some 42) ||> Option.defaultValue // evaluates to 42
Requires & types
Requires: open Systemval provider: (Type * obj) list -> IServiceProviderlet withQueue = provider [ typeof<IOrderQueue>, box { new IOrderQueue with member _.Flush() = 5 } ]
flushOrdersFromProvider |> Flow.run withQueue |> shouldEqual (Exit.Success 5)
match flushOrdersFromProvider |> Flow.run (provider []) with
| Exit.Failure(Cause.Die _) -> ()
| other -> failwithf "expected a defect, got %A" other
withQueue: IServiceProviderprovider: (Type * obj) list -> IServiceProvidertypeof: TypeGenerate a System.Type runtime representation of a static type. let t = typeof<int> // Gets the System.Type t.FullName // Evaluates to "System.Int32"
FsLiveDocsGeneratedPage21_2D306DEB1823.IOrderQueuebox: 'T -> objnullBoxes a strongly typed value. The value to box. The boxed object. let x: int = 123 let obj1 = box x // obj1 is a generic object type unbox<int> obj1 // Evaluates to 123 (int) unbox<double> obj1 // Throws System.InvalidCastException
_: IOrderQueueFlush: unit -> intflushOrdersFromProvider: Flow<IServiceProvider,unit,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.Flowrun: '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.
FailureThe workflow failed due to a specific cause.
Axial.Cause`1Represents the cause of a failed workflow. The type of the domain-specific failure value.
DieAn unexpected defect or panic (e.g., an exception).
other: Exit<int,unit>failwithf: Printf.StringFormat<'T,'Result> -> 'TPrint to a string buffer and raise an exception with the given result. Helper printers must return strings. The formatter. The formatted result. See Printf.failwithf (link: ) for examples.
Requires & types
Requires: open Axial (packages: Axial)val withQueue: IServiceProviderServiceProvider.get treats a missing registration as a defect, not a typed error, because an unregistered
service is a configuration bug rather than something a workflow should handle.
The rule is one line: use IServiceProvider to build the world; do not make every business workflow depend on it.
A workflow typed Flow<IServiceProvider, _, _> can reach anything, which is exactly the property the environment
channel exists to remove. Convert at the edge and let the rest of the application name what it needs. At the
composition root, resolve the dependencies once and hand the application an ordinary record:
type OrderEnv = { Orders: IOrderQueue }
let buildOrderEnv : Flow<IServiceProvider, unit, OrderEnv> =
flow {
let! orders = ServiceProvider.get<IOrderQueue, _, _> ()
return { Orders = orders }
}
let flushOrders : Flow<OrderEnv, unit, int> =
flow {
let! orders = Flow.envWith _.Orders
return orders.Flush()
}
FsLiveDocsGeneratedPage21_2D306DEB1823.OrderEnvOrders: IOrderQueueFsLiveDocsGeneratedPage21_2D306DEB1823.IOrderQueuebuildOrderEnv: Flow<IServiceProvider,unit,OrderEnv>Axial.Flow`3System.IServiceProviderDefines a mechanism for retrieving a service object; that is, an object that provides custom support to other objects.
unitThe type 'unit', which has only one value "()". This value is special and always uses the representation 'null'. Basic Types
flow: FlowBuilderThe universal flow { } computation expression.
orders: IOrderQueueAxial.ServiceProviderReads services from an environment. This is the host boundary. Use it in glue and adapters where dynamic container lookup is the intended behaviour; application workflows should declare what they need instead. Missing registrations are configuration defects and fail through Cause.Die rather than the typed error channel. Build the environment with a layer when a missing registration should be a typed startup error.
get: unit -> Flow<'env,'error,'service>Resolves a service from the IServiceProvider in the environment. The service type being requested. The environment type. The workflow error type. A flow that succeeds with the requested service instance. let orders = ServiceProvider.get<IOrderRepository, _, _> ()
flushOrders: Flow<OrderEnv,unit,int>intAn abbreviation for the CLI type . Basic Types
Axial.FlowenvWith: ('env -> 'value) -> Flow<'env,'error,'value>Projects one value from the current environment. This is the primary way to access app dependencies, configuration, or request metadata stored in env. The projection runs only when the flow is executed, so constructing the flow is still pure and side-effect free. Prefer small projections over passing a large environment deeper into reusable helpers. A function that extracts a value from the environment. A containing the projected value. let region () = Flow.envWith (fun (environment: {| Region: string |}) -> environment.Region)
_arg1: OrderEnvFlush: unit -> intRequires & types
Requires: open Axial; open System (packages: Axial)val buildOrderEnv: Flow<IServiceProvider,unit,OrderEnv>val flushOrders: Flow<OrderEnv,unit,int>let appEnv =
match buildOrderEnv |> Flow.run (provider [ typeof<IOrderQueue>, box { new IOrderQueue with member _.Flush() = 5 } ]) with
| Exit.Success env -> env
| Exit.Failure cause -> failwithf "startup failed: %A" cause
flushOrders |> Flow.run appEnv |> shouldEqual (Exit.Success 5)
appEnv: OrderEnvbuildOrderEnv: Flow<IServiceProvider,unit,OrderEnv>(|>): '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.Flowrun: '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
provider: (Type * obj) list -> IServiceProvidertypeof: TypeGenerate a System.Type runtime representation of a static type. let t = typeof<int> // Gets the System.Type t.FullName // Evaluates to "System.Int32"
FsLiveDocsGeneratedPage21_2D306DEB1823.IOrderQueuebox: 'T -> objnullBoxes a strongly typed value. The value to box. The boxed object. let x: int = 123 let obj1 = box x // obj1 is a generic object type unbox<int> obj1 // Evaluates to 123 (int) unbox<double> obj1 // Throws System.InvalidCastException
_: IOrderQueueFlush: unit -> intAxial.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.
env: OrderEnvFailureThe workflow failed due to a specific cause.
cause: Cause<unit>failwithf: Printf.StringFormat<'T,'Result> -> 'TPrint to a string buffer and raise an exception with the given result. Helper printers must return strings. The formatter. The formatted result. See Printf.failwithf (link: ) for examples.
flushOrders: Flow<OrderEnv,unit,int>shouldEqual: 'a -> 'a -> unitRequires & types
Requires: open Axial (packages: Axial)val appEnv: OrderEnvWith this shape, the container lookup happens once in buildOrderEnv; flushOrders and the rest of the application name only the record.
3. Provision it with a layer
When building the environment is itself effectful (it can fail with a typed startup error, needs a resource released later, or must await something), construction becomes a workflow of its own. Layers are the core combinators for those workflows.
A layer acquires its resources inside the scope Layer.provide creates, so they are released when the provided flow
finishes, fails, or is interrupted. The layers guide opens and closes a repository
around the workflow, and the resources guide covers scope-based cleanup directly.
Choose an explicit typed startup error when a missing registration is part of provisioning's contract:
let orderLayer : Layer<IServiceProvider, string, OrderEnv> =
Layer.fromFlow (
Flow.envWith (fun (provider: IServiceProvider) ->
match provider.GetService typeof<IOrderQueue> with
| :? IOrderQueue as queue -> Ok { Orders = queue }
| _ -> Error "Order queue was not registered")
|> Flow.bind Flow.fromResult)
let fromHost : Flow<IServiceProvider, string, int> =
Flow.envWith (fun (env: OrderEnv) -> env.Orders.Flush()) |> Layer.provide orderLayer
orderLayer: Layer<IServiceProvider,string,OrderEnv>Axial.Layer`3Represents a provisioning step that builds an explicit environment inside a scope. The input environment required to build the layer. The typed failure produced during provisioning. The environment or service bundle produced by the layer.
System.IServiceProviderDefines a mechanism for retrieving a service object; that is, an object that provides custom support to other objects.
stringAn abbreviation for the CLI type . Basic Types
FsLiveDocsGeneratedPage21_2D306DEB1823.OrderEnvAxial.LayerModulefromFlow: Flow<'input,'error,'output> -> Layer<'input,'error,'output>Creates a layer that builds its output by running a flow with the layer's input as its environment. The flow runs in the layer's scope, so what it registers with Flow.scopeAcquireRelease, Flow.scopeFinalizer, or Flow.scopeResource stays open until the Layer.provide boundary closes, and is released in reverse acquisition order. A typed failure fails provisioning; whatever was acquired before it is released. The flow that builds the layer output. A layer that succeeds with the flow's value. let database : Layer<AppConfig, DbError, Database> = Layer.fromFlow (Flow.scopeAcquireRelease (Database.connect ()) Database.close)
Axial.FlowenvWith: ('env -> 'value) -> Flow<'env,'error,'value>Projects one value from the current environment. This is the primary way to access app dependencies, configuration, or request metadata stored in env. The projection runs only when the flow is executed, so constructing the flow is still pure and side-effect free. Prefer small projections over passing a large environment deeper into reusable helpers. A function that extracts a value from the environment. A containing the projected value. let region () = Flow.envWith (fun (environment: {| Region: string |}) -> environment.Region)
provider: IServiceProviderGetService: Type -> objGets the service object of the specified type. An object that specifies the type of service object to get. A service object of type . -or- if there is no service object of type .
typeof: TypeGenerate a System.Type runtime representation of a static type. let t = typeof<int> // Gets the System.Type t.FullName // Evaluates to "System.Int32"
FsLiveDocsGeneratedPage21_2D306DEB1823.IOrderQueuequeue: IOrderQueueOkRepresents an OK or a Successful result. The code succeeded with a value of 'T.
Orders: IOrderQueueErrorRepresents an Error or a Failure. The code failed with a value of 'TError representing what went wrong.
(|>): '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
bind: ('value -> Flow<'env,'error,'next>) -> Flow<'env,'error,'value> -> Flow<'env,'error,'next>Sequences a dependent flow after a successful value. This is the flatmap operation for . The continuation only runs when the source flow succeeds, and it receives the successful value. Use bind when the next effect depends on the previous result; use map when the next step is pure. On .NET, a recursive return! through bind does not keep a task per call alive. Work still pending in the source, such as a use or try/finally, lives until the source completes. A function that takes the successful value and returns a new flow. The source flow to sequence. A representing the combined workflow. let flow = Flow.succeed 1 |> Flow.bind (fun x -> Flow.succeed (x + 1))
fromResult: Result<'value,'error> -> Flow<'env,'error,'value>Lifts a into a synchronous flow. The result value to lift. A flow that succeeds or fails based on the result. Flow.fromResult (Ok "success") |> Flow.run ()
fromHost: Flow<IServiceProvider,string,int>Axial.Flow`3intAn abbreviation for the CLI type . Basic Types
env: OrderEnvFlush: unit -> intprovide: Layer<'input,'error,'environment> -> Flow<'environment,'error,'value> -> Flow<'input,'error,'value>Builds an environment with a layer, runs a downstream flow, and always closes the layer scope. This is the provisioning boundary. It creates a fresh scope, builds the supplied layer inside that scope, runs the downstream flow with the built environment, and finalizes all acquired resources when the downstream flow completes or fails. The layer that builds the downstream environment. The flow to run with the provided environment. A flow that requires only the input environment of the layer. let program () = let runtimeLayer = Layer.succeed "production" let workflow = Flow.envWith String.length Layer.provide runtimeLayer workflow
Requires & types
Requires: open Axial; open System (packages: Axial)val orderLayer: Layer<IServiceProvider,string,OrderEnv>val fromHost: Flow<IServiceProvider,string,int>An empty provider fails before the application runs:
fromHost |> Flow.run (provider []) |> shouldEqual (Exit.Failure(Cause.Fail "Order queue was not registered"))
fromHost: Flow<IServiceProvider,string,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.Flowrun: '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
provider: (Type * obj) list -> IServiceProvidershouldEqual: '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.
FailureThe workflow failed due to a specific cause.
Axial.Cause`1Represents the cause of a failed workflow. The type of the domain-specific failure value.
FailAn expected domain-specific failure.
Requires & types
Requires: open Axial (packages: Axial)The layer consumes the provider and produces only the application's authority record. Runtime values need no container bundle; hosts install their clock/log overrides separately at the execution boundary.
Choosing
| Situation | Use |
|---|---|
| You can build the value | Construct it and call Flow.run |
| A host container owns the implementations | ServiceProvider.get at the edge |
| Construction can fail, block, or acquire | A layer |
Tests almost always want the first row, whatever production uses.

