succeed
SourceCreates an effect that immediately succeeds with a value.
Use this for pure values that should still participate in the typed effect composition model.
Runtime
Small explicit effect type used for systems and runtime orchestration.
Fx models delayed computation with typed success, failure, and environment channels, but stays intentionally minimal instead of becoming a full effect system.
In this library it mainly exists so systems can return executable work while still carrying typed service requirements and explicit failure channels where needed. Most game systems will use Fx.sync(...), but the type keeps the orchestration model uniform.
// Build one small delayed computation.
const program = Fx.map(Fx.succeed(1), (value) => value + 1)
// Execute it explicitly at the runtime boundary.
const result = Fx.runSync(program)
Creates an effect that immediately succeeds with a value.
syncWraps a synchronous computation in an Fx.
failCreates an effect that fails by throwing the provided error when run.
mapTransforms the success value of an effect.
flatMapSequences two effects, allowing the second one to depend on the first result.
accessReads the whole effect environment.
accessServiceReads a single service from the environment by key.
provideSupplies the environment needed by an effect.
runSyncRuns an effect that no longer requires any environment.
Minimal constructors and combinators for explicit delayed computations.
Creates an effect that immediately succeeds with a value.
Use this for pure values that should still participate in the typed effect composition model.
Wraps a synchronous computation in an Fx.
This is the most common constructor for system implementations in the current runtime because systems are executed synchronously.
Creates an effect that fails by throwing the provided error when run.
Transforms the success value of an effect.
Sequences two effects, allowing the second one to depend on the first result.
Reads the whole effect environment.
Use this when a system helper wants access to all declared services at once.
Reads a single service from the environment by key.
This is useful for small helpers that need one dependency without threading the entire environment type manually.
Supplies the environment needed by an effect.
Runs an effect that no longer requires any environment.
The runtime uses this at the edge after it has provided the services declared by a system spec.