Skip to content

About

Effect for MoonBit. Programs compile to JavaScript and call the TypeScript Effect library directly.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

74 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

opraying/effect

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

./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.

Design

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.

Example

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.

What is included

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.

Hand-written sources

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:

License

Apache-2.0. Copyright the opraying contributors.

Effect is MIT, copyright the Effect authors.

About

Effect for MoonBit. Programs compile to JavaScript and call the TypeScript Effect library directly.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages