Effect for MoonBit. MoonBit compiles to JavaScript, and an Effect value is the Effect object itself. The value, the error, and the environment are MoonBit types. There is no second runtime and no glue TypeScript: a program declares its data, derives schemas, defines services and layers, and the build emits JavaScript and .d.ts.
UI subpaths (effect/ui, the HTML host, and the kit) belong to opraying/effect-ui.
./scripts/effect-build.sh is the entry point: setup, generate, check, and test. ./scripts/ci.sh is the full gate. ./scripts/new-app.sh scaffolds an example. Commands and invariants are in AGENTS.md.
The binding follows the TypeScript Effect library. Generated bindings cover the effect package and the official @effect/* packages. Hand-written overlays add the MoonBit shape: direct-style gen blocks, typed errors, and services keyed the way Effect keys them. The upstream pin lives in the repository package.json.
An Effect value is the work itself. succeed and fail construct it:
fn double(n : Int32) -> @Effect.Effect[Int32, String, @Effect.NoEnv] {
if n < 0 {
@Effect.fail("negative")
} else {
@Effect.succeed(n * 2)
}
}examples/combinators is a short program of services, retries, and the file system. examples/app is a longer notes application. Run either with moon run on the js target.
Effect, Layer, Schema, Stream, Schedule, Atom, and the platform, SQL, AI, and OpenTelemetry packages. Errors from JavaScript decode into MoonBit error types. A requirement that has no MoonBit capability is documented as unchecked instead of being invented.
Package *.generated.mbt files are generated bindings linked from the generated/ submodule (opraying/mbt-generated, branch effect). Focus edits on the hand-written core, overlays, and generator:
- Pure hand-written packages: Async/, Interop/, Protobuf/.
- Primary hand-written overlays (non-
*.generated.mbtfiles): Effect/, Http/, Schema/, FileSystem/, Ai/, State/, Stream/, Cli/, Observe/, Schedule/, Atom/, Data/. - Generator & ABI scripts:
scripts/gen-effect.mjs,scripts/effect-manifest.mjs,scripts/abi.mjs,scripts/tsrs-ir.mjs,scripts/gen-dts.mjs,scripts/TRANSLATOR.md. - Build/CI scripts:
scripts/effect-build.sh,scripts/ci.sh,package.json.
Apache-2.0. Copyright the opraying contributors.
Effect is MIT, copyright the Effect authors.